From 62e3d61ee0443c0d3866e13d15775cf93d503463 Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Mon, 13 Nov 2023 06:02:53 -0500 Subject: [PATCH 1/2] feat: add add limited support for mixed operators --- OpenFGAParser.g4 | 26 +- pkg/go/errors/errors.go | 2 +- pkg/go/gen/OpenFGAParser.interp | 5 +- pkg/go/gen/openfga_parser.go | 1794 ++++++++++++----- pkg/go/gen/openfgaparser_base_listener.go | 18 + pkg/go/gen/openfgaparser_listener.go | 18 + pkg/go/go.mod | 6 +- pkg/go/go.sum | 8 +- pkg/go/transformer/dsltojson.go | 2 +- pkg/js/errors.ts | 2 +- pkg/js/gen/OpenFGAParser.interp | 5 +- pkg/js/gen/OpenFGAParser.ts | 1114 ++++++---- pkg/js/gen/OpenFGAParserListener.ts | 33 + pkg/js/package-lock.json | 32 +- pkg/js/package.json | 8 +- pkg/js/tests/_testcases.ts | 6 +- pkg/js/tests/jsontodsl.test.ts | 6 +- pkg/js/transformer/dsltojson.ts | 121 +- pkg/js/transformer/jsontodsl.ts | 66 +- pkg/js/util/exceptions.ts | 15 + pkg/js/validator/validate-dsl.ts | 333 ++- tests/data/dsl-semantic-validation-cases.yaml | 16 +- tests/data/dsl-syntax-validation-cases.yaml | 398 +++- ...n-syntax-transformer-validation-cases.yaml | 212 +- .../authorization-model.fga | 18 + .../authorization-model.json | 379 ++++ .../authorization-model.fga | 13 + .../authorization-model.json | 190 ++ 28 files changed, 3693 insertions(+), 1153 deletions(-) create mode 100644 tests/data/transformer/14-mixed-operators/authorization-model.fga create mode 100644 tests/data/transformer/14-mixed-operators/authorization-model.json create mode 100644 tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.fga create mode 100644 tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.json diff --git a/OpenFGAParser.g4 b/OpenFGAParser.g4 index 12847764..d8360c84 100644 --- a/OpenFGAParser.g4 +++ b/OpenFGAParser.g4 @@ -10,12 +10,32 @@ modelHeader: (multiLineComment NEWLINE)? MODEL NEWLINE SCHEMA WHITESPACE schemaV typeDefs: typeDef*; typeDef: (NEWLINE multiLineComment)? NEWLINE TYPE WHITESPACE typeName=IDENTIFIER (NEWLINE RELATIONS relationDeclaration+)?; -relationDeclaration: NEWLINE DEFINE WHITESPACE relationName WHITESPACE? COLON WHITESPACE? relationDef; +// Relation definitions +relationDeclaration: NEWLINE DEFINE WHITESPACE relationName WHITESPACE? COLON WHITESPACE? (relationDef); relationName: IDENTIFIER; -relationDef: (relationDefDirectAssignment | relationDefGrouping) (relationDefPartials)?; -relationDefPartials: (WHITESPACE OR WHITESPACE relationDefGrouping)+ | (WHITESPACE AND WHITESPACE relationDefGrouping)+ | (WHITESPACE BUT_NOT WHITESPACE relationDefGrouping)+; + +relationDef: (relationDefDirectAssignment | relationDefGrouping | relationRecurse) (relationDefPartials)?; +relationDefNoDirect: (relationDefGrouping | relationRecurseNoDirect) (relationDefPartials)?; + +relationDefPartials: + (WHITESPACE OR WHITESPACE (relationDefGrouping | relationRecurseNoDirect))+ + | (WHITESPACE AND WHITESPACE (relationDefGrouping | relationRecurseNoDirect))+ + | (WHITESPACE BUT_NOT WHITESPACE (relationDefGrouping | relationRecurseNoDirect)); + relationDefGrouping: relationDefRewrite; +relationRecurse: + LPAREN WHITESPACE* ( + relationDef | + relationRecurseNoDirect + ) WHITESPACE* RPAREN; + +relationRecurseNoDirect: + LPAREN WHITESPACE* ( + relationDefNoDirect | + relationRecurseNoDirect + ) WHITESPACE* RPAREN; + relationDefDirectAssignment: LBRACKET WHITESPACE? relationDefTypeRestriction WHITESPACE? (COMMA WHITESPACE? relationDefTypeRestriction WHITESPACE?)* RPRACKET; relationDefRewrite: rewriteComputedusersetName=IDENTIFIER (WHITESPACE FROM WHITESPACE rewriteTuplesetName=IDENTIFIER)?; diff --git a/pkg/go/errors/errors.go b/pkg/go/errors/errors.go index 920133eb..b3433691 100644 --- a/pkg/go/errors/errors.go +++ b/pkg/go/errors/errors.go @@ -8,7 +8,7 @@ import ( var ErrUnsupportedJSON = errors.New("json not currently supported by dsl") func UnsupportedDSLNestingError(typeName string, relationName string) error { - return fmt.Errorf("the '%s' relation under the '%s' type has mixed operators which are not supported by the OpenFGA DSL syntax yet", relationName, typeName) + return fmt.Errorf("the '%s' relation definition under the '%s' type is not supported by the OpenFGA DSL syntax yet", relationName, typeName) } func ConditionNameDoesntMatchError(conditionName string, conditionNestedName string) error { diff --git a/pkg/go/gen/OpenFGAParser.interp b/pkg/go/gen/OpenFGAParser.interp index f58e61ad..a7b05788 100644 --- a/pkg/go/gen/OpenFGAParser.interp +++ b/pkg/go/gen/OpenFGAParser.interp @@ -116,8 +116,11 @@ typeDef relationDeclaration relationName relationDef +relationDefNoDirect relationDefPartials relationDefGrouping +relationRecurse +relationRecurseNoDirect relationDefDirectAssignment relationDefRewrite relationDefTypeRestriction @@ -133,4 +136,4 @@ conditionExpression atn: -[4, 1, 52, 301, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 3, 0, 44, 8, 0, 1, 0, 3, 0, 47, 8, 0, 1, 0, 1, 0, 3, 0, 51, 8, 0, 1, 0, 1, 0, 3, 0, 55, 8, 0, 1, 0, 1, 0, 3, 0, 59, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 66, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 74, 8, 1, 1, 2, 5, 2, 77, 8, 2, 10, 2, 12, 2, 80, 9, 2, 1, 3, 1, 3, 3, 3, 84, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 93, 8, 3, 11, 3, 12, 3, 94, 3, 3, 97, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 104, 8, 4, 1, 4, 1, 4, 3, 4, 108, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 116, 8, 6, 1, 6, 3, 6, 119, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 125, 8, 7, 11, 7, 12, 7, 126, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 133, 8, 7, 11, 7, 12, 7, 134, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 141, 8, 7, 11, 7, 12, 7, 142, 3, 7, 145, 8, 7, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, 151, 8, 9, 1, 9, 1, 9, 3, 9, 155, 8, 9, 1, 9, 1, 9, 3, 9, 159, 8, 9, 1, 9, 1, 9, 3, 9, 163, 8, 9, 5, 9, 165, 8, 9, 10, 9, 12, 9, 168, 9, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 11, 3, 11, 180, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 189, 8, 11, 1, 11, 3, 11, 192, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 199, 8, 12, 1, 13, 5, 13, 202, 8, 13, 10, 13, 12, 13, 205, 9, 13, 1, 14, 1, 14, 3, 14, 209, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 216, 8, 14, 1, 14, 1, 14, 3, 14, 220, 8, 14, 1, 14, 1, 14, 3, 14, 224, 8, 14, 1, 14, 1, 14, 3, 14, 228, 8, 14, 1, 14, 1, 14, 3, 14, 232, 8, 14, 5, 14, 234, 8, 14, 10, 14, 12, 14, 237, 9, 14, 1, 14, 3, 14, 240, 8, 14, 1, 14, 1, 14, 3, 14, 244, 8, 14, 1, 14, 1, 14, 3, 14, 248, 8, 14, 1, 14, 3, 14, 251, 8, 14, 1, 14, 1, 14, 3, 14, 255, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 3, 16, 262, 8, 16, 1, 16, 1, 16, 3, 16, 266, 8, 16, 1, 16, 1, 16, 3, 16, 270, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 281, 8, 18, 1, 19, 1, 19, 5, 19, 285, 8, 19, 10, 19, 12, 19, 288, 9, 19, 1, 19, 1, 19, 3, 19, 292, 8, 19, 1, 20, 1, 20, 5, 20, 296, 8, 20, 10, 20, 12, 20, 299, 9, 20, 1, 20, 0, 0, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 0, 3, 1, 0, 52, 52, 2, 0, 18, 29, 31, 52, 1, 0, 30, 30, 331, 0, 43, 1, 0, 0, 0, 2, 65, 1, 0, 0, 0, 4, 78, 1, 0, 0, 0, 6, 83, 1, 0, 0, 0, 8, 98, 1, 0, 0, 0, 10, 111, 1, 0, 0, 0, 12, 115, 1, 0, 0, 0, 14, 144, 1, 0, 0, 0, 16, 146, 1, 0, 0, 0, 18, 148, 1, 0, 0, 0, 20, 171, 1, 0, 0, 0, 22, 179, 1, 0, 0, 0, 24, 193, 1, 0, 0, 0, 26, 203, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 258, 1, 0, 0, 0, 32, 261, 1, 0, 0, 0, 34, 273, 1, 0, 0, 0, 36, 280, 1, 0, 0, 0, 38, 282, 1, 0, 0, 0, 40, 297, 1, 0, 0, 0, 42, 44, 5, 44, 0, 0, 43, 42, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 46, 1, 0, 0, 0, 45, 47, 5, 52, 0, 0, 46, 45, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 2, 1, 0, 49, 51, 5, 52, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 54, 3, 4, 2, 0, 53, 55, 5, 52, 0, 0, 54, 53, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 58, 3, 26, 13, 0, 57, 59, 5, 52, 0, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 61, 5, 0, 0, 1, 61, 1, 1, 0, 0, 0, 62, 63, 3, 38, 19, 0, 63, 64, 5, 52, 0, 0, 64, 66, 1, 0, 0, 0, 65, 62, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 5, 10, 0, 0, 68, 69, 5, 52, 0, 0, 69, 70, 5, 11, 0, 0, 70, 71, 5, 44, 0, 0, 71, 73, 5, 12, 0, 0, 72, 74, 5, 44, 0, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 3, 1, 0, 0, 0, 75, 77, 3, 6, 3, 0, 76, 75, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 81, 82, 5, 52, 0, 0, 82, 84, 3, 38, 19, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 86, 5, 52, 0, 0, 86, 87, 5, 13, 0, 0, 87, 88, 5, 44, 0, 0, 88, 96, 5, 51, 0, 0, 89, 90, 5, 52, 0, 0, 90, 92, 5, 15, 0, 0, 91, 93, 3, 8, 4, 0, 92, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 97, 1, 0, 0, 0, 96, 89, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 7, 1, 0, 0, 0, 98, 99, 5, 52, 0, 0, 99, 100, 5, 16, 0, 0, 100, 101, 5, 44, 0, 0, 101, 103, 3, 10, 5, 0, 102, 104, 5, 44, 0, 0, 103, 102, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 107, 5, 2, 0, 0, 106, 108, 5, 44, 0, 0, 107, 106, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 3, 12, 6, 0, 110, 9, 1, 0, 0, 0, 111, 112, 5, 51, 0, 0, 112, 11, 1, 0, 0, 0, 113, 116, 3, 18, 9, 0, 114, 116, 3, 16, 8, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 118, 1, 0, 0, 0, 117, 119, 3, 14, 7, 0, 118, 117, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, 13, 1, 0, 0, 0, 120, 121, 5, 44, 0, 0, 121, 122, 5, 7, 0, 0, 122, 123, 5, 44, 0, 0, 123, 125, 3, 16, 8, 0, 124, 120, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 145, 1, 0, 0, 0, 128, 129, 5, 44, 0, 0, 129, 130, 5, 6, 0, 0, 130, 131, 5, 44, 0, 0, 131, 133, 3, 16, 8, 0, 132, 128, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 145, 1, 0, 0, 0, 136, 137, 5, 44, 0, 0, 137, 138, 5, 8, 0, 0, 138, 139, 5, 44, 0, 0, 139, 141, 3, 16, 8, 0, 140, 136, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0, 0, 0, 144, 124, 1, 0, 0, 0, 144, 132, 1, 0, 0, 0, 144, 140, 1, 0, 0, 0, 145, 15, 1, 0, 0, 0, 146, 147, 3, 20, 10, 0, 147, 17, 1, 0, 0, 0, 148, 150, 5, 27, 0, 0, 149, 151, 5, 44, 0, 0, 150, 149, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 154, 3, 22, 11, 0, 153, 155, 5, 44, 0, 0, 154, 153, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 166, 1, 0, 0, 0, 156, 158, 5, 3, 0, 0, 157, 159, 5, 44, 0, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 3, 22, 11, 0, 161, 163, 5, 44, 0, 0, 162, 161, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 165, 1, 0, 0, 0, 164, 156, 1, 0, 0, 0, 165, 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 169, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 170, 5, 28, 0, 0, 170, 19, 1, 0, 0, 0, 171, 176, 5, 51, 0, 0, 172, 173, 5, 44, 0, 0, 173, 174, 5, 9, 0, 0, 174, 175, 5, 44, 0, 0, 175, 177, 5, 51, 0, 0, 176, 172, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 21, 1, 0, 0, 0, 178, 180, 5, 52, 0, 0, 179, 178, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 188, 1, 0, 0, 0, 181, 189, 3, 24, 12, 0, 182, 183, 3, 24, 12, 0, 183, 184, 5, 44, 0, 0, 184, 185, 5, 17, 0, 0, 185, 186, 5, 44, 0, 0, 186, 187, 3, 30, 15, 0, 187, 189, 1, 0, 0, 0, 188, 181, 1, 0, 0, 0, 188, 182, 1, 0, 0, 0, 189, 191, 1, 0, 0, 0, 190, 192, 5, 52, 0, 0, 191, 190, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 23, 1, 0, 0, 0, 193, 198, 5, 51, 0, 0, 194, 195, 5, 2, 0, 0, 195, 199, 5, 38, 0, 0, 196, 197, 5, 1, 0, 0, 197, 199, 5, 51, 0, 0, 198, 194, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 25, 1, 0, 0, 0, 200, 202, 3, 28, 14, 0, 201, 200, 1, 0, 0, 0, 202, 205, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 27, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 206, 207, 5, 52, 0, 0, 207, 209, 3, 38, 19, 0, 208, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 5, 52, 0, 0, 211, 212, 5, 14, 0, 0, 212, 213, 5, 44, 0, 0, 213, 215, 3, 30, 15, 0, 214, 216, 5, 44, 0, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 5, 31, 0, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 223, 3, 32, 16, 0, 222, 224, 5, 44, 0, 0, 223, 222, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 235, 1, 0, 0, 0, 225, 227, 5, 3, 0, 0, 226, 228, 5, 44, 0, 0, 227, 226, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 231, 3, 32, 16, 0, 230, 232, 5, 44, 0, 0, 231, 230, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, 232, 234, 1, 0, 0, 0, 233, 225, 1, 0, 0, 0, 234, 237, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 238, 240, 5, 52, 0, 0, 239, 238, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, 241, 1, 0, 0, 0, 241, 243, 5, 32, 0, 0, 242, 244, 5, 44, 0, 0, 243, 242, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, 245, 247, 5, 29, 0, 0, 246, 248, 5, 52, 0, 0, 247, 246, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 250, 1, 0, 0, 0, 249, 251, 5, 44, 0, 0, 250, 249, 1, 0, 0, 0, 250, 251, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 254, 3, 40, 20, 0, 253, 255, 5, 52, 0, 0, 254, 253, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 257, 5, 30, 0, 0, 257, 29, 1, 0, 0, 0, 258, 259, 5, 51, 0, 0, 259, 31, 1, 0, 0, 0, 260, 262, 5, 52, 0, 0, 261, 260, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 265, 3, 34, 17, 0, 264, 266, 5, 44, 0, 0, 265, 264, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 269, 5, 2, 0, 0, 268, 270, 5, 44, 0, 0, 269, 268, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 272, 3, 36, 18, 0, 272, 33, 1, 0, 0, 0, 273, 274, 5, 51, 0, 0, 274, 35, 1, 0, 0, 0, 275, 281, 5, 5, 0, 0, 276, 277, 5, 4, 0, 0, 277, 278, 5, 21, 0, 0, 278, 279, 5, 5, 0, 0, 279, 281, 5, 24, 0, 0, 280, 275, 1, 0, 0, 0, 280, 276, 1, 0, 0, 0, 281, 37, 1, 0, 0, 0, 282, 286, 5, 1, 0, 0, 283, 285, 8, 0, 0, 0, 284, 283, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 291, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, 290, 5, 52, 0, 0, 290, 292, 3, 38, 19, 0, 291, 289, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 39, 1, 0, 0, 0, 293, 296, 7, 1, 0, 0, 294, 296, 8, 2, 0, 0, 295, 293, 1, 0, 0, 0, 295, 294, 1, 0, 0, 0, 296, 299, 1, 0, 0, 0, 297, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 41, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 50, 43, 46, 50, 54, 58, 65, 73, 78, 83, 94, 96, 103, 107, 115, 118, 126, 134, 142, 144, 150, 154, 158, 162, 166, 176, 179, 188, 191, 198, 203, 208, 215, 219, 223, 227, 231, 235, 239, 243, 247, 250, 254, 261, 265, 269, 280, 286, 291, 295, 297] \ No newline at end of file +[4, 1, 52, 358, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 1, 0, 3, 0, 50, 8, 0, 1, 0, 3, 0, 53, 8, 0, 1, 0, 1, 0, 3, 0, 57, 8, 0, 1, 0, 1, 0, 3, 0, 61, 8, 0, 1, 0, 1, 0, 3, 0, 65, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 72, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 80, 8, 1, 1, 2, 5, 2, 83, 8, 2, 10, 2, 12, 2, 86, 9, 2, 1, 3, 1, 3, 3, 3, 90, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 99, 8, 3, 11, 3, 12, 3, 100, 3, 3, 103, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 110, 8, 4, 1, 4, 1, 4, 3, 4, 114, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 123, 8, 6, 1, 6, 3, 6, 126, 8, 6, 1, 7, 1, 7, 3, 7, 130, 8, 7, 1, 7, 3, 7, 133, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 140, 8, 8, 4, 8, 142, 8, 8, 11, 8, 12, 8, 143, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 4, 8, 153, 8, 8, 11, 8, 12, 8, 154, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 162, 8, 8, 3, 8, 164, 8, 8, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 170, 8, 10, 10, 10, 12, 10, 173, 9, 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 10, 5, 10, 180, 8, 10, 10, 10, 12, 10, 183, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 5, 11, 189, 8, 11, 10, 11, 12, 11, 192, 9, 11, 1, 11, 1, 11, 3, 11, 196, 8, 11, 1, 11, 5, 11, 199, 8, 11, 10, 11, 12, 11, 202, 9, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 208, 8, 12, 1, 12, 1, 12, 3, 12, 212, 8, 12, 1, 12, 1, 12, 3, 12, 216, 8, 12, 1, 12, 1, 12, 3, 12, 220, 8, 12, 5, 12, 222, 8, 12, 10, 12, 12, 12, 225, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 234, 8, 13, 1, 14, 3, 14, 237, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 246, 8, 14, 1, 14, 3, 14, 249, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 256, 8, 15, 1, 16, 5, 16, 259, 8, 16, 10, 16, 12, 16, 262, 9, 16, 1, 17, 1, 17, 3, 17, 266, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 273, 8, 17, 1, 17, 1, 17, 3, 17, 277, 8, 17, 1, 17, 1, 17, 3, 17, 281, 8, 17, 1, 17, 1, 17, 3, 17, 285, 8, 17, 1, 17, 1, 17, 3, 17, 289, 8, 17, 5, 17, 291, 8, 17, 10, 17, 12, 17, 294, 9, 17, 1, 17, 3, 17, 297, 8, 17, 1, 17, 1, 17, 3, 17, 301, 8, 17, 1, 17, 1, 17, 3, 17, 305, 8, 17, 1, 17, 3, 17, 308, 8, 17, 1, 17, 1, 17, 3, 17, 312, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 3, 19, 319, 8, 19, 1, 19, 1, 19, 3, 19, 323, 8, 19, 1, 19, 1, 19, 3, 19, 327, 8, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 338, 8, 21, 1, 22, 1, 22, 5, 22, 342, 8, 22, 10, 22, 12, 22, 345, 9, 22, 1, 22, 1, 22, 3, 22, 349, 8, 22, 1, 23, 1, 23, 5, 23, 353, 8, 23, 10, 23, 12, 23, 356, 9, 23, 1, 23, 0, 0, 24, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 0, 3, 1, 0, 52, 52, 2, 0, 18, 29, 31, 52, 1, 0, 30, 30, 396, 0, 49, 1, 0, 0, 0, 2, 71, 1, 0, 0, 0, 4, 84, 1, 0, 0, 0, 6, 89, 1, 0, 0, 0, 8, 104, 1, 0, 0, 0, 10, 117, 1, 0, 0, 0, 12, 122, 1, 0, 0, 0, 14, 129, 1, 0, 0, 0, 16, 163, 1, 0, 0, 0, 18, 165, 1, 0, 0, 0, 20, 167, 1, 0, 0, 0, 22, 186, 1, 0, 0, 0, 24, 205, 1, 0, 0, 0, 26, 228, 1, 0, 0, 0, 28, 236, 1, 0, 0, 0, 30, 250, 1, 0, 0, 0, 32, 260, 1, 0, 0, 0, 34, 265, 1, 0, 0, 0, 36, 315, 1, 0, 0, 0, 38, 318, 1, 0, 0, 0, 40, 330, 1, 0, 0, 0, 42, 337, 1, 0, 0, 0, 44, 339, 1, 0, 0, 0, 46, 354, 1, 0, 0, 0, 48, 50, 5, 44, 0, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, 1, 0, 0, 0, 51, 53, 5, 52, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 3, 2, 1, 0, 55, 57, 5, 52, 0, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 60, 3, 4, 2, 0, 59, 61, 5, 52, 0, 0, 60, 59, 1, 0, 0, 0, 60, 61, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 64, 3, 32, 16, 0, 63, 65, 5, 52, 0, 0, 64, 63, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 5, 0, 0, 1, 67, 1, 1, 0, 0, 0, 68, 69, 3, 44, 22, 0, 69, 70, 5, 52, 0, 0, 70, 72, 1, 0, 0, 0, 71, 68, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 74, 5, 10, 0, 0, 74, 75, 5, 52, 0, 0, 75, 76, 5, 11, 0, 0, 76, 77, 5, 44, 0, 0, 77, 79, 5, 12, 0, 0, 78, 80, 5, 44, 0, 0, 79, 78, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 3, 1, 0, 0, 0, 81, 83, 3, 6, 3, 0, 82, 81, 1, 0, 0, 0, 83, 86, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 5, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 87, 88, 5, 52, 0, 0, 88, 90, 3, 44, 22, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 5, 52, 0, 0, 92, 93, 5, 13, 0, 0, 93, 94, 5, 44, 0, 0, 94, 102, 5, 51, 0, 0, 95, 96, 5, 52, 0, 0, 96, 98, 5, 15, 0, 0, 97, 99, 3, 8, 4, 0, 98, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 103, 1, 0, 0, 0, 102, 95, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 7, 1, 0, 0, 0, 104, 105, 5, 52, 0, 0, 105, 106, 5, 16, 0, 0, 106, 107, 5, 44, 0, 0, 107, 109, 3, 10, 5, 0, 108, 110, 5, 44, 0, 0, 109, 108, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 113, 5, 2, 0, 0, 112, 114, 5, 44, 0, 0, 113, 112, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 3, 12, 6, 0, 116, 9, 1, 0, 0, 0, 117, 118, 5, 51, 0, 0, 118, 11, 1, 0, 0, 0, 119, 123, 3, 24, 12, 0, 120, 123, 3, 18, 9, 0, 121, 123, 3, 20, 10, 0, 122, 119, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 121, 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 126, 3, 16, 8, 0, 125, 124, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 13, 1, 0, 0, 0, 127, 130, 3, 18, 9, 0, 128, 130, 3, 22, 11, 0, 129, 127, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, 132, 1, 0, 0, 0, 131, 133, 3, 16, 8, 0, 132, 131, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 15, 1, 0, 0, 0, 134, 135, 5, 44, 0, 0, 135, 136, 5, 7, 0, 0, 136, 139, 5, 44, 0, 0, 137, 140, 3, 18, 9, 0, 138, 140, 3, 22, 11, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 142, 1, 0, 0, 0, 141, 134, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 164, 1, 0, 0, 0, 145, 146, 5, 44, 0, 0, 146, 147, 5, 6, 0, 0, 147, 150, 5, 44, 0, 0, 148, 151, 3, 18, 9, 0, 149, 151, 3, 22, 11, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 153, 1, 0, 0, 0, 152, 145, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 164, 1, 0, 0, 0, 156, 157, 5, 44, 0, 0, 157, 158, 5, 8, 0, 0, 158, 161, 5, 44, 0, 0, 159, 162, 3, 18, 9, 0, 160, 162, 3, 22, 11, 0, 161, 159, 1, 0, 0, 0, 161, 160, 1, 0, 0, 0, 162, 164, 1, 0, 0, 0, 163, 141, 1, 0, 0, 0, 163, 152, 1, 0, 0, 0, 163, 156, 1, 0, 0, 0, 164, 17, 1, 0, 0, 0, 165, 166, 3, 26, 13, 0, 166, 19, 1, 0, 0, 0, 167, 171, 5, 31, 0, 0, 168, 170, 5, 44, 0, 0, 169, 168, 1, 0, 0, 0, 170, 173, 1, 0, 0, 0, 171, 169, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 176, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 174, 177, 3, 12, 6, 0, 175, 177, 3, 22, 11, 0, 176, 174, 1, 0, 0, 0, 176, 175, 1, 0, 0, 0, 177, 181, 1, 0, 0, 0, 178, 180, 5, 44, 0, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 184, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 184, 185, 5, 32, 0, 0, 185, 21, 1, 0, 0, 0, 186, 190, 5, 31, 0, 0, 187, 189, 5, 44, 0, 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 195, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 193, 196, 3, 14, 7, 0, 194, 196, 3, 22, 11, 0, 195, 193, 1, 0, 0, 0, 195, 194, 1, 0, 0, 0, 196, 200, 1, 0, 0, 0, 197, 199, 5, 44, 0, 0, 198, 197, 1, 0, 0, 0, 199, 202, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 203, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 203, 204, 5, 32, 0, 0, 204, 23, 1, 0, 0, 0, 205, 207, 5, 27, 0, 0, 206, 208, 5, 44, 0, 0, 207, 206, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 211, 3, 28, 14, 0, 210, 212, 5, 44, 0, 0, 211, 210, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 223, 1, 0, 0, 0, 213, 215, 5, 3, 0, 0, 214, 216, 5, 44, 0, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 3, 28, 14, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 222, 1, 0, 0, 0, 221, 213, 1, 0, 0, 0, 222, 225, 1, 0, 0, 0, 223, 221, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 226, 1, 0, 0, 0, 225, 223, 1, 0, 0, 0, 226, 227, 5, 28, 0, 0, 227, 25, 1, 0, 0, 0, 228, 233, 5, 51, 0, 0, 229, 230, 5, 44, 0, 0, 230, 231, 5, 9, 0, 0, 231, 232, 5, 44, 0, 0, 232, 234, 5, 51, 0, 0, 233, 229, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 27, 1, 0, 0, 0, 235, 237, 5, 52, 0, 0, 236, 235, 1, 0, 0, 0, 236, 237, 1, 0, 0, 0, 237, 245, 1, 0, 0, 0, 238, 246, 3, 30, 15, 0, 239, 240, 3, 30, 15, 0, 240, 241, 5, 44, 0, 0, 241, 242, 5, 17, 0, 0, 242, 243, 5, 44, 0, 0, 243, 244, 3, 36, 18, 0, 244, 246, 1, 0, 0, 0, 245, 238, 1, 0, 0, 0, 245, 239, 1, 0, 0, 0, 246, 248, 1, 0, 0, 0, 247, 249, 5, 52, 0, 0, 248, 247, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 29, 1, 0, 0, 0, 250, 255, 5, 51, 0, 0, 251, 252, 5, 2, 0, 0, 252, 256, 5, 38, 0, 0, 253, 254, 5, 1, 0, 0, 254, 256, 5, 51, 0, 0, 255, 251, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 31, 1, 0, 0, 0, 257, 259, 3, 34, 17, 0, 258, 257, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 33, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 264, 5, 52, 0, 0, 264, 266, 3, 44, 22, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 268, 5, 52, 0, 0, 268, 269, 5, 14, 0, 0, 269, 270, 5, 44, 0, 0, 270, 272, 3, 36, 18, 0, 271, 273, 5, 44, 0, 0, 272, 271, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 276, 5, 31, 0, 0, 275, 277, 5, 44, 0, 0, 276, 275, 1, 0, 0, 0, 276, 277, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 280, 3, 38, 19, 0, 279, 281, 5, 44, 0, 0, 280, 279, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 292, 1, 0, 0, 0, 282, 284, 5, 3, 0, 0, 283, 285, 5, 44, 0, 0, 284, 283, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 286, 1, 0, 0, 0, 286, 288, 3, 38, 19, 0, 287, 289, 5, 44, 0, 0, 288, 287, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 291, 1, 0, 0, 0, 290, 282, 1, 0, 0, 0, 291, 294, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 296, 1, 0, 0, 0, 294, 292, 1, 0, 0, 0, 295, 297, 5, 52, 0, 0, 296, 295, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 300, 5, 32, 0, 0, 299, 301, 5, 44, 0, 0, 300, 299, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 5, 29, 0, 0, 303, 305, 5, 52, 0, 0, 304, 303, 1, 0, 0, 0, 304, 305, 1, 0, 0, 0, 305, 307, 1, 0, 0, 0, 306, 308, 5, 44, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 311, 3, 46, 23, 0, 310, 312, 5, 52, 0, 0, 311, 310, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, 314, 5, 30, 0, 0, 314, 35, 1, 0, 0, 0, 315, 316, 5, 51, 0, 0, 316, 37, 1, 0, 0, 0, 317, 319, 5, 52, 0, 0, 318, 317, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 322, 3, 40, 20, 0, 321, 323, 5, 44, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 5, 2, 0, 0, 325, 327, 5, 44, 0, 0, 326, 325, 1, 0, 0, 0, 326, 327, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 329, 3, 42, 21, 0, 329, 39, 1, 0, 0, 0, 330, 331, 5, 51, 0, 0, 331, 41, 1, 0, 0, 0, 332, 338, 5, 5, 0, 0, 333, 334, 5, 4, 0, 0, 334, 335, 5, 21, 0, 0, 335, 336, 5, 5, 0, 0, 336, 338, 5, 24, 0, 0, 337, 332, 1, 0, 0, 0, 337, 333, 1, 0, 0, 0, 338, 43, 1, 0, 0, 0, 339, 343, 5, 1, 0, 0, 340, 342, 8, 0, 0, 0, 341, 340, 1, 0, 0, 0, 342, 345, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 348, 1, 0, 0, 0, 345, 343, 1, 0, 0, 0, 346, 347, 5, 52, 0, 0, 347, 349, 3, 44, 22, 0, 348, 346, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, 45, 1, 0, 0, 0, 350, 353, 7, 1, 0, 0, 351, 353, 8, 2, 0, 0, 352, 350, 1, 0, 0, 0, 352, 351, 1, 0, 0, 0, 353, 356, 1, 0, 0, 0, 354, 352, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 47, 1, 0, 0, 0, 356, 354, 1, 0, 0, 0, 60, 49, 52, 56, 60, 64, 71, 79, 84, 89, 100, 102, 109, 113, 122, 125, 129, 132, 139, 143, 150, 154, 161, 163, 171, 176, 181, 190, 195, 200, 207, 211, 215, 219, 223, 233, 236, 245, 248, 255, 260, 265, 272, 276, 280, 284, 288, 292, 296, 300, 304, 307, 311, 318, 322, 326, 337, 343, 348, 352, 354] \ No newline at end of file diff --git a/pkg/go/gen/openfga_parser.go b/pkg/go/gen/openfga_parser.go index a54fef53..5d890c8b 100644 --- a/pkg/go/gen/openfga_parser.go +++ b/pkg/go/gen/openfga_parser.go @@ -54,7 +54,8 @@ func openfgaparserParserInit() { } staticData.RuleNames = []string{ "main", "modelHeader", "typeDefs", "typeDef", "relationDeclaration", - "relationName", "relationDef", "relationDefPartials", "relationDefGrouping", + "relationName", "relationDef", "relationDefNoDirect", "relationDefPartials", + "relationDefGrouping", "relationRecurse", "relationRecurseNoDirect", "relationDefDirectAssignment", "relationDefRewrite", "relationDefTypeRestriction", "relationDefTypeRestrictionBase", "conditions", "condition", "conditionName", "conditionParameter", "parameterName", "parameterType", "multiLineComment", @@ -62,143 +63,170 @@ func openfgaparserParserInit() { } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 52, 301, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, + 4, 1, 52, 358, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, - 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, - 0, 3, 0, 44, 8, 0, 1, 0, 3, 0, 47, 8, 0, 1, 0, 1, 0, 3, 0, 51, 8, 0, 1, - 0, 1, 0, 3, 0, 55, 8, 0, 1, 0, 1, 0, 3, 0, 59, 8, 0, 1, 0, 1, 0, 1, 1, - 1, 1, 1, 1, 3, 1, 66, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 74, - 8, 1, 1, 2, 5, 2, 77, 8, 2, 10, 2, 12, 2, 80, 9, 2, 1, 3, 1, 3, 3, 3, 84, - 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 93, 8, 3, 11, 3, - 12, 3, 94, 3, 3, 97, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 104, 8, - 4, 1, 4, 1, 4, 3, 4, 108, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 3, - 6, 116, 8, 6, 1, 6, 3, 6, 119, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 125, - 8, 7, 11, 7, 12, 7, 126, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 133, 8, 7, 11, 7, - 12, 7, 134, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 141, 8, 7, 11, 7, 12, 7, 142, - 3, 7, 145, 8, 7, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, 151, 8, 9, 1, 9, 1, 9, 3, - 9, 155, 8, 9, 1, 9, 1, 9, 3, 9, 159, 8, 9, 1, 9, 1, 9, 3, 9, 163, 8, 9, - 5, 9, 165, 8, 9, 10, 9, 12, 9, 168, 9, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, - 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 11, 3, 11, 180, 8, 11, 1, 11, 1, - 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 189, 8, 11, 1, 11, 3, 11, - 192, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 199, 8, 12, 1, 13, - 5, 13, 202, 8, 13, 10, 13, 12, 13, 205, 9, 13, 1, 14, 1, 14, 3, 14, 209, - 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 216, 8, 14, 1, 14, 1, - 14, 3, 14, 220, 8, 14, 1, 14, 1, 14, 3, 14, 224, 8, 14, 1, 14, 1, 14, 3, - 14, 228, 8, 14, 1, 14, 1, 14, 3, 14, 232, 8, 14, 5, 14, 234, 8, 14, 10, - 14, 12, 14, 237, 9, 14, 1, 14, 3, 14, 240, 8, 14, 1, 14, 1, 14, 3, 14, - 244, 8, 14, 1, 14, 1, 14, 3, 14, 248, 8, 14, 1, 14, 3, 14, 251, 8, 14, - 1, 14, 1, 14, 3, 14, 255, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 3, - 16, 262, 8, 16, 1, 16, 1, 16, 3, 16, 266, 8, 16, 1, 16, 1, 16, 3, 16, 270, - 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, - 18, 281, 8, 18, 1, 19, 1, 19, 5, 19, 285, 8, 19, 10, 19, 12, 19, 288, 9, - 19, 1, 19, 1, 19, 3, 19, 292, 8, 19, 1, 20, 1, 20, 5, 20, 296, 8, 20, 10, - 20, 12, 20, 299, 9, 20, 1, 20, 0, 0, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, - 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 0, 3, 1, 0, 52, 52, 2, - 0, 18, 29, 31, 52, 1, 0, 30, 30, 331, 0, 43, 1, 0, 0, 0, 2, 65, 1, 0, 0, - 0, 4, 78, 1, 0, 0, 0, 6, 83, 1, 0, 0, 0, 8, 98, 1, 0, 0, 0, 10, 111, 1, - 0, 0, 0, 12, 115, 1, 0, 0, 0, 14, 144, 1, 0, 0, 0, 16, 146, 1, 0, 0, 0, - 18, 148, 1, 0, 0, 0, 20, 171, 1, 0, 0, 0, 22, 179, 1, 0, 0, 0, 24, 193, - 1, 0, 0, 0, 26, 203, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 258, 1, 0, 0, - 0, 32, 261, 1, 0, 0, 0, 34, 273, 1, 0, 0, 0, 36, 280, 1, 0, 0, 0, 38, 282, - 1, 0, 0, 0, 40, 297, 1, 0, 0, 0, 42, 44, 5, 44, 0, 0, 43, 42, 1, 0, 0, - 0, 43, 44, 1, 0, 0, 0, 44, 46, 1, 0, 0, 0, 45, 47, 5, 52, 0, 0, 46, 45, - 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 2, 1, 0, - 49, 51, 5, 52, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, - 0, 0, 0, 52, 54, 3, 4, 2, 0, 53, 55, 5, 52, 0, 0, 54, 53, 1, 0, 0, 0, 54, - 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 58, 3, 26, 13, 0, 57, 59, 5, 52, - 0, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 61, - 5, 0, 0, 1, 61, 1, 1, 0, 0, 0, 62, 63, 3, 38, 19, 0, 63, 64, 5, 52, 0, - 0, 64, 66, 1, 0, 0, 0, 65, 62, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, - 1, 0, 0, 0, 67, 68, 5, 10, 0, 0, 68, 69, 5, 52, 0, 0, 69, 70, 5, 11, 0, - 0, 70, 71, 5, 44, 0, 0, 71, 73, 5, 12, 0, 0, 72, 74, 5, 44, 0, 0, 73, 72, - 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 3, 1, 0, 0, 0, 75, 77, 3, 6, 3, 0, - 76, 75, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, - 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 81, 82, 5, 52, 0, 0, 82, - 84, 3, 38, 19, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 1, 0, - 0, 0, 85, 86, 5, 52, 0, 0, 86, 87, 5, 13, 0, 0, 87, 88, 5, 44, 0, 0, 88, - 96, 5, 51, 0, 0, 89, 90, 5, 52, 0, 0, 90, 92, 5, 15, 0, 0, 91, 93, 3, 8, - 4, 0, 92, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, - 1, 0, 0, 0, 95, 97, 1, 0, 0, 0, 96, 89, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, - 97, 7, 1, 0, 0, 0, 98, 99, 5, 52, 0, 0, 99, 100, 5, 16, 0, 0, 100, 101, - 5, 44, 0, 0, 101, 103, 3, 10, 5, 0, 102, 104, 5, 44, 0, 0, 103, 102, 1, - 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 107, 5, 2, 0, - 0, 106, 108, 5, 44, 0, 0, 107, 106, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, - 109, 1, 0, 0, 0, 109, 110, 3, 12, 6, 0, 110, 9, 1, 0, 0, 0, 111, 112, 5, - 51, 0, 0, 112, 11, 1, 0, 0, 0, 113, 116, 3, 18, 9, 0, 114, 116, 3, 16, - 8, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 118, 1, 0, 0, 0, - 117, 119, 3, 14, 7, 0, 118, 117, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, - 13, 1, 0, 0, 0, 120, 121, 5, 44, 0, 0, 121, 122, 5, 7, 0, 0, 122, 123, - 5, 44, 0, 0, 123, 125, 3, 16, 8, 0, 124, 120, 1, 0, 0, 0, 125, 126, 1, - 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 145, 1, 0, 0, - 0, 128, 129, 5, 44, 0, 0, 129, 130, 5, 6, 0, 0, 130, 131, 5, 44, 0, 0, - 131, 133, 3, 16, 8, 0, 132, 128, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, - 132, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 145, 1, 0, 0, 0, 136, 137, - 5, 44, 0, 0, 137, 138, 5, 8, 0, 0, 138, 139, 5, 44, 0, 0, 139, 141, 3, - 16, 8, 0, 140, 136, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 140, 1, 0, 0, - 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0, 0, 0, 144, 124, 1, 0, 0, 0, 144, - 132, 1, 0, 0, 0, 144, 140, 1, 0, 0, 0, 145, 15, 1, 0, 0, 0, 146, 147, 3, - 20, 10, 0, 147, 17, 1, 0, 0, 0, 148, 150, 5, 27, 0, 0, 149, 151, 5, 44, - 0, 0, 150, 149, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, - 152, 154, 3, 22, 11, 0, 153, 155, 5, 44, 0, 0, 154, 153, 1, 0, 0, 0, 154, - 155, 1, 0, 0, 0, 155, 166, 1, 0, 0, 0, 156, 158, 5, 3, 0, 0, 157, 159, - 5, 44, 0, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 1, 0, - 0, 0, 160, 162, 3, 22, 11, 0, 161, 163, 5, 44, 0, 0, 162, 161, 1, 0, 0, - 0, 162, 163, 1, 0, 0, 0, 163, 165, 1, 0, 0, 0, 164, 156, 1, 0, 0, 0, 165, - 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 169, - 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 170, 5, 28, 0, 0, 170, 19, 1, 0, - 0, 0, 171, 176, 5, 51, 0, 0, 172, 173, 5, 44, 0, 0, 173, 174, 5, 9, 0, - 0, 174, 175, 5, 44, 0, 0, 175, 177, 5, 51, 0, 0, 176, 172, 1, 0, 0, 0, - 176, 177, 1, 0, 0, 0, 177, 21, 1, 0, 0, 0, 178, 180, 5, 52, 0, 0, 179, - 178, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 188, 1, 0, 0, 0, 181, 189, - 3, 24, 12, 0, 182, 183, 3, 24, 12, 0, 183, 184, 5, 44, 0, 0, 184, 185, - 5, 17, 0, 0, 185, 186, 5, 44, 0, 0, 186, 187, 3, 30, 15, 0, 187, 189, 1, - 0, 0, 0, 188, 181, 1, 0, 0, 0, 188, 182, 1, 0, 0, 0, 189, 191, 1, 0, 0, - 0, 190, 192, 5, 52, 0, 0, 191, 190, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, - 23, 1, 0, 0, 0, 193, 198, 5, 51, 0, 0, 194, 195, 5, 2, 0, 0, 195, 199, - 5, 38, 0, 0, 196, 197, 5, 1, 0, 0, 197, 199, 5, 51, 0, 0, 198, 194, 1, - 0, 0, 0, 198, 196, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 25, 1, 0, 0, - 0, 200, 202, 3, 28, 14, 0, 201, 200, 1, 0, 0, 0, 202, 205, 1, 0, 0, 0, - 203, 201, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 27, 1, 0, 0, 0, 205, 203, - 1, 0, 0, 0, 206, 207, 5, 52, 0, 0, 207, 209, 3, 38, 19, 0, 208, 206, 1, - 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 5, 52, 0, - 0, 211, 212, 5, 14, 0, 0, 212, 213, 5, 44, 0, 0, 213, 215, 3, 30, 15, 0, - 214, 216, 5, 44, 0, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, - 217, 1, 0, 0, 0, 217, 219, 5, 31, 0, 0, 218, 220, 5, 44, 0, 0, 219, 218, - 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 223, 3, 32, - 16, 0, 222, 224, 5, 44, 0, 0, 223, 222, 1, 0, 0, 0, 223, 224, 1, 0, 0, - 0, 224, 235, 1, 0, 0, 0, 225, 227, 5, 3, 0, 0, 226, 228, 5, 44, 0, 0, 227, - 226, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 231, - 3, 32, 16, 0, 230, 232, 5, 44, 0, 0, 231, 230, 1, 0, 0, 0, 231, 232, 1, - 0, 0, 0, 232, 234, 1, 0, 0, 0, 233, 225, 1, 0, 0, 0, 234, 237, 1, 0, 0, - 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, - 235, 1, 0, 0, 0, 238, 240, 5, 52, 0, 0, 239, 238, 1, 0, 0, 0, 239, 240, - 1, 0, 0, 0, 240, 241, 1, 0, 0, 0, 241, 243, 5, 32, 0, 0, 242, 244, 5, 44, - 0, 0, 243, 242, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, - 245, 247, 5, 29, 0, 0, 246, 248, 5, 52, 0, 0, 247, 246, 1, 0, 0, 0, 247, - 248, 1, 0, 0, 0, 248, 250, 1, 0, 0, 0, 249, 251, 5, 44, 0, 0, 250, 249, - 1, 0, 0, 0, 250, 251, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 254, 3, 40, - 20, 0, 253, 255, 5, 52, 0, 0, 254, 253, 1, 0, 0, 0, 254, 255, 1, 0, 0, - 0, 255, 256, 1, 0, 0, 0, 256, 257, 5, 30, 0, 0, 257, 29, 1, 0, 0, 0, 258, - 259, 5, 51, 0, 0, 259, 31, 1, 0, 0, 0, 260, 262, 5, 52, 0, 0, 261, 260, - 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 265, 3, 34, - 17, 0, 264, 266, 5, 44, 0, 0, 265, 264, 1, 0, 0, 0, 265, 266, 1, 0, 0, - 0, 266, 267, 1, 0, 0, 0, 267, 269, 5, 2, 0, 0, 268, 270, 5, 44, 0, 0, 269, - 268, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 272, - 3, 36, 18, 0, 272, 33, 1, 0, 0, 0, 273, 274, 5, 51, 0, 0, 274, 35, 1, 0, - 0, 0, 275, 281, 5, 5, 0, 0, 276, 277, 5, 4, 0, 0, 277, 278, 5, 21, 0, 0, - 278, 279, 5, 5, 0, 0, 279, 281, 5, 24, 0, 0, 280, 275, 1, 0, 0, 0, 280, - 276, 1, 0, 0, 0, 281, 37, 1, 0, 0, 0, 282, 286, 5, 1, 0, 0, 283, 285, 8, - 0, 0, 0, 284, 283, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, - 0, 286, 287, 1, 0, 0, 0, 287, 291, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, - 290, 5, 52, 0, 0, 290, 292, 3, 38, 19, 0, 291, 289, 1, 0, 0, 0, 291, 292, - 1, 0, 0, 0, 292, 39, 1, 0, 0, 0, 293, 296, 7, 1, 0, 0, 294, 296, 8, 2, - 0, 0, 295, 293, 1, 0, 0, 0, 295, 294, 1, 0, 0, 0, 296, 299, 1, 0, 0, 0, - 297, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 41, 1, 0, 0, 0, 299, 297, - 1, 0, 0, 0, 50, 43, 46, 50, 54, 58, 65, 73, 78, 83, 94, 96, 103, 107, 115, - 118, 126, 134, 142, 144, 150, 154, 158, 162, 166, 176, 179, 188, 191, 198, - 203, 208, 215, 219, 223, 227, 231, 235, 239, 243, 247, 250, 254, 261, 265, - 269, 280, 286, 291, 295, 297, + 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, + 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 1, 0, 3, 0, 50, 8, 0, 1, 0, 3, 0, + 53, 8, 0, 1, 0, 1, 0, 3, 0, 57, 8, 0, 1, 0, 1, 0, 3, 0, 61, 8, 0, 1, 0, + 1, 0, 3, 0, 65, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 72, 8, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 80, 8, 1, 1, 2, 5, 2, 83, 8, 2, + 10, 2, 12, 2, 86, 9, 2, 1, 3, 1, 3, 3, 3, 90, 8, 3, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 3, 1, 3, 1, 3, 4, 3, 99, 8, 3, 11, 3, 12, 3, 100, 3, 3, 103, 8, 3, + 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 110, 8, 4, 1, 4, 1, 4, 3, 4, 114, 8, + 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 123, 8, 6, 1, 6, 3, + 6, 126, 8, 6, 1, 7, 1, 7, 3, 7, 130, 8, 7, 1, 7, 3, 7, 133, 8, 7, 1, 8, + 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 140, 8, 8, 4, 8, 142, 8, 8, 11, 8, 12, 8, + 143, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 4, 8, 153, 8, 8, 11, + 8, 12, 8, 154, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 162, 8, 8, 3, 8, 164, + 8, 8, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 170, 8, 10, 10, 10, 12, 10, 173, + 9, 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 10, 5, 10, 180, 8, 10, 10, 10, + 12, 10, 183, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 5, 11, 189, 8, 11, 10, + 11, 12, 11, 192, 9, 11, 1, 11, 1, 11, 3, 11, 196, 8, 11, 1, 11, 5, 11, + 199, 8, 11, 10, 11, 12, 11, 202, 9, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, + 12, 208, 8, 12, 1, 12, 1, 12, 3, 12, 212, 8, 12, 1, 12, 1, 12, 3, 12, 216, + 8, 12, 1, 12, 1, 12, 3, 12, 220, 8, 12, 5, 12, 222, 8, 12, 10, 12, 12, + 12, 225, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, + 234, 8, 13, 1, 14, 3, 14, 237, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, + 1, 14, 1, 14, 3, 14, 246, 8, 14, 1, 14, 3, 14, 249, 8, 14, 1, 15, 1, 15, + 1, 15, 1, 15, 1, 15, 3, 15, 256, 8, 15, 1, 16, 5, 16, 259, 8, 16, 10, 16, + 12, 16, 262, 9, 16, 1, 17, 1, 17, 3, 17, 266, 8, 17, 1, 17, 1, 17, 1, 17, + 1, 17, 1, 17, 3, 17, 273, 8, 17, 1, 17, 1, 17, 3, 17, 277, 8, 17, 1, 17, + 1, 17, 3, 17, 281, 8, 17, 1, 17, 1, 17, 3, 17, 285, 8, 17, 1, 17, 1, 17, + 3, 17, 289, 8, 17, 5, 17, 291, 8, 17, 10, 17, 12, 17, 294, 9, 17, 1, 17, + 3, 17, 297, 8, 17, 1, 17, 1, 17, 3, 17, 301, 8, 17, 1, 17, 1, 17, 3, 17, + 305, 8, 17, 1, 17, 3, 17, 308, 8, 17, 1, 17, 1, 17, 3, 17, 312, 8, 17, + 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 3, 19, 319, 8, 19, 1, 19, 1, 19, 3, + 19, 323, 8, 19, 1, 19, 1, 19, 3, 19, 327, 8, 19, 1, 19, 1, 19, 1, 20, 1, + 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 338, 8, 21, 1, 22, 1, 22, + 5, 22, 342, 8, 22, 10, 22, 12, 22, 345, 9, 22, 1, 22, 1, 22, 3, 22, 349, + 8, 22, 1, 23, 1, 23, 5, 23, 353, 8, 23, 10, 23, 12, 23, 356, 9, 23, 1, + 23, 0, 0, 24, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, 0, 3, 1, 0, 52, 52, 2, 0, 18, 29, 31, 52, + 1, 0, 30, 30, 396, 0, 49, 1, 0, 0, 0, 2, 71, 1, 0, 0, 0, 4, 84, 1, 0, 0, + 0, 6, 89, 1, 0, 0, 0, 8, 104, 1, 0, 0, 0, 10, 117, 1, 0, 0, 0, 12, 122, + 1, 0, 0, 0, 14, 129, 1, 0, 0, 0, 16, 163, 1, 0, 0, 0, 18, 165, 1, 0, 0, + 0, 20, 167, 1, 0, 0, 0, 22, 186, 1, 0, 0, 0, 24, 205, 1, 0, 0, 0, 26, 228, + 1, 0, 0, 0, 28, 236, 1, 0, 0, 0, 30, 250, 1, 0, 0, 0, 32, 260, 1, 0, 0, + 0, 34, 265, 1, 0, 0, 0, 36, 315, 1, 0, 0, 0, 38, 318, 1, 0, 0, 0, 40, 330, + 1, 0, 0, 0, 42, 337, 1, 0, 0, 0, 44, 339, 1, 0, 0, 0, 46, 354, 1, 0, 0, + 0, 48, 50, 5, 44, 0, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, + 1, 0, 0, 0, 51, 53, 5, 52, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, + 53, 54, 1, 0, 0, 0, 54, 56, 3, 2, 1, 0, 55, 57, 5, 52, 0, 0, 56, 55, 1, + 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 60, 3, 4, 2, 0, 59, + 61, 5, 52, 0, 0, 60, 59, 1, 0, 0, 0, 60, 61, 1, 0, 0, 0, 61, 62, 1, 0, + 0, 0, 62, 64, 3, 32, 16, 0, 63, 65, 5, 52, 0, 0, 64, 63, 1, 0, 0, 0, 64, + 65, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 5, 0, 0, 1, 67, 1, 1, 0, 0, + 0, 68, 69, 3, 44, 22, 0, 69, 70, 5, 52, 0, 0, 70, 72, 1, 0, 0, 0, 71, 68, + 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 74, 5, 10, 0, 0, + 74, 75, 5, 52, 0, 0, 75, 76, 5, 11, 0, 0, 76, 77, 5, 44, 0, 0, 77, 79, + 5, 12, 0, 0, 78, 80, 5, 44, 0, 0, 79, 78, 1, 0, 0, 0, 79, 80, 1, 0, 0, + 0, 80, 3, 1, 0, 0, 0, 81, 83, 3, 6, 3, 0, 82, 81, 1, 0, 0, 0, 83, 86, 1, + 0, 0, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 5, 1, 0, 0, 0, 86, + 84, 1, 0, 0, 0, 87, 88, 5, 52, 0, 0, 88, 90, 3, 44, 22, 0, 89, 87, 1, 0, + 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 5, 52, 0, 0, 92, + 93, 5, 13, 0, 0, 93, 94, 5, 44, 0, 0, 94, 102, 5, 51, 0, 0, 95, 96, 5, + 52, 0, 0, 96, 98, 5, 15, 0, 0, 97, 99, 3, 8, 4, 0, 98, 97, 1, 0, 0, 0, + 99, 100, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 103, + 1, 0, 0, 0, 102, 95, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 7, 1, 0, 0, + 0, 104, 105, 5, 52, 0, 0, 105, 106, 5, 16, 0, 0, 106, 107, 5, 44, 0, 0, + 107, 109, 3, 10, 5, 0, 108, 110, 5, 44, 0, 0, 109, 108, 1, 0, 0, 0, 109, + 110, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 113, 5, 2, 0, 0, 112, 114, + 5, 44, 0, 0, 113, 112, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, + 0, 0, 115, 116, 3, 12, 6, 0, 116, 9, 1, 0, 0, 0, 117, 118, 5, 51, 0, 0, + 118, 11, 1, 0, 0, 0, 119, 123, 3, 24, 12, 0, 120, 123, 3, 18, 9, 0, 121, + 123, 3, 20, 10, 0, 122, 119, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 121, + 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 126, 3, 16, 8, 0, 125, 124, 1, 0, + 0, 0, 125, 126, 1, 0, 0, 0, 126, 13, 1, 0, 0, 0, 127, 130, 3, 18, 9, 0, + 128, 130, 3, 22, 11, 0, 129, 127, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, + 132, 1, 0, 0, 0, 131, 133, 3, 16, 8, 0, 132, 131, 1, 0, 0, 0, 132, 133, + 1, 0, 0, 0, 133, 15, 1, 0, 0, 0, 134, 135, 5, 44, 0, 0, 135, 136, 5, 7, + 0, 0, 136, 139, 5, 44, 0, 0, 137, 140, 3, 18, 9, 0, 138, 140, 3, 22, 11, + 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 142, 1, 0, 0, 0, 141, + 134, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, + 1, 0, 0, 0, 144, 164, 1, 0, 0, 0, 145, 146, 5, 44, 0, 0, 146, 147, 5, 6, + 0, 0, 147, 150, 5, 44, 0, 0, 148, 151, 3, 18, 9, 0, 149, 151, 3, 22, 11, + 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 153, 1, 0, 0, 0, 152, + 145, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 154, 155, + 1, 0, 0, 0, 155, 164, 1, 0, 0, 0, 156, 157, 5, 44, 0, 0, 157, 158, 5, 8, + 0, 0, 158, 161, 5, 44, 0, 0, 159, 162, 3, 18, 9, 0, 160, 162, 3, 22, 11, + 0, 161, 159, 1, 0, 0, 0, 161, 160, 1, 0, 0, 0, 162, 164, 1, 0, 0, 0, 163, + 141, 1, 0, 0, 0, 163, 152, 1, 0, 0, 0, 163, 156, 1, 0, 0, 0, 164, 17, 1, + 0, 0, 0, 165, 166, 3, 26, 13, 0, 166, 19, 1, 0, 0, 0, 167, 171, 5, 31, + 0, 0, 168, 170, 5, 44, 0, 0, 169, 168, 1, 0, 0, 0, 170, 173, 1, 0, 0, 0, + 171, 169, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 176, 1, 0, 0, 0, 173, + 171, 1, 0, 0, 0, 174, 177, 3, 12, 6, 0, 175, 177, 3, 22, 11, 0, 176, 174, + 1, 0, 0, 0, 176, 175, 1, 0, 0, 0, 177, 181, 1, 0, 0, 0, 178, 180, 5, 44, + 0, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, + 181, 182, 1, 0, 0, 0, 182, 184, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 184, + 185, 5, 32, 0, 0, 185, 21, 1, 0, 0, 0, 186, 190, 5, 31, 0, 0, 187, 189, + 5, 44, 0, 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, + 0, 0, 190, 191, 1, 0, 0, 0, 191, 195, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, + 193, 196, 3, 14, 7, 0, 194, 196, 3, 22, 11, 0, 195, 193, 1, 0, 0, 0, 195, + 194, 1, 0, 0, 0, 196, 200, 1, 0, 0, 0, 197, 199, 5, 44, 0, 0, 198, 197, + 1, 0, 0, 0, 199, 202, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, + 0, 0, 201, 203, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 203, 204, 5, 32, 0, 0, + 204, 23, 1, 0, 0, 0, 205, 207, 5, 27, 0, 0, 206, 208, 5, 44, 0, 0, 207, + 206, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 211, + 3, 28, 14, 0, 210, 212, 5, 44, 0, 0, 211, 210, 1, 0, 0, 0, 211, 212, 1, + 0, 0, 0, 212, 223, 1, 0, 0, 0, 213, 215, 5, 3, 0, 0, 214, 216, 5, 44, 0, + 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, + 219, 3, 28, 14, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, + 1, 0, 0, 0, 220, 222, 1, 0, 0, 0, 221, 213, 1, 0, 0, 0, 222, 225, 1, 0, + 0, 0, 223, 221, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 226, 1, 0, 0, 0, + 225, 223, 1, 0, 0, 0, 226, 227, 5, 28, 0, 0, 227, 25, 1, 0, 0, 0, 228, + 233, 5, 51, 0, 0, 229, 230, 5, 44, 0, 0, 230, 231, 5, 9, 0, 0, 231, 232, + 5, 44, 0, 0, 232, 234, 5, 51, 0, 0, 233, 229, 1, 0, 0, 0, 233, 234, 1, + 0, 0, 0, 234, 27, 1, 0, 0, 0, 235, 237, 5, 52, 0, 0, 236, 235, 1, 0, 0, + 0, 236, 237, 1, 0, 0, 0, 237, 245, 1, 0, 0, 0, 238, 246, 3, 30, 15, 0, + 239, 240, 3, 30, 15, 0, 240, 241, 5, 44, 0, 0, 241, 242, 5, 17, 0, 0, 242, + 243, 5, 44, 0, 0, 243, 244, 3, 36, 18, 0, 244, 246, 1, 0, 0, 0, 245, 238, + 1, 0, 0, 0, 245, 239, 1, 0, 0, 0, 246, 248, 1, 0, 0, 0, 247, 249, 5, 52, + 0, 0, 248, 247, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 29, 1, 0, 0, 0, + 250, 255, 5, 51, 0, 0, 251, 252, 5, 2, 0, 0, 252, 256, 5, 38, 0, 0, 253, + 254, 5, 1, 0, 0, 254, 256, 5, 51, 0, 0, 255, 251, 1, 0, 0, 0, 255, 253, + 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 31, 1, 0, 0, 0, 257, 259, 3, 34, + 17, 0, 258, 257, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, + 260, 261, 1, 0, 0, 0, 261, 33, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 264, + 5, 52, 0, 0, 264, 266, 3, 44, 22, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, + 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 268, 5, 52, 0, 0, 268, 269, 5, 14, + 0, 0, 269, 270, 5, 44, 0, 0, 270, 272, 3, 36, 18, 0, 271, 273, 5, 44, 0, + 0, 272, 271, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, + 276, 5, 31, 0, 0, 275, 277, 5, 44, 0, 0, 276, 275, 1, 0, 0, 0, 276, 277, + 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 280, 3, 38, 19, 0, 279, 281, 5, + 44, 0, 0, 280, 279, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 292, 1, 0, 0, + 0, 282, 284, 5, 3, 0, 0, 283, 285, 5, 44, 0, 0, 284, 283, 1, 0, 0, 0, 284, + 285, 1, 0, 0, 0, 285, 286, 1, 0, 0, 0, 286, 288, 3, 38, 19, 0, 287, 289, + 5, 44, 0, 0, 288, 287, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 291, 1, 0, + 0, 0, 290, 282, 1, 0, 0, 0, 291, 294, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, + 292, 293, 1, 0, 0, 0, 293, 296, 1, 0, 0, 0, 294, 292, 1, 0, 0, 0, 295, + 297, 5, 52, 0, 0, 296, 295, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 298, + 1, 0, 0, 0, 298, 300, 5, 32, 0, 0, 299, 301, 5, 44, 0, 0, 300, 299, 1, + 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 5, 29, 0, + 0, 303, 305, 5, 52, 0, 0, 304, 303, 1, 0, 0, 0, 304, 305, 1, 0, 0, 0, 305, + 307, 1, 0, 0, 0, 306, 308, 5, 44, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, + 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 311, 3, 46, 23, 0, 310, 312, 5, + 52, 0, 0, 311, 310, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 313, 1, 0, 0, + 0, 313, 314, 5, 30, 0, 0, 314, 35, 1, 0, 0, 0, 315, 316, 5, 51, 0, 0, 316, + 37, 1, 0, 0, 0, 317, 319, 5, 52, 0, 0, 318, 317, 1, 0, 0, 0, 318, 319, + 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 322, 3, 40, 20, 0, 321, 323, 5, + 44, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, + 0, 324, 326, 5, 2, 0, 0, 325, 327, 5, 44, 0, 0, 326, 325, 1, 0, 0, 0, 326, + 327, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 329, 3, 42, 21, 0, 329, 39, + 1, 0, 0, 0, 330, 331, 5, 51, 0, 0, 331, 41, 1, 0, 0, 0, 332, 338, 5, 5, + 0, 0, 333, 334, 5, 4, 0, 0, 334, 335, 5, 21, 0, 0, 335, 336, 5, 5, 0, 0, + 336, 338, 5, 24, 0, 0, 337, 332, 1, 0, 0, 0, 337, 333, 1, 0, 0, 0, 338, + 43, 1, 0, 0, 0, 339, 343, 5, 1, 0, 0, 340, 342, 8, 0, 0, 0, 341, 340, 1, + 0, 0, 0, 342, 345, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, + 0, 344, 348, 1, 0, 0, 0, 345, 343, 1, 0, 0, 0, 346, 347, 5, 52, 0, 0, 347, + 349, 3, 44, 22, 0, 348, 346, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, 45, + 1, 0, 0, 0, 350, 353, 7, 1, 0, 0, 351, 353, 8, 2, 0, 0, 352, 350, 1, 0, + 0, 0, 352, 351, 1, 0, 0, 0, 353, 356, 1, 0, 0, 0, 354, 352, 1, 0, 0, 0, + 354, 355, 1, 0, 0, 0, 355, 47, 1, 0, 0, 0, 356, 354, 1, 0, 0, 0, 60, 49, + 52, 56, 60, 64, 71, 79, 84, 89, 100, 102, 109, 113, 122, 125, 129, 132, + 139, 143, 150, 154, 161, 163, 171, 176, 181, 190, 195, 200, 207, 211, 215, + 219, 223, 233, 236, 245, 248, 255, 260, 265, 272, 276, 280, 284, 288, 292, + 296, 300, 304, 307, 311, 318, 322, 326, 337, 343, 348, 352, 354, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -301,20 +329,23 @@ const ( OpenFGAParserRULE_relationDeclaration = 4 OpenFGAParserRULE_relationName = 5 OpenFGAParserRULE_relationDef = 6 - OpenFGAParserRULE_relationDefPartials = 7 - OpenFGAParserRULE_relationDefGrouping = 8 - OpenFGAParserRULE_relationDefDirectAssignment = 9 - OpenFGAParserRULE_relationDefRewrite = 10 - OpenFGAParserRULE_relationDefTypeRestriction = 11 - OpenFGAParserRULE_relationDefTypeRestrictionBase = 12 - OpenFGAParserRULE_conditions = 13 - OpenFGAParserRULE_condition = 14 - OpenFGAParserRULE_conditionName = 15 - OpenFGAParserRULE_conditionParameter = 16 - OpenFGAParserRULE_parameterName = 17 - OpenFGAParserRULE_parameterType = 18 - OpenFGAParserRULE_multiLineComment = 19 - OpenFGAParserRULE_conditionExpression = 20 + OpenFGAParserRULE_relationDefNoDirect = 7 + OpenFGAParserRULE_relationDefPartials = 8 + OpenFGAParserRULE_relationDefGrouping = 9 + OpenFGAParserRULE_relationRecurse = 10 + OpenFGAParserRULE_relationRecurseNoDirect = 11 + OpenFGAParserRULE_relationDefDirectAssignment = 12 + OpenFGAParserRULE_relationDefRewrite = 13 + OpenFGAParserRULE_relationDefTypeRestriction = 14 + OpenFGAParserRULE_relationDefTypeRestrictionBase = 15 + OpenFGAParserRULE_conditions = 16 + OpenFGAParserRULE_condition = 17 + OpenFGAParserRULE_conditionName = 18 + OpenFGAParserRULE_conditionParameter = 19 + OpenFGAParserRULE_parameterName = 20 + OpenFGAParserRULE_parameterType = 21 + OpenFGAParserRULE_multiLineComment = 22 + OpenFGAParserRULE_conditionExpression = 23 ) // IMainContext is an interface to support dynamic dispatch. @@ -463,7 +494,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(43) + p.SetState(49) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -473,7 +504,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(42) + p.SetState(48) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -482,7 +513,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { } } - p.SetState(46) + p.SetState(52) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -492,7 +523,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { if _la == OpenFGAParserNEWLINE { { - p.SetState(45) + p.SetState(51) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -502,16 +533,16 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { } { - p.SetState(48) + p.SetState(54) p.ModelHeader() } - p.SetState(50) + p.SetState(56) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 2, p.GetParserRuleContext()) == 1 { { - p.SetState(49) + p.SetState(55) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -523,16 +554,16 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { goto errorExit } { - p.SetState(52) + p.SetState(58) p.TypeDefs() } - p.SetState(54) + p.SetState(60) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) == 1 { { - p.SetState(53) + p.SetState(59) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -544,10 +575,10 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { goto errorExit } { - p.SetState(56) + p.SetState(62) p.Conditions() } - p.SetState(58) + p.SetState(64) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -557,7 +588,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { if _la == OpenFGAParserNEWLINE { { - p.SetState(57) + p.SetState(63) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -567,7 +598,7 @@ func (p *OpenFGAParser) Main() (localctx IMainContext) { } { - p.SetState(60) + p.SetState(66) p.Match(OpenFGAParserEOF) if p.HasError() { // Recognition error - abort rule @@ -733,7 +764,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(65) + p.SetState(71) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -743,11 +774,11 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { if _la == OpenFGAParserHASH { { - p.SetState(62) + p.SetState(68) p.MultiLineComment() } { - p.SetState(63) + p.SetState(69) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -757,7 +788,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { } { - p.SetState(67) + p.SetState(73) p.Match(OpenFGAParserMODEL) if p.HasError() { // Recognition error - abort rule @@ -765,7 +796,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { } } { - p.SetState(68) + p.SetState(74) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -773,7 +804,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { } } { - p.SetState(69) + p.SetState(75) p.Match(OpenFGAParserSCHEMA) if p.HasError() { // Recognition error - abort rule @@ -781,7 +812,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { } } { - p.SetState(70) + p.SetState(76) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -789,7 +820,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { } } { - p.SetState(71) + p.SetState(77) var _m = p.Match(OpenFGAParserSCHEMA_VERSION) @@ -799,7 +830,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { goto errorExit } } - p.SetState(73) + p.SetState(79) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -809,7 +840,7 @@ func (p *OpenFGAParser) ModelHeader() (localctx IModelHeaderContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(72) + p.SetState(78) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -953,7 +984,7 @@ func (p *OpenFGAParser) TypeDefs() (localctx ITypeDefsContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(78) + p.SetState(84) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -965,13 +996,13 @@ func (p *OpenFGAParser) TypeDefs() (localctx ITypeDefsContext) { for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(75) + p.SetState(81) p.TypeDef() } } - p.SetState(80) + p.SetState(86) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1178,13 +1209,13 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(83) + p.SetState(89) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 8, p.GetParserRuleContext()) == 1 { { - p.SetState(81) + p.SetState(87) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -1192,7 +1223,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { } } { - p.SetState(82) + p.SetState(88) p.MultiLineComment() } @@ -1200,7 +1231,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { goto errorExit } { - p.SetState(85) + p.SetState(91) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -1208,7 +1239,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { } } { - p.SetState(86) + p.SetState(92) p.Match(OpenFGAParserTYPE) if p.HasError() { // Recognition error - abort rule @@ -1216,7 +1247,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { } } { - p.SetState(87) + p.SetState(93) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -1224,7 +1255,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { } } { - p.SetState(88) + p.SetState(94) var _m = p.Match(OpenFGAParserIDENTIFIER) @@ -1234,13 +1265,13 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { goto errorExit } } - p.SetState(96) + p.SetState(102) p.GetErrorHandler().Sync(p) if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) == 1 { { - p.SetState(89) + p.SetState(95) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -1248,14 +1279,14 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { } } { - p.SetState(90) + p.SetState(96) p.Match(OpenFGAParserRELATIONS) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(92) + p.SetState(98) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1265,7 +1296,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { switch _alt { case 1: { - p.SetState(91) + p.SetState(97) p.RelationDeclaration() } @@ -1277,7 +1308,7 @@ func (p *OpenFGAParser) TypeDef() (localctx ITypeDefContext) { goto errorExit } - p.SetState(94) + p.SetState(100) p.GetErrorHandler().Sync(p) _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 9, p.GetParserRuleContext()) if p.HasError() { @@ -1440,7 +1471,7 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont p.EnterOuterAlt(localctx, 1) { - p.SetState(98) + p.SetState(104) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -1448,7 +1479,7 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont } } { - p.SetState(99) + p.SetState(105) p.Match(OpenFGAParserDEFINE) if p.HasError() { // Recognition error - abort rule @@ -1456,7 +1487,7 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont } } { - p.SetState(100) + p.SetState(106) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -1464,10 +1495,10 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont } } { - p.SetState(101) + p.SetState(107) p.RelationName() } - p.SetState(103) + p.SetState(109) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1477,7 +1508,7 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont if _la == OpenFGAParserWHITESPACE { { - p.SetState(102) + p.SetState(108) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -1487,14 +1518,14 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont } { - p.SetState(105) + p.SetState(111) p.Match(OpenFGAParserCOLON) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(107) + p.SetState(113) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1504,7 +1535,7 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont if _la == OpenFGAParserWHITESPACE { { - p.SetState(106) + p.SetState(112) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -1513,13 +1544,15 @@ func (p *OpenFGAParser) RelationDeclaration() (localctx IRelationDeclarationCont } } + { - p.SetState(109) + p.SetState(115) p.RelationDef() } + errorExit: if p.HasError() { v := p.GetError() @@ -1613,7 +1646,7 @@ func (p *OpenFGAParser) RelationName() (localctx IRelationNameContext) { p.EnterRule(localctx, 10, OpenFGAParserRULE_relationName) p.EnterOuterAlt(localctx, 1) { - p.SetState(111) + p.SetState(117) p.Match(OpenFGAParserIDENTIFIER) if p.HasError() { // Recognition error - abort rule @@ -1647,6 +1680,7 @@ type IRelationDefContext interface { // Getter signatures RelationDefDirectAssignment() IRelationDefDirectAssignmentContext RelationDefGrouping() IRelationDefGroupingContext + RelationRecurse() IRelationRecurseContext RelationDefPartials() IRelationDefPartialsContext // IsRelationDefContext differentiates from other interfaces. @@ -1717,6 +1751,22 @@ func (s *RelationDefContext) RelationDefGrouping() IRelationDefGroupingContext { return t.(IRelationDefGroupingContext) } +func (s *RelationDefContext) RelationRecurse() IRelationRecurseContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationRecurseContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationRecurseContext) +} + func (s *RelationDefContext) RelationDefPartials() IRelationDefPartialsContext { var t antlr.RuleContext; for _, ctx := range s.GetChildren() { @@ -1760,10 +1810,8 @@ func (s *RelationDefContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) RelationDef() (localctx IRelationDefContext) { localctx = NewRelationDefContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 12, OpenFGAParserRULE_relationDef) - var _la int - p.EnterOuterAlt(localctx, 1) - p.SetState(115) + p.SetState(122) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -1772,37 +1820,222 @@ func (p *OpenFGAParser) RelationDef() (localctx IRelationDefContext) { switch p.GetTokenStream().LA(1) { case OpenFGAParserLBRACKET: { - p.SetState(113) + p.SetState(119) p.RelationDefDirectAssignment() } case OpenFGAParserIDENTIFIER: { - p.SetState(114) + p.SetState(120) p.RelationDefGrouping() } + case OpenFGAParserLPAREN: + { + p.SetState(121) + p.RelationRecurse() + } + + default: p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) goto errorExit } - p.SetState(118) + p.SetState(125) + p.GetErrorHandler().Sync(p) + + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) == 1 { + { + p.SetState(124) + p.RelationDefPartials() + } + + } else if p.HasError() { // JIM + goto errorExit + } + + + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + + +// IRelationDefNoDirectContext is an interface to support dynamic dispatch. +type IRelationDefNoDirectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RelationDefGrouping() IRelationDefGroupingContext + RelationRecurseNoDirect() IRelationRecurseNoDirectContext + RelationDefPartials() IRelationDefPartialsContext + + // IsRelationDefNoDirectContext differentiates from other interfaces. + IsRelationDefNoDirectContext() +} + +type RelationDefNoDirectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelationDefNoDirectContext() *RelationDefNoDirectContext { + var p = new(RelationDefNoDirectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationDefNoDirect + return p +} + +func InitEmptyRelationDefNoDirectContext(p *RelationDefNoDirectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationDefNoDirect +} + +func (*RelationDefNoDirectContext) IsRelationDefNoDirectContext() {} + +func NewRelationDefNoDirectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationDefNoDirectContext { + var p = new(RelationDefNoDirectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = OpenFGAParserRULE_relationDefNoDirect + + return p +} + +func (s *RelationDefNoDirectContext) GetParser() antlr.Parser { return s.parser } + +func (s *RelationDefNoDirectContext) RelationDefGrouping() IRelationDefGroupingContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationDefGroupingContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationDefGroupingContext) +} + +func (s *RelationDefNoDirectContext) RelationRecurseNoDirect() IRelationRecurseNoDirectContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationRecurseNoDirectContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationRecurseNoDirectContext) +} + +func (s *RelationDefNoDirectContext) RelationDefPartials() IRelationDefPartialsContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationDefPartialsContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationDefPartialsContext) +} + +func (s *RelationDefNoDirectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RelationDefNoDirectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + + +func (s *RelationDefNoDirectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.EnterRelationDefNoDirect(s) + } +} + +func (s *RelationDefNoDirectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.ExitRelationDefNoDirect(s) + } +} + + + + +func (p *OpenFGAParser) RelationDefNoDirect() (localctx IRelationDefNoDirectContext) { + localctx = NewRelationDefNoDirectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 14, OpenFGAParserRULE_relationDefNoDirect) + p.EnterOuterAlt(localctx, 1) + p.SetState(129) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _la = p.GetTokenStream().LA(1) + + switch p.GetTokenStream().LA(1) { + case OpenFGAParserIDENTIFIER: + { + p.SetState(127) + p.RelationDefGrouping() + } - if _la == OpenFGAParserWHITESPACE { + case OpenFGAParserLPAREN: + { + p.SetState(128) + p.RelationRecurseNoDirect() + } + + + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.SetState(132) + p.GetErrorHandler().Sync(p) + + + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 16, p.GetParserRuleContext()) == 1 { { - p.SetState(117) + p.SetState(131) p.RelationDefPartials() } + } else if p.HasError() { // JIM + goto errorExit } @@ -1835,10 +2068,11 @@ type IRelationDefPartialsContext interface { OR(i int) antlr.TerminalNode AllRelationDefGrouping() []IRelationDefGroupingContext RelationDefGrouping(i int) IRelationDefGroupingContext + AllRelationRecurseNoDirect() []IRelationRecurseNoDirectContext + RelationRecurseNoDirect(i int) IRelationRecurseNoDirectContext AllAND() []antlr.TerminalNode AND(i int) antlr.TerminalNode - AllBUT_NOT() []antlr.TerminalNode - BUT_NOT(i int) antlr.TerminalNode + BUT_NOT() antlr.TerminalNode // IsRelationDefPartialsContext differentiates from other interfaces. IsRelationDefPartialsContext() @@ -1933,6 +2167,47 @@ func (s *RelationDefPartialsContext) RelationDefGrouping(i int) IRelationDefGrou return t.(IRelationDefGroupingContext) } +func (s *RelationDefPartialsContext) AllRelationRecurseNoDirect() []IRelationRecurseNoDirectContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IRelationRecurseNoDirectContext); ok { + len++ + } + } + + tst := make([]IRelationRecurseNoDirectContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IRelationRecurseNoDirectContext); ok { + tst[i] = t.(IRelationRecurseNoDirectContext) + i++ + } + } + + return tst +} + +func (s *RelationDefPartialsContext) RelationRecurseNoDirect(i int) IRelationRecurseNoDirectContext { + var t antlr.RuleContext; + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationRecurseNoDirectContext); ok { + if j == i { + t = ctx.(antlr.RuleContext); + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IRelationRecurseNoDirectContext) +} + func (s *RelationDefPartialsContext) AllAND() []antlr.TerminalNode { return s.GetTokens(OpenFGAParserAND) } @@ -1941,12 +2216,8 @@ func (s *RelationDefPartialsContext) AND(i int) antlr.TerminalNode { return s.GetToken(OpenFGAParserAND, i) } -func (s *RelationDefPartialsContext) AllBUT_NOT() []antlr.TerminalNode { - return s.GetTokens(OpenFGAParserBUT_NOT) -} - -func (s *RelationDefPartialsContext) BUT_NOT(i int) antlr.TerminalNode { - return s.GetToken(OpenFGAParserBUT_NOT, i) +func (s *RelationDefPartialsContext) BUT_NOT() antlr.TerminalNode { + return s.GetToken(OpenFGAParserBUT_NOT, 0) } func (s *RelationDefPartialsContext) GetRuleContext() antlr.RuleContext { @@ -1975,168 +2246,579 @@ func (s *RelationDefPartialsContext) ExitRule(listener antlr.ParseTreeListener) func (p *OpenFGAParser) RelationDefPartials() (localctx IRelationDefPartialsContext) { localctx = NewRelationDefPartialsContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 14, OpenFGAParserRULE_relationDefPartials) - var _la int + p.EnterRule(localctx, 16, OpenFGAParserRULE_relationDefPartials) + var _alt int - p.SetState(144) + p.SetState(163) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 22, p.GetParserRuleContext()) { case 1: p.EnterOuterAlt(localctx, 1) - p.SetState(124) + p.SetState(141) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _la = p.GetTokenStream().LA(1) + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(134) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(135) + p.Match(OpenFGAParserOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(136) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(139) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case OpenFGAParserIDENTIFIER: + { + p.SetState(137) + p.RelationDefGrouping() + } - for ok := true; ok; ok = _la == OpenFGAParserWHITESPACE { - { - p.SetState(120) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(121) - p.Match(OpenFGAParserOR) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(122) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(123) - p.RelationDefGrouping() - } + case OpenFGAParserLPAREN: + { + p.SetState(138) + p.RelationRecurseNoDirect() + } - p.SetState(126) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) - } - case 2: - p.EnterOuterAlt(localctx, 2) - p.SetState(132) - p.GetErrorHandler().Sync(p) + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + + + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + p.SetState(143) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 18, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + } + + + case 2: + p.EnterOuterAlt(localctx, 2) + p.SetState(152) + p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _la = p.GetTokenStream().LA(1) + _alt = 1 + for ok := true; ok; ok = _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + switch _alt { + case 1: + { + p.SetState(145) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(146) + p.Match(OpenFGAParserAND) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(147) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(150) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + switch p.GetTokenStream().LA(1) { + case OpenFGAParserIDENTIFIER: + { + p.SetState(148) + p.RelationDefGrouping() + } - for ok := true; ok; ok = _la == OpenFGAParserWHITESPACE { - { - p.SetState(128) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule + + case OpenFGAParserLPAREN: + { + p.SetState(149) + p.RelationRecurseNoDirect() + } + + + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) goto errorExit - } + } + + + + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit } - { - p.SetState(129) - p.Match(OpenFGAParserAND) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } + + p.SetState(154) + p.GetErrorHandler().Sync(p) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 20, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit } - { - p.SetState(130) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } + } + + + case 3: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(156) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(157) + p.Match(OpenFGAParserBUT_NOT) + if p.HasError() { + // Recognition error - abort rule + goto errorExit } + } + { + p.SetState(158) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(161) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case OpenFGAParserIDENTIFIER: { - p.SetState(131) + p.SetState(159) p.RelationDefGrouping() } - p.SetState(134) - p.GetErrorHandler().Sync(p) + case OpenFGAParserLPAREN: + { + p.SetState(160) + p.RelationRecurseNoDirect() + } + + + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + + +// IRelationDefGroupingContext is an interface to support dynamic dispatch. +type IRelationDefGroupingContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + RelationDefRewrite() IRelationDefRewriteContext + + // IsRelationDefGroupingContext differentiates from other interfaces. + IsRelationDefGroupingContext() +} + +type RelationDefGroupingContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelationDefGroupingContext() *RelationDefGroupingContext { + var p = new(RelationDefGroupingContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationDefGrouping + return p +} + +func InitEmptyRelationDefGroupingContext(p *RelationDefGroupingContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationDefGrouping +} + +func (*RelationDefGroupingContext) IsRelationDefGroupingContext() {} + +func NewRelationDefGroupingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationDefGroupingContext { + var p = new(RelationDefGroupingContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = OpenFGAParserRULE_relationDefGrouping + + return p +} + +func (s *RelationDefGroupingContext) GetParser() antlr.Parser { return s.parser } + +func (s *RelationDefGroupingContext) RelationDefRewrite() IRelationDefRewriteContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationDefRewriteContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationDefRewriteContext) +} + +func (s *RelationDefGroupingContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RelationDefGroupingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + + +func (s *RelationDefGroupingContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.EnterRelationDefGrouping(s) + } +} + +func (s *RelationDefGroupingContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.ExitRelationDefGrouping(s) + } +} + + + + +func (p *OpenFGAParser) RelationDefGrouping() (localctx IRelationDefGroupingContext) { + localctx = NewRelationDefGroupingContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 18, OpenFGAParserRULE_relationDefGrouping) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(165) + p.RelationDefRewrite() + } + + + +errorExit: + if p.HasError() { + v := p.GetError() + localctx.SetException(v) + p.GetErrorHandler().ReportError(p, v) + p.GetErrorHandler().Recover(p, v) + p.SetError(nil) + } + p.ExitRule() + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + + +// IRelationRecurseContext is an interface to support dynamic dispatch. +type IRelationRecurseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LPAREN() antlr.TerminalNode + RPAREN() antlr.TerminalNode + RelationDef() IRelationDefContext + RelationRecurseNoDirect() IRelationRecurseNoDirectContext + AllWHITESPACE() []antlr.TerminalNode + WHITESPACE(i int) antlr.TerminalNode + + // IsRelationRecurseContext differentiates from other interfaces. + IsRelationRecurseContext() +} + +type RelationRecurseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRelationRecurseContext() *RelationRecurseContext { + var p = new(RelationRecurseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationRecurse + return p +} + +func InitEmptyRelationRecurseContext(p *RelationRecurseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = OpenFGAParserRULE_relationRecurse +} + +func (*RelationRecurseContext) IsRelationRecurseContext() {} + +func NewRelationRecurseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationRecurseContext { + var p = new(RelationRecurseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = OpenFGAParserRULE_relationRecurse + + return p +} + +func (s *RelationRecurseContext) GetParser() antlr.Parser { return s.parser } + +func (s *RelationRecurseContext) LPAREN() antlr.TerminalNode { + return s.GetToken(OpenFGAParserLPAREN, 0) +} + +func (s *RelationRecurseContext) RPAREN() antlr.TerminalNode { + return s.GetToken(OpenFGAParserRPAREN, 0) +} + +func (s *RelationRecurseContext) RelationDef() IRelationDefContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationDefContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationDefContext) +} + +func (s *RelationRecurseContext) RelationRecurseNoDirect() IRelationRecurseNoDirectContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationRecurseNoDirectContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationRecurseNoDirectContext) +} + +func (s *RelationRecurseContext) AllWHITESPACE() []antlr.TerminalNode { + return s.GetTokens(OpenFGAParserWHITESPACE) +} + +func (s *RelationRecurseContext) WHITESPACE(i int) antlr.TerminalNode { + return s.GetToken(OpenFGAParserWHITESPACE, i) +} + +func (s *RelationRecurseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RelationRecurseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + + +func (s *RelationRecurseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.EnterRelationRecurse(s) + } +} + +func (s *RelationRecurseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(OpenFGAParserListener); ok { + listenerT.ExitRelationRecurse(s) + } +} + + + + +func (p *OpenFGAParser) RelationRecurse() (localctx IRelationRecurseContext) { + localctx = NewRelationRecurseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 20, OpenFGAParserRULE_relationRecurse) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(167) + p.Match(OpenFGAParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(171) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + + for _la == OpenFGAParserWHITESPACE { + { + p.SetState(168) + p.Match(OpenFGAParserWHITESPACE) if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) + // Recognition error - abort rule + goto errorExit + } } - case 3: - p.EnterOuterAlt(localctx, 3) - p.SetState(140) + p.SetState(173) p.GetErrorHandler().Sync(p) if p.HasError() { - goto errorExit - } + goto errorExit + } _la = p.GetTokenStream().LA(1) + } + p.SetState(176) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } - - for ok := true; ok; ok = _la == OpenFGAParserWHITESPACE { - { - p.SetState(136) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(137) - p.Match(OpenFGAParserBUT_NOT) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(138) - p.Match(OpenFGAParserWHITESPACE) - if p.HasError() { - // Recognition error - abort rule - goto errorExit - } - } - { - p.SetState(139) - p.RelationDefGrouping() - } + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) { + case 1: + { + p.SetState(174) + p.RelationDef() + } - p.SetState(142) - p.GetErrorHandler().Sync(p) - if p.HasError() { - goto errorExit - } - _la = p.GetTokenStream().LA(1) + case 2: + { + p.SetState(175) + p.RelationRecurseNoDirect() } case antlr.ATNInvalidAltNumber: goto errorExit } + p.SetState(181) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + + for _la == OpenFGAParserWHITESPACE { + { + p.SetState(178) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + + p.SetState(183) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(184) + p.Match(OpenFGAParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + errorExit: @@ -2153,56 +2835,69 @@ errorExit: } -// IRelationDefGroupingContext is an interface to support dynamic dispatch. -type IRelationDefGroupingContext interface { +// IRelationRecurseNoDirectContext is an interface to support dynamic dispatch. +type IRelationRecurseNoDirectContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // Getter signatures - RelationDefRewrite() IRelationDefRewriteContext + LPAREN() antlr.TerminalNode + RPAREN() antlr.TerminalNode + RelationDefNoDirect() IRelationDefNoDirectContext + RelationRecurseNoDirect() IRelationRecurseNoDirectContext + AllWHITESPACE() []antlr.TerminalNode + WHITESPACE(i int) antlr.TerminalNode - // IsRelationDefGroupingContext differentiates from other interfaces. - IsRelationDefGroupingContext() + // IsRelationRecurseNoDirectContext differentiates from other interfaces. + IsRelationRecurseNoDirectContext() } -type RelationDefGroupingContext struct { +type RelationRecurseNoDirectContext struct { antlr.BaseParserRuleContext parser antlr.Parser } -func NewEmptyRelationDefGroupingContext() *RelationDefGroupingContext { - var p = new(RelationDefGroupingContext) +func NewEmptyRelationRecurseNoDirectContext() *RelationRecurseNoDirectContext { + var p = new(RelationRecurseNoDirectContext) antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) - p.RuleIndex = OpenFGAParserRULE_relationDefGrouping + p.RuleIndex = OpenFGAParserRULE_relationRecurseNoDirect return p } -func InitEmptyRelationDefGroupingContext(p *RelationDefGroupingContext) { +func InitEmptyRelationRecurseNoDirectContext(p *RelationRecurseNoDirectContext) { antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) - p.RuleIndex = OpenFGAParserRULE_relationDefGrouping + p.RuleIndex = OpenFGAParserRULE_relationRecurseNoDirect } -func (*RelationDefGroupingContext) IsRelationDefGroupingContext() {} +func (*RelationRecurseNoDirectContext) IsRelationRecurseNoDirectContext() {} -func NewRelationDefGroupingContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationDefGroupingContext { - var p = new(RelationDefGroupingContext) +func NewRelationRecurseNoDirectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelationRecurseNoDirectContext { + var p = new(RelationRecurseNoDirectContext) antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) p.parser = parser - p.RuleIndex = OpenFGAParserRULE_relationDefGrouping + p.RuleIndex = OpenFGAParserRULE_relationRecurseNoDirect return p } -func (s *RelationDefGroupingContext) GetParser() antlr.Parser { return s.parser } +func (s *RelationRecurseNoDirectContext) GetParser() antlr.Parser { return s.parser } -func (s *RelationDefGroupingContext) RelationDefRewrite() IRelationDefRewriteContext { +func (s *RelationRecurseNoDirectContext) LPAREN() antlr.TerminalNode { + return s.GetToken(OpenFGAParserLPAREN, 0) +} + +func (s *RelationRecurseNoDirectContext) RPAREN() antlr.TerminalNode { + return s.GetToken(OpenFGAParserRPAREN, 0) +} + +func (s *RelationRecurseNoDirectContext) RelationDefNoDirect() IRelationDefNoDirectContext { var t antlr.RuleContext; for _, ctx := range s.GetChildren() { - if _, ok := ctx.(IRelationDefRewriteContext); ok { + if _, ok := ctx.(IRelationDefNoDirectContext); ok { t = ctx.(antlr.RuleContext); break } @@ -2212,40 +2907,153 @@ func (s *RelationDefGroupingContext) RelationDefRewrite() IRelationDefRewriteCon return nil } - return t.(IRelationDefRewriteContext) + return t.(IRelationDefNoDirectContext) } -func (s *RelationDefGroupingContext) GetRuleContext() antlr.RuleContext { +func (s *RelationRecurseNoDirectContext) RelationRecurseNoDirect() IRelationRecurseNoDirectContext { + var t antlr.RuleContext; + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IRelationRecurseNoDirectContext); ok { + t = ctx.(antlr.RuleContext); + break + } + } + + if t == nil { + return nil + } + + return t.(IRelationRecurseNoDirectContext) +} + +func (s *RelationRecurseNoDirectContext) AllWHITESPACE() []antlr.TerminalNode { + return s.GetTokens(OpenFGAParserWHITESPACE) +} + +func (s *RelationRecurseNoDirectContext) WHITESPACE(i int) antlr.TerminalNode { + return s.GetToken(OpenFGAParserWHITESPACE, i) +} + +func (s *RelationRecurseNoDirectContext) GetRuleContext() antlr.RuleContext { return s } -func (s *RelationDefGroupingContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { +func (s *RelationRecurseNoDirectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } -func (s *RelationDefGroupingContext) EnterRule(listener antlr.ParseTreeListener) { +func (s *RelationRecurseNoDirectContext) EnterRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(OpenFGAParserListener); ok { - listenerT.EnterRelationDefGrouping(s) + listenerT.EnterRelationRecurseNoDirect(s) } } -func (s *RelationDefGroupingContext) ExitRule(listener antlr.ParseTreeListener) { +func (s *RelationRecurseNoDirectContext) ExitRule(listener antlr.ParseTreeListener) { if listenerT, ok := listener.(OpenFGAParserListener); ok { - listenerT.ExitRelationDefGrouping(s) + listenerT.ExitRelationRecurseNoDirect(s) } } -func (p *OpenFGAParser) RelationDefGrouping() (localctx IRelationDefGroupingContext) { - localctx = NewRelationDefGroupingContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 16, OpenFGAParserRULE_relationDefGrouping) +func (p *OpenFGAParser) RelationRecurseNoDirect() (localctx IRelationRecurseNoDirectContext) { + localctx = NewRelationRecurseNoDirectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 22, OpenFGAParserRULE_relationRecurseNoDirect) + var _la int + p.EnterOuterAlt(localctx, 1) { - p.SetState(146) - p.RelationDefRewrite() + p.SetState(186) + p.Match(OpenFGAParserLPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(190) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + + for _la == OpenFGAParserWHITESPACE { + { + p.SetState(187) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + + p.SetState(192) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + p.SetState(195) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 27, p.GetParserRuleContext()) { + case 1: + { + p.SetState(193) + p.RelationDefNoDirect() + } + + + case 2: + { + p.SetState(194) + p.RelationRecurseNoDirect() + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.SetState(200) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + + for _la == OpenFGAParserWHITESPACE { + { + p.SetState(197) + p.Match(OpenFGAParserWHITESPACE) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + + p.SetState(202) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + { + p.SetState(203) + p.Match(OpenFGAParserRPAREN) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } } @@ -2408,19 +3216,19 @@ func (s *RelationDefDirectAssignmentContext) ExitRule(listener antlr.ParseTreeLi func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDirectAssignmentContext) { localctx = NewRelationDefDirectAssignmentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 18, OpenFGAParserRULE_relationDefDirectAssignment) + p.EnterRule(localctx, 24, OpenFGAParserRULE_relationDefDirectAssignment) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(148) + p.SetState(205) p.Match(OpenFGAParserLBRACKET) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(150) + p.SetState(207) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2430,7 +3238,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire if _la == OpenFGAParserWHITESPACE { { - p.SetState(149) + p.SetState(206) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2440,10 +3248,10 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire } { - p.SetState(152) + p.SetState(209) p.RelationDefTypeRestriction() } - p.SetState(154) + p.SetState(211) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2453,7 +3261,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire if _la == OpenFGAParserWHITESPACE { { - p.SetState(153) + p.SetState(210) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2462,7 +3270,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire } } - p.SetState(166) + p.SetState(223) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2472,14 +3280,14 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire for _la == OpenFGAParserCOMMA { { - p.SetState(156) + p.SetState(213) p.Match(OpenFGAParserCOMMA) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(158) + p.SetState(215) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2489,7 +3297,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire if _la == OpenFGAParserWHITESPACE { { - p.SetState(157) + p.SetState(214) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2499,10 +3307,10 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire } { - p.SetState(160) + p.SetState(217) p.RelationDefTypeRestriction() } - p.SetState(162) + p.SetState(219) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2512,7 +3320,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire if _la == OpenFGAParserWHITESPACE { { - p.SetState(161) + p.SetState(218) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2523,7 +3331,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire } - p.SetState(168) + p.SetState(225) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2531,7 +3339,7 @@ func (p *OpenFGAParser) RelationDefDirectAssignment() (localctx IRelationDefDire _la = p.GetTokenStream().LA(1) } { - p.SetState(169) + p.SetState(226) p.Match(OpenFGAParserRPRACKET) if p.HasError() { // Recognition error - abort rule @@ -2677,10 +3485,10 @@ func (s *RelationDefRewriteContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) RelationDefRewrite() (localctx IRelationDefRewriteContext) { localctx = NewRelationDefRewriteContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 20, OpenFGAParserRULE_relationDefRewrite) + p.EnterRule(localctx, 26, OpenFGAParserRULE_relationDefRewrite) p.EnterOuterAlt(localctx, 1) { - p.SetState(171) + p.SetState(228) var _m = p.Match(OpenFGAParserIDENTIFIER) @@ -2690,13 +3498,13 @@ func (p *OpenFGAParser) RelationDefRewrite() (localctx IRelationDefRewriteContex goto errorExit } } - p.SetState(176) + p.SetState(233) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 34, p.GetParserRuleContext()) == 1 { { - p.SetState(172) + p.SetState(229) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2704,7 +3512,7 @@ func (p *OpenFGAParser) RelationDefRewrite() (localctx IRelationDefRewriteContex } } { - p.SetState(173) + p.SetState(230) p.Match(OpenFGAParserFROM) if p.HasError() { // Recognition error - abort rule @@ -2712,7 +3520,7 @@ func (p *OpenFGAParser) RelationDefRewrite() (localctx IRelationDefRewriteContex } } { - p.SetState(174) + p.SetState(231) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2720,7 +3528,7 @@ func (p *OpenFGAParser) RelationDefRewrite() (localctx IRelationDefRewriteContex } } { - p.SetState(175) + p.SetState(232) var _m = p.Match(OpenFGAParserIDENTIFIER) @@ -2881,11 +3689,11 @@ func (s *RelationDefTypeRestrictionContext) ExitRule(listener antlr.ParseTreeLis func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeRestrictionContext) { localctx = NewRelationDefTypeRestrictionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 22, OpenFGAParserRULE_relationDefTypeRestriction) + p.EnterRule(localctx, 28, OpenFGAParserRULE_relationDefTypeRestriction) var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(179) + p.SetState(236) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2895,7 +3703,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR if _la == OpenFGAParserNEWLINE { { - p.SetState(178) + p.SetState(235) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -2904,27 +3712,27 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR } } - p.SetState(188) + p.SetState(245) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 26, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 36, p.GetParserRuleContext()) { case 1: { - p.SetState(181) + p.SetState(238) p.RelationDefTypeRestrictionBase() } case 2: { - p.SetState(182) + p.SetState(239) p.RelationDefTypeRestrictionBase() } { - p.SetState(183) + p.SetState(240) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2932,7 +3740,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR } } { - p.SetState(184) + p.SetState(241) p.Match(OpenFGAParserKEYWORD_WITH) if p.HasError() { // Recognition error - abort rule @@ -2940,7 +3748,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR } } { - p.SetState(185) + p.SetState(242) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -2948,7 +3756,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR } } { - p.SetState(186) + p.SetState(243) p.ConditionName() } @@ -2956,7 +3764,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR case antlr.ATNInvalidAltNumber: goto errorExit } - p.SetState(191) + p.SetState(248) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -2966,7 +3774,7 @@ func (p *OpenFGAParser) RelationDefTypeRestriction() (localctx IRelationDefTypeR if _la == OpenFGAParserNEWLINE { { - p.SetState(190) + p.SetState(247) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3125,10 +3933,10 @@ func (s *RelationDefTypeRestrictionBaseContext) ExitRule(listener antlr.ParseTre func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefTypeRestrictionBaseContext) { localctx = NewRelationDefTypeRestrictionBaseContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 24, OpenFGAParserRULE_relationDefTypeRestrictionBase) + p.EnterRule(localctx, 30, OpenFGAParserRULE_relationDefTypeRestrictionBase) p.EnterOuterAlt(localctx, 1) { - p.SetState(193) + p.SetState(250) var _m = p.Match(OpenFGAParserIDENTIFIER) @@ -3138,7 +3946,7 @@ func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefT goto errorExit } } - p.SetState(198) + p.SetState(255) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3146,7 +3954,7 @@ func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefT switch p.GetTokenStream().LA(1) { case OpenFGAParserCOLON: { - p.SetState(194) + p.SetState(251) p.Match(OpenFGAParserCOLON) if p.HasError() { // Recognition error - abort rule @@ -3154,7 +3962,7 @@ func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefT } } { - p.SetState(195) + p.SetState(252) var _m = p.Match(OpenFGAParserSTAR) @@ -3169,7 +3977,7 @@ func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefT case OpenFGAParserHASH: { - p.SetState(196) + p.SetState(253) p.Match(OpenFGAParserHASH) if p.HasError() { // Recognition error - abort rule @@ -3177,7 +3985,7 @@ func (p *OpenFGAParser) RelationDefTypeRestrictionBase() (localctx IRelationDefT } } { - p.SetState(197) + p.SetState(254) var _m = p.Match(OpenFGAParserIDENTIFIER) @@ -3327,34 +4135,34 @@ func (s *ConditionsContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) Conditions() (localctx IConditionsContext) { localctx = NewConditionsContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 26, OpenFGAParserRULE_conditions) + p.EnterRule(localctx, 32, OpenFGAParserRULE_conditions) var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(203) + p.SetState(260) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 29, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 39, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { { - p.SetState(200) + p.SetState(257) p.Condition() } } - p.SetState(205) + p.SetState(262) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 29, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 39, p.GetParserRuleContext()) if p.HasError() { goto errorExit } @@ -3596,17 +4404,17 @@ func (s *ConditionContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) Condition() (localctx IConditionContext) { localctx = NewConditionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 28, OpenFGAParserRULE_condition) + p.EnterRule(localctx, 34, OpenFGAParserRULE_condition) var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(208) + p.SetState(265) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 30, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) == 1 { { - p.SetState(206) + p.SetState(263) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3614,7 +4422,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } } { - p.SetState(207) + p.SetState(264) p.MultiLineComment() } @@ -3622,7 +4430,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { goto errorExit } { - p.SetState(210) + p.SetState(267) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3630,7 +4438,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } } { - p.SetState(211) + p.SetState(268) p.Match(OpenFGAParserCONDITION) if p.HasError() { // Recognition error - abort rule @@ -3638,7 +4446,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } } { - p.SetState(212) + p.SetState(269) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3646,10 +4454,10 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } } { - p.SetState(213) + p.SetState(270) p.ConditionName() } - p.SetState(215) + p.SetState(272) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3659,7 +4467,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(214) + p.SetState(271) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3669,14 +4477,14 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(217) + p.SetState(274) p.Match(OpenFGAParserLPAREN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(219) + p.SetState(276) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3686,7 +4494,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(218) + p.SetState(275) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3696,10 +4504,10 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(221) + p.SetState(278) p.ConditionParameter() } - p.SetState(223) + p.SetState(280) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3709,7 +4517,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(222) + p.SetState(279) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3718,7 +4526,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } } - p.SetState(235) + p.SetState(292) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3728,14 +4536,14 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { for _la == OpenFGAParserCOMMA { { - p.SetState(225) + p.SetState(282) p.Match(OpenFGAParserCOMMA) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(227) + p.SetState(284) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3745,7 +4553,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(226) + p.SetState(283) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3755,10 +4563,10 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(229) + p.SetState(286) p.ConditionParameter() } - p.SetState(231) + p.SetState(288) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3768,7 +4576,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(230) + p.SetState(287) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3779,14 +4587,14 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } - p.SetState(237) + p.SetState(294) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(239) + p.SetState(296) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3796,7 +4604,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserNEWLINE { { - p.SetState(238) + p.SetState(295) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3806,14 +4614,14 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(241) + p.SetState(298) p.Match(OpenFGAParserRPAREN) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(243) + p.SetState(300) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3823,7 +4631,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserWHITESPACE { { - p.SetState(242) + p.SetState(299) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3833,20 +4641,20 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(245) + p.SetState(302) p.Match(OpenFGAParserLBRACE) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(247) + p.SetState(304) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 39, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) == 1 { { - p.SetState(246) + p.SetState(303) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3857,13 +4665,13 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } else if p.HasError() { // JIM goto errorExit } - p.SetState(250) + p.SetState(307) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 40, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 50, p.GetParserRuleContext()) == 1 { { - p.SetState(249) + p.SetState(306) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -3875,10 +4683,10 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { goto errorExit } { - p.SetState(252) + p.SetState(309) p.ConditionExpression() } - p.SetState(254) + p.SetState(311) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -3888,7 +4696,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { if _la == OpenFGAParserNEWLINE { { - p.SetState(253) + p.SetState(310) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -3898,7 +4706,7 @@ func (p *OpenFGAParser) Condition() (localctx IConditionContext) { } { - p.SetState(256) + p.SetState(313) p.Match(OpenFGAParserRBRACE) if p.HasError() { // Recognition error - abort rule @@ -3998,10 +4806,10 @@ func (s *ConditionNameContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) ConditionName() (localctx IConditionNameContext) { localctx = NewConditionNameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 30, OpenFGAParserRULE_conditionName) + p.EnterRule(localctx, 36, OpenFGAParserRULE_conditionName) p.EnterOuterAlt(localctx, 1) { - p.SetState(258) + p.SetState(315) p.Match(OpenFGAParserIDENTIFIER) if p.HasError() { // Recognition error - abort rule @@ -4150,11 +4958,11 @@ func (s *ConditionParameterContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContext) { localctx = NewConditionParameterContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 32, OpenFGAParserRULE_conditionParameter) + p.EnterRule(localctx, 38, OpenFGAParserRULE_conditionParameter) var _la int p.EnterOuterAlt(localctx, 1) - p.SetState(261) + p.SetState(318) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4164,7 +4972,7 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex if _la == OpenFGAParserNEWLINE { { - p.SetState(260) + p.SetState(317) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -4174,10 +4982,10 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex } { - p.SetState(263) + p.SetState(320) p.ParameterName() } - p.SetState(265) + p.SetState(322) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4187,7 +4995,7 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex if _la == OpenFGAParserWHITESPACE { { - p.SetState(264) + p.SetState(321) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -4197,14 +5005,14 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex } { - p.SetState(267) + p.SetState(324) p.Match(OpenFGAParserCOLON) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(269) + p.SetState(326) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4214,7 +5022,7 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex if _la == OpenFGAParserWHITESPACE { { - p.SetState(268) + p.SetState(325) p.Match(OpenFGAParserWHITESPACE) if p.HasError() { // Recognition error - abort rule @@ -4224,7 +5032,7 @@ func (p *OpenFGAParser) ConditionParameter() (localctx IConditionParameterContex } { - p.SetState(271) + p.SetState(328) p.ParameterType() } @@ -4320,10 +5128,10 @@ func (s *ParameterNameContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) ParameterName() (localctx IParameterNameContext) { localctx = NewParameterNameContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 34, OpenFGAParserRULE_parameterName) + p.EnterRule(localctx, 40, OpenFGAParserRULE_parameterName) p.EnterOuterAlt(localctx, 1) { - p.SetState(273) + p.SetState(330) p.Match(OpenFGAParserIDENTIFIER) if p.HasError() { // Recognition error - abort rule @@ -4438,8 +5246,8 @@ func (s *ParameterTypeContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { localctx = NewParameterTypeContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 36, OpenFGAParserRULE_parameterType) - p.SetState(280) + p.EnterRule(localctx, 42, OpenFGAParserRULE_parameterType) + p.SetState(337) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4449,7 +5257,7 @@ func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { case OpenFGAParserCONDITION_PARAM_TYPE: p.EnterOuterAlt(localctx, 1) { - p.SetState(275) + p.SetState(332) p.Match(OpenFGAParserCONDITION_PARAM_TYPE) if p.HasError() { // Recognition error - abort rule @@ -4461,7 +5269,7 @@ func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { case OpenFGAParserCONDITION_PARAM_CONTAINER: p.EnterOuterAlt(localctx, 2) { - p.SetState(276) + p.SetState(333) p.Match(OpenFGAParserCONDITION_PARAM_CONTAINER) if p.HasError() { // Recognition error - abort rule @@ -4469,7 +5277,7 @@ func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { } } { - p.SetState(277) + p.SetState(334) p.Match(OpenFGAParserLESS) if p.HasError() { // Recognition error - abort rule @@ -4477,7 +5285,7 @@ func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { } } { - p.SetState(278) + p.SetState(335) p.Match(OpenFGAParserCONDITION_PARAM_TYPE) if p.HasError() { // Recognition error - abort rule @@ -4485,7 +5293,7 @@ func (p *OpenFGAParser) ParameterType() (localctx IParameterTypeContext) { } } { - p.SetState(279) + p.SetState(336) p.Match(OpenFGAParserGREATER) if p.HasError() { // Recognition error - abort rule @@ -4619,19 +5427,19 @@ func (s *MultiLineCommentContext) ExitRule(listener antlr.ParseTreeListener) { func (p *OpenFGAParser) MultiLineComment() (localctx IMultiLineCommentContext) { localctx = NewMultiLineCommentContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 38, OpenFGAParserRULE_multiLineComment) + p.EnterRule(localctx, 44, OpenFGAParserRULE_multiLineComment) var _la int p.EnterOuterAlt(localctx, 1) { - p.SetState(282) + p.SetState(339) p.Match(OpenFGAParserHASH) if p.HasError() { // Recognition error - abort rule goto errorExit } } - p.SetState(286) + p.SetState(343) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit @@ -4641,7 +5449,7 @@ func (p *OpenFGAParser) MultiLineComment() (localctx IMultiLineCommentContext) { for ((int64(_la) & ^0x3f) == 0 && ((int64(1) << _la) & 4503599627370494) != 0) { { - p.SetState(283) + p.SetState(340) _la = p.GetTokenStream().LA(1) if _la <= 0 || _la == OpenFGAParserNEWLINE { @@ -4653,20 +5461,20 @@ func (p *OpenFGAParser) MultiLineComment() (localctx IMultiLineCommentContext) { } - p.SetState(288) + p.SetState(345) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } _la = p.GetTokenStream().LA(1) } - p.SetState(291) + p.SetState(348) p.GetErrorHandler().Sync(p) - if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 47, p.GetParserRuleContext()) == 1 { + if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 57, p.GetParserRuleContext()) == 1 { { - p.SetState(289) + p.SetState(346) p.Match(OpenFGAParserNEWLINE) if p.HasError() { // Recognition error - abort rule @@ -4674,7 +5482,7 @@ func (p *OpenFGAParser) MultiLineComment() (localctx IMultiLineCommentContext) { } } { - p.SetState(290) + p.SetState(347) p.MultiLineComment() } @@ -5119,33 +5927,33 @@ func (s *ConditionExpressionContext) ExitRule(listener antlr.ParseTreeListener) func (p *OpenFGAParser) ConditionExpression() (localctx IConditionExpressionContext) { localctx = NewConditionExpressionContext(p, p.GetParserRuleContext(), p.GetState()) - p.EnterRule(localctx, 40, OpenFGAParserRULE_conditionExpression) + p.EnterRule(localctx, 46, OpenFGAParserRULE_conditionExpression) var _la int var _alt int p.EnterOuterAlt(localctx, 1) - p.SetState(297) + p.SetState(354) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) if p.HasError() { goto errorExit } for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { if _alt == 1 { - p.SetState(295) + p.SetState(352) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 48, p.GetParserRuleContext()) { + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 58, p.GetParserRuleContext()) { case 1: { - p.SetState(293) + p.SetState(350) _la = p.GetTokenStream().LA(1) if !(((int64(_la) & ^0x3f) == 0 && ((int64(1) << _la) & 9007198180737024) != 0)) { @@ -5159,7 +5967,7 @@ func (p *OpenFGAParser) ConditionExpression() (localctx IConditionExpressionCont case 2: { - p.SetState(294) + p.SetState(351) _la = p.GetTokenStream().LA(1) if _la <= 0 || _la == OpenFGAParserRBRACE { @@ -5175,12 +5983,12 @@ func (p *OpenFGAParser) ConditionExpression() (localctx IConditionExpressionCont } } - p.SetState(299) + p.SetState(356) p.GetErrorHandler().Sync(p) if p.HasError() { goto errorExit } - _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 49, p.GetParserRuleContext()) + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 59, p.GetParserRuleContext()) if p.HasError() { goto errorExit } diff --git a/pkg/go/gen/openfgaparser_base_listener.go b/pkg/go/gen/openfgaparser_base_listener.go index fba204ee..e141eb52 100644 --- a/pkg/go/gen/openfgaparser_base_listener.go +++ b/pkg/go/gen/openfgaparser_base_listener.go @@ -63,6 +63,12 @@ func (s *BaseOpenFGAParserListener) EnterRelationDef(ctx *RelationDefContext) {} // ExitRelationDef is called when production relationDef is exited. func (s *BaseOpenFGAParserListener) ExitRelationDef(ctx *RelationDefContext) {} +// EnterRelationDefNoDirect is called when production relationDefNoDirect is entered. +func (s *BaseOpenFGAParserListener) EnterRelationDefNoDirect(ctx *RelationDefNoDirectContext) {} + +// ExitRelationDefNoDirect is called when production relationDefNoDirect is exited. +func (s *BaseOpenFGAParserListener) ExitRelationDefNoDirect(ctx *RelationDefNoDirectContext) {} + // EnterRelationDefPartials is called when production relationDefPartials is entered. func (s *BaseOpenFGAParserListener) EnterRelationDefPartials(ctx *RelationDefPartialsContext) {} @@ -75,6 +81,18 @@ func (s *BaseOpenFGAParserListener) EnterRelationDefGrouping(ctx *RelationDefGro // ExitRelationDefGrouping is called when production relationDefGrouping is exited. func (s *BaseOpenFGAParserListener) ExitRelationDefGrouping(ctx *RelationDefGroupingContext) {} +// EnterRelationRecurse is called when production relationRecurse is entered. +func (s *BaseOpenFGAParserListener) EnterRelationRecurse(ctx *RelationRecurseContext) {} + +// ExitRelationRecurse is called when production relationRecurse is exited. +func (s *BaseOpenFGAParserListener) ExitRelationRecurse(ctx *RelationRecurseContext) {} + +// EnterRelationRecurseNoDirect is called when production relationRecurseNoDirect is entered. +func (s *BaseOpenFGAParserListener) EnterRelationRecurseNoDirect(ctx *RelationRecurseNoDirectContext) {} + +// ExitRelationRecurseNoDirect is called when production relationRecurseNoDirect is exited. +func (s *BaseOpenFGAParserListener) ExitRelationRecurseNoDirect(ctx *RelationRecurseNoDirectContext) {} + // EnterRelationDefDirectAssignment is called when production relationDefDirectAssignment is entered. func (s *BaseOpenFGAParserListener) EnterRelationDefDirectAssignment(ctx *RelationDefDirectAssignmentContext) {} diff --git a/pkg/go/gen/openfgaparser_listener.go b/pkg/go/gen/openfgaparser_listener.go index 2144a62b..db8094cb 100644 --- a/pkg/go/gen/openfgaparser_listener.go +++ b/pkg/go/gen/openfgaparser_listener.go @@ -30,12 +30,21 @@ type OpenFGAParserListener interface { // EnterRelationDef is called when entering the relationDef production. EnterRelationDef(c *RelationDefContext) + // EnterRelationDefNoDirect is called when entering the relationDefNoDirect production. + EnterRelationDefNoDirect(c *RelationDefNoDirectContext) + // EnterRelationDefPartials is called when entering the relationDefPartials production. EnterRelationDefPartials(c *RelationDefPartialsContext) // EnterRelationDefGrouping is called when entering the relationDefGrouping production. EnterRelationDefGrouping(c *RelationDefGroupingContext) + // EnterRelationRecurse is called when entering the relationRecurse production. + EnterRelationRecurse(c *RelationRecurseContext) + + // EnterRelationRecurseNoDirect is called when entering the relationRecurseNoDirect production. + EnterRelationRecurseNoDirect(c *RelationRecurseNoDirectContext) + // EnterRelationDefDirectAssignment is called when entering the relationDefDirectAssignment production. EnterRelationDefDirectAssignment(c *RelationDefDirectAssignmentContext) @@ -93,12 +102,21 @@ type OpenFGAParserListener interface { // ExitRelationDef is called when exiting the relationDef production. ExitRelationDef(c *RelationDefContext) + // ExitRelationDefNoDirect is called when exiting the relationDefNoDirect production. + ExitRelationDefNoDirect(c *RelationDefNoDirectContext) + // ExitRelationDefPartials is called when exiting the relationDefPartials production. ExitRelationDefPartials(c *RelationDefPartialsContext) // ExitRelationDefGrouping is called when exiting the relationDefGrouping production. ExitRelationDefGrouping(c *RelationDefGroupingContext) + // ExitRelationRecurse is called when exiting the relationRecurse production. + ExitRelationRecurse(c *RelationRecurseContext) + + // ExitRelationRecurseNoDirect is called when exiting the relationRecurseNoDirect production. + ExitRelationRecurseNoDirect(c *RelationRecurseNoDirectContext) + // ExitRelationDefDirectAssignment is called when exiting the relationDefDirectAssignment production. ExitRelationDefDirectAssignment(c *RelationDefDirectAssignmentContext) diff --git a/pkg/go/go.mod b/pkg/go/go.mod index 7d336149..d7b5e637 100644 --- a/pkg/go/go.mod +++ b/pkg/go/go.mod @@ -1,11 +1,11 @@ module github.com/openfga/language/pkg/go -go 1.21.4 +go 1.21.5 require ( github.com/antlr4-go/antlr/v4 v4.13.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca + github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73 github.com/stretchr/testify v1.8.4 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 @@ -20,7 +20,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/pkg/go/go.sum b/pkg/go/go.sum index 88552c62..be78f076 100644 --- a/pkg/go/go.sum +++ b/pkg/go/go.sum @@ -22,16 +22,16 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca h1:a6jTXuhaDujhui5CD3bzwJ8gwFAHrHi+gx1XRq0LZWg= -github.com/openfga/api/proto v0.0.0-20231201195548-7ad5c05e75ca/go.mod h1:YSbEQDNGnVlThfExHQ3zDNd+puWXf4zzfL0ms2VbIwI= +github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73 h1:lGEwAl2ixfmDU+BjoOTPcBTgWEcqvKQaz0/eb8dqyoE= +github.com/openfga/api/proto v0.0.0-20231208224251-d2c535d32f73/go.mod h1:YSbEQDNGnVlThfExHQ3zDNd+puWXf4zzfL0ms2VbIwI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= -golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb h1:c0vyKkb6yr3KR7jEfJaOSv4lG7xPkbN6r52aJz1d8a8= +golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= diff --git a/pkg/go/transformer/dsltojson.go b/pkg/go/transformer/dsltojson.go index 88bfdf5f..01bb40be 100644 --- a/pkg/go/transformer/dsltojson.go +++ b/pkg/go/transformer/dsltojson.go @@ -298,7 +298,7 @@ func (l *OpenFgaDslListener) EnterRelationDefPartials(ctx *parser.RelationDefPar l.currentRelation.Operator = RELATION_DEFINITION_OPERATOR_OR } else if len(ctx.AllAND()) > 0 { l.currentRelation.Operator = RELATION_DEFINITION_OPERATOR_AND - } else if len(ctx.AllBUT_NOT()) > 0 { + } else if ctx.BUT_NOT() != nil { l.currentRelation.Operator = RELATION_DEFINITION_OPERATOR_BUT_NOT } } diff --git a/pkg/js/errors.ts b/pkg/js/errors.ts index 9fa1390c..8512e686 100644 --- a/pkg/js/errors.ts +++ b/pkg/js/errors.ts @@ -158,7 +158,7 @@ export class UnsupportedDSLNestingError extends Error { public relationName: string, ) { super( - `the '${relationName}' relation under the '${typeName}' type has mixed operators which are not supported by the OpenFGA DSL syntax yet`, + `the '${relationName}' relation definition under the '${typeName}' type is not supported by the OpenFGA DSL syntax yet`, ); } } diff --git a/pkg/js/gen/OpenFGAParser.interp b/pkg/js/gen/OpenFGAParser.interp index f58e61ad..a7b05788 100644 --- a/pkg/js/gen/OpenFGAParser.interp +++ b/pkg/js/gen/OpenFGAParser.interp @@ -116,8 +116,11 @@ typeDef relationDeclaration relationName relationDef +relationDefNoDirect relationDefPartials relationDefGrouping +relationRecurse +relationRecurseNoDirect relationDefDirectAssignment relationDefRewrite relationDefTypeRestriction @@ -133,4 +136,4 @@ conditionExpression atn: -[4, 1, 52, 301, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 3, 0, 44, 8, 0, 1, 0, 3, 0, 47, 8, 0, 1, 0, 1, 0, 3, 0, 51, 8, 0, 1, 0, 1, 0, 3, 0, 55, 8, 0, 1, 0, 1, 0, 3, 0, 59, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 66, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 74, 8, 1, 1, 2, 5, 2, 77, 8, 2, 10, 2, 12, 2, 80, 9, 2, 1, 3, 1, 3, 3, 3, 84, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 93, 8, 3, 11, 3, 12, 3, 94, 3, 3, 97, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 104, 8, 4, 1, 4, 1, 4, 3, 4, 108, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 116, 8, 6, 1, 6, 3, 6, 119, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 125, 8, 7, 11, 7, 12, 7, 126, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 133, 8, 7, 11, 7, 12, 7, 134, 1, 7, 1, 7, 1, 7, 1, 7, 4, 7, 141, 8, 7, 11, 7, 12, 7, 142, 3, 7, 145, 8, 7, 1, 8, 1, 8, 1, 9, 1, 9, 3, 9, 151, 8, 9, 1, 9, 1, 9, 3, 9, 155, 8, 9, 1, 9, 1, 9, 3, 9, 159, 8, 9, 1, 9, 1, 9, 3, 9, 163, 8, 9, 5, 9, 165, 8, 9, 10, 9, 12, 9, 168, 9, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 11, 3, 11, 180, 8, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 189, 8, 11, 1, 11, 3, 11, 192, 8, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 199, 8, 12, 1, 13, 5, 13, 202, 8, 13, 10, 13, 12, 13, 205, 9, 13, 1, 14, 1, 14, 3, 14, 209, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 216, 8, 14, 1, 14, 1, 14, 3, 14, 220, 8, 14, 1, 14, 1, 14, 3, 14, 224, 8, 14, 1, 14, 1, 14, 3, 14, 228, 8, 14, 1, 14, 1, 14, 3, 14, 232, 8, 14, 5, 14, 234, 8, 14, 10, 14, 12, 14, 237, 9, 14, 1, 14, 3, 14, 240, 8, 14, 1, 14, 1, 14, 3, 14, 244, 8, 14, 1, 14, 1, 14, 3, 14, 248, 8, 14, 1, 14, 3, 14, 251, 8, 14, 1, 14, 1, 14, 3, 14, 255, 8, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 3, 16, 262, 8, 16, 1, 16, 1, 16, 3, 16, 266, 8, 16, 1, 16, 1, 16, 3, 16, 270, 8, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 281, 8, 18, 1, 19, 1, 19, 5, 19, 285, 8, 19, 10, 19, 12, 19, 288, 9, 19, 1, 19, 1, 19, 3, 19, 292, 8, 19, 1, 20, 1, 20, 5, 20, 296, 8, 20, 10, 20, 12, 20, 299, 9, 20, 1, 20, 0, 0, 21, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 0, 3, 1, 0, 52, 52, 2, 0, 18, 29, 31, 52, 1, 0, 30, 30, 331, 0, 43, 1, 0, 0, 0, 2, 65, 1, 0, 0, 0, 4, 78, 1, 0, 0, 0, 6, 83, 1, 0, 0, 0, 8, 98, 1, 0, 0, 0, 10, 111, 1, 0, 0, 0, 12, 115, 1, 0, 0, 0, 14, 144, 1, 0, 0, 0, 16, 146, 1, 0, 0, 0, 18, 148, 1, 0, 0, 0, 20, 171, 1, 0, 0, 0, 22, 179, 1, 0, 0, 0, 24, 193, 1, 0, 0, 0, 26, 203, 1, 0, 0, 0, 28, 208, 1, 0, 0, 0, 30, 258, 1, 0, 0, 0, 32, 261, 1, 0, 0, 0, 34, 273, 1, 0, 0, 0, 36, 280, 1, 0, 0, 0, 38, 282, 1, 0, 0, 0, 40, 297, 1, 0, 0, 0, 42, 44, 5, 44, 0, 0, 43, 42, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 46, 1, 0, 0, 0, 45, 47, 5, 52, 0, 0, 46, 45, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 2, 1, 0, 49, 51, 5, 52, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 54, 3, 4, 2, 0, 53, 55, 5, 52, 0, 0, 54, 53, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 1, 0, 0, 0, 56, 58, 3, 26, 13, 0, 57, 59, 5, 52, 0, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 61, 5, 0, 0, 1, 61, 1, 1, 0, 0, 0, 62, 63, 3, 38, 19, 0, 63, 64, 5, 52, 0, 0, 64, 66, 1, 0, 0, 0, 65, 62, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 68, 5, 10, 0, 0, 68, 69, 5, 52, 0, 0, 69, 70, 5, 11, 0, 0, 70, 71, 5, 44, 0, 0, 71, 73, 5, 12, 0, 0, 72, 74, 5, 44, 0, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 3, 1, 0, 0, 0, 75, 77, 3, 6, 3, 0, 76, 75, 1, 0, 0, 0, 77, 80, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 5, 1, 0, 0, 0, 80, 78, 1, 0, 0, 0, 81, 82, 5, 52, 0, 0, 82, 84, 3, 38, 19, 0, 83, 81, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 86, 5, 52, 0, 0, 86, 87, 5, 13, 0, 0, 87, 88, 5, 44, 0, 0, 88, 96, 5, 51, 0, 0, 89, 90, 5, 52, 0, 0, 90, 92, 5, 15, 0, 0, 91, 93, 3, 8, 4, 0, 92, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 92, 1, 0, 0, 0, 94, 95, 1, 0, 0, 0, 95, 97, 1, 0, 0, 0, 96, 89, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 7, 1, 0, 0, 0, 98, 99, 5, 52, 0, 0, 99, 100, 5, 16, 0, 0, 100, 101, 5, 44, 0, 0, 101, 103, 3, 10, 5, 0, 102, 104, 5, 44, 0, 0, 103, 102, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 1, 0, 0, 0, 105, 107, 5, 2, 0, 0, 106, 108, 5, 44, 0, 0, 107, 106, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 110, 3, 12, 6, 0, 110, 9, 1, 0, 0, 0, 111, 112, 5, 51, 0, 0, 112, 11, 1, 0, 0, 0, 113, 116, 3, 18, 9, 0, 114, 116, 3, 16, 8, 0, 115, 113, 1, 0, 0, 0, 115, 114, 1, 0, 0, 0, 116, 118, 1, 0, 0, 0, 117, 119, 3, 14, 7, 0, 118, 117, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, 13, 1, 0, 0, 0, 120, 121, 5, 44, 0, 0, 121, 122, 5, 7, 0, 0, 122, 123, 5, 44, 0, 0, 123, 125, 3, 16, 8, 0, 124, 120, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 145, 1, 0, 0, 0, 128, 129, 5, 44, 0, 0, 129, 130, 5, 6, 0, 0, 130, 131, 5, 44, 0, 0, 131, 133, 3, 16, 8, 0, 132, 128, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 134, 135, 1, 0, 0, 0, 135, 145, 1, 0, 0, 0, 136, 137, 5, 44, 0, 0, 137, 138, 5, 8, 0, 0, 138, 139, 5, 44, 0, 0, 139, 141, 3, 16, 8, 0, 140, 136, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 140, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 145, 1, 0, 0, 0, 144, 124, 1, 0, 0, 0, 144, 132, 1, 0, 0, 0, 144, 140, 1, 0, 0, 0, 145, 15, 1, 0, 0, 0, 146, 147, 3, 20, 10, 0, 147, 17, 1, 0, 0, 0, 148, 150, 5, 27, 0, 0, 149, 151, 5, 44, 0, 0, 150, 149, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 154, 3, 22, 11, 0, 153, 155, 5, 44, 0, 0, 154, 153, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 166, 1, 0, 0, 0, 156, 158, 5, 3, 0, 0, 157, 159, 5, 44, 0, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 3, 22, 11, 0, 161, 163, 5, 44, 0, 0, 162, 161, 1, 0, 0, 0, 162, 163, 1, 0, 0, 0, 163, 165, 1, 0, 0, 0, 164, 156, 1, 0, 0, 0, 165, 168, 1, 0, 0, 0, 166, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 169, 1, 0, 0, 0, 168, 166, 1, 0, 0, 0, 169, 170, 5, 28, 0, 0, 170, 19, 1, 0, 0, 0, 171, 176, 5, 51, 0, 0, 172, 173, 5, 44, 0, 0, 173, 174, 5, 9, 0, 0, 174, 175, 5, 44, 0, 0, 175, 177, 5, 51, 0, 0, 176, 172, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 21, 1, 0, 0, 0, 178, 180, 5, 52, 0, 0, 179, 178, 1, 0, 0, 0, 179, 180, 1, 0, 0, 0, 180, 188, 1, 0, 0, 0, 181, 189, 3, 24, 12, 0, 182, 183, 3, 24, 12, 0, 183, 184, 5, 44, 0, 0, 184, 185, 5, 17, 0, 0, 185, 186, 5, 44, 0, 0, 186, 187, 3, 30, 15, 0, 187, 189, 1, 0, 0, 0, 188, 181, 1, 0, 0, 0, 188, 182, 1, 0, 0, 0, 189, 191, 1, 0, 0, 0, 190, 192, 5, 52, 0, 0, 191, 190, 1, 0, 0, 0, 191, 192, 1, 0, 0, 0, 192, 23, 1, 0, 0, 0, 193, 198, 5, 51, 0, 0, 194, 195, 5, 2, 0, 0, 195, 199, 5, 38, 0, 0, 196, 197, 5, 1, 0, 0, 197, 199, 5, 51, 0, 0, 198, 194, 1, 0, 0, 0, 198, 196, 1, 0, 0, 0, 198, 199, 1, 0, 0, 0, 199, 25, 1, 0, 0, 0, 200, 202, 3, 28, 14, 0, 201, 200, 1, 0, 0, 0, 202, 205, 1, 0, 0, 0, 203, 201, 1, 0, 0, 0, 203, 204, 1, 0, 0, 0, 204, 27, 1, 0, 0, 0, 205, 203, 1, 0, 0, 0, 206, 207, 5, 52, 0, 0, 207, 209, 3, 38, 19, 0, 208, 206, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 210, 1, 0, 0, 0, 210, 211, 5, 52, 0, 0, 211, 212, 5, 14, 0, 0, 212, 213, 5, 44, 0, 0, 213, 215, 3, 30, 15, 0, 214, 216, 5, 44, 0, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 5, 31, 0, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 221, 1, 0, 0, 0, 221, 223, 3, 32, 16, 0, 222, 224, 5, 44, 0, 0, 223, 222, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 235, 1, 0, 0, 0, 225, 227, 5, 3, 0, 0, 226, 228, 5, 44, 0, 0, 227, 226, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 231, 3, 32, 16, 0, 230, 232, 5, 44, 0, 0, 231, 230, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, 232, 234, 1, 0, 0, 0, 233, 225, 1, 0, 0, 0, 234, 237, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 239, 1, 0, 0, 0, 237, 235, 1, 0, 0, 0, 238, 240, 5, 52, 0, 0, 239, 238, 1, 0, 0, 0, 239, 240, 1, 0, 0, 0, 240, 241, 1, 0, 0, 0, 241, 243, 5, 32, 0, 0, 242, 244, 5, 44, 0, 0, 243, 242, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 245, 1, 0, 0, 0, 245, 247, 5, 29, 0, 0, 246, 248, 5, 52, 0, 0, 247, 246, 1, 0, 0, 0, 247, 248, 1, 0, 0, 0, 248, 250, 1, 0, 0, 0, 249, 251, 5, 44, 0, 0, 250, 249, 1, 0, 0, 0, 250, 251, 1, 0, 0, 0, 251, 252, 1, 0, 0, 0, 252, 254, 3, 40, 20, 0, 253, 255, 5, 52, 0, 0, 254, 253, 1, 0, 0, 0, 254, 255, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 257, 5, 30, 0, 0, 257, 29, 1, 0, 0, 0, 258, 259, 5, 51, 0, 0, 259, 31, 1, 0, 0, 0, 260, 262, 5, 52, 0, 0, 261, 260, 1, 0, 0, 0, 261, 262, 1, 0, 0, 0, 262, 263, 1, 0, 0, 0, 263, 265, 3, 34, 17, 0, 264, 266, 5, 44, 0, 0, 265, 264, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 269, 5, 2, 0, 0, 268, 270, 5, 44, 0, 0, 269, 268, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 272, 3, 36, 18, 0, 272, 33, 1, 0, 0, 0, 273, 274, 5, 51, 0, 0, 274, 35, 1, 0, 0, 0, 275, 281, 5, 5, 0, 0, 276, 277, 5, 4, 0, 0, 277, 278, 5, 21, 0, 0, 278, 279, 5, 5, 0, 0, 279, 281, 5, 24, 0, 0, 280, 275, 1, 0, 0, 0, 280, 276, 1, 0, 0, 0, 281, 37, 1, 0, 0, 0, 282, 286, 5, 1, 0, 0, 283, 285, 8, 0, 0, 0, 284, 283, 1, 0, 0, 0, 285, 288, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 287, 1, 0, 0, 0, 287, 291, 1, 0, 0, 0, 288, 286, 1, 0, 0, 0, 289, 290, 5, 52, 0, 0, 290, 292, 3, 38, 19, 0, 291, 289, 1, 0, 0, 0, 291, 292, 1, 0, 0, 0, 292, 39, 1, 0, 0, 0, 293, 296, 7, 1, 0, 0, 294, 296, 8, 2, 0, 0, 295, 293, 1, 0, 0, 0, 295, 294, 1, 0, 0, 0, 296, 299, 1, 0, 0, 0, 297, 295, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 41, 1, 0, 0, 0, 299, 297, 1, 0, 0, 0, 50, 43, 46, 50, 54, 58, 65, 73, 78, 83, 94, 96, 103, 107, 115, 118, 126, 134, 142, 144, 150, 154, 158, 162, 166, 176, 179, 188, 191, 198, 203, 208, 215, 219, 223, 227, 231, 235, 239, 243, 247, 250, 254, 261, 265, 269, 280, 286, 291, 295, 297] \ No newline at end of file +[4, 1, 52, 358, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 1, 0, 3, 0, 50, 8, 0, 1, 0, 3, 0, 53, 8, 0, 1, 0, 1, 0, 3, 0, 57, 8, 0, 1, 0, 1, 0, 3, 0, 61, 8, 0, 1, 0, 1, 0, 3, 0, 65, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 72, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 80, 8, 1, 1, 2, 5, 2, 83, 8, 2, 10, 2, 12, 2, 86, 9, 2, 1, 3, 1, 3, 3, 3, 90, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 99, 8, 3, 11, 3, 12, 3, 100, 3, 3, 103, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 110, 8, 4, 1, 4, 1, 4, 3, 4, 114, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 3, 6, 123, 8, 6, 1, 6, 3, 6, 126, 8, 6, 1, 7, 1, 7, 3, 7, 130, 8, 7, 1, 7, 3, 7, 133, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 140, 8, 8, 4, 8, 142, 8, 8, 11, 8, 12, 8, 143, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 4, 8, 153, 8, 8, 11, 8, 12, 8, 154, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 162, 8, 8, 3, 8, 164, 8, 8, 1, 9, 1, 9, 1, 10, 1, 10, 5, 10, 170, 8, 10, 10, 10, 12, 10, 173, 9, 10, 1, 10, 1, 10, 3, 10, 177, 8, 10, 1, 10, 5, 10, 180, 8, 10, 10, 10, 12, 10, 183, 9, 10, 1, 10, 1, 10, 1, 11, 1, 11, 5, 11, 189, 8, 11, 10, 11, 12, 11, 192, 9, 11, 1, 11, 1, 11, 3, 11, 196, 8, 11, 1, 11, 5, 11, 199, 8, 11, 10, 11, 12, 11, 202, 9, 11, 1, 11, 1, 11, 1, 12, 1, 12, 3, 12, 208, 8, 12, 1, 12, 1, 12, 3, 12, 212, 8, 12, 1, 12, 1, 12, 3, 12, 216, 8, 12, 1, 12, 1, 12, 3, 12, 220, 8, 12, 5, 12, 222, 8, 12, 10, 12, 12, 12, 225, 9, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 234, 8, 13, 1, 14, 3, 14, 237, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 246, 8, 14, 1, 14, 3, 14, 249, 8, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 256, 8, 15, 1, 16, 5, 16, 259, 8, 16, 10, 16, 12, 16, 262, 9, 16, 1, 17, 1, 17, 3, 17, 266, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 273, 8, 17, 1, 17, 1, 17, 3, 17, 277, 8, 17, 1, 17, 1, 17, 3, 17, 281, 8, 17, 1, 17, 1, 17, 3, 17, 285, 8, 17, 1, 17, 1, 17, 3, 17, 289, 8, 17, 5, 17, 291, 8, 17, 10, 17, 12, 17, 294, 9, 17, 1, 17, 3, 17, 297, 8, 17, 1, 17, 1, 17, 3, 17, 301, 8, 17, 1, 17, 1, 17, 3, 17, 305, 8, 17, 1, 17, 3, 17, 308, 8, 17, 1, 17, 1, 17, 3, 17, 312, 8, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 3, 19, 319, 8, 19, 1, 19, 1, 19, 3, 19, 323, 8, 19, 1, 19, 1, 19, 3, 19, 327, 8, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 338, 8, 21, 1, 22, 1, 22, 5, 22, 342, 8, 22, 10, 22, 12, 22, 345, 9, 22, 1, 22, 1, 22, 3, 22, 349, 8, 22, 1, 23, 1, 23, 5, 23, 353, 8, 23, 10, 23, 12, 23, 356, 9, 23, 1, 23, 0, 0, 24, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 0, 3, 1, 0, 52, 52, 2, 0, 18, 29, 31, 52, 1, 0, 30, 30, 396, 0, 49, 1, 0, 0, 0, 2, 71, 1, 0, 0, 0, 4, 84, 1, 0, 0, 0, 6, 89, 1, 0, 0, 0, 8, 104, 1, 0, 0, 0, 10, 117, 1, 0, 0, 0, 12, 122, 1, 0, 0, 0, 14, 129, 1, 0, 0, 0, 16, 163, 1, 0, 0, 0, 18, 165, 1, 0, 0, 0, 20, 167, 1, 0, 0, 0, 22, 186, 1, 0, 0, 0, 24, 205, 1, 0, 0, 0, 26, 228, 1, 0, 0, 0, 28, 236, 1, 0, 0, 0, 30, 250, 1, 0, 0, 0, 32, 260, 1, 0, 0, 0, 34, 265, 1, 0, 0, 0, 36, 315, 1, 0, 0, 0, 38, 318, 1, 0, 0, 0, 40, 330, 1, 0, 0, 0, 42, 337, 1, 0, 0, 0, 44, 339, 1, 0, 0, 0, 46, 354, 1, 0, 0, 0, 48, 50, 5, 44, 0, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, 1, 0, 0, 0, 51, 53, 5, 52, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 56, 3, 2, 1, 0, 55, 57, 5, 52, 0, 0, 56, 55, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 60, 3, 4, 2, 0, 59, 61, 5, 52, 0, 0, 60, 59, 1, 0, 0, 0, 60, 61, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 64, 3, 32, 16, 0, 63, 65, 5, 52, 0, 0, 64, 63, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 67, 5, 0, 0, 1, 67, 1, 1, 0, 0, 0, 68, 69, 3, 44, 22, 0, 69, 70, 5, 52, 0, 0, 70, 72, 1, 0, 0, 0, 71, 68, 1, 0, 0, 0, 71, 72, 1, 0, 0, 0, 72, 73, 1, 0, 0, 0, 73, 74, 5, 10, 0, 0, 74, 75, 5, 52, 0, 0, 75, 76, 5, 11, 0, 0, 76, 77, 5, 44, 0, 0, 77, 79, 5, 12, 0, 0, 78, 80, 5, 44, 0, 0, 79, 78, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 3, 1, 0, 0, 0, 81, 83, 3, 6, 3, 0, 82, 81, 1, 0, 0, 0, 83, 86, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 5, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 87, 88, 5, 52, 0, 0, 88, 90, 3, 44, 22, 0, 89, 87, 1, 0, 0, 0, 89, 90, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 92, 5, 52, 0, 0, 92, 93, 5, 13, 0, 0, 93, 94, 5, 44, 0, 0, 94, 102, 5, 51, 0, 0, 95, 96, 5, 52, 0, 0, 96, 98, 5, 15, 0, 0, 97, 99, 3, 8, 4, 0, 98, 97, 1, 0, 0, 0, 99, 100, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 103, 1, 0, 0, 0, 102, 95, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 7, 1, 0, 0, 0, 104, 105, 5, 52, 0, 0, 105, 106, 5, 16, 0, 0, 106, 107, 5, 44, 0, 0, 107, 109, 3, 10, 5, 0, 108, 110, 5, 44, 0, 0, 109, 108, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 113, 5, 2, 0, 0, 112, 114, 5, 44, 0, 0, 113, 112, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 3, 12, 6, 0, 116, 9, 1, 0, 0, 0, 117, 118, 5, 51, 0, 0, 118, 11, 1, 0, 0, 0, 119, 123, 3, 24, 12, 0, 120, 123, 3, 18, 9, 0, 121, 123, 3, 20, 10, 0, 122, 119, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 121, 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 126, 3, 16, 8, 0, 125, 124, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 13, 1, 0, 0, 0, 127, 130, 3, 18, 9, 0, 128, 130, 3, 22, 11, 0, 129, 127, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, 132, 1, 0, 0, 0, 131, 133, 3, 16, 8, 0, 132, 131, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 15, 1, 0, 0, 0, 134, 135, 5, 44, 0, 0, 135, 136, 5, 7, 0, 0, 136, 139, 5, 44, 0, 0, 137, 140, 3, 18, 9, 0, 138, 140, 3, 22, 11, 0, 139, 137, 1, 0, 0, 0, 139, 138, 1, 0, 0, 0, 140, 142, 1, 0, 0, 0, 141, 134, 1, 0, 0, 0, 142, 143, 1, 0, 0, 0, 143, 141, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 164, 1, 0, 0, 0, 145, 146, 5, 44, 0, 0, 146, 147, 5, 6, 0, 0, 147, 150, 5, 44, 0, 0, 148, 151, 3, 18, 9, 0, 149, 151, 3, 22, 11, 0, 150, 148, 1, 0, 0, 0, 150, 149, 1, 0, 0, 0, 151, 153, 1, 0, 0, 0, 152, 145, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 164, 1, 0, 0, 0, 156, 157, 5, 44, 0, 0, 157, 158, 5, 8, 0, 0, 158, 161, 5, 44, 0, 0, 159, 162, 3, 18, 9, 0, 160, 162, 3, 22, 11, 0, 161, 159, 1, 0, 0, 0, 161, 160, 1, 0, 0, 0, 162, 164, 1, 0, 0, 0, 163, 141, 1, 0, 0, 0, 163, 152, 1, 0, 0, 0, 163, 156, 1, 0, 0, 0, 164, 17, 1, 0, 0, 0, 165, 166, 3, 26, 13, 0, 166, 19, 1, 0, 0, 0, 167, 171, 5, 31, 0, 0, 168, 170, 5, 44, 0, 0, 169, 168, 1, 0, 0, 0, 170, 173, 1, 0, 0, 0, 171, 169, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 176, 1, 0, 0, 0, 173, 171, 1, 0, 0, 0, 174, 177, 3, 12, 6, 0, 175, 177, 3, 22, 11, 0, 176, 174, 1, 0, 0, 0, 176, 175, 1, 0, 0, 0, 177, 181, 1, 0, 0, 0, 178, 180, 5, 44, 0, 0, 179, 178, 1, 0, 0, 0, 180, 183, 1, 0, 0, 0, 181, 179, 1, 0, 0, 0, 181, 182, 1, 0, 0, 0, 182, 184, 1, 0, 0, 0, 183, 181, 1, 0, 0, 0, 184, 185, 5, 32, 0, 0, 185, 21, 1, 0, 0, 0, 186, 190, 5, 31, 0, 0, 187, 189, 5, 44, 0, 0, 188, 187, 1, 0, 0, 0, 189, 192, 1, 0, 0, 0, 190, 188, 1, 0, 0, 0, 190, 191, 1, 0, 0, 0, 191, 195, 1, 0, 0, 0, 192, 190, 1, 0, 0, 0, 193, 196, 3, 14, 7, 0, 194, 196, 3, 22, 11, 0, 195, 193, 1, 0, 0, 0, 195, 194, 1, 0, 0, 0, 196, 200, 1, 0, 0, 0, 197, 199, 5, 44, 0, 0, 198, 197, 1, 0, 0, 0, 199, 202, 1, 0, 0, 0, 200, 198, 1, 0, 0, 0, 200, 201, 1, 0, 0, 0, 201, 203, 1, 0, 0, 0, 202, 200, 1, 0, 0, 0, 203, 204, 5, 32, 0, 0, 204, 23, 1, 0, 0, 0, 205, 207, 5, 27, 0, 0, 206, 208, 5, 44, 0, 0, 207, 206, 1, 0, 0, 0, 207, 208, 1, 0, 0, 0, 208, 209, 1, 0, 0, 0, 209, 211, 3, 28, 14, 0, 210, 212, 5, 44, 0, 0, 211, 210, 1, 0, 0, 0, 211, 212, 1, 0, 0, 0, 212, 223, 1, 0, 0, 0, 213, 215, 5, 3, 0, 0, 214, 216, 5, 44, 0, 0, 215, 214, 1, 0, 0, 0, 215, 216, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 3, 28, 14, 0, 218, 220, 5, 44, 0, 0, 219, 218, 1, 0, 0, 0, 219, 220, 1, 0, 0, 0, 220, 222, 1, 0, 0, 0, 221, 213, 1, 0, 0, 0, 222, 225, 1, 0, 0, 0, 223, 221, 1, 0, 0, 0, 223, 224, 1, 0, 0, 0, 224, 226, 1, 0, 0, 0, 225, 223, 1, 0, 0, 0, 226, 227, 5, 28, 0, 0, 227, 25, 1, 0, 0, 0, 228, 233, 5, 51, 0, 0, 229, 230, 5, 44, 0, 0, 230, 231, 5, 9, 0, 0, 231, 232, 5, 44, 0, 0, 232, 234, 5, 51, 0, 0, 233, 229, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 27, 1, 0, 0, 0, 235, 237, 5, 52, 0, 0, 236, 235, 1, 0, 0, 0, 236, 237, 1, 0, 0, 0, 237, 245, 1, 0, 0, 0, 238, 246, 3, 30, 15, 0, 239, 240, 3, 30, 15, 0, 240, 241, 5, 44, 0, 0, 241, 242, 5, 17, 0, 0, 242, 243, 5, 44, 0, 0, 243, 244, 3, 36, 18, 0, 244, 246, 1, 0, 0, 0, 245, 238, 1, 0, 0, 0, 245, 239, 1, 0, 0, 0, 246, 248, 1, 0, 0, 0, 247, 249, 5, 52, 0, 0, 248, 247, 1, 0, 0, 0, 248, 249, 1, 0, 0, 0, 249, 29, 1, 0, 0, 0, 250, 255, 5, 51, 0, 0, 251, 252, 5, 2, 0, 0, 252, 256, 5, 38, 0, 0, 253, 254, 5, 1, 0, 0, 254, 256, 5, 51, 0, 0, 255, 251, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 255, 256, 1, 0, 0, 0, 256, 31, 1, 0, 0, 0, 257, 259, 3, 34, 17, 0, 258, 257, 1, 0, 0, 0, 259, 262, 1, 0, 0, 0, 260, 258, 1, 0, 0, 0, 260, 261, 1, 0, 0, 0, 261, 33, 1, 0, 0, 0, 262, 260, 1, 0, 0, 0, 263, 264, 5, 52, 0, 0, 264, 266, 3, 44, 22, 0, 265, 263, 1, 0, 0, 0, 265, 266, 1, 0, 0, 0, 266, 267, 1, 0, 0, 0, 267, 268, 5, 52, 0, 0, 268, 269, 5, 14, 0, 0, 269, 270, 5, 44, 0, 0, 270, 272, 3, 36, 18, 0, 271, 273, 5, 44, 0, 0, 272, 271, 1, 0, 0, 0, 272, 273, 1, 0, 0, 0, 273, 274, 1, 0, 0, 0, 274, 276, 5, 31, 0, 0, 275, 277, 5, 44, 0, 0, 276, 275, 1, 0, 0, 0, 276, 277, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 280, 3, 38, 19, 0, 279, 281, 5, 44, 0, 0, 280, 279, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, 281, 292, 1, 0, 0, 0, 282, 284, 5, 3, 0, 0, 283, 285, 5, 44, 0, 0, 284, 283, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 286, 1, 0, 0, 0, 286, 288, 3, 38, 19, 0, 287, 289, 5, 44, 0, 0, 288, 287, 1, 0, 0, 0, 288, 289, 1, 0, 0, 0, 289, 291, 1, 0, 0, 0, 290, 282, 1, 0, 0, 0, 291, 294, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 296, 1, 0, 0, 0, 294, 292, 1, 0, 0, 0, 295, 297, 5, 52, 0, 0, 296, 295, 1, 0, 0, 0, 296, 297, 1, 0, 0, 0, 297, 298, 1, 0, 0, 0, 298, 300, 5, 32, 0, 0, 299, 301, 5, 44, 0, 0, 300, 299, 1, 0, 0, 0, 300, 301, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 5, 29, 0, 0, 303, 305, 5, 52, 0, 0, 304, 303, 1, 0, 0, 0, 304, 305, 1, 0, 0, 0, 305, 307, 1, 0, 0, 0, 306, 308, 5, 44, 0, 0, 307, 306, 1, 0, 0, 0, 307, 308, 1, 0, 0, 0, 308, 309, 1, 0, 0, 0, 309, 311, 3, 46, 23, 0, 310, 312, 5, 52, 0, 0, 311, 310, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 313, 1, 0, 0, 0, 313, 314, 5, 30, 0, 0, 314, 35, 1, 0, 0, 0, 315, 316, 5, 51, 0, 0, 316, 37, 1, 0, 0, 0, 317, 319, 5, 52, 0, 0, 318, 317, 1, 0, 0, 0, 318, 319, 1, 0, 0, 0, 319, 320, 1, 0, 0, 0, 320, 322, 3, 40, 20, 0, 321, 323, 5, 44, 0, 0, 322, 321, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 324, 1, 0, 0, 0, 324, 326, 5, 2, 0, 0, 325, 327, 5, 44, 0, 0, 326, 325, 1, 0, 0, 0, 326, 327, 1, 0, 0, 0, 327, 328, 1, 0, 0, 0, 328, 329, 3, 42, 21, 0, 329, 39, 1, 0, 0, 0, 330, 331, 5, 51, 0, 0, 331, 41, 1, 0, 0, 0, 332, 338, 5, 5, 0, 0, 333, 334, 5, 4, 0, 0, 334, 335, 5, 21, 0, 0, 335, 336, 5, 5, 0, 0, 336, 338, 5, 24, 0, 0, 337, 332, 1, 0, 0, 0, 337, 333, 1, 0, 0, 0, 338, 43, 1, 0, 0, 0, 339, 343, 5, 1, 0, 0, 340, 342, 8, 0, 0, 0, 341, 340, 1, 0, 0, 0, 342, 345, 1, 0, 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 348, 1, 0, 0, 0, 345, 343, 1, 0, 0, 0, 346, 347, 5, 52, 0, 0, 347, 349, 3, 44, 22, 0, 348, 346, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, 45, 1, 0, 0, 0, 350, 353, 7, 1, 0, 0, 351, 353, 8, 2, 0, 0, 352, 350, 1, 0, 0, 0, 352, 351, 1, 0, 0, 0, 353, 356, 1, 0, 0, 0, 354, 352, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 47, 1, 0, 0, 0, 356, 354, 1, 0, 0, 0, 60, 49, 52, 56, 60, 64, 71, 79, 84, 89, 100, 102, 109, 113, 122, 125, 129, 132, 139, 143, 150, 154, 161, 163, 171, 176, 181, 190, 195, 200, 207, 211, 215, 219, 223, 233, 236, 245, 248, 255, 260, 265, 272, 276, 280, 284, 288, 292, 296, 300, 304, 307, 311, 318, 322, 326, 337, 343, 348, 352, 354] \ No newline at end of file diff --git a/pkg/js/gen/OpenFGAParser.ts b/pkg/js/gen/OpenFGAParser.ts index e88be7d8..72e61bd8 100644 --- a/pkg/js/gen/OpenFGAParser.ts +++ b/pkg/js/gen/OpenFGAParser.ts @@ -77,20 +77,23 @@ export default class OpenFGAParser extends Parser { public static readonly RULE_relationDeclaration = 4; public static readonly RULE_relationName = 5; public static readonly RULE_relationDef = 6; - public static readonly RULE_relationDefPartials = 7; - public static readonly RULE_relationDefGrouping = 8; - public static readonly RULE_relationDefDirectAssignment = 9; - public static readonly RULE_relationDefRewrite = 10; - public static readonly RULE_relationDefTypeRestriction = 11; - public static readonly RULE_relationDefTypeRestrictionBase = 12; - public static readonly RULE_conditions = 13; - public static readonly RULE_condition = 14; - public static readonly RULE_conditionName = 15; - public static readonly RULE_conditionParameter = 16; - public static readonly RULE_parameterName = 17; - public static readonly RULE_parameterType = 18; - public static readonly RULE_multiLineComment = 19; - public static readonly RULE_conditionExpression = 20; + public static readonly RULE_relationDefNoDirect = 7; + public static readonly RULE_relationDefPartials = 8; + public static readonly RULE_relationDefGrouping = 9; + public static readonly RULE_relationRecurse = 10; + public static readonly RULE_relationRecurseNoDirect = 11; + public static readonly RULE_relationDefDirectAssignment = 12; + public static readonly RULE_relationDefRewrite = 13; + public static readonly RULE_relationDefTypeRestriction = 14; + public static readonly RULE_relationDefTypeRestrictionBase = 15; + public static readonly RULE_conditions = 16; + public static readonly RULE_condition = 17; + public static readonly RULE_conditionName = 18; + public static readonly RULE_conditionParameter = 19; + public static readonly RULE_parameterName = 20; + public static readonly RULE_parameterType = 21; + public static readonly RULE_multiLineComment = 22; + public static readonly RULE_conditionExpression = 23; public static readonly literalNames: (string | null)[] = [ null, "'#'", "':'", "','", null, null, @@ -155,7 +158,8 @@ export default class OpenFGAParser extends Parser { // tslint:disable:no-trailing-whitespace public static readonly ruleNames: string[] = [ "main", "modelHeader", "typeDefs", "typeDef", "relationDeclaration", "relationName", - "relationDef", "relationDefPartials", "relationDefGrouping", "relationDefDirectAssignment", + "relationDef", "relationDefNoDirect", "relationDefPartials", "relationDefGrouping", + "relationRecurse", "relationRecurseNoDirect", "relationDefDirectAssignment", "relationDefRewrite", "relationDefTypeRestriction", "relationDefTypeRestrictionBase", "conditions", "condition", "conditionName", "conditionParameter", "parameterName", "parameterType", "multiLineComment", "conditionExpression", @@ -182,63 +186,63 @@ export default class OpenFGAParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 43; + this.state = 49; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 42; + this.state = 48; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 46; + this.state = 52; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 45; + this.state = 51; this.match(OpenFGAParser.NEWLINE); } } - this.state = 48; + this.state = 54; this.modelHeader(); - this.state = 50; + this.state = 56; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 2, this._ctx) ) { case 1: { - this.state = 49; + this.state = 55; this.match(OpenFGAParser.NEWLINE); } break; } - this.state = 52; + this.state = 58; this.typeDefs(); - this.state = 54; + this.state = 60; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 3, this._ctx) ) { case 1: { - this.state = 53; + this.state = 59; this.match(OpenFGAParser.NEWLINE); } break; } - this.state = 56; + this.state = 62; this.conditions(); - this.state = 58; + this.state = 64; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 57; + this.state = 63; this.match(OpenFGAParser.NEWLINE); } } - this.state = 60; + this.state = 66; this.match(OpenFGAParser.EOF); } } @@ -264,34 +268,34 @@ export default class OpenFGAParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 65; + this.state = 71; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===1) { { - this.state = 62; + this.state = 68; this.multiLineComment(); - this.state = 63; + this.state = 69; this.match(OpenFGAParser.NEWLINE); } } - this.state = 67; + this.state = 73; this.match(OpenFGAParser.MODEL); - this.state = 68; + this.state = 74; this.match(OpenFGAParser.NEWLINE); - this.state = 69; + this.state = 75; this.match(OpenFGAParser.SCHEMA); - this.state = 70; + this.state = 76; this.match(OpenFGAParser.WHITESPACE); - this.state = 71; + this.state = 77; localctx._schemaVersion = this.match(OpenFGAParser.SCHEMA_VERSION); - this.state = 73; + this.state = 79; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 72; + this.state = 78; this.match(OpenFGAParser.WHITESPACE); } } @@ -320,19 +324,19 @@ export default class OpenFGAParser extends Parser { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 78; + this.state = 84; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 7, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 75; + this.state = 81; this.typeDef(); } } } - this.state = 80; + this.state = 86; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 7, this._ctx); } @@ -360,36 +364,36 @@ export default class OpenFGAParser extends Parser { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 83; + this.state = 89; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 8, this._ctx) ) { case 1: { - this.state = 81; + this.state = 87; this.match(OpenFGAParser.NEWLINE); - this.state = 82; + this.state = 88; this.multiLineComment(); } break; } - this.state = 85; + this.state = 91; this.match(OpenFGAParser.NEWLINE); - this.state = 86; + this.state = 92; this.match(OpenFGAParser.TYPE); - this.state = 87; + this.state = 93; this.match(OpenFGAParser.WHITESPACE); - this.state = 88; + this.state = 94; localctx._typeName = this.match(OpenFGAParser.IDENTIFIER); - this.state = 96; + this.state = 102; this._errHandler.sync(this); switch ( this._interp.adaptivePredict(this._input, 10, this._ctx) ) { case 1: { - this.state = 89; + this.state = 95; this.match(OpenFGAParser.NEWLINE); - this.state = 90; + this.state = 96; this.match(OpenFGAParser.RELATIONS); - this.state = 92; + this.state = 98; this._errHandler.sync(this); _alt = 1; do { @@ -397,7 +401,7 @@ export default class OpenFGAParser extends Parser { case 1: { { - this.state = 91; + this.state = 97; this.relationDeclaration(); } } @@ -405,7 +409,7 @@ export default class OpenFGAParser extends Parser { default: throw new NoViableAltException(this); } - this.state = 94; + this.state = 100; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input, 9, this._ctx); } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); @@ -436,39 +440,41 @@ export default class OpenFGAParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 98; + this.state = 104; this.match(OpenFGAParser.NEWLINE); - this.state = 99; + this.state = 105; this.match(OpenFGAParser.DEFINE); - this.state = 100; + this.state = 106; this.match(OpenFGAParser.WHITESPACE); - this.state = 101; + this.state = 107; this.relationName(); - this.state = 103; + this.state = 109; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 102; + this.state = 108; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 105; + this.state = 111; this.match(OpenFGAParser.COLON); - this.state = 107; + this.state = 113; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 106; + this.state = 112; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 109; + { + this.state = 115; this.relationDef(); } + } } catch (re) { if (re instanceof RecognitionException) { @@ -491,7 +497,7 @@ export default class OpenFGAParser extends Parser { try { this.enterOuterAlt(localctx, 1); { - this.state = 111; + this.state = 117; this.match(OpenFGAParser.IDENTIFIER); } } @@ -513,38 +519,94 @@ export default class OpenFGAParser extends Parser { public relationDef(): RelationDefContext { let localctx: RelationDefContext = new RelationDefContext(this, this._ctx, this.state); this.enterRule(localctx, 12, OpenFGAParser.RULE_relationDef); - let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 115; + this.state = 122; this._errHandler.sync(this); switch (this._input.LA(1)) { case 27: { - this.state = 113; + this.state = 119; this.relationDefDirectAssignment(); } break; case 51: { - this.state = 114; + this.state = 120; this.relationDefGrouping(); } break; + case 31: + { + this.state = 121; + this.relationRecurse(); + } + break; default: throw new NoViableAltException(this); } - this.state = 118; + this.state = 125; this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la===44) { + switch ( this._interp.adaptivePredict(this._input, 14, this._ctx) ) { + case 1: { - this.state = 117; + this.state = 124; this.relationDefPartials(); } + break; + } + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public relationDefNoDirect(): RelationDefNoDirectContext { + let localctx: RelationDefNoDirectContext = new RelationDefNoDirectContext(this, this._ctx, this.state); + this.enterRule(localctx, 14, OpenFGAParser.RULE_relationDefNoDirect); + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 129; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case 51: + { + this.state = 127; + this.relationDefGrouping(); + } + break; + case 31: + { + this.state = 128; + this.relationRecurseNoDirect(); + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 132; + this._errHandler.sync(this); + switch ( this._interp.adaptivePredict(this._input, 16, this._ctx) ) { + case 1: + { + this.state = 131; + this.relationDefPartials(); + } + break; } - } } catch (re) { @@ -564,85 +626,135 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public relationDefPartials(): RelationDefPartialsContext { let localctx: RelationDefPartialsContext = new RelationDefPartialsContext(this, this._ctx, this.state); - this.enterRule(localctx, 14, OpenFGAParser.RULE_relationDefPartials); - let _la: number; + this.enterRule(localctx, 16, OpenFGAParser.RULE_relationDefPartials); try { - this.state = 144; + let _alt: number; + this.state = 163; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 18, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 22, this._ctx) ) { case 1: this.enterOuterAlt(localctx, 1); { - this.state = 124; + this.state = 141; this._errHandler.sync(this); - _la = this._input.LA(1); + _alt = 1; do { - { - { - this.state = 120; - this.match(OpenFGAParser.WHITESPACE); - this.state = 121; - this.match(OpenFGAParser.OR); - this.state = 122; - this.match(OpenFGAParser.WHITESPACE); - this.state = 123; - this.relationDefGrouping(); - } + switch (_alt) { + case 1: + { + { + this.state = 134; + this.match(OpenFGAParser.WHITESPACE); + this.state = 135; + this.match(OpenFGAParser.OR); + this.state = 136; + this.match(OpenFGAParser.WHITESPACE); + this.state = 139; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case 51: + { + this.state = 137; + this.relationDefGrouping(); + } + break; + case 31: + { + this.state = 138; + this.relationRecurseNoDirect(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + break; + default: + throw new NoViableAltException(this); } - this.state = 126; + this.state = 143; this._errHandler.sync(this); - _la = this._input.LA(1); - } while (_la===44); + _alt = this._interp.adaptivePredict(this._input, 18, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); } break; case 2: this.enterOuterAlt(localctx, 2); { - this.state = 132; + this.state = 152; this._errHandler.sync(this); - _la = this._input.LA(1); + _alt = 1; do { - { - { - this.state = 128; - this.match(OpenFGAParser.WHITESPACE); - this.state = 129; - this.match(OpenFGAParser.AND); - this.state = 130; - this.match(OpenFGAParser.WHITESPACE); - this.state = 131; - this.relationDefGrouping(); - } + switch (_alt) { + case 1: + { + { + this.state = 145; + this.match(OpenFGAParser.WHITESPACE); + this.state = 146; + this.match(OpenFGAParser.AND); + this.state = 147; + this.match(OpenFGAParser.WHITESPACE); + this.state = 150; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case 51: + { + this.state = 148; + this.relationDefGrouping(); + } + break; + case 31: + { + this.state = 149; + this.relationRecurseNoDirect(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + break; + default: + throw new NoViableAltException(this); } - this.state = 134; + this.state = 154; this._errHandler.sync(this); - _la = this._input.LA(1); - } while (_la===44); + _alt = this._interp.adaptivePredict(this._input, 20, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); } break; case 3: this.enterOuterAlt(localctx, 3); { - this.state = 140; + { + this.state = 156; + this.match(OpenFGAParser.WHITESPACE); + this.state = 157; + this.match(OpenFGAParser.BUT_NOT); + this.state = 158; + this.match(OpenFGAParser.WHITESPACE); + this.state = 161; this._errHandler.sync(this); - _la = this._input.LA(1); - do { - { + switch (this._input.LA(1)) { + case 51: { - this.state = 136; - this.match(OpenFGAParser.WHITESPACE); - this.state = 137; - this.match(OpenFGAParser.BUT_NOT); - this.state = 138; - this.match(OpenFGAParser.WHITESPACE); - this.state = 139; + this.state = 159; this.relationDefGrouping(); } + break; + case 31: + { + this.state = 160; + this.relationRecurseNoDirect(); } - this.state = 142; - this._errHandler.sync(this); - _la = this._input.LA(1); - } while (_la===44); + break; + default: + throw new NoViableAltException(this); + } + } } break; } @@ -664,11 +776,11 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public relationDefGrouping(): RelationDefGroupingContext { let localctx: RelationDefGroupingContext = new RelationDefGroupingContext(this, this._ctx, this.state); - this.enterRule(localctx, 16, OpenFGAParser.RULE_relationDefGrouping); + this.enterRule(localctx, 18, OpenFGAParser.RULE_relationDefGrouping); try { this.enterOuterAlt(localctx, 1); { - this.state = 146; + this.state = 165; this.relationDefRewrite(); } } @@ -687,74 +799,218 @@ export default class OpenFGAParser extends Parser { return localctx; } // @RuleVersion(0) + public relationRecurse(): RelationRecurseContext { + let localctx: RelationRecurseContext = new RelationRecurseContext(this, this._ctx, this.state); + this.enterRule(localctx, 20, OpenFGAParser.RULE_relationRecurse); + let _la: number; + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 167; + this.match(OpenFGAParser.LPAREN); + this.state = 171; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la===44) { + { + { + this.state = 168; + this.match(OpenFGAParser.WHITESPACE); + } + } + this.state = 173; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 176; + this._errHandler.sync(this); + switch ( this._interp.adaptivePredict(this._input, 24, this._ctx) ) { + case 1: + { + this.state = 174; + this.relationDef(); + } + break; + case 2: + { + this.state = 175; + this.relationRecurseNoDirect(); + } + break; + } + this.state = 181; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la===44) { + { + { + this.state = 178; + this.match(OpenFGAParser.WHITESPACE); + } + } + this.state = 183; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 184; + this.match(OpenFGAParser.RPAREN); + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) + public relationRecurseNoDirect(): RelationRecurseNoDirectContext { + let localctx: RelationRecurseNoDirectContext = new RelationRecurseNoDirectContext(this, this._ctx, this.state); + this.enterRule(localctx, 22, OpenFGAParser.RULE_relationRecurseNoDirect); + let _la: number; + try { + this.enterOuterAlt(localctx, 1); + { + this.state = 186; + this.match(OpenFGAParser.LPAREN); + this.state = 190; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la===44) { + { + { + this.state = 187; + this.match(OpenFGAParser.WHITESPACE); + } + } + this.state = 192; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 195; + this._errHandler.sync(this); + switch ( this._interp.adaptivePredict(this._input, 27, this._ctx) ) { + case 1: + { + this.state = 193; + this.relationDefNoDirect(); + } + break; + case 2: + { + this.state = 194; + this.relationRecurseNoDirect(); + } + break; + } + this.state = 200; + this._errHandler.sync(this); + _la = this._input.LA(1); + while (_la===44) { + { + { + this.state = 197; + this.match(OpenFGAParser.WHITESPACE); + } + } + this.state = 202; + this._errHandler.sync(this); + _la = this._input.LA(1); + } + this.state = 203; + this.match(OpenFGAParser.RPAREN); + } + } + catch (re) { + if (re instanceof RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } + finally { + this.exitRule(); + } + return localctx; + } + // @RuleVersion(0) public relationDefDirectAssignment(): RelationDefDirectAssignmentContext { let localctx: RelationDefDirectAssignmentContext = new RelationDefDirectAssignmentContext(this, this._ctx, this.state); - this.enterRule(localctx, 18, OpenFGAParser.RULE_relationDefDirectAssignment); + this.enterRule(localctx, 24, OpenFGAParser.RULE_relationDefDirectAssignment); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 148; + this.state = 205; this.match(OpenFGAParser.LBRACKET); - this.state = 150; + this.state = 207; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 149; + this.state = 206; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 152; + this.state = 209; this.relationDefTypeRestriction(); - this.state = 154; + this.state = 211; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 153; + this.state = 210; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 166; + this.state = 223; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===3) { { { - this.state = 156; + this.state = 213; this.match(OpenFGAParser.COMMA); - this.state = 158; + this.state = 215; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 157; + this.state = 214; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 160; + this.state = 217; this.relationDefTypeRestriction(); - this.state = 162; + this.state = 219; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 161; + this.state = 218; this.match(OpenFGAParser.WHITESPACE); } } } } - this.state = 168; + this.state = 225; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 169; + this.state = 226; this.match(OpenFGAParser.RPRACKET); } } @@ -775,24 +1031,24 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public relationDefRewrite(): RelationDefRewriteContext { let localctx: RelationDefRewriteContext = new RelationDefRewriteContext(this, this._ctx, this.state); - this.enterRule(localctx, 20, OpenFGAParser.RULE_relationDefRewrite); + this.enterRule(localctx, 26, OpenFGAParser.RULE_relationDefRewrite); try { this.enterOuterAlt(localctx, 1); { - this.state = 171; + this.state = 228; localctx._rewriteComputedusersetName = this.match(OpenFGAParser.IDENTIFIER); - this.state = 176; + this.state = 233; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 24, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 34, this._ctx) ) { case 1: { - this.state = 172; + this.state = 229; this.match(OpenFGAParser.WHITESPACE); - this.state = 173; + this.state = 230; this.match(OpenFGAParser.FROM); - this.state = 174; + this.state = 231; this.match(OpenFGAParser.WHITESPACE); - this.state = 175; + this.state = 232; localctx._rewriteTuplesetName = this.match(OpenFGAParser.IDENTIFIER); } break; @@ -816,53 +1072,53 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public relationDefTypeRestriction(): RelationDefTypeRestrictionContext { let localctx: RelationDefTypeRestrictionContext = new RelationDefTypeRestrictionContext(this, this._ctx, this.state); - this.enterRule(localctx, 22, OpenFGAParser.RULE_relationDefTypeRestriction); + this.enterRule(localctx, 28, OpenFGAParser.RULE_relationDefTypeRestriction); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 179; + this.state = 236; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 178; + this.state = 235; this.match(OpenFGAParser.NEWLINE); } } - this.state = 188; + this.state = 245; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 26, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 36, this._ctx) ) { case 1: { - this.state = 181; + this.state = 238; this.relationDefTypeRestrictionBase(); } break; case 2: { { - this.state = 182; + this.state = 239; this.relationDefTypeRestrictionBase(); - this.state = 183; + this.state = 240; this.match(OpenFGAParser.WHITESPACE); - this.state = 184; + this.state = 241; this.match(OpenFGAParser.KEYWORD_WITH); - this.state = 185; + this.state = 242; this.match(OpenFGAParser.WHITESPACE); - this.state = 186; + this.state = 243; this.conditionName(); } } break; } - this.state = 191; + this.state = 248; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 190; + this.state = 247; this.match(OpenFGAParser.NEWLINE); } } @@ -886,21 +1142,21 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public relationDefTypeRestrictionBase(): RelationDefTypeRestrictionBaseContext { let localctx: RelationDefTypeRestrictionBaseContext = new RelationDefTypeRestrictionBaseContext(this, this._ctx, this.state); - this.enterRule(localctx, 24, OpenFGAParser.RULE_relationDefTypeRestrictionBase); + this.enterRule(localctx, 30, OpenFGAParser.RULE_relationDefTypeRestrictionBase); try { this.enterOuterAlt(localctx, 1); { - this.state = 193; + this.state = 250; localctx._relationDefTypeRestrictionType = this.match(OpenFGAParser.IDENTIFIER); - this.state = 198; + this.state = 255; this._errHandler.sync(this); switch (this._input.LA(1)) { case 2: { { - this.state = 194; + this.state = 251; this.match(OpenFGAParser.COLON); - this.state = 195; + this.state = 252; localctx._relationDefTypeRestrictionWildcard = this.match(OpenFGAParser.STAR); } } @@ -908,9 +1164,9 @@ export default class OpenFGAParser extends Parser { case 1: { { - this.state = 196; + this.state = 253; this.match(OpenFGAParser.HASH); - this.state = 197; + this.state = 254; localctx._relationDefTypeRestrictionRelation = this.match(OpenFGAParser.IDENTIFIER); } } @@ -942,26 +1198,26 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public conditions(): ConditionsContext { let localctx: ConditionsContext = new ConditionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 26, OpenFGAParser.RULE_conditions); + this.enterRule(localctx, 32, OpenFGAParser.RULE_conditions); try { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 203; + this.state = 260; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 29, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 39, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { - this.state = 200; + this.state = 257; this.condition(); } } } - this.state = 205; + this.state = 262; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 29, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 39, this._ctx); } } } @@ -982,158 +1238,158 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public condition(): ConditionContext { let localctx: ConditionContext = new ConditionContext(this, this._ctx, this.state); - this.enterRule(localctx, 28, OpenFGAParser.RULE_condition); + this.enterRule(localctx, 34, OpenFGAParser.RULE_condition); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 208; + this.state = 265; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 30, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 40, this._ctx) ) { case 1: { - this.state = 206; + this.state = 263; this.match(OpenFGAParser.NEWLINE); - this.state = 207; + this.state = 264; this.multiLineComment(); } break; } - this.state = 210; + this.state = 267; this.match(OpenFGAParser.NEWLINE); - this.state = 211; + this.state = 268; this.match(OpenFGAParser.CONDITION); - this.state = 212; + this.state = 269; this.match(OpenFGAParser.WHITESPACE); - this.state = 213; + this.state = 270; this.conditionName(); - this.state = 215; + this.state = 272; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 214; + this.state = 271; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 217; + this.state = 274; this.match(OpenFGAParser.LPAREN); - this.state = 219; + this.state = 276; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 218; + this.state = 275; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 221; + this.state = 278; this.conditionParameter(); - this.state = 223; + this.state = 280; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 222; + this.state = 279; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 235; + this.state = 292; this._errHandler.sync(this); _la = this._input.LA(1); while (_la===3) { { { - this.state = 225; + this.state = 282; this.match(OpenFGAParser.COMMA); - this.state = 227; + this.state = 284; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 226; + this.state = 283; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 229; + this.state = 286; this.conditionParameter(); - this.state = 231; + this.state = 288; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 230; + this.state = 287; this.match(OpenFGAParser.WHITESPACE); } } } } - this.state = 237; + this.state = 294; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 239; + this.state = 296; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 238; + this.state = 295; this.match(OpenFGAParser.NEWLINE); } } - this.state = 241; + this.state = 298; this.match(OpenFGAParser.RPAREN); - this.state = 243; + this.state = 300; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 242; + this.state = 299; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 245; + this.state = 302; this.match(OpenFGAParser.LBRACE); - this.state = 247; + this.state = 304; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 39, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 49, this._ctx) ) { case 1: { - this.state = 246; + this.state = 303; this.match(OpenFGAParser.NEWLINE); } break; } - this.state = 250; + this.state = 307; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 40, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 50, this._ctx) ) { case 1: { - this.state = 249; + this.state = 306; this.match(OpenFGAParser.WHITESPACE); } break; } - this.state = 252; + this.state = 309; this.conditionExpression(); - this.state = 254; + this.state = 311; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 253; + this.state = 310; this.match(OpenFGAParser.NEWLINE); } } - this.state = 256; + this.state = 313; this.match(OpenFGAParser.RBRACE); } } @@ -1154,11 +1410,11 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public conditionName(): ConditionNameContext { let localctx: ConditionNameContext = new ConditionNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 30, OpenFGAParser.RULE_conditionName); + this.enterRule(localctx, 36, OpenFGAParser.RULE_conditionName); try { this.enterOuterAlt(localctx, 1); { - this.state = 258; + this.state = 315; this.match(OpenFGAParser.IDENTIFIER); } } @@ -1179,46 +1435,46 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public conditionParameter(): ConditionParameterContext { let localctx: ConditionParameterContext = new ConditionParameterContext(this, this._ctx, this.state); - this.enterRule(localctx, 32, OpenFGAParser.RULE_conditionParameter); + this.enterRule(localctx, 38, OpenFGAParser.RULE_conditionParameter); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 261; + this.state = 318; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===52) { { - this.state = 260; + this.state = 317; this.match(OpenFGAParser.NEWLINE); } } - this.state = 263; + this.state = 320; this.parameterName(); - this.state = 265; + this.state = 322; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 264; + this.state = 321; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 267; + this.state = 324; this.match(OpenFGAParser.COLON); - this.state = 269; + this.state = 326; this._errHandler.sync(this); _la = this._input.LA(1); if (_la===44) { { - this.state = 268; + this.state = 325; this.match(OpenFGAParser.WHITESPACE); } } - this.state = 271; + this.state = 328; this.parameterType(); } } @@ -1239,11 +1495,11 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public parameterName(): ParameterNameContext { let localctx: ParameterNameContext = new ParameterNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 34, OpenFGAParser.RULE_parameterName); + this.enterRule(localctx, 40, OpenFGAParser.RULE_parameterName); try { this.enterOuterAlt(localctx, 1); { - this.state = 273; + this.state = 330; this.match(OpenFGAParser.IDENTIFIER); } } @@ -1264,15 +1520,15 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public parameterType(): ParameterTypeContext { let localctx: ParameterTypeContext = new ParameterTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 36, OpenFGAParser.RULE_parameterType); + this.enterRule(localctx, 42, OpenFGAParser.RULE_parameterType); try { - this.state = 280; + this.state = 337; this._errHandler.sync(this); switch (this._input.LA(1)) { case 5: this.enterOuterAlt(localctx, 1); { - this.state = 275; + this.state = 332; this.match(OpenFGAParser.CONDITION_PARAM_TYPE); } break; @@ -1280,13 +1536,13 @@ export default class OpenFGAParser extends Parser { this.enterOuterAlt(localctx, 2); { { - this.state = 276; + this.state = 333; this.match(OpenFGAParser.CONDITION_PARAM_CONTAINER); - this.state = 277; + this.state = 334; this.match(OpenFGAParser.LESS); - this.state = 278; + this.state = 335; this.match(OpenFGAParser.CONDITION_PARAM_TYPE); - this.state = 279; + this.state = 336; this.match(OpenFGAParser.GREATER); } } @@ -1312,20 +1568,20 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public multiLineComment(): MultiLineCommentContext { let localctx: MultiLineCommentContext = new MultiLineCommentContext(this, this._ctx, this.state); - this.enterRule(localctx, 38, OpenFGAParser.RULE_multiLineComment); + this.enterRule(localctx, 44, OpenFGAParser.RULE_multiLineComment); let _la: number; try { this.enterOuterAlt(localctx, 1); { - this.state = 282; + this.state = 339; this.match(OpenFGAParser.HASH); - this.state = 286; + this.state = 343; this._errHandler.sync(this); _la = this._input.LA(1); while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 4294967294) !== 0) || ((((_la - 32)) & ~0x1F) === 0 && ((1 << (_la - 32)) & 1048575) !== 0)) { { { - this.state = 283; + this.state = 340; _la = this._input.LA(1); if(_la<=0 || _la===52) { this._errHandler.recoverInline(this); @@ -1336,18 +1592,18 @@ export default class OpenFGAParser extends Parser { } } } - this.state = 288; + this.state = 345; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 291; + this.state = 348; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 47, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 57, this._ctx) ) { case 1: { - this.state = 289; + this.state = 346; this.match(OpenFGAParser.NEWLINE); - this.state = 290; + this.state = 347; this.multiLineComment(); } break; @@ -1371,24 +1627,24 @@ export default class OpenFGAParser extends Parser { // @RuleVersion(0) public conditionExpression(): ConditionExpressionContext { let localctx: ConditionExpressionContext = new ConditionExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 40, OpenFGAParser.RULE_conditionExpression); + this.enterRule(localctx, 46, OpenFGAParser.RULE_conditionExpression); let _la: number; try { let _alt: number; this.enterOuterAlt(localctx, 1); { - this.state = 297; + this.state = 354; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 49, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 59, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { - this.state = 295; + this.state = 352; this._errHandler.sync(this); - switch ( this._interp.adaptivePredict(this._input, 48, this._ctx) ) { + switch ( this._interp.adaptivePredict(this._input, 58, this._ctx) ) { case 1: { - this.state = 293; + this.state = 350; _la = this._input.LA(1); if(!((((_la) & ~0x1F) === 0 && ((1 << _la) & 3220963328) !== 0) || ((((_la - 32)) & ~0x1F) === 0 && ((1 << (_la - 32)) & 2097151) !== 0))) { this._errHandler.recoverInline(this); @@ -1401,7 +1657,7 @@ export default class OpenFGAParser extends Parser { break; case 2: { - this.state = 294; + this.state = 351; _la = this._input.LA(1); if(_la<=0 || _la===30) { this._errHandler.recoverInline(this); @@ -1415,9 +1671,9 @@ export default class OpenFGAParser extends Parser { } } } - this.state = 299; + this.state = 356; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 49, this._ctx); + _alt = this._interp.adaptivePredict(this._input, 59, this._ctx); } } } @@ -1436,107 +1692,127 @@ export default class OpenFGAParser extends Parser { return localctx; } - public static readonly _serializedATN: number[] = [4,1,52,301,2,0,7,0,2, + public static readonly _serializedATN: number[] = [4,1,52,358,2,0,7,0,2, 1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2, 10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17, - 7,17,2,18,7,18,2,19,7,19,2,20,7,20,1,0,3,0,44,8,0,1,0,3,0,47,8,0,1,0,1, - 0,3,0,51,8,0,1,0,1,0,3,0,55,8,0,1,0,1,0,3,0,59,8,0,1,0,1,0,1,1,1,1,1,1, - 3,1,66,8,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,74,8,1,1,2,5,2,77,8,2,10,2,12,2, - 80,9,2,1,3,1,3,3,3,84,8,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,4,3,93,8,3,11,3,12, - 3,94,3,3,97,8,3,1,4,1,4,1,4,1,4,1,4,3,4,104,8,4,1,4,1,4,3,4,108,8,4,1,4, - 1,4,1,5,1,5,1,6,1,6,3,6,116,8,6,1,6,3,6,119,8,6,1,7,1,7,1,7,1,7,4,7,125, - 8,7,11,7,12,7,126,1,7,1,7,1,7,1,7,4,7,133,8,7,11,7,12,7,134,1,7,1,7,1,7, - 1,7,4,7,141,8,7,11,7,12,7,142,3,7,145,8,7,1,8,1,8,1,9,1,9,3,9,151,8,9,1, - 9,1,9,3,9,155,8,9,1,9,1,9,3,9,159,8,9,1,9,1,9,3,9,163,8,9,5,9,165,8,9,10, - 9,12,9,168,9,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,3,10,177,8,10,1,11,3,11, - 180,8,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11,189,8,11,1,11,3,11,192, - 8,11,1,12,1,12,1,12,1,12,1,12,3,12,199,8,12,1,13,5,13,202,8,13,10,13,12, - 13,205,9,13,1,14,1,14,3,14,209,8,14,1,14,1,14,1,14,1,14,1,14,3,14,216,8, - 14,1,14,1,14,3,14,220,8,14,1,14,1,14,3,14,224,8,14,1,14,1,14,3,14,228,8, - 14,1,14,1,14,3,14,232,8,14,5,14,234,8,14,10,14,12,14,237,9,14,1,14,3,14, - 240,8,14,1,14,1,14,3,14,244,8,14,1,14,1,14,3,14,248,8,14,1,14,3,14,251, - 8,14,1,14,1,14,3,14,255,8,14,1,14,1,14,1,15,1,15,1,16,3,16,262,8,16,1,16, - 1,16,3,16,266,8,16,1,16,1,16,3,16,270,8,16,1,16,1,16,1,17,1,17,1,18,1,18, - 1,18,1,18,1,18,3,18,281,8,18,1,19,1,19,5,19,285,8,19,10,19,12,19,288,9, - 19,1,19,1,19,3,19,292,8,19,1,20,1,20,5,20,296,8,20,10,20,12,20,299,9,20, - 1,20,0,0,21,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,0, - 3,1,0,52,52,2,0,18,29,31,52,1,0,30,30,331,0,43,1,0,0,0,2,65,1,0,0,0,4,78, - 1,0,0,0,6,83,1,0,0,0,8,98,1,0,0,0,10,111,1,0,0,0,12,115,1,0,0,0,14,144, - 1,0,0,0,16,146,1,0,0,0,18,148,1,0,0,0,20,171,1,0,0,0,22,179,1,0,0,0,24, - 193,1,0,0,0,26,203,1,0,0,0,28,208,1,0,0,0,30,258,1,0,0,0,32,261,1,0,0,0, - 34,273,1,0,0,0,36,280,1,0,0,0,38,282,1,0,0,0,40,297,1,0,0,0,42,44,5,44, - 0,0,43,42,1,0,0,0,43,44,1,0,0,0,44,46,1,0,0,0,45,47,5,52,0,0,46,45,1,0, - 0,0,46,47,1,0,0,0,47,48,1,0,0,0,48,50,3,2,1,0,49,51,5,52,0,0,50,49,1,0, - 0,0,50,51,1,0,0,0,51,52,1,0,0,0,52,54,3,4,2,0,53,55,5,52,0,0,54,53,1,0, - 0,0,54,55,1,0,0,0,55,56,1,0,0,0,56,58,3,26,13,0,57,59,5,52,0,0,58,57,1, - 0,0,0,58,59,1,0,0,0,59,60,1,0,0,0,60,61,5,0,0,1,61,1,1,0,0,0,62,63,3,38, - 19,0,63,64,5,52,0,0,64,66,1,0,0,0,65,62,1,0,0,0,65,66,1,0,0,0,66,67,1,0, - 0,0,67,68,5,10,0,0,68,69,5,52,0,0,69,70,5,11,0,0,70,71,5,44,0,0,71,73,5, - 12,0,0,72,74,5,44,0,0,73,72,1,0,0,0,73,74,1,0,0,0,74,3,1,0,0,0,75,77,3, - 6,3,0,76,75,1,0,0,0,77,80,1,0,0,0,78,76,1,0,0,0,78,79,1,0,0,0,79,5,1,0, - 0,0,80,78,1,0,0,0,81,82,5,52,0,0,82,84,3,38,19,0,83,81,1,0,0,0,83,84,1, - 0,0,0,84,85,1,0,0,0,85,86,5,52,0,0,86,87,5,13,0,0,87,88,5,44,0,0,88,96, - 5,51,0,0,89,90,5,52,0,0,90,92,5,15,0,0,91,93,3,8,4,0,92,91,1,0,0,0,93,94, - 1,0,0,0,94,92,1,0,0,0,94,95,1,0,0,0,95,97,1,0,0,0,96,89,1,0,0,0,96,97,1, - 0,0,0,97,7,1,0,0,0,98,99,5,52,0,0,99,100,5,16,0,0,100,101,5,44,0,0,101, - 103,3,10,5,0,102,104,5,44,0,0,103,102,1,0,0,0,103,104,1,0,0,0,104,105,1, - 0,0,0,105,107,5,2,0,0,106,108,5,44,0,0,107,106,1,0,0,0,107,108,1,0,0,0, - 108,109,1,0,0,0,109,110,3,12,6,0,110,9,1,0,0,0,111,112,5,51,0,0,112,11, - 1,0,0,0,113,116,3,18,9,0,114,116,3,16,8,0,115,113,1,0,0,0,115,114,1,0,0, - 0,116,118,1,0,0,0,117,119,3,14,7,0,118,117,1,0,0,0,118,119,1,0,0,0,119, - 13,1,0,0,0,120,121,5,44,0,0,121,122,5,7,0,0,122,123,5,44,0,0,123,125,3, - 16,8,0,124,120,1,0,0,0,125,126,1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0, - 127,145,1,0,0,0,128,129,5,44,0,0,129,130,5,6,0,0,130,131,5,44,0,0,131,133, - 3,16,8,0,132,128,1,0,0,0,133,134,1,0,0,0,134,132,1,0,0,0,134,135,1,0,0, - 0,135,145,1,0,0,0,136,137,5,44,0,0,137,138,5,8,0,0,138,139,5,44,0,0,139, - 141,3,16,8,0,140,136,1,0,0,0,141,142,1,0,0,0,142,140,1,0,0,0,142,143,1, - 0,0,0,143,145,1,0,0,0,144,124,1,0,0,0,144,132,1,0,0,0,144,140,1,0,0,0,145, - 15,1,0,0,0,146,147,3,20,10,0,147,17,1,0,0,0,148,150,5,27,0,0,149,151,5, - 44,0,0,150,149,1,0,0,0,150,151,1,0,0,0,151,152,1,0,0,0,152,154,3,22,11, - 0,153,155,5,44,0,0,154,153,1,0,0,0,154,155,1,0,0,0,155,166,1,0,0,0,156, - 158,5,3,0,0,157,159,5,44,0,0,158,157,1,0,0,0,158,159,1,0,0,0,159,160,1, - 0,0,0,160,162,3,22,11,0,161,163,5,44,0,0,162,161,1,0,0,0,162,163,1,0,0, - 0,163,165,1,0,0,0,164,156,1,0,0,0,165,168,1,0,0,0,166,164,1,0,0,0,166,167, - 1,0,0,0,167,169,1,0,0,0,168,166,1,0,0,0,169,170,5,28,0,0,170,19,1,0,0,0, - 171,176,5,51,0,0,172,173,5,44,0,0,173,174,5,9,0,0,174,175,5,44,0,0,175, - 177,5,51,0,0,176,172,1,0,0,0,176,177,1,0,0,0,177,21,1,0,0,0,178,180,5,52, - 0,0,179,178,1,0,0,0,179,180,1,0,0,0,180,188,1,0,0,0,181,189,3,24,12,0,182, - 183,3,24,12,0,183,184,5,44,0,0,184,185,5,17,0,0,185,186,5,44,0,0,186,187, - 3,30,15,0,187,189,1,0,0,0,188,181,1,0,0,0,188,182,1,0,0,0,189,191,1,0,0, - 0,190,192,5,52,0,0,191,190,1,0,0,0,191,192,1,0,0,0,192,23,1,0,0,0,193,198, - 5,51,0,0,194,195,5,2,0,0,195,199,5,38,0,0,196,197,5,1,0,0,197,199,5,51, - 0,0,198,194,1,0,0,0,198,196,1,0,0,0,198,199,1,0,0,0,199,25,1,0,0,0,200, - 202,3,28,14,0,201,200,1,0,0,0,202,205,1,0,0,0,203,201,1,0,0,0,203,204,1, - 0,0,0,204,27,1,0,0,0,205,203,1,0,0,0,206,207,5,52,0,0,207,209,3,38,19,0, - 208,206,1,0,0,0,208,209,1,0,0,0,209,210,1,0,0,0,210,211,5,52,0,0,211,212, - 5,14,0,0,212,213,5,44,0,0,213,215,3,30,15,0,214,216,5,44,0,0,215,214,1, - 0,0,0,215,216,1,0,0,0,216,217,1,0,0,0,217,219,5,31,0,0,218,220,5,44,0,0, - 219,218,1,0,0,0,219,220,1,0,0,0,220,221,1,0,0,0,221,223,3,32,16,0,222,224, - 5,44,0,0,223,222,1,0,0,0,223,224,1,0,0,0,224,235,1,0,0,0,225,227,5,3,0, - 0,226,228,5,44,0,0,227,226,1,0,0,0,227,228,1,0,0,0,228,229,1,0,0,0,229, - 231,3,32,16,0,230,232,5,44,0,0,231,230,1,0,0,0,231,232,1,0,0,0,232,234, - 1,0,0,0,233,225,1,0,0,0,234,237,1,0,0,0,235,233,1,0,0,0,235,236,1,0,0,0, - 236,239,1,0,0,0,237,235,1,0,0,0,238,240,5,52,0,0,239,238,1,0,0,0,239,240, - 1,0,0,0,240,241,1,0,0,0,241,243,5,32,0,0,242,244,5,44,0,0,243,242,1,0,0, - 0,243,244,1,0,0,0,244,245,1,0,0,0,245,247,5,29,0,0,246,248,5,52,0,0,247, - 246,1,0,0,0,247,248,1,0,0,0,248,250,1,0,0,0,249,251,5,44,0,0,250,249,1, - 0,0,0,250,251,1,0,0,0,251,252,1,0,0,0,252,254,3,40,20,0,253,255,5,52,0, - 0,254,253,1,0,0,0,254,255,1,0,0,0,255,256,1,0,0,0,256,257,5,30,0,0,257, - 29,1,0,0,0,258,259,5,51,0,0,259,31,1,0,0,0,260,262,5,52,0,0,261,260,1,0, - 0,0,261,262,1,0,0,0,262,263,1,0,0,0,263,265,3,34,17,0,264,266,5,44,0,0, - 265,264,1,0,0,0,265,266,1,0,0,0,266,267,1,0,0,0,267,269,5,2,0,0,268,270, - 5,44,0,0,269,268,1,0,0,0,269,270,1,0,0,0,270,271,1,0,0,0,271,272,3,36,18, - 0,272,33,1,0,0,0,273,274,5,51,0,0,274,35,1,0,0,0,275,281,5,5,0,0,276,277, - 5,4,0,0,277,278,5,21,0,0,278,279,5,5,0,0,279,281,5,24,0,0,280,275,1,0,0, - 0,280,276,1,0,0,0,281,37,1,0,0,0,282,286,5,1,0,0,283,285,8,0,0,0,284,283, - 1,0,0,0,285,288,1,0,0,0,286,284,1,0,0,0,286,287,1,0,0,0,287,291,1,0,0,0, - 288,286,1,0,0,0,289,290,5,52,0,0,290,292,3,38,19,0,291,289,1,0,0,0,291, - 292,1,0,0,0,292,39,1,0,0,0,293,296,7,1,0,0,294,296,8,2,0,0,295,293,1,0, - 0,0,295,294,1,0,0,0,296,299,1,0,0,0,297,295,1,0,0,0,297,298,1,0,0,0,298, - 41,1,0,0,0,299,297,1,0,0,0,50,43,46,50,54,58,65,73,78,83,94,96,103,107, - 115,118,126,134,142,144,150,154,158,162,166,176,179,188,191,198,203,208, - 215,219,223,227,231,235,239,243,247,250,254,261,265,269,280,286,291,295, - 297]; + 7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,1,0,3, + 0,50,8,0,1,0,3,0,53,8,0,1,0,1,0,3,0,57,8,0,1,0,1,0,3,0,61,8,0,1,0,1,0,3, + 0,65,8,0,1,0,1,0,1,1,1,1,1,1,3,1,72,8,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,80, + 8,1,1,2,5,2,83,8,2,10,2,12,2,86,9,2,1,3,1,3,3,3,90,8,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,4,3,99,8,3,11,3,12,3,100,3,3,103,8,3,1,4,1,4,1,4,1,4,1,4,3, + 4,110,8,4,1,4,1,4,3,4,114,8,4,1,4,1,4,1,5,1,5,1,6,1,6,1,6,3,6,123,8,6,1, + 6,3,6,126,8,6,1,7,1,7,3,7,130,8,7,1,7,3,7,133,8,7,1,8,1,8,1,8,1,8,1,8,3, + 8,140,8,8,4,8,142,8,8,11,8,12,8,143,1,8,1,8,1,8,1,8,1,8,3,8,151,8,8,4,8, + 153,8,8,11,8,12,8,154,1,8,1,8,1,8,1,8,1,8,3,8,162,8,8,3,8,164,8,8,1,9,1, + 9,1,10,1,10,5,10,170,8,10,10,10,12,10,173,9,10,1,10,1,10,3,10,177,8,10, + 1,10,5,10,180,8,10,10,10,12,10,183,9,10,1,10,1,10,1,11,1,11,5,11,189,8, + 11,10,11,12,11,192,9,11,1,11,1,11,3,11,196,8,11,1,11,5,11,199,8,11,10,11, + 12,11,202,9,11,1,11,1,11,1,12,1,12,3,12,208,8,12,1,12,1,12,3,12,212,8,12, + 1,12,1,12,3,12,216,8,12,1,12,1,12,3,12,220,8,12,5,12,222,8,12,10,12,12, + 12,225,9,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,3,13,234,8,13,1,14,3,14, + 237,8,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,246,8,14,1,14,3,14,249, + 8,14,1,15,1,15,1,15,1,15,1,15,3,15,256,8,15,1,16,5,16,259,8,16,10,16,12, + 16,262,9,16,1,17,1,17,3,17,266,8,17,1,17,1,17,1,17,1,17,1,17,3,17,273,8, + 17,1,17,1,17,3,17,277,8,17,1,17,1,17,3,17,281,8,17,1,17,1,17,3,17,285,8, + 17,1,17,1,17,3,17,289,8,17,5,17,291,8,17,10,17,12,17,294,9,17,1,17,3,17, + 297,8,17,1,17,1,17,3,17,301,8,17,1,17,1,17,3,17,305,8,17,1,17,3,17,308, + 8,17,1,17,1,17,3,17,312,8,17,1,17,1,17,1,18,1,18,1,19,3,19,319,8,19,1,19, + 1,19,3,19,323,8,19,1,19,1,19,3,19,327,8,19,1,19,1,19,1,20,1,20,1,21,1,21, + 1,21,1,21,1,21,3,21,338,8,21,1,22,1,22,5,22,342,8,22,10,22,12,22,345,9, + 22,1,22,1,22,3,22,349,8,22,1,23,1,23,5,23,353,8,23,10,23,12,23,356,9,23, + 1,23,0,0,24,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42, + 44,46,0,3,1,0,52,52,2,0,18,29,31,52,1,0,30,30,396,0,49,1,0,0,0,2,71,1,0, + 0,0,4,84,1,0,0,0,6,89,1,0,0,0,8,104,1,0,0,0,10,117,1,0,0,0,12,122,1,0,0, + 0,14,129,1,0,0,0,16,163,1,0,0,0,18,165,1,0,0,0,20,167,1,0,0,0,22,186,1, + 0,0,0,24,205,1,0,0,0,26,228,1,0,0,0,28,236,1,0,0,0,30,250,1,0,0,0,32,260, + 1,0,0,0,34,265,1,0,0,0,36,315,1,0,0,0,38,318,1,0,0,0,40,330,1,0,0,0,42, + 337,1,0,0,0,44,339,1,0,0,0,46,354,1,0,0,0,48,50,5,44,0,0,49,48,1,0,0,0, + 49,50,1,0,0,0,50,52,1,0,0,0,51,53,5,52,0,0,52,51,1,0,0,0,52,53,1,0,0,0, + 53,54,1,0,0,0,54,56,3,2,1,0,55,57,5,52,0,0,56,55,1,0,0,0,56,57,1,0,0,0, + 57,58,1,0,0,0,58,60,3,4,2,0,59,61,5,52,0,0,60,59,1,0,0,0,60,61,1,0,0,0, + 61,62,1,0,0,0,62,64,3,32,16,0,63,65,5,52,0,0,64,63,1,0,0,0,64,65,1,0,0, + 0,65,66,1,0,0,0,66,67,5,0,0,1,67,1,1,0,0,0,68,69,3,44,22,0,69,70,5,52,0, + 0,70,72,1,0,0,0,71,68,1,0,0,0,71,72,1,0,0,0,72,73,1,0,0,0,73,74,5,10,0, + 0,74,75,5,52,0,0,75,76,5,11,0,0,76,77,5,44,0,0,77,79,5,12,0,0,78,80,5,44, + 0,0,79,78,1,0,0,0,79,80,1,0,0,0,80,3,1,0,0,0,81,83,3,6,3,0,82,81,1,0,0, + 0,83,86,1,0,0,0,84,82,1,0,0,0,84,85,1,0,0,0,85,5,1,0,0,0,86,84,1,0,0,0, + 87,88,5,52,0,0,88,90,3,44,22,0,89,87,1,0,0,0,89,90,1,0,0,0,90,91,1,0,0, + 0,91,92,5,52,0,0,92,93,5,13,0,0,93,94,5,44,0,0,94,102,5,51,0,0,95,96,5, + 52,0,0,96,98,5,15,0,0,97,99,3,8,4,0,98,97,1,0,0,0,99,100,1,0,0,0,100,98, + 1,0,0,0,100,101,1,0,0,0,101,103,1,0,0,0,102,95,1,0,0,0,102,103,1,0,0,0, + 103,7,1,0,0,0,104,105,5,52,0,0,105,106,5,16,0,0,106,107,5,44,0,0,107,109, + 3,10,5,0,108,110,5,44,0,0,109,108,1,0,0,0,109,110,1,0,0,0,110,111,1,0,0, + 0,111,113,5,2,0,0,112,114,5,44,0,0,113,112,1,0,0,0,113,114,1,0,0,0,114, + 115,1,0,0,0,115,116,3,12,6,0,116,9,1,0,0,0,117,118,5,51,0,0,118,11,1,0, + 0,0,119,123,3,24,12,0,120,123,3,18,9,0,121,123,3,20,10,0,122,119,1,0,0, + 0,122,120,1,0,0,0,122,121,1,0,0,0,123,125,1,0,0,0,124,126,3,16,8,0,125, + 124,1,0,0,0,125,126,1,0,0,0,126,13,1,0,0,0,127,130,3,18,9,0,128,130,3,22, + 11,0,129,127,1,0,0,0,129,128,1,0,0,0,130,132,1,0,0,0,131,133,3,16,8,0,132, + 131,1,0,0,0,132,133,1,0,0,0,133,15,1,0,0,0,134,135,5,44,0,0,135,136,5,7, + 0,0,136,139,5,44,0,0,137,140,3,18,9,0,138,140,3,22,11,0,139,137,1,0,0,0, + 139,138,1,0,0,0,140,142,1,0,0,0,141,134,1,0,0,0,142,143,1,0,0,0,143,141, + 1,0,0,0,143,144,1,0,0,0,144,164,1,0,0,0,145,146,5,44,0,0,146,147,5,6,0, + 0,147,150,5,44,0,0,148,151,3,18,9,0,149,151,3,22,11,0,150,148,1,0,0,0,150, + 149,1,0,0,0,151,153,1,0,0,0,152,145,1,0,0,0,153,154,1,0,0,0,154,152,1,0, + 0,0,154,155,1,0,0,0,155,164,1,0,0,0,156,157,5,44,0,0,157,158,5,8,0,0,158, + 161,5,44,0,0,159,162,3,18,9,0,160,162,3,22,11,0,161,159,1,0,0,0,161,160, + 1,0,0,0,162,164,1,0,0,0,163,141,1,0,0,0,163,152,1,0,0,0,163,156,1,0,0,0, + 164,17,1,0,0,0,165,166,3,26,13,0,166,19,1,0,0,0,167,171,5,31,0,0,168,170, + 5,44,0,0,169,168,1,0,0,0,170,173,1,0,0,0,171,169,1,0,0,0,171,172,1,0,0, + 0,172,176,1,0,0,0,173,171,1,0,0,0,174,177,3,12,6,0,175,177,3,22,11,0,176, + 174,1,0,0,0,176,175,1,0,0,0,177,181,1,0,0,0,178,180,5,44,0,0,179,178,1, + 0,0,0,180,183,1,0,0,0,181,179,1,0,0,0,181,182,1,0,0,0,182,184,1,0,0,0,183, + 181,1,0,0,0,184,185,5,32,0,0,185,21,1,0,0,0,186,190,5,31,0,0,187,189,5, + 44,0,0,188,187,1,0,0,0,189,192,1,0,0,0,190,188,1,0,0,0,190,191,1,0,0,0, + 191,195,1,0,0,0,192,190,1,0,0,0,193,196,3,14,7,0,194,196,3,22,11,0,195, + 193,1,0,0,0,195,194,1,0,0,0,196,200,1,0,0,0,197,199,5,44,0,0,198,197,1, + 0,0,0,199,202,1,0,0,0,200,198,1,0,0,0,200,201,1,0,0,0,201,203,1,0,0,0,202, + 200,1,0,0,0,203,204,5,32,0,0,204,23,1,0,0,0,205,207,5,27,0,0,206,208,5, + 44,0,0,207,206,1,0,0,0,207,208,1,0,0,0,208,209,1,0,0,0,209,211,3,28,14, + 0,210,212,5,44,0,0,211,210,1,0,0,0,211,212,1,0,0,0,212,223,1,0,0,0,213, + 215,5,3,0,0,214,216,5,44,0,0,215,214,1,0,0,0,215,216,1,0,0,0,216,217,1, + 0,0,0,217,219,3,28,14,0,218,220,5,44,0,0,219,218,1,0,0,0,219,220,1,0,0, + 0,220,222,1,0,0,0,221,213,1,0,0,0,222,225,1,0,0,0,223,221,1,0,0,0,223,224, + 1,0,0,0,224,226,1,0,0,0,225,223,1,0,0,0,226,227,5,28,0,0,227,25,1,0,0,0, + 228,233,5,51,0,0,229,230,5,44,0,0,230,231,5,9,0,0,231,232,5,44,0,0,232, + 234,5,51,0,0,233,229,1,0,0,0,233,234,1,0,0,0,234,27,1,0,0,0,235,237,5,52, + 0,0,236,235,1,0,0,0,236,237,1,0,0,0,237,245,1,0,0,0,238,246,3,30,15,0,239, + 240,3,30,15,0,240,241,5,44,0,0,241,242,5,17,0,0,242,243,5,44,0,0,243,244, + 3,36,18,0,244,246,1,0,0,0,245,238,1,0,0,0,245,239,1,0,0,0,246,248,1,0,0, + 0,247,249,5,52,0,0,248,247,1,0,0,0,248,249,1,0,0,0,249,29,1,0,0,0,250,255, + 5,51,0,0,251,252,5,2,0,0,252,256,5,38,0,0,253,254,5,1,0,0,254,256,5,51, + 0,0,255,251,1,0,0,0,255,253,1,0,0,0,255,256,1,0,0,0,256,31,1,0,0,0,257, + 259,3,34,17,0,258,257,1,0,0,0,259,262,1,0,0,0,260,258,1,0,0,0,260,261,1, + 0,0,0,261,33,1,0,0,0,262,260,1,0,0,0,263,264,5,52,0,0,264,266,3,44,22,0, + 265,263,1,0,0,0,265,266,1,0,0,0,266,267,1,0,0,0,267,268,5,52,0,0,268,269, + 5,14,0,0,269,270,5,44,0,0,270,272,3,36,18,0,271,273,5,44,0,0,272,271,1, + 0,0,0,272,273,1,0,0,0,273,274,1,0,0,0,274,276,5,31,0,0,275,277,5,44,0,0, + 276,275,1,0,0,0,276,277,1,0,0,0,277,278,1,0,0,0,278,280,3,38,19,0,279,281, + 5,44,0,0,280,279,1,0,0,0,280,281,1,0,0,0,281,292,1,0,0,0,282,284,5,3,0, + 0,283,285,5,44,0,0,284,283,1,0,0,0,284,285,1,0,0,0,285,286,1,0,0,0,286, + 288,3,38,19,0,287,289,5,44,0,0,288,287,1,0,0,0,288,289,1,0,0,0,289,291, + 1,0,0,0,290,282,1,0,0,0,291,294,1,0,0,0,292,290,1,0,0,0,292,293,1,0,0,0, + 293,296,1,0,0,0,294,292,1,0,0,0,295,297,5,52,0,0,296,295,1,0,0,0,296,297, + 1,0,0,0,297,298,1,0,0,0,298,300,5,32,0,0,299,301,5,44,0,0,300,299,1,0,0, + 0,300,301,1,0,0,0,301,302,1,0,0,0,302,304,5,29,0,0,303,305,5,52,0,0,304, + 303,1,0,0,0,304,305,1,0,0,0,305,307,1,0,0,0,306,308,5,44,0,0,307,306,1, + 0,0,0,307,308,1,0,0,0,308,309,1,0,0,0,309,311,3,46,23,0,310,312,5,52,0, + 0,311,310,1,0,0,0,311,312,1,0,0,0,312,313,1,0,0,0,313,314,5,30,0,0,314, + 35,1,0,0,0,315,316,5,51,0,0,316,37,1,0,0,0,317,319,5,52,0,0,318,317,1,0, + 0,0,318,319,1,0,0,0,319,320,1,0,0,0,320,322,3,40,20,0,321,323,5,44,0,0, + 322,321,1,0,0,0,322,323,1,0,0,0,323,324,1,0,0,0,324,326,5,2,0,0,325,327, + 5,44,0,0,326,325,1,0,0,0,326,327,1,0,0,0,327,328,1,0,0,0,328,329,3,42,21, + 0,329,39,1,0,0,0,330,331,5,51,0,0,331,41,1,0,0,0,332,338,5,5,0,0,333,334, + 5,4,0,0,334,335,5,21,0,0,335,336,5,5,0,0,336,338,5,24,0,0,337,332,1,0,0, + 0,337,333,1,0,0,0,338,43,1,0,0,0,339,343,5,1,0,0,340,342,8,0,0,0,341,340, + 1,0,0,0,342,345,1,0,0,0,343,341,1,0,0,0,343,344,1,0,0,0,344,348,1,0,0,0, + 345,343,1,0,0,0,346,347,5,52,0,0,347,349,3,44,22,0,348,346,1,0,0,0,348, + 349,1,0,0,0,349,45,1,0,0,0,350,353,7,1,0,0,351,353,8,2,0,0,352,350,1,0, + 0,0,352,351,1,0,0,0,353,356,1,0,0,0,354,352,1,0,0,0,354,355,1,0,0,0,355, + 47,1,0,0,0,356,354,1,0,0,0,60,49,52,56,60,64,71,79,84,89,100,102,109,113, + 122,125,129,132,139,143,150,154,161,163,171,176,181,190,195,200,207,211, + 215,219,223,233,236,245,248,255,260,265,272,276,280,284,288,292,296,300, + 304,307,311,318,322,326,337,343,348,352,354]; private static __ATN: ATN; public static get _ATN(): ATN { @@ -1793,6 +2069,9 @@ export class RelationDefContext extends ParserRuleContext { public relationDefGrouping(): RelationDefGroupingContext { return this.getTypedRuleContext(RelationDefGroupingContext, 0) as RelationDefGroupingContext; } + public relationRecurse(): RelationRecurseContext { + return this.getTypedRuleContext(RelationRecurseContext, 0) as RelationRecurseContext; + } public relationDefPartials(): RelationDefPartialsContext { return this.getTypedRuleContext(RelationDefPartialsContext, 0) as RelationDefPartialsContext; } @@ -1812,6 +2091,36 @@ export class RelationDefContext extends ParserRuleContext { } +export class RelationDefNoDirectContext extends ParserRuleContext { + constructor(parser?: OpenFGAParser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public relationDefGrouping(): RelationDefGroupingContext { + return this.getTypedRuleContext(RelationDefGroupingContext, 0) as RelationDefGroupingContext; + } + public relationRecurseNoDirect(): RelationRecurseNoDirectContext { + return this.getTypedRuleContext(RelationRecurseNoDirectContext, 0) as RelationRecurseNoDirectContext; + } + public relationDefPartials(): RelationDefPartialsContext { + return this.getTypedRuleContext(RelationDefPartialsContext, 0) as RelationDefPartialsContext; + } + public get ruleIndex(): number { + return OpenFGAParser.RULE_relationDefNoDirect; + } + public enterRule(listener: OpenFGAParserListener): void { + if(listener.enterRelationDefNoDirect) { + listener.enterRelationDefNoDirect(this); + } + } + public exitRule(listener: OpenFGAParserListener): void { + if(listener.exitRelationDefNoDirect) { + listener.exitRelationDefNoDirect(this); + } + } +} + + export class RelationDefPartialsContext extends ParserRuleContext { constructor(parser?: OpenFGAParser, parent?: ParserRuleContext, invokingState?: number) { super(parent, invokingState); @@ -1835,17 +2144,20 @@ export class RelationDefPartialsContext extends ParserRuleContext { public relationDefGrouping(i: number): RelationDefGroupingContext { return this.getTypedRuleContext(RelationDefGroupingContext, i) as RelationDefGroupingContext; } + public relationRecurseNoDirect_list(): RelationRecurseNoDirectContext[] { + return this.getTypedRuleContexts(RelationRecurseNoDirectContext) as RelationRecurseNoDirectContext[]; + } + public relationRecurseNoDirect(i: number): RelationRecurseNoDirectContext { + return this.getTypedRuleContext(RelationRecurseNoDirectContext, i) as RelationRecurseNoDirectContext; + } public AND_list(): TerminalNode[] { return this.getTokens(OpenFGAParser.AND); } public AND(i: number): TerminalNode { return this.getToken(OpenFGAParser.AND, i); } - public BUT_NOT_list(): TerminalNode[] { - return this.getTokens(OpenFGAParser.BUT_NOT); - } - public BUT_NOT(i: number): TerminalNode { - return this.getToken(OpenFGAParser.BUT_NOT, i); + public BUT_NOT(): TerminalNode { + return this.getToken(OpenFGAParser.BUT_NOT, 0); } public get ruleIndex(): number { return OpenFGAParser.RULE_relationDefPartials; @@ -1887,6 +2199,84 @@ export class RelationDefGroupingContext extends ParserRuleContext { } +export class RelationRecurseContext extends ParserRuleContext { + constructor(parser?: OpenFGAParser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public LPAREN(): TerminalNode { + return this.getToken(OpenFGAParser.LPAREN, 0); + } + public RPAREN(): TerminalNode { + return this.getToken(OpenFGAParser.RPAREN, 0); + } + public relationDef(): RelationDefContext { + return this.getTypedRuleContext(RelationDefContext, 0) as RelationDefContext; + } + public relationRecurseNoDirect(): RelationRecurseNoDirectContext { + return this.getTypedRuleContext(RelationRecurseNoDirectContext, 0) as RelationRecurseNoDirectContext; + } + public WHITESPACE_list(): TerminalNode[] { + return this.getTokens(OpenFGAParser.WHITESPACE); + } + public WHITESPACE(i: number): TerminalNode { + return this.getToken(OpenFGAParser.WHITESPACE, i); + } + public get ruleIndex(): number { + return OpenFGAParser.RULE_relationRecurse; + } + public enterRule(listener: OpenFGAParserListener): void { + if(listener.enterRelationRecurse) { + listener.enterRelationRecurse(this); + } + } + public exitRule(listener: OpenFGAParserListener): void { + if(listener.exitRelationRecurse) { + listener.exitRelationRecurse(this); + } + } +} + + +export class RelationRecurseNoDirectContext extends ParserRuleContext { + constructor(parser?: OpenFGAParser, parent?: ParserRuleContext, invokingState?: number) { + super(parent, invokingState); + this.parser = parser; + } + public LPAREN(): TerminalNode { + return this.getToken(OpenFGAParser.LPAREN, 0); + } + public RPAREN(): TerminalNode { + return this.getToken(OpenFGAParser.RPAREN, 0); + } + public relationDefNoDirect(): RelationDefNoDirectContext { + return this.getTypedRuleContext(RelationDefNoDirectContext, 0) as RelationDefNoDirectContext; + } + public relationRecurseNoDirect(): RelationRecurseNoDirectContext { + return this.getTypedRuleContext(RelationRecurseNoDirectContext, 0) as RelationRecurseNoDirectContext; + } + public WHITESPACE_list(): TerminalNode[] { + return this.getTokens(OpenFGAParser.WHITESPACE); + } + public WHITESPACE(i: number): TerminalNode { + return this.getToken(OpenFGAParser.WHITESPACE, i); + } + public get ruleIndex(): number { + return OpenFGAParser.RULE_relationRecurseNoDirect; + } + public enterRule(listener: OpenFGAParserListener): void { + if(listener.enterRelationRecurseNoDirect) { + listener.enterRelationRecurseNoDirect(this); + } + } + public exitRule(listener: OpenFGAParserListener): void { + if(listener.exitRelationRecurseNoDirect) { + listener.exitRelationRecurseNoDirect(this); + } + } +} + + export class RelationDefDirectAssignmentContext extends ParserRuleContext { constructor(parser?: OpenFGAParser, parent?: ParserRuleContext, invokingState?: number) { super(parent, invokingState); diff --git a/pkg/js/gen/OpenFGAParserListener.ts b/pkg/js/gen/OpenFGAParserListener.ts index a497c5df..db928511 100644 --- a/pkg/js/gen/OpenFGAParserListener.ts +++ b/pkg/js/gen/OpenFGAParserListener.ts @@ -10,8 +10,11 @@ import { TypeDefContext } from "./OpenFGAParser"; import { RelationDeclarationContext } from "./OpenFGAParser"; import { RelationNameContext } from "./OpenFGAParser"; import { RelationDefContext } from "./OpenFGAParser"; +import { RelationDefNoDirectContext } from "./OpenFGAParser"; import { RelationDefPartialsContext } from "./OpenFGAParser"; import { RelationDefGroupingContext } from "./OpenFGAParser"; +import { RelationRecurseContext } from "./OpenFGAParser"; +import { RelationRecurseNoDirectContext } from "./OpenFGAParser"; import { RelationDefDirectAssignmentContext } from "./OpenFGAParser"; import { RelationDefRewriteContext } from "./OpenFGAParser"; import { RelationDefTypeRestrictionContext } from "./OpenFGAParser"; @@ -101,6 +104,16 @@ export default class OpenFGAParserListener extends ParseTreeListener { * @param ctx the parse tree */ exitRelationDef?: (ctx: RelationDefContext) => void; + /** + * Enter a parse tree produced by `OpenFGAParser.relationDefNoDirect`. + * @param ctx the parse tree + */ + enterRelationDefNoDirect?: (ctx: RelationDefNoDirectContext) => void; + /** + * Exit a parse tree produced by `OpenFGAParser.relationDefNoDirect`. + * @param ctx the parse tree + */ + exitRelationDefNoDirect?: (ctx: RelationDefNoDirectContext) => void; /** * Enter a parse tree produced by `OpenFGAParser.relationDefPartials`. * @param ctx the parse tree @@ -121,6 +134,26 @@ export default class OpenFGAParserListener extends ParseTreeListener { * @param ctx the parse tree */ exitRelationDefGrouping?: (ctx: RelationDefGroupingContext) => void; + /** + * Enter a parse tree produced by `OpenFGAParser.relationRecurse`. + * @param ctx the parse tree + */ + enterRelationRecurse?: (ctx: RelationRecurseContext) => void; + /** + * Exit a parse tree produced by `OpenFGAParser.relationRecurse`. + * @param ctx the parse tree + */ + exitRelationRecurse?: (ctx: RelationRecurseContext) => void; + /** + * Enter a parse tree produced by `OpenFGAParser.relationRecurseNoDirect`. + * @param ctx the parse tree + */ + enterRelationRecurseNoDirect?: (ctx: RelationRecurseNoDirectContext) => void; + /** + * Exit a parse tree produced by `OpenFGAParser.relationRecurseNoDirect`. + * @param ctx the parse tree + */ + exitRelationRecurseNoDirect?: (ctx: RelationRecurseNoDirectContext) => void; /** * Enter a parse tree produced by `OpenFGAParser.relationDefDirectAssignment`. * @param ctx the parse tree diff --git a/pkg/js/package-lock.json b/pkg/js/package-lock.json index b8cd2f25..686f31d7 100644 --- a/pkg/js/package-lock.json +++ b/pkg/js/package-lock.json @@ -13,9 +13,9 @@ }, "devDependencies": { "@openfga/sdk": "^0.3.0-beta.1", - "@types/jest": "^29.5.10", + "@types/jest": "^29.5.11", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.10.3", + "@types/node": "^20.10.4", "@typescript-eslint/eslint-plugin": "^6.13.2", "@typescript-eslint/parser": "^6.13.2", "eslint": "^8.55.0", @@ -23,9 +23,9 @@ "eslint-plugin-import": "^2.29.0", "jest": "^29.7.0", "jest-html-reporter": "^3.10.2", - "prettier": "^3.1.0", + "prettier": "^3.1.1", "ts-jest": "^29.1.1", - "typescript": "^5.3.2", + "typescript": "^5.3.3", "yaml": "^2.3.4" } }, @@ -1370,9 +1370,9 @@ } }, "node_modules/@types/jest": { - "version": "29.5.10", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.10.tgz", - "integrity": "sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==", + "version": "29.5.11", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", + "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -1398,9 +1398,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", - "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", + "version": "20.10.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", + "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -5052,9 +5052,9 @@ } }, "node_modules/prettier": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", - "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -5866,9 +5866,9 @@ } }, "node_modules/typescript": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", - "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/pkg/js/package.json b/pkg/js/package.json index 4ee82e88..d94abd37 100644 --- a/pkg/js/package.json +++ b/pkg/js/package.json @@ -34,9 +34,9 @@ }, "devDependencies": { "@openfga/sdk": "^0.3.0-beta.1", - "@types/jest": "^29.5.10", + "@types/jest": "^29.5.11", "@types/js-yaml": "^4.0.9", - "@types/node": "^20.10.3", + "@types/node": "^20.10.4", "@typescript-eslint/eslint-plugin": "^6.13.2", "@typescript-eslint/parser": "^6.13.2", "eslint": "^8.55.0", @@ -44,9 +44,9 @@ "eslint-plugin-import": "^2.29.0", "jest": "^29.7.0", "jest-html-reporter": "^3.10.2", - "prettier": "^3.1.0", + "prettier": "^3.1.1", "ts-jest": "^29.1.1", - "typescript": "^5.3.2", + "typescript": "^5.3.3", "yaml": "^2.3.4" }, "files": [ diff --git a/pkg/js/tests/_testcases.ts b/pkg/js/tests/_testcases.ts index e1af75cf..d8447992 100644 --- a/pkg/js/tests/_testcases.ts +++ b/pkg/js/tests/_testcases.ts @@ -81,12 +81,10 @@ export function loadDSLValidationErrorTestCases(): MultipleInvalidTestCase[] { } export function loadInvalidJSONSyntaxTestCases(): InvalidJSONSyntaxTestCase[] { - const docs = yaml.parseAllDocuments( + return yaml.parse( fs.readFileSync( path.join(__dirname, "../../../tests", "data", "json-syntax-transformer-validation-cases.yaml"), "utf-8", ), - ); - - return docs.map((d) => d.toJSON()) as InvalidJSONSyntaxTestCase[]; + ) as InvalidJSONSyntaxTestCase[]; } diff --git a/pkg/js/tests/jsontodsl.test.ts b/pkg/js/tests/jsontodsl.test.ts index 1d6cdacd..8853ff90 100644 --- a/pkg/js/tests/jsontodsl.test.ts +++ b/pkg/js/tests/jsontodsl.test.ts @@ -18,7 +18,11 @@ describe("jsonToDSL", () => { const testFn = testCase.skip ? it.skip : it; testFn(`should throw an error when transforming ${testCase.name} from JSON to DSL`, () => { - expect(() => transformJSONStringToDSL(testCase.json)).toThrow(testCase.error_message); + if (testCase.error_message) { + expect(() => transformJSONStringToDSL(testCase.json)).toThrow(testCase.error_message); + } else { + expect(() => transformJSONStringToDSL(testCase.json)).not.toThrow(); + } }); }); }); diff --git a/pkg/js/transformer/dsltojson.ts b/pkg/js/transformer/dsltojson.ts index 64074b18..e8e1e698 100644 --- a/pkg/js/transformer/dsltojson.ts +++ b/pkg/js/transformer/dsltojson.ts @@ -22,6 +22,8 @@ import OpenFGAParser, { RelationDefPartialsContext, RelationDefRewriteContext, RelationDefTypeRestrictionContext, + RelationRecurseContext, + RelationRecurseNoDirectContext, TypeDefContext, TypeDefsContext, } from "../gen/OpenFGAParser"; @@ -44,6 +46,51 @@ interface Relation { typeInfo: RelationTypeInfo; } +function parseExpression( + rewrites: Userset[] | undefined, + operator: RelationDefinitionOperator | undefined, +): Userset | undefined { + let relationDef: Userset | undefined; + + if (!rewrites?.length) { + return; + } + if (rewrites?.length === 1) { + relationDef = rewrites[0]; + } else { + switch (operator) { + case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_OR: + relationDef = { + union: { + child: rewrites, + }, + }; + break; + case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_AND: + relationDef = { + intersection: { + child: rewrites, + }, + }; + break; + case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_BUT_NOT: + relationDef = { + difference: { + base: rewrites.shift()!, + subtract: rewrites.shift()!, + }, + }; + break; + } + } + return relationDef; +} + +interface StackRelation { + rewrites: Userset[]; + operator: RelationDefinitionOperator; +} + /** * This Visitor walks the tree generated by parsers and produces Python code * @@ -55,6 +102,8 @@ class OpenFgaDslListener extends OpenFGAListener { private currentRelation: Partial | undefined; private currentCondition: Condition | undefined; + private rewriteStack: StackRelation[] = []; + exitModelHeader = (ctx: ModelHeaderContext) => { if (ctx.SCHEMA_VERSION()) { this.authorizationModel.schema_version = ctx.SCHEMA_VERSION().getText(); @@ -107,6 +156,8 @@ class OpenFgaDslListener extends OpenFGAListener { rewrites: [], typeInfo: { directly_related_user_types: [] }, }; + + this.rewriteStack = []; }; exitRelationDeclaration = (ctx: RelationDeclarationContext) => { @@ -115,39 +166,10 @@ class OpenFgaDslListener extends OpenFGAListener { } const relationName = ctx.relationName().getText(); - let relationDef: Userset | undefined; const rewrites = this.currentRelation?.rewrites; - if (!rewrites?.length) { - return; - } - if (rewrites?.length === 1) { - relationDef = rewrites[0]; - } else { - switch (this.currentRelation?.operator) { - case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_OR: - relationDef = { - union: { - child: rewrites, - }, - }; - break; - case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_AND: - relationDef = { - intersection: { - child: rewrites, - }, - }; - break; - case RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_BUT_NOT: - relationDef = { - difference: { - base: rewrites![0], - subtract: rewrites![1], - }, - }; - break; - } - } + + let relationDef = parseExpression(rewrites, this.currentRelation?.operator); + if (relationDef) { // Throw error if same named relation occurs more than once in a relationship definition block if (this.currentTypeDef!.relations![relationName]) { @@ -180,6 +202,7 @@ class OpenFgaDslListener extends OpenFGAListener { }; this.currentRelation?.rewrites?.push(partialRewrite); }; + exitRelationDefTypeRestriction = (ctx: RelationDefTypeRestrictionContext) => { const relationRef: Partial = {}; const baseRestriction = ctx.relationDefTypeRestrictionBase(); @@ -227,12 +250,44 @@ class OpenFgaDslListener extends OpenFGAListener { this.currentRelation?.rewrites?.push(partialRewrite); }; + exitRelationRecurse = (ctx: RelationRecurseContext) => { + const rewrites = this.currentRelation?.rewrites; + + let relationDef = parseExpression(rewrites, this.currentRelation?.operator); + + if (relationDef) { + this.currentRelation!.rewrites = [relationDef]; + } + }; + + enterRelationRecurseNoDirect = (ctx: RelationRecurseNoDirectContext) => { + this.rewriteStack?.push({ + rewrites: this.currentRelation!.rewrites!, + operator: this.currentRelation!.operator!, + }); + + this.currentRelation!.rewrites = []; + }; + + exitRelationRecurseNoDirect = (ctx: RelationRecurseNoDirectContext) => { + const rewrites = this.currentRelation?.rewrites; + + let relationDef = parseExpression(rewrites, this.currentRelation?.operator); + + const stack = this.rewriteStack.pop(); + + if (relationDef) { + this.currentRelation!.operator = stack?.operator; + this.currentRelation!.rewrites = [...stack!.rewrites, relationDef]; + } + }; + enterRelationDefPartials = (ctx: RelationDefPartialsContext) => { if (ctx.OR_list().length) { this.currentRelation!.operator = RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_OR; } else if (ctx.AND_list().length) { this.currentRelation!.operator = RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_AND; - } else if (ctx.BUT_NOT_list().length) { + } else if (ctx.BUT_NOT()) { this.currentRelation!.operator = RelationDefinitionOperator.RELATION_DEFINITION_OPERATOR_BUT_NOT; } }; diff --git a/pkg/js/transformer/jsontodsl.ts b/pkg/js/transformer/jsontodsl.ts index f1f04abc..ad9832d5 100644 --- a/pkg/js/transformer/jsontodsl.ts +++ b/pkg/js/transformer/jsontodsl.ts @@ -9,6 +9,47 @@ import type { } from "@openfga/sdk"; import { ConditionNameDoesntMatchError, UnsupportedDSLNestingError } from "../errors"; +class DirectAssignmentValidator { + occured: number = 0; + stateStack: Userset[] = []; + + isFirstPosition = (userset: Userset): boolean => { + // Throw error is direct assignemnt is present, and not the first element. + if (userset.this) { + return true; + } + + if (userset.difference?.base) { + if (userset.difference.base.this) { + return true; + } else { + return this.isFirstPosition(userset.difference.base); + } + } else if (userset.intersection?.child.length) { + if (userset.intersection.child[0].this) { + return true; + } else { + return this.isFirstPosition(userset.intersection.child[0]); + } + } else if (userset.union?.child.length) { + if (userset.union.child[0].this) { + return true; + } else { + return this.isFirstPosition(userset.union.child[0]); + } + } + + return false; + }; + + reset = () => { + this.occured = 0; + this.stateStack = []; + }; +} + +const validator = new DirectAssignmentValidator(); + function parseTypeRestriction(restriction: RelationReference): string { const typeName = restriction.type; const relation = restriction.relation; @@ -110,6 +151,8 @@ function parseSubRelation( typeRestrictions: RelationReference[], ): string { if (relationDefinition.this != null) { + // Make sure we no more than 1 reference for direct assignment in a given relation + validator.occured++; return parseThis(typeRestrictions); } @@ -121,6 +164,18 @@ function parseSubRelation( return parseTupleToUserset(relationDefinition); } + if (relationDefinition.union != null) { + return `(${parseUnion(typeName, relationName, relationDefinition, typeRestrictions)})`; + } + + if (relationDefinition.intersection != null) { + return `(${parseIntersection(typeName, relationName, relationDefinition, typeRestrictions)})`; + } + + if (relationDefinition.difference != null) { + return `(${parseDifference(typeName, relationName, relationDefinition, typeRestrictions)})`; + } + throw new UnsupportedDSLNestingError(typeName, relationName); } @@ -130,6 +185,8 @@ function parseRelation( relationDefinition: Userset = {}, relationMetadata: RelationMetadata = {}, ) { + validator.reset(); + let parsedRelationString = ` define ${relationName}: `; const typeRestrictions: RelationReference[] = relationMetadata.directly_related_user_types || []; @@ -143,7 +200,12 @@ function parseRelation( parsedRelationString += parseSubRelation(typeName, relationName, relationDefinition, typeRestrictions); } - return parsedRelationString; + // Check if we have either no direct assignment, or we had exactly 1 direct assignment in the first position + if (!validator.occured || (validator.occured === 1 && validator.isFirstPosition(relationDefinition))) { + return parsedRelationString; + } + + throw new Error(`the '${relationName}' relation definition under the '${typeName}' type is not supported by the OpenFGA DSL syntax yet`); } const parseType = (typeDef: TypeDefinition): string => { @@ -217,6 +279,8 @@ const parseConditions = (model: AuthorizationModel): string => { }; export const transformJSONToDSL = (model: AuthorizationModel): string => { + validator.reset(); + const schemaVersion = model?.schema_version || "1.1"; const typeDefinitions = model?.type_definitions?.map((typeDef) => parseType(typeDef)); const parsedConditionsString = parseConditions(model); diff --git a/pkg/js/util/exceptions.ts b/pkg/js/util/exceptions.ts index d41f8eb6..3b571e42 100644 --- a/pkg/js/util/exceptions.ts +++ b/pkg/js/util/exceptions.ts @@ -79,6 +79,18 @@ const createTupleUsersetRequireDirectError = (props: BaseProps) => { ); }; +const createNoEntryPointLoopError = (props: BaseProps, typeName: string) => { + const { errors, lines, lineIndex, symbol } = props; + errors.push( + constructValidationError({ + message: `\`${symbol}\` is an impossible relation for \`${typeName}\` (potential loop).`, + lines, + lineIndex, + metadata: { symbol, errorType: ValidationError.RelationNoEntrypoint, relation: symbol }, + }), + ); +}; + const createNoEntryPointError = (props: BaseProps, typeName: string) => { const { errors, lines, lineIndex, symbol } = props; errors.push( @@ -350,6 +362,9 @@ export const exceptionCollector = (errors: ModelValidationSingleError[], lines: raiseDuplicateRelationshipDefinition(lineIndex: number, symbol: string) { createDuplicateRelationshipDefinitionError({ errors, lines, lineIndex, symbol }); }, + raiseNoEntryPointLoop(lineIndex: number, symbol: string, typeName: string) { + createNoEntryPointLoopError({ errors, lines, lineIndex, symbol }, typeName); + }, raiseNoEntryPoint(lineIndex: number, symbol: string, typeName: string) { createNoEntryPointError({ errors, lines, lineIndex, symbol }, typeName); }, diff --git a/pkg/js/validator/validate-dsl.ts b/pkg/js/validator/validate-dsl.ts index bc8e4577..46880d7a 100644 --- a/pkg/js/validator/validate-dsl.ts +++ b/pkg/js/validator/validate-dsl.ts @@ -38,6 +38,10 @@ interface RelationTargetParserResult { rewrite: RewriteType; } +const deepCopy = (object: any): any => { + return JSON.parse(JSON.stringify(object)); +}; + const geConditionLineNumber = (conditionName: string, lines: string[], skipIndex?: number) => { if (!skipIndex) { skipIndex = 0; @@ -168,166 +172,160 @@ function allowableTypes(typeName: Record, type: string, return [allowedTypes, isValid]; } -// helper function to parse through a child relation to see if there are unique entry points. -// Entry point describes ways that tuples can be assigned to the relation -// For example, -// type user -// type org -// relations -// define member: [user] -// we can assign a user with (type user) to org's member -// However, in the following example -// type doc -// relations -// define reader as writer -// define writer as reader -// It is impossible to have any tuples that assign to doc's reader and writer -function childHasEntryPoint( - transformedTypes: Record, +// for the type/relation, whether there are any unique entry points, and if a loop is found +// if there are unique entry points (i.e., direct relations) then it will return true +// otherwise, it will follow its children to see if there are unique entry points +// if there is a loop durig traversal, the function will return a boolean indicating so +function hasEntryPointOrLoop( + typeMap: Record, + typeName: string, + relationName: string | undefined, + rewrite: Userset, visitedRecords: Record>, - type: string, - childDef: RelationTargetParserResult | undefined, - allowedTypes: string[], -): boolean { - if (!childDef) { - return false; +): [boolean, boolean] { + // Deep copy + const visited = deepCopy(visitedRecords); + + if (!relationName) { + // nothing to do if relation is undefined + return [false, false]; } - if (childDef.rewrite === RewriteType.Direct) { - // we can safely assume that direct rewrite (i.e., it is a self/this), there are direct entry point - for (const item of allowedTypes) { - const { decodedType, decodedRelation } = destructTupleToUserset(item); - if (!decodedRelation) { - // this is not a tuple set and is a straight type, we can return true right away - return true; + if (!visited[typeName]) { + visited[typeName] = {}; + } + visited[typeName][relationName] = true; + + const currentRelation = typeMap[typeName].relations; + if (!currentRelation || !currentRelation[relationName]) { + return [false, false]; + } + + const relationMetadata = typeMap[typeName].metadata?.relations; + + if (!typeMap[typeName].relations || !typeMap[typeName].relations![relationName]) { + return [false, false]; + } + + if (rewrite.this) { + for (const assignableType of getTypeRestrictions( + relationMetadata?.[relationName]?.directly_related_user_types || [], + )) { + const { decodedType, decodedRelation, isWildcard } = destructTupleToUserset(assignableType); + if (!decodedRelation || isWildcard) { + return [true, false]; } - // it is only true if it has unique entry point - if (hasEntryPoint(transformedTypes, visitedRecords, decodedType, decodedRelation)) { - return true; + + const assignableRelation = typeMap[decodedType].relations![decodedRelation]; + if (!assignableRelation) { + return [false, false]; + } + + if (visited[decodedType][decodedRelation]) { + continue; + } + + const [hasEntry, _] = hasEntryPointOrLoop(typeMap, decodedType, decodedRelation, assignableRelation, visited); + if (hasEntry) { + return [true, false]; } } - } - // otherwise, we will need to follow the child - if (!childDef.from) { - // this is a simpler case - we only need to check the child type itself - if (hasEntryPoint(transformedTypes, visitedRecords, type, childDef.target)) { - return true; + + return [false, false]; + } else if (rewrite.computedUserset) { + const computedRelationName = rewrite.computedUserset.relation; + if (!computedRelationName) { + return [false, false]; } - } else { - // there is a from. We need to parse thru all the from's possible type - // to see if there are unique entry point - const fromPossibleTypes = getTypeRestrictions( - transformedTypes[type].metadata?.relations![childDef.from].directly_related_user_types || [], - ); - for (const fromType of fromPossibleTypes) { - const { decodedType } = destructTupleToUserset(fromType); + if (!typeMap[typeName].relations![computedRelationName]) { + return [false, false]; + } - // For now, we just look at the type without seeing whether the user set - // of the type is reachable too in the case of tuple to user set. - // TODO: We may have to investigate whether we need to dive into relation (if present) of the userset - if (hasEntryPoint(transformedTypes, visitedRecords, decodedType, childDef.target)) { - return true; - } + const computedRelation = typeMap[typeName].relations![computedRelationName]; + if (!computedRelation) { + return [false, false]; } - } - return false; -} -// for the type/relation, whether there are any unique entry points -// if there are unique entry points (i.e., direct relations) then it will return true -// otherwise, it will follow its children to see if there are unique entry points -function hasEntryPoint( - typeMap: Record, - visitedRecords: Record>, - type: string, - relation: string | undefined, -): boolean { - if (!relation) { - // nothing to do if relation is undefined - return false; - } - // check to see if we already visited this relation to avoid infinite loop - if (visitedRecords[type] && visitedRecords[type][relation]) { - return false; - } - if (!visitedRecords[type]) { - visitedRecords[type] = {}; - } - visitedRecords[type][relation] = true; + // Loop detected + if (visited[typeName][computedRelationName]) { + return [false, true]; + } - const currentRelation = typeMap[type].relations; - if (!currentRelation || !currentRelation[relation]) { - return false; - } + const [hasEntry, loop] = hasEntryPointOrLoop(typeMap, typeName, computedRelationName, computedRelation, visited); + return [hasEntry, loop]; + } else if (rewrite.tupleToUserset) { + const tuplesetRelationName = rewrite.tupleToUserset.tupleset.relation; + const computedRelationName = rewrite.tupleToUserset.computedUserset.relation; - const relationMetadata = typeMap[type].metadata?.relations; - - const allowedTypes = getTypeRestrictions(relationMetadata?.[relation]?.directly_related_user_types || []); - - if (Object.prototype.hasOwnProperty.call(currentRelation[relation], RelationDefOperator.Union)) { - for (const childDef of currentRelation[relation].union?.child || []) { - if ( - childHasEntryPoint( - typeMap, - // create deep copy - JSON.parse(JSON.stringify(visitedRecords)), - type, - getRelationalParserResult(childDef), - allowedTypes, - ) - ) { - return true; + if (!tuplesetRelationName || !computedRelationName) { + return [false, false]; + } + + const tuplesetRelation = typeMap[typeName].relations![tuplesetRelationName]; + if (!tuplesetRelation) { + return [false, false]; + } + + for (const assignableType of getTypeRestrictions( + relationMetadata?.[tuplesetRelationName]?.directly_related_user_types || [], + )) { + const assignableRelation = typeMap[assignableType].relations![computedRelationName]; + if (assignableRelation) { + if (visited[assignableType] && visited[assignableType][computedRelationName]) { + continue; + } + + const [hasEntry, _] = hasEntryPointOrLoop(typeMap, assignableType, computedRelationName, assignableRelation, visited); + if (hasEntry) { + return [true, false]; + } } } - return false; - } else if (Object.prototype.hasOwnProperty.call(currentRelation[relation], RelationDefOperator.Intersection)) { - // this requires all child to have entry point - for (const childDef of currentRelation[relation].intersection?.child || []) { - if ( - !childHasEntryPoint( - typeMap, - // create deep copy - JSON.parse(JSON.stringify(visitedRecords)), - type, - getRelationalParserResult(childDef), - allowedTypes, - ) - ) { - return false; + return [false, false]; + } else if (rewrite.union) { + let loop = false; + + for (const child of rewrite.union.child) { + const [entryPoint, childLoop] = hasEntryPointOrLoop(typeMap, typeName, relationName, child, deepCopy(visited)); + if (entryPoint) { + return [true, false]; } + loop = loop || childLoop; } - return true; - } else if (Object.prototype.hasOwnProperty.call(currentRelation[relation], RelationDefOperator.Difference)) { - // difference requires both base and subtract to have entry - if ( - !childHasEntryPoint( - typeMap, - JSON.parse(JSON.stringify(visitedRecords)), - type, - getRelationalParserResult(currentRelation[relation].difference!.base), - allowedTypes, - ) || - !childHasEntryPoint( - typeMap, - JSON.parse(JSON.stringify(visitedRecords)), - type, - getRelationalParserResult(currentRelation[relation].difference!.subtract), - allowedTypes, - ) - ) { - return false; + return [false, loop]; + } else if (rewrite.intersection) { + for (const child of rewrite.intersection.child) { + const [hasEntry, childLoop] = hasEntryPointOrLoop(typeMap, typeName, relationName, child, deepCopy(visited)); + if (!hasEntry) { + return [false, childLoop]; + } } - return true; - } else { - // Single - const values = getRelationalParserResult(currentRelation[relation]); - if (childHasEntryPoint(typeMap, JSON.parse(JSON.stringify(visitedRecords)), type, values, allowedTypes)) { - return true; + + return [true, false]; + } else if (rewrite.difference) { + const visited = deepCopy(visitedRecords); + + const [hasEntryBase, loopBase] = hasEntryPointOrLoop(typeMap, typeName, relationName, rewrite.difference.base, visited); + if (!hasEntryBase) { + return [false, loopBase]; + } + + const [hasEntrySubtract, loopSubtract] = hasEntryPointOrLoop( + typeMap, + typeName, + relationName, + rewrite.difference.subtract, + visited, + ); + if (!hasEntrySubtract) { + return [false, loopSubtract]; } - return false; + return [true, false]; } + + return [false, false]; } function checkForDuplicatesTypeNamesInRelation( @@ -553,40 +551,21 @@ function relationDefined( return; } - const currentRelation = relations[relation]; - if (Object.prototype.hasOwnProperty.call(currentRelation, RelationDefOperator.Union)) { - for (const childDef of currentRelation.union?.child || []) { - childDefDefined(lines, collector, typeMap, type, relation, getRelationalParserResult(childDef), conditions); - } - } else if (Object.prototype.hasOwnProperty.call(currentRelation, RelationDefOperator.Intersection)) { - for (const childDef of currentRelation.intersection?.child || []) { - childDefDefined(lines, collector, typeMap, type, relation, getRelationalParserResult(childDef), conditions); - } - } else if (Object.prototype.hasOwnProperty.call(currentRelation, RelationDefOperator.Difference)) { - if (currentRelation.difference?.base) { - childDefDefined( - lines, - collector, - typeMap, - type, - relation, - getRelationalParserResult(currentRelation.difference.base), - conditions, - ); - } - if (currentRelation.difference?.subtract) { - childDefDefined( - lines, - collector, - typeMap, - type, - relation, - getRelationalParserResult(currentRelation.difference.subtract), - conditions, - ); + const currentRelation = { ...relations[relation] }; + const children: Userset[] = [currentRelation]; + + while (children.length) { + const child = children.shift(); + + if (child?.union?.child.length) { + children.push(...child.union.child); + } else if (child?.intersection?.child.length) { + children.push(...child.intersection.child); + } else if (child?.difference?.base && child.difference.subtract) { + children.push(child?.difference?.base, child.difference.subtract); + } else if (child) { + childDefDefined(lines, collector, typeMap, type, relation, getRelationalParserResult(child), conditions); } - } else { - childDefDefined(lines, collector, typeMap, type, relation, getRelationalParserResult(currentRelation), conditions); } } @@ -660,10 +639,16 @@ function modelValidation( const typeName = typeDef.type; // parse through each of the relations to do validation for (const relationName in typeDef.relations) { - if (!hasEntryPoint(typeMap, {}, typeName, relationName)) { + const currentRelation = typeMap[typeName].relations; + const [hasEntry, loop] = hasEntryPointOrLoop(typeMap, typeName, relationName, currentRelation![relationName], {}); + if (!hasEntry) { const typeIndex = getTypeLineNumber(typeName, lines); const lineIndex = getRelationLineNumber(relationName, lines, typeIndex); - collector.raiseNoEntryPoint(lineIndex, relationName, typeName); + if (loop) { + collector.raiseNoEntryPointLoop(lineIndex, relationName, typeName); + } else { + collector.raiseNoEntryPoint(lineIndex, relationName, typeName); + } } } }); diff --git a/tests/data/dsl-semantic-validation-cases.yaml b/tests/data/dsl-semantic-validation-cases.yaml index be46c594..cd5e9b26 100644 --- a/tests/data/dsl-semantic-validation-cases.yaml +++ b/tests/data/dsl-semantic-validation-cases.yaml @@ -360,7 +360,7 @@ define reader: writer define writer: reader expected_errors: - - msg: '`reader` is an impossible relation for `document` (no entrypoint).' + - msg: '`reader` is an impossible relation for `document` (potential loop).' line: start: 5 end: 5 @@ -369,7 +369,7 @@ end: 18 metadata: errorType: relation-no-entry-point - - msg: '`writer` is an impossible relation for `document` (no entrypoint).' + - msg: '`writer` is an impossible relation for `document` (potential loop).' line: start: 6 end: 6 @@ -542,7 +542,7 @@ define action2: admin and action3 and action1 define action3: admin and action1 and action2 expected_errors: - - msg: '`action1` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action1` is an impossible relation for `doc` (potential loop).' line: start: 7 end: 7 @@ -551,7 +551,7 @@ end: 19 metadata: errorType: relation-no-entry-point - - msg: '`action2` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action2` is an impossible relation for `doc` (potential loop).' line: start: 8 end: 8 @@ -560,7 +560,7 @@ end: 19 metadata: errorType: relation-no-entry-point - - msg: '`action3` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action3` is an impossible relation for `doc` (potential loop).' line: start: 9 end: 9 @@ -581,7 +581,7 @@ define action2: admin but not action3 define action3: admin but not action1 expected_errors: - - msg: '`action1` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action1` is an impossible relation for `doc` (potential loop).' line: start: 7 end: 7 @@ -590,7 +590,7 @@ end: 19 metadata: errorType: relation-no-entry-point - - msg: '`action2` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action2` is an impossible relation for `doc` (potential loop).' line: start: 8 end: 8 @@ -599,7 +599,7 @@ end: 19 metadata: errorType: relation-no-entry-point - - msg: '`action3` is an impossible relation for `doc` (no entrypoint).' + - msg: '`action3` is an impossible relation for `doc` (potential loop).' line: start: 9 end: 9 diff --git a/tests/data/dsl-syntax-validation-cases.yaml b/tests/data/dsl-syntax-validation-cases.yaml index 6fe68eb2..85affb0e 100644 --- a/tests/data/dsl-syntax-validation-cases.yaml +++ b/tests/data/dsl-syntax-validation-cases.yaml @@ -136,15 +136,134 @@ define blocked: [user] define viewer: [user] and follower or own but not blocked expected_errors: - - msg: "mismatched input 'or' expecting 'and'" + - msg: "mismatched input ' ' expecting {, NEWLINE}" line: start: 8 end: 8 column: - start: 39 - end: 41 + start: 38 + end: 39 metadata: - symbol: "or" + symbol: " " +- name: mixed operators with parens + dsl: | + model + schema 1.1 + type user + relations + define own: [user] + define follower: [user] + define blocked: [user] + define viewer: [user] and (follower but not blocked) or own + expected_errors: + - msg: "mismatched input ' ' expecting {, NEWLINE}" + line: + start: 8 + end: 8 + column: + start: 56 + end: 57 + metadata: + symbol: " " +- name: mixed operators with mulitple paren sets + dsl: | + model + schema 1.1 + type user + relations + define own: [user] + define follower: [user] + define blocked: [user] + define viewer: [user] and (follower but not blocked) or (foo and bar) and (baz or foobar) + expected_errors: + - msg: "mismatched input ' ' expecting {, NEWLINE}" + line: + start: 8 + end: 8 + column: + start: 56 + end: 57 + metadata: + symbol: " " +- name: mixed operators with mulitple operations and paren sets + dsl: | + model + schema 1.1 + type user + relations + define allowed: [user] + define follower: [user] + define blocked: [user] + define restricted: [user] + define viewer: [user] or allowed or follower or (blocked or restricted or (foo and bar but not baz)) + expected_errors: + - msg: "extraneous input 'but not' expecting {')', WHITESPACE}" + line: + start: 9 + end: 9 + column: + start: 91 + end: 98 + metadata: + symbol: "but not" + - msg: "extraneous input 'baz' expecting {')', WHITESPACE}" + line: + start: 9 + end: 9 + column: + start: 99 + end: 102 + metadata: + symbol: "baz" +- name: mixed operators with mixed operations and paren sets + dsl: | + model + schema 1.1 + type user + relations + define follower: [user] + define blocked: [user] + define restricted: [user] + define viewer: [user] and follower or (restricted but not blocked) + expected_errors: + - msg: "mismatched input ' ' expecting {, NEWLINE}" + line: + start: 8 + end: 8 + column: + start: 38 + end: 39 + metadata: + symbol: " " +- name: mixed operators with mixed operations and paren sets + dsl: | + model + schema 1.1 + type user + relations + define follower: [user] + define blocked: [user] + define restricted: [user] + define viewer: [user] and (follower but not blocked but not restricted) + expected_errors: + - msg: "extraneous input 'but not' expecting {')', WHITESPACE}" + line: + start: 8 + end: 8 + column: + start: 56 + end: 63 + metadata: + symbol: "but not" + - msg: "extraneous input 'restricted' expecting {')', WHITESPACE}" + line: + start: 8 + end: 8 + column: + start: 64 + end: 74 + metadata: + symbol: "restricted" - name: misspelled define dsl: | model @@ -206,33 +325,15 @@ end: 20 metadata: symbol: 'as' - - msg: "no viable alternative at input ' self'" + - msg: "mismatched input ' ' expecting {, NEWLINE}" line: start: 9 end: 9 column: - start: 21 - end: 25 - metadata: - symbol: 'self' - - msg: "missing ':' at 'as'" - line: - start: 10 - end: 10 - column: - start: 18 - end: 20 - metadata: - symbol: 'as' - - msg: "no viable alternative at input ' viewer'" - line: - start: 10 - end: 10 - column: - start: 21 - end: 27 + start: 20 + end: 21 metadata: - symbol: 'viewer' + symbol: ' ' - name: empty directly assignable relations with spaces should yield error dsl: | model @@ -344,15 +445,15 @@ end: 20 metadata: symbol: 'as' - - msg: "no viable alternative at input ' self'" + - msg: "mismatched input ' ' expecting {, NEWLINE}" line: start: 7 end: 7 column: - start: 21 - end: 25 + start: 20 + end: 21 metadata: - symbol: 'self' + symbol: ' ' - name: >- mixing 1.0 and 1.1 should not be allowed as non assignable self is not allowed @@ -374,16 +475,15 @@ end: 20 metadata: symbol: 'as' - - msg: "no viable alternative at input ' self'" + - msg: "mismatched input ' ' expecting {, NEWLINE}" line: start: 7 end: 7 column: - start: 21 - end: 25 + start: 20 + end: 21 metadata: - symbol: 'self' - + symbol: ' ' - name: should not allow no model schema dsl: | type user @@ -446,7 +546,7 @@ define editor: [user] define viewer: editor but not [document#viewer] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 7 end: 7 @@ -473,7 +573,7 @@ define viewer: [document#viewer] or [document#editor] define editor: [document#viewer] or [document#editor] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 5 end: 5 @@ -501,7 +601,7 @@ define editor: [user] define viewer: [user] and [document#editor] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 7 end: 7 @@ -529,7 +629,7 @@ define editor: [user] define viewer: [document#editor] but not [user] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 7 end: 7 @@ -557,7 +657,7 @@ define editor: [user] define viewer: [user] but not [document#editor] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 7 end: 7 @@ -585,7 +685,7 @@ define editor: [user] define viewer: [user] or [document#editor] expected_errors: - - msg: "extraneous input '[' expecting IDENTIFIER" + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" line: start: 7 end: 7 @@ -1076,3 +1176,219 @@ condition is_not_hidden(status: string) { status != "hidden" } + +- name: a valid model with multiple operators + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: [user] + define rel3: [user] + define rel4: [user] + define rel5: [user] + define rel6: [user] + define rel7: [user] + define rel8: [user] + define rel9: (rel1 or rel2 or rel3) but not ((rel4 and rel5 and rel6) but not (rel7 but not rel8)) + +- name: a valid model with multiple operators x2 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: [user] + define rel3: [user] + define rel4: [user] + define rel5: [user] + define rel6: [user] + define rel7: [user] + define rel8: [user] + define rel9: ((rel1 or rel2 or rel3) but not ((rel4 and rel5 and rel6) but not (rel7 but not rel8))) + +- name: an invalid model with multiple type restriction instances in a relation definition + dsl: | + model + schema 1.1 + type user + relations + define viewer: [user] or [user] + expected_errors: + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" + line: + start: 5 + end: 5 + column: + start: 29 + end: 30 + metadata: + symbol: "[" + - msg: "extraneous input ']' expecting {, NEWLINE}" + line: + start: 5 + end: 5 + column: + start: 34 + end: 35 + metadata: + symbol: "]" + +- name: an invalid model with confusing but not references + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: [user] + define rel3: [user] + define rel4: rel1 but not rel2 but not rel3 + expected_errors: + - msg: "mismatched input ' ' expecting {, NEWLINE}" + line: + start: 8 + end: 8 + column: + start: 34 + end: 35 + metadata: + symbol: " " + +- name: an invalid model with mixed operators + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: [user] + define rel3: [user] + define rel4: rel1 and rel2 or rel3 + expected_errors: + - msg: "mismatched input ' ' expecting {, NEWLINE}" + line: + start: 8 + end: 8 + column: + start: 30 + end: 31 + metadata: + symbol: " " + +- name: an invalid model x1 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: but not rel1 + expected_errors: + - msg: "mismatched input 'but not' expecting {'[', '(', IDENTIFIER}" + line: + start: 6 + end: 6 + column: + start: 17 + end: 24 + metadata: + symbol: "but not" + +- name: an invalid model x2 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: or rel1 + expected_errors: + - msg: "mismatched input 'or' expecting {'[', '(', IDENTIFIER}" + line: + start: 6 + end: 6 + column: + start: 17 + end: 19 + metadata: + symbol: "or" + +- name: an invalid model x3 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: and rel1 + expected_errors: + - msg: "mismatched input 'and' expecting {'[', '(', IDENTIFIER}" + line: + start: 6 + end: 6 + column: + start: 17 + end: 20 + metadata: + symbol: "and" + +- name: an invalid model with the type definition not in the first place x1 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: rel1 and [user] + expected_errors: + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" + line: + start: 6 + end: 6 + column: + start: 26 + end: 27 + metadata: + symbol: "[" + - msg: "extraneous input ']' expecting {, NEWLINE}" + line: + start: 6 + end: 6 + column: + start: 31 + end: 32 + metadata: + symbol: "]" + +- name: an invalid model with the type definition not in the first place x2 + dsl: | + model + schema 1.1 + type user + relations + define rel1: [user] + define rel2: [user] + define rel3: [user] + define relation: rel3 or ((rel1 and rel2) but not [user]) + expected_errors: + - msg: "extraneous input '[' expecting {'(', IDENTIFIER}" + line: + start: 8 + end: 8 + column: + start: 54 + end: 55 + metadata: + symbol: "[" + - msg: "extraneous input ']' expecting {')', WHITESPACE}" + line: + start: 8 + end: 8 + column: + start: 59 + end: 60 + metadata: + symbol: "]" diff --git a/tests/data/json-syntax-transformer-validation-cases.yaml b/tests/data/json-syntax-transformer-validation-cases.yaml index caadb72d..467bac16 100644 --- a/tests/data/json-syntax-transformer-validation-cases.yaml +++ b/tests/data/json-syntax-transformer-validation-cases.yaml @@ -76,5 +76,215 @@ } ] } + +- name: mixed operators with direct assignment 1 + json: >-2 + { + "schema_version": "1.1", + "type_definitions": [ + { + "type": "user", + "relations": { + "rel1": { + "this": {} + }, + "rel2": { + "difference": { + "base": { + "computedUserset": { + "relation": "rel1" + } + }, + "subtract": { + "this": {} + } + } + } + }, + "metadata": { + "relations": { + "rel1": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "rel2": { + "directly_related_user_types": [] + } + } + } + } + ] + } + valid: false, + error_message: the 'rel2' relation definition under the 'user' type is not supported by the OpenFGA DSL syntax yet + +- name: mixed operators with direct assignment 2 + json: >-2 + { + "schema_version": "1.1", + "type_definitions": [ + { + "type": "user", + "relations": { + "allowed": { + "this": {} + }, + "blocked": { + "this": {} + }, + "rel1": { + "union": { + "child": [ + { + "intersection": { + "child": [ + { + "this": {} + }, + { + "computedUserset": { + "relation": "allowed" + } + } + ] + } + }, + { + "difference": { + "base": { + "this": {} + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + } + ] + } + } + }, + "metadata": { + "relations": { + "allowed": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "blocked": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "rel1": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + } + } + } + } + ] + } + valid: false, + error_message: the 'rel1' relation definition under the 'user' type is not supported by the OpenFGA DSL syntax yet + +- name: mixed operators with direct assignment 3 + json: >-2 + { + "schema_version": "1.1", + "type_definitions": [ + { + "type": "user", + "relations": { + "rel1": { + "this": {} + }, + "rel2": { + "this": {} + }, + "rel3": { + "this": {} + }, + "rel4": { + "union": { + "child": [ + { + "computedUserset": { + "relation": "rel3" + } + }, + { + "difference": { + "base": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "rel1" + } + }, + { + "computedUserset": { + "relation": "rel2" + } + } + ] + } + }, + "subtract": { + "this": {} + } + } + } + ] + } + } + }, + "metadata": { + "relations": { + "rel1": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "rel2": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "rel3": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "rel4": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + } + } + } + } + ] + } valid: false, - error_message: the 'can_view' relation under the 'folder' type has mixed operators which are not supported by the OpenFGA DSL syntax yet + error_message: the 'rel4' relation definition under the 'user' type is not supported by the OpenFGA DSL syntax yet diff --git a/tests/data/transformer/14-mixed-operators/authorization-model.fga b/tests/data/transformer/14-mixed-operators/authorization-model.fga new file mode 100644 index 00000000..d8bd25e6 --- /dev/null +++ b/tests/data/transformer/14-mixed-operators/authorization-model.fga @@ -0,0 +1,18 @@ +model + schema 1.1 + +type user + +type document + relations + define allowed: [user] + define base: [user] + define blocked: [user] + define relation1: (base and allowed) but not blocked + define relation2: base and (allowed but not blocked) + define relation3: ((relation1 and relation2) or (allowed but not blocked)) and allowed + define relation4: (allowed but not (relation1 or relation2 or relation3)) but not (base and blocked) + define relation5: (relation1 and relation2 and relation3) but not relation4 + define relation6: relation1 and ((relation2 but not relation3) but not relation4) + define relation7: allowed and ((base but not blocked) or (relation1 and (relation2 but not relation3 from relation4))) + define relation8: relation1 and (relation2 but not (relation3 but not relation4)) diff --git a/tests/data/transformer/14-mixed-operators/authorization-model.json b/tests/data/transformer/14-mixed-operators/authorization-model.json new file mode 100644 index 00000000..5dd5dd71 --- /dev/null +++ b/tests/data/transformer/14-mixed-operators/authorization-model.json @@ -0,0 +1,379 @@ +{ + "schema_version": "1.1", + "type_definitions": [ + { + "type": "user", + "relations": {}, + "metadata": null + }, + { + "type": "document", + "relations": { + "allowed": { + "this": {} + }, + "base": { + "this": {} + }, + "blocked": { + "this": {} + }, + "relation1": { + "difference": { + "base": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "base" + } + }, + { + "computedUserset": { + "relation": "allowed" + } + } + ] + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + }, + "relation2": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "base" + } + }, + { + "difference": { + "base": { + "computedUserset": { + "relation": "allowed" + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + } + ] + } + }, + "relation3": { + "intersection": { + "child": [ + { + "union": { + "child": [ + { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "computedUserset": { + "relation": "relation2" + } + } + ] + } + }, + { + "difference": { + "base": { + "computedUserset": { + "relation": "allowed" + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + } + ] + } + }, + { + "computedUserset": { + "relation": "allowed" + } + } + ] + } + }, + "relation4": { + "difference": { + "base": { + "difference": { + "base": { + "computedUserset": { + "relation": "allowed" + } + }, + "subtract": { + "union": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "computedUserset": { + "relation": "relation2" + } + }, + { + "computedUserset": { + "relation": "relation3" + } + } + ] + } + } + } + }, + "subtract": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "base" + } + }, + { + "computedUserset": { + "relation": "blocked" + } + } + ] + } + } + } + }, + "relation5": { + "difference": { + "base": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "computedUserset": { + "relation": "relation2" + } + }, + { + "computedUserset": { + "relation": "relation3" + } + } + ] + } + }, + "subtract": { + "computedUserset": { + "relation": "relation4" + } + } + } + }, + "relation6": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "difference": { + "base": { + "difference": { + "base": { + "computedUserset": { + "relation": "relation2" + } + }, + "subtract": { + "computedUserset": { + "relation": "relation3" + } + } + } + }, + "subtract": { + "computedUserset": { + "relation": "relation4" + } + } + } + } + ] + } + }, + "relation7": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "allowed" + } + }, + { + "union": { + "child": [ + { + "difference": { + "base": { + "computedUserset": { + "relation": "base" + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + }, + { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "difference": { + "base": { + "computedUserset": { + "relation": "relation2" + } + }, + "subtract": { + "tupleToUserset": { + "computedUserset": { + "relation": "relation3" + }, + "tupleset": { + "relation": "relation4" + } + } + } + } + } + ] + } + } + ] + } + } + ] + } + }, + "relation8": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "difference": { + "base": { + "computedUserset": { + "relation": "relation2" + } + }, + "subtract": { + "difference": { + "base": { + "computedUserset": { + "relation": "relation3" + } + }, + "subtract": { + "computedUserset": { + "relation": "relation4" + } + } + } + } + } + } + ] + } + } + }, + "metadata": { + "relations": { + "allowed": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "base": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "blocked": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "relation1": { + "directly_related_user_types": [] + }, + "relation2": { + "directly_related_user_types": [] + }, + "relation3": { + "directly_related_user_types": [] + }, + "relation4": { + "directly_related_user_types": [] + }, + "relation5": { + "directly_related_user_types": [] + }, + "relation6": { + "directly_related_user_types": [] + }, + "relation7": { + "directly_related_user_types": [] + }, + "relation8": { + "directly_related_user_types": [] + } + } + } + } + ] +} \ No newline at end of file diff --git a/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.fga b/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.fga new file mode 100644 index 00000000..44dd494f --- /dev/null +++ b/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.fga @@ -0,0 +1,13 @@ +model + schema 1.1 + +type user + +type document + relations + define allowed: [user] + define blocked: [user] + define relation1: ([user] and allowed) but not blocked + define relation2: [user] and (allowed but not blocked) + define relation3: [user, user:*, user#follower with cond] or ((relation1 and relation2) but not blocked) + define relation4: ([user] or (relation1 and relation2)) but not relation3 diff --git a/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.json b/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.json new file mode 100644 index 00000000..4d140384 --- /dev/null +++ b/tests/data/transformer/15-mixed-operators-with-direct-assignments-once-beginning-of-line/authorization-model.json @@ -0,0 +1,190 @@ +{ + "schema_version": "1.1", + "type_definitions": [ + { + "type": "user", + "relations": {}, + "metadata": null + }, + { + "type": "document", + "relations": { + "allowed": { + "this": {} + }, + "blocked": { + "this": {} + }, + "relation1": { + "difference": { + "base": { + "intersection": { + "child": [ + { + "this": {} + }, + { + "computedUserset": { + "relation": "allowed" + } + } + ] + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + }, + "relation2": { + "intersection": { + "child": [ + { + "this": {} + }, + { + "difference": { + "base": { + "computedUserset": { + "relation": "allowed" + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + } + ] + } + }, + "relation3": { + "union": { + "child": [ + { + "this": {} + }, + { + "difference": { + "base": { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "computedUserset": { + "relation": "relation2" + } + } + ] + } + }, + "subtract": { + "computedUserset": { + "relation": "blocked" + } + } + } + } + ] + } + }, + "relation4": { + "difference": { + "base": { + "union": { + "child": [ + { + "this": {} + }, + { + "intersection": { + "child": [ + { + "computedUserset": { + "relation": "relation1" + } + }, + { + "computedUserset": { + "relation": "relation2" + } + } + ] + } + } + ] + } + }, + "subtract": { + "computedUserset": { + "relation": "relation3" + } + } + } + } + }, + "metadata": { + "relations": { + "allowed": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "blocked": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "relation1": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "relation2": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + }, + "relation3": { + "directly_related_user_types": [ + { + "type": "user" + }, + { + "type": "user", + "wildcard": {} + }, + { + "type": "user", + "condition": "cond", + "relation": "follower" + } + ] + }, + "relation4": { + "directly_related_user_types": [ + { + "type": "user" + } + ] + } + } + } + } + ] +} \ No newline at end of file From aed88a0d6d1367e464017e6588fae25069470789 Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Sun, 10 Dec 2023 23:49:43 -0500 Subject: [PATCH 2/2] release(js): v0.2.0-beta.6 --- pkg/js/CHANGELOG.md | 9 +++++++++ pkg/js/package-lock.json | 4 ++-- pkg/js/package.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/js/CHANGELOG.md b/pkg/js/CHANGELOG.md index c1c16aac..523f0393 100644 --- a/pkg/js/CHANGELOG.md +++ b/pkg/js/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## v0.2.0-beta.6 + +### [v0.2.0-beta.6](https://github.com/openfga/language/releases/tag/vv0.2.0-beta.3...v0.2.0-beta.4) (2023-12-11) + +last commit: 8b692a44e937beae8693cc155b205ffc5b732fbe + +Added: +- Initial limited support for mixing operators [#107](https://github.com/openfga/language/pull/107) + ## v0.2.0-beta.4 ### [v0.2.0-beta.4](https://github.com/openfga/language/releases/tag/vv0.2.0-beta.3...v0.2.0-beta.4) (2023-10-04) diff --git a/pkg/js/package-lock.json b/pkg/js/package-lock.json index 686f31d7..6844be32 100644 --- a/pkg/js/package-lock.json +++ b/pkg/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "@openfga/syntax-transformer", - "version": "0.2.0-beta.5", + "version": "0.2.0-beta.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@openfga/syntax-transformer", - "version": "0.2.0-beta.5", + "version": "0.2.0-beta.6", "license": "Apache-2.0", "dependencies": { "antlr4": "^4.13.1" diff --git a/pkg/js/package.json b/pkg/js/package.json index d94abd37..a4bbebd2 100644 --- a/pkg/js/package.json +++ b/pkg/js/package.json @@ -1,6 +1,6 @@ { "name": "@openfga/syntax-transformer", - "version": "0.2.0-beta.5", + "version": "0.2.0-beta.6", "description": "", "license": "Apache-2.0", "main": "./dist/index.js",