diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13365b3..ba3fe9f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: id: set-matrix run: | # List of all available parsers - ALL_PARSERS="redshift postgresql cql snowflake tsql doris trino plsql googlesql mysql partiql tidb bq mariadb" + ALL_PARSERS="redshift postgresql cql snowflake tsql doris trino plsql googlesql mysql partiql tidb bq mariadb cosmosdb" # Add more parsers here as they are added to the repository # ALL_PARSERS="redshift mysql postgresql" diff --git a/cosmosdb/CosmosDBLexer.g4 b/cosmosdb/CosmosDBLexer.g4 new file mode 100644 index 0000000..614e268 --- /dev/null +++ b/cosmosdb/CosmosDBLexer.g4 @@ -0,0 +1,129 @@ +lexer grammar CosmosDBLexer; + +options { + caseInsensitive = true; +} + +fragment A: [a]; +fragment B: [b]; +fragment C: [c]; +fragment D: [d]; +fragment E: [e]; +fragment F: [f]; +fragment G: [g]; +fragment H: [h]; +fragment I: [i]; +fragment J: [j]; +fragment K: [k]; +fragment L: [l]; +fragment M: [m]; +fragment N: [n]; +fragment O: [o]; +fragment P: [p]; +fragment Q: [q]; +fragment R: [r]; +fragment S: [s]; +fragment T: [t]; +fragment U: [u]; +fragment V: [v]; +fragment W: [w]; +fragment X: [x]; +fragment Y: [y]; +fragment Z: [z]; + +MULTIPLY_OPERATOR: '*'; + +AS_SYMBOL: 'AS'; +SELECT_SYMBOL: 'SELECT'; +FROM_SYMBOL: 'FROM'; +DISTINCT_SYMBOL: 'DISTINCT'; +UNDEFINED_SYMBOL: 'UNDEFINED'; +NULL_SYMBOL: 'NULL'; +FALSE_SYMBOL: 'FALSE'; +TRUE_SYMBOL: 'TRUE'; +NOT_SYMBOL: 'NOT'; +UDF_SYMBOL: 'UDF'; +WHERE_SYMBOL: 'WHERE'; +AND_SYMBOL: 'AND'; +OR_SYMBOL: 'OR'; + +AT_SYMBOL: '@'; +LC_BRACKET_SYMBOL: '{'; +RC_BRACKET_SYMBOL: '}'; +LS_BRACKET_SYMBOL: '['; +RS_BRACKET_SYMBOL: ']'; +LR_BRACKET_SYMBOL: '('; +RR_BRACKET_SYMBOL: ')'; +SINGLE_QUOTE_SYMBOL: '\''; +DOUBLE_QUOTE_SYMBOL: '"'; +COMMA_SYMBOL: ','; +DOT_SYMBOL: '.'; +QUESTION_MARK_SYMBOL: '?'; +COLON_SYMBOL: ':'; +PLUS_SYMBOL: '+'; +MINUS_SYMBOL: '-'; +BIT_NOT_SYMBOL: '~'; +DIVIDE_SYMBOL: '/'; +MODULO_SYMBOL: '%'; +BIT_AND_SYMBOL: '&'; +BIT_OR_SYMBOL: '|'; +DOUBLE_BAR_SYMBOL: '||'; +BIT_XOR_SYMBOL: '^'; +EQUAL_SYMBOL: '='; + +/* Identifiers */ +IDENTIFIER: [a-z] [a-z_0-9]*; + +// White space handling +WHITESPACE: + [ \t\f\r\n] -> channel(HIDDEN); // Ignore whitespaces. + +// Decimal literal. +fragment DEC_DIGIT: [0-9]; +fragment DEC_DOT_DEC: ( + DEC_DIGIT+ '.' DEC_DIGIT+ + | DEC_DIGIT+ '.' + | '.' DEC_DIGIT+ + ); + +DECIMAL: DEC_DIGIT+; +REAL: (DECIMAL | DEC_DOT_DEC) ('E' [+-]? DEC_DIGIT+); +FLOAT: DEC_DOT_DEC; + +// Hexadecimal literal. +fragment HEX_DIGIT: [0-9A-F]; +HEXADECIMAL: '0' 'X' HEX_DIGIT+; + +fragment FullWidthLetter options { + caseInsensitive = false; +}: + '\u00c0' ..'\u00d6' + | '\u00d8' ..'\u00f6' + | '\u00f8' ..'\u00ff' + | '\u0100' ..'\u1fff' + | '\u2c00' ..'\u2fff' + | '\u3040' ..'\u318f' + | '\u3300' ..'\u337f' + | '\u3400' ..'\u3fff' + | '\u4e00' ..'\u9fff' + | '\ua000' ..'\ud7ff' + | '\uf900' ..'\ufaff' + | '\uff00' ..'\ufff0'; +// | '\u10000'..'\u1F9FF' //not support four bytes chars | '\u20000'..'\u2FA1F' + +// String literal. +fragment ESCAPE_SEQUENCE: + '\\' [btnrf"'\\/] // Basic escape sequences: \b, \t, \n, \r, \f, ", ', \, / + | '\\u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT; // Unicode escape: \uXXXX + +fragment STRING_CHAR: + ESCAPE_SEQUENCE + | ~[\\"'\r\n]; // Any Unicode character EXCEPT: \, ", ', \r, \n + +// String literals +SINGLE_QUOTE_STRING_LITERAL: + SINGLE_QUOTE_SYMBOL STRING_CHAR* SINGLE_QUOTE_SYMBOL; + + +DOUBLE_QUOTE_STRING_LITERAL: + DOUBLE_QUOTE_SYMBOL STRING_CHAR* DOUBLE_QUOTE_SYMBOL; diff --git a/cosmosdb/CosmosDBParser.g4 b/cosmosdb/CosmosDBParser.g4 new file mode 100644 index 0000000..0d3469a --- /dev/null +++ b/cosmosdb/CosmosDBParser.g4 @@ -0,0 +1,153 @@ +parser grammar CosmosDBParser; + +options { + tokenVocab = CosmosDBLexer; +} + +root: select EOF; + +select: select_clause from_clause where_clause?; + +select_clause: SELECT_SYMBOL select_specification; + +select_specification: + MULTIPLY_OPERATOR + | DISTINCT_SYMBOL? object_property_list; + +from_clause: FROM_SYMBOL from_specification; + +where_clause: WHERE_SYMBOL scalar_expression_in_where; + +from_specification: from_source; + +from_source: container_expression; + +container_expression: container_name (AS_SYMBOL? IDENTIFIER)?; + +container_name: IDENTIFIER; + +object_property_list: + object_property (COMMA_SYMBOL object_property)*; + +object_property: scalar_expression (AS_SYMBOL? property_alias)?; + +property_alias: IDENTIFIER; + +// scalar_expression: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/scalar-expressions +scalar_expression: + input_alias + | scalar_expression DOT_SYMBOL property_name + | scalar_expression LS_BRACKET_SYMBOL ( + (DOUBLE_QUOTE_STRING_LITERAL) + | (array_index) + ) RS_BRACKET_SYMBOL + | unary_operator scalar_expression; + +// TODO(zp): Merge scalar_expression and scalar_expression_in_where while supporting the project +// fully. https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/scalar-expressions +scalar_expression_in_where: + constant + | input_alias + | parameter_name + | scalar_expression_in_where AND_SYMBOL scalar_expression_in_where + | scalar_expression_in_where OR_SYMBOL scalar_expression_in_where + | scalar_expression_in_where DOT_SYMBOL property_name + | scalar_expression_in_where LS_BRACKET_SYMBOL ( + (DOUBLE_QUOTE_STRING_LITERAL) + | (array_index) + ) RS_BRACKET_SYMBOL + | unary_operator scalar_expression_in_where + | scalar_expression_in_where binary_operator scalar_expression_in_where + | scalar_expression_in_where QUESTION_MARK_SYMBOL scalar_expression_in_where COLON_SYMBOL + scalar_expression_in_where + | scalar_function_expression + | create_object_expression + | create_array_expression + | LR_BRACKET_SYMBOL scalar_expression_in_where RR_BRACKET_SYMBOL; + +create_array_expression: array_constant; + +create_object_expression: object_constant; + +scalar_function_expression: + udf_scalar_function_expression + | builtin_function_expression; + +udf_scalar_function_expression: + UDF_SYMBOL DOT_SYMBOL IDENTIFIER LR_BRACKET_SYMBOL ( + scalar_expression_in_where ( + COMMA_SYMBOL scalar_expression_in_where + )* + ) RR_BRACKET_SYMBOL; + +builtin_function_expression: + IDENTIFIER LR_BRACKET_SYMBOL ( + scalar_expression_in_where ( + COMMA_SYMBOL scalar_expression_in_where + )* + ) RR_BRACKET_SYMBOL; + +binary_operator: + MULTIPLY_OPERATOR + | DIVIDE_SYMBOL + | MODULO_SYMBOL + | PLUS_SYMBOL + | MINUS_SYMBOL + | BIT_AND_SYMBOL + | BIT_XOR_SYMBOL + | BIT_OR_SYMBOL + | DOUBLE_BAR_SYMBOL + | EQUAL_SYMBOL; + +unary_operator: BIT_NOT_SYMBOL | PLUS_SYMBOL | MINUS_SYMBOL; + +parameter_name: AT_SYMBOL IDENTIFIER; + +// https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/constants +constant: + undefined_constant + | null_constant + | boolean_constant + | number_constant + | string_constant + | array_constant + | object_constant; + +object_constant: + LC_BRACKET_SYMBOL ( + object_constant_field_pair ( + COMMA_SYMBOL object_constant_field_pair + )* + ) RC_BRACKET_SYMBOL; + +object_constant_field_pair: ( + property_name + | (DOUBLE_QUOTE_SYMBOL property_name DOUBLE_QUOTE_SYMBOL) + ) COMMA_SYMBOL constant; + +array_constant: + LS_BRACKET_SYMBOL (constant (COMMA_SYMBOL constant)*)? RS_BRACKET_SYMBOL; + +string_constant: string_literal; + +undefined_constant: UNDEFINED_SYMBOL; + +null_constant: NULL_SYMBOL; + +boolean_constant: TRUE_SYMBOL | FALSE_SYMBOL; + +number_constant: decimal_literal | hexadecimal_literal; + +string_literal: + SINGLE_QUOTE_STRING_LITERAL + | DOUBLE_QUOTE_STRING_LITERAL; + +decimal_literal: DECIMAL | REAL | FLOAT; + +hexadecimal_literal: HEXADECIMAL; + +property_name: IDENTIFIER; + +array_index: DECIMAL; + +input_alias: IDENTIFIER; \ No newline at end of file diff --git a/cosmosdb/Makefile b/cosmosdb/Makefile new file mode 100644 index 0000000..978961e --- /dev/null +++ b/cosmosdb/Makefile @@ -0,0 +1,7 @@ +all: build test + +build: + antlr -Dlanguage=Go -package cosmosdb -visitor -o . CosmosDBLexer.g4 CosmosDBParser.g4 + +test: + go test -v -run TestCosmosDBParser diff --git a/cosmosdb/README.md b/cosmosdb/README.md new file mode 100644 index 0000000..5bf4171 --- /dev/null +++ b/cosmosdb/README.md @@ -0,0 +1,7 @@ +# cosmosdb-parser + +Cosmos DB SQL parser based on ANTLR4. + +## References + +- [Queries in Azure Cosmos DB for NoSQL](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/) diff --git a/cosmosdb/cosmosdb_lexer.go b/cosmosdb/cosmosdb_lexer.go new file mode 100644 index 0000000..236a505 --- /dev/null +++ b/cosmosdb/cosmosdb_lexer.go @@ -0,0 +1,360 @@ +// Code generated from CosmosDBLexer.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb + +import ( + "fmt" + "github.com/antlr4-go/antlr/v4" + "sync" + "unicode" +) + +// Suppress unused import error +var _ = fmt.Printf +var _ = sync.Once{} +var _ = unicode.IsLetter + +type CosmosDBLexer struct { + *antlr.BaseLexer + channelNames []string + modeNames []string + // TODO: EOF string +} + +var CosmosDBLexerLexerStaticData struct { + once sync.Once + serializedATN []int32 + ChannelNames []string + ModeNames []string + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func cosmosdblexerLexerInit() { + staticData := &CosmosDBLexerLexerStaticData + staticData.ChannelNames = []string{ + "DEFAULT_TOKEN_CHANNEL", "HIDDEN", + } + staticData.ModeNames = []string{ + "DEFAULT_MODE", + } + staticData.LiteralNames = []string{ + "", "'*'", "'AS'", "'SELECT'", "'FROM'", "'DISTINCT'", "'UNDEFINED'", + "'NULL'", "'FALSE'", "'TRUE'", "'NOT'", "'UDF'", "'WHERE'", "'AND'", + "'OR'", "'@'", "'{'", "'}'", "'['", "']'", "'('", "')'", "'''", "'\"'", + "','", "'.'", "'?'", "':'", "'+'", "'-'", "'~'", "'/'", "'%'", "'&'", + "'|'", "'||'", "'^'", "'='", + } + staticData.SymbolicNames = []string{ + "", "MULTIPLY_OPERATOR", "AS_SYMBOL", "SELECT_SYMBOL", "FROM_SYMBOL", + "DISTINCT_SYMBOL", "UNDEFINED_SYMBOL", "NULL_SYMBOL", "FALSE_SYMBOL", + "TRUE_SYMBOL", "NOT_SYMBOL", "UDF_SYMBOL", "WHERE_SYMBOL", "AND_SYMBOL", + "OR_SYMBOL", "AT_SYMBOL", "LC_BRACKET_SYMBOL", "RC_BRACKET_SYMBOL", + "LS_BRACKET_SYMBOL", "RS_BRACKET_SYMBOL", "LR_BRACKET_SYMBOL", "RR_BRACKET_SYMBOL", + "SINGLE_QUOTE_SYMBOL", "DOUBLE_QUOTE_SYMBOL", "COMMA_SYMBOL", "DOT_SYMBOL", + "QUESTION_MARK_SYMBOL", "COLON_SYMBOL", "PLUS_SYMBOL", "MINUS_SYMBOL", + "BIT_NOT_SYMBOL", "DIVIDE_SYMBOL", "MODULO_SYMBOL", "BIT_AND_SYMBOL", + "BIT_OR_SYMBOL", "DOUBLE_BAR_SYMBOL", "BIT_XOR_SYMBOL", "EQUAL_SYMBOL", + "IDENTIFIER", "WHITESPACE", "DECIMAL", "REAL", "FLOAT", "HEXADECIMAL", + "SINGLE_QUOTE_STRING_LITERAL", "DOUBLE_QUOTE_STRING_LITERAL", + } + staticData.RuleNames = []string{ + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "MULTIPLY_OPERATOR", + "AS_SYMBOL", "SELECT_SYMBOL", "FROM_SYMBOL", "DISTINCT_SYMBOL", "UNDEFINED_SYMBOL", + "NULL_SYMBOL", "FALSE_SYMBOL", "TRUE_SYMBOL", "NOT_SYMBOL", "UDF_SYMBOL", + "WHERE_SYMBOL", "AND_SYMBOL", "OR_SYMBOL", "AT_SYMBOL", "LC_BRACKET_SYMBOL", + "RC_BRACKET_SYMBOL", "LS_BRACKET_SYMBOL", "RS_BRACKET_SYMBOL", "LR_BRACKET_SYMBOL", + "RR_BRACKET_SYMBOL", "SINGLE_QUOTE_SYMBOL", "DOUBLE_QUOTE_SYMBOL", "COMMA_SYMBOL", + "DOT_SYMBOL", "QUESTION_MARK_SYMBOL", "COLON_SYMBOL", "PLUS_SYMBOL", + "MINUS_SYMBOL", "BIT_NOT_SYMBOL", "DIVIDE_SYMBOL", "MODULO_SYMBOL", + "BIT_AND_SYMBOL", "BIT_OR_SYMBOL", "DOUBLE_BAR_SYMBOL", "BIT_XOR_SYMBOL", + "EQUAL_SYMBOL", "IDENTIFIER", "WHITESPACE", "DEC_DIGIT", "DEC_DOT_DEC", + "DECIMAL", "REAL", "FLOAT", "HEX_DIGIT", "HEXADECIMAL", "FullWidthLetter", + "ESCAPE_SEQUENCE", "STRING_CHAR", "SINGLE_QUOTE_STRING_LITERAL", "DOUBLE_QUOTE_STRING_LITERAL", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 0, 45, 431, 6, -1, 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, 2, 24, 7, 24, 2, 25, 7, 25, + 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, + 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, + 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, + 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, + 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, + 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, + 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, + 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, + 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, + 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, + 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, + 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 17, 1, 17, 1, + 18, 1, 18, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 23, + 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, + 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, + 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, + 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, + 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, + 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, + 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, + 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1, 42, + 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, + 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, + 1, 53, 1, 54, 1, 54, 1, 55, 1, 55, 1, 56, 1, 56, 1, 57, 1, 57, 1, 58, 1, + 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 62, 1, 62, 1, 63, + 1, 63, 5, 63, 330, 8, 63, 10, 63, 12, 63, 333, 9, 63, 1, 64, 1, 64, 1, + 64, 1, 64, 1, 65, 1, 65, 1, 66, 4, 66, 342, 8, 66, 11, 66, 12, 66, 343, + 1, 66, 1, 66, 4, 66, 348, 8, 66, 11, 66, 12, 66, 349, 1, 66, 4, 66, 353, + 8, 66, 11, 66, 12, 66, 354, 1, 66, 1, 66, 1, 66, 1, 66, 4, 66, 361, 8, + 66, 11, 66, 12, 66, 362, 3, 66, 365, 8, 66, 1, 67, 4, 67, 368, 8, 67, 11, + 67, 12, 67, 369, 1, 68, 1, 68, 3, 68, 374, 8, 68, 1, 68, 1, 68, 3, 68, + 378, 8, 68, 1, 68, 4, 68, 381, 8, 68, 11, 68, 12, 68, 382, 1, 69, 1, 69, + 1, 70, 1, 70, 1, 71, 1, 71, 1, 71, 4, 71, 392, 8, 71, 11, 71, 12, 71, 393, + 1, 72, 1, 72, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, 73, 1, + 73, 1, 73, 3, 73, 408, 8, 73, 1, 74, 1, 74, 3, 74, 412, 8, 74, 1, 75, 1, + 75, 5, 75, 416, 8, 75, 10, 75, 12, 75, 419, 9, 75, 1, 75, 1, 75, 1, 76, + 1, 76, 5, 76, 425, 8, 76, 10, 76, 12, 76, 428, 9, 76, 1, 76, 1, 76, 0, + 0, 77, 1, 0, 3, 0, 5, 0, 7, 0, 9, 0, 11, 0, 13, 0, 15, 0, 17, 0, 19, 0, + 21, 0, 23, 0, 25, 0, 27, 0, 29, 0, 31, 0, 33, 0, 35, 0, 37, 0, 39, 0, 41, + 0, 43, 0, 45, 0, 47, 0, 49, 0, 51, 0, 53, 1, 55, 2, 57, 3, 59, 4, 61, 5, + 63, 6, 65, 7, 67, 8, 69, 9, 71, 10, 73, 11, 75, 12, 77, 13, 79, 14, 81, + 15, 83, 16, 85, 17, 87, 18, 89, 19, 91, 20, 93, 21, 95, 22, 97, 23, 99, + 24, 101, 25, 103, 26, 105, 27, 107, 28, 109, 29, 111, 30, 113, 31, 115, + 32, 117, 33, 119, 34, 121, 35, 123, 36, 125, 37, 127, 38, 129, 39, 131, + 0, 133, 0, 135, 40, 137, 41, 139, 42, 141, 0, 143, 43, 145, 0, 147, 0, + 149, 0, 151, 44, 153, 45, 1, 0, 35, 2, 0, 65, 65, 97, 97, 2, 0, 66, 66, + 98, 98, 2, 0, 67, 67, 99, 99, 2, 0, 68, 68, 100, 100, 2, 0, 69, 69, 101, + 101, 2, 0, 70, 70, 102, 102, 2, 0, 71, 71, 103, 103, 2, 0, 72, 72, 104, + 104, 2, 0, 73, 73, 105, 105, 2, 0, 74, 74, 106, 106, 2, 0, 75, 75, 107, + 107, 2, 0, 76, 76, 108, 108, 2, 0, 77, 77, 109, 109, 2, 0, 78, 78, 110, + 110, 2, 0, 79, 79, 111, 111, 2, 0, 80, 80, 112, 112, 2, 0, 81, 81, 113, + 113, 2, 0, 82, 82, 114, 114, 2, 0, 83, 83, 115, 115, 2, 0, 84, 84, 116, + 116, 2, 0, 85, 85, 117, 117, 2, 0, 86, 86, 118, 118, 2, 0, 87, 87, 119, + 119, 2, 0, 88, 88, 120, 120, 2, 0, 89, 89, 121, 121, 2, 0, 90, 90, 122, + 122, 2, 0, 65, 90, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, + 9, 10, 12, 13, 32, 32, 1, 0, 48, 57, 2, 0, 43, 43, 45, 45, 3, 0, 48, 57, + 65, 70, 97, 102, 10, 0, 192, 214, 216, 246, 248, 8191, 11264, 12287, 12352, + 12687, 13056, 13183, 13312, 16383, 19968, 55295, 63744, 64255, 65280, 65520, + 14, 0, 34, 34, 39, 39, 47, 47, 66, 66, 70, 70, 78, 78, 82, 82, 84, 84, + 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 5, 0, 10, 10, 13, + 13, 34, 34, 39, 39, 92, 92, 414, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, + 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, + 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, + 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, + 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, + 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, + 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, + 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, + 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, + 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, + 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, + 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 143, 1, 0, + 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 1, 155, 1, 0, 0, 0, 3, 157, + 1, 0, 0, 0, 5, 159, 1, 0, 0, 0, 7, 161, 1, 0, 0, 0, 9, 163, 1, 0, 0, 0, + 11, 165, 1, 0, 0, 0, 13, 167, 1, 0, 0, 0, 15, 169, 1, 0, 0, 0, 17, 171, + 1, 0, 0, 0, 19, 173, 1, 0, 0, 0, 21, 175, 1, 0, 0, 0, 23, 177, 1, 0, 0, + 0, 25, 179, 1, 0, 0, 0, 27, 181, 1, 0, 0, 0, 29, 183, 1, 0, 0, 0, 31, 185, + 1, 0, 0, 0, 33, 187, 1, 0, 0, 0, 35, 189, 1, 0, 0, 0, 37, 191, 1, 0, 0, + 0, 39, 193, 1, 0, 0, 0, 41, 195, 1, 0, 0, 0, 43, 197, 1, 0, 0, 0, 45, 199, + 1, 0, 0, 0, 47, 201, 1, 0, 0, 0, 49, 203, 1, 0, 0, 0, 51, 205, 1, 0, 0, + 0, 53, 207, 1, 0, 0, 0, 55, 209, 1, 0, 0, 0, 57, 212, 1, 0, 0, 0, 59, 219, + 1, 0, 0, 0, 61, 224, 1, 0, 0, 0, 63, 233, 1, 0, 0, 0, 65, 243, 1, 0, 0, + 0, 67, 248, 1, 0, 0, 0, 69, 254, 1, 0, 0, 0, 71, 259, 1, 0, 0, 0, 73, 263, + 1, 0, 0, 0, 75, 267, 1, 0, 0, 0, 77, 273, 1, 0, 0, 0, 79, 277, 1, 0, 0, + 0, 81, 280, 1, 0, 0, 0, 83, 282, 1, 0, 0, 0, 85, 284, 1, 0, 0, 0, 87, 286, + 1, 0, 0, 0, 89, 288, 1, 0, 0, 0, 91, 290, 1, 0, 0, 0, 93, 292, 1, 0, 0, + 0, 95, 294, 1, 0, 0, 0, 97, 296, 1, 0, 0, 0, 99, 298, 1, 0, 0, 0, 101, + 300, 1, 0, 0, 0, 103, 302, 1, 0, 0, 0, 105, 304, 1, 0, 0, 0, 107, 306, + 1, 0, 0, 0, 109, 308, 1, 0, 0, 0, 111, 310, 1, 0, 0, 0, 113, 312, 1, 0, + 0, 0, 115, 314, 1, 0, 0, 0, 117, 316, 1, 0, 0, 0, 119, 318, 1, 0, 0, 0, + 121, 320, 1, 0, 0, 0, 123, 323, 1, 0, 0, 0, 125, 325, 1, 0, 0, 0, 127, + 327, 1, 0, 0, 0, 129, 334, 1, 0, 0, 0, 131, 338, 1, 0, 0, 0, 133, 364, + 1, 0, 0, 0, 135, 367, 1, 0, 0, 0, 137, 373, 1, 0, 0, 0, 139, 384, 1, 0, + 0, 0, 141, 386, 1, 0, 0, 0, 143, 388, 1, 0, 0, 0, 145, 395, 1, 0, 0, 0, + 147, 407, 1, 0, 0, 0, 149, 411, 1, 0, 0, 0, 151, 413, 1, 0, 0, 0, 153, + 422, 1, 0, 0, 0, 155, 156, 7, 0, 0, 0, 156, 2, 1, 0, 0, 0, 157, 158, 7, + 1, 0, 0, 158, 4, 1, 0, 0, 0, 159, 160, 7, 2, 0, 0, 160, 6, 1, 0, 0, 0, + 161, 162, 7, 3, 0, 0, 162, 8, 1, 0, 0, 0, 163, 164, 7, 4, 0, 0, 164, 10, + 1, 0, 0, 0, 165, 166, 7, 5, 0, 0, 166, 12, 1, 0, 0, 0, 167, 168, 7, 6, + 0, 0, 168, 14, 1, 0, 0, 0, 169, 170, 7, 7, 0, 0, 170, 16, 1, 0, 0, 0, 171, + 172, 7, 8, 0, 0, 172, 18, 1, 0, 0, 0, 173, 174, 7, 9, 0, 0, 174, 20, 1, + 0, 0, 0, 175, 176, 7, 10, 0, 0, 176, 22, 1, 0, 0, 0, 177, 178, 7, 11, 0, + 0, 178, 24, 1, 0, 0, 0, 179, 180, 7, 12, 0, 0, 180, 26, 1, 0, 0, 0, 181, + 182, 7, 13, 0, 0, 182, 28, 1, 0, 0, 0, 183, 184, 7, 14, 0, 0, 184, 30, + 1, 0, 0, 0, 185, 186, 7, 15, 0, 0, 186, 32, 1, 0, 0, 0, 187, 188, 7, 16, + 0, 0, 188, 34, 1, 0, 0, 0, 189, 190, 7, 17, 0, 0, 190, 36, 1, 0, 0, 0, + 191, 192, 7, 18, 0, 0, 192, 38, 1, 0, 0, 0, 193, 194, 7, 19, 0, 0, 194, + 40, 1, 0, 0, 0, 195, 196, 7, 20, 0, 0, 196, 42, 1, 0, 0, 0, 197, 198, 7, + 21, 0, 0, 198, 44, 1, 0, 0, 0, 199, 200, 7, 22, 0, 0, 200, 46, 1, 0, 0, + 0, 201, 202, 7, 23, 0, 0, 202, 48, 1, 0, 0, 0, 203, 204, 7, 24, 0, 0, 204, + 50, 1, 0, 0, 0, 205, 206, 7, 25, 0, 0, 206, 52, 1, 0, 0, 0, 207, 208, 5, + 42, 0, 0, 208, 54, 1, 0, 0, 0, 209, 210, 7, 0, 0, 0, 210, 211, 7, 18, 0, + 0, 211, 56, 1, 0, 0, 0, 212, 213, 7, 18, 0, 0, 213, 214, 7, 4, 0, 0, 214, + 215, 7, 11, 0, 0, 215, 216, 7, 4, 0, 0, 216, 217, 7, 2, 0, 0, 217, 218, + 7, 19, 0, 0, 218, 58, 1, 0, 0, 0, 219, 220, 7, 5, 0, 0, 220, 221, 7, 17, + 0, 0, 221, 222, 7, 14, 0, 0, 222, 223, 7, 12, 0, 0, 223, 60, 1, 0, 0, 0, + 224, 225, 7, 3, 0, 0, 225, 226, 7, 8, 0, 0, 226, 227, 7, 18, 0, 0, 227, + 228, 7, 19, 0, 0, 228, 229, 7, 8, 0, 0, 229, 230, 7, 13, 0, 0, 230, 231, + 7, 2, 0, 0, 231, 232, 7, 19, 0, 0, 232, 62, 1, 0, 0, 0, 233, 234, 7, 20, + 0, 0, 234, 235, 7, 13, 0, 0, 235, 236, 7, 3, 0, 0, 236, 237, 7, 4, 0, 0, + 237, 238, 7, 5, 0, 0, 238, 239, 7, 8, 0, 0, 239, 240, 7, 13, 0, 0, 240, + 241, 7, 4, 0, 0, 241, 242, 7, 3, 0, 0, 242, 64, 1, 0, 0, 0, 243, 244, 7, + 13, 0, 0, 244, 245, 7, 20, 0, 0, 245, 246, 7, 11, 0, 0, 246, 247, 7, 11, + 0, 0, 247, 66, 1, 0, 0, 0, 248, 249, 7, 5, 0, 0, 249, 250, 7, 0, 0, 0, + 250, 251, 7, 11, 0, 0, 251, 252, 7, 18, 0, 0, 252, 253, 7, 4, 0, 0, 253, + 68, 1, 0, 0, 0, 254, 255, 7, 19, 0, 0, 255, 256, 7, 17, 0, 0, 256, 257, + 7, 20, 0, 0, 257, 258, 7, 4, 0, 0, 258, 70, 1, 0, 0, 0, 259, 260, 7, 13, + 0, 0, 260, 261, 7, 14, 0, 0, 261, 262, 7, 19, 0, 0, 262, 72, 1, 0, 0, 0, + 263, 264, 7, 20, 0, 0, 264, 265, 7, 3, 0, 0, 265, 266, 7, 5, 0, 0, 266, + 74, 1, 0, 0, 0, 267, 268, 7, 22, 0, 0, 268, 269, 7, 7, 0, 0, 269, 270, + 7, 4, 0, 0, 270, 271, 7, 17, 0, 0, 271, 272, 7, 4, 0, 0, 272, 76, 1, 0, + 0, 0, 273, 274, 7, 0, 0, 0, 274, 275, 7, 13, 0, 0, 275, 276, 7, 3, 0, 0, + 276, 78, 1, 0, 0, 0, 277, 278, 7, 14, 0, 0, 278, 279, 7, 17, 0, 0, 279, + 80, 1, 0, 0, 0, 280, 281, 5, 64, 0, 0, 281, 82, 1, 0, 0, 0, 282, 283, 5, + 123, 0, 0, 283, 84, 1, 0, 0, 0, 284, 285, 5, 125, 0, 0, 285, 86, 1, 0, + 0, 0, 286, 287, 5, 91, 0, 0, 287, 88, 1, 0, 0, 0, 288, 289, 5, 93, 0, 0, + 289, 90, 1, 0, 0, 0, 290, 291, 5, 40, 0, 0, 291, 92, 1, 0, 0, 0, 292, 293, + 5, 41, 0, 0, 293, 94, 1, 0, 0, 0, 294, 295, 5, 39, 0, 0, 295, 96, 1, 0, + 0, 0, 296, 297, 5, 34, 0, 0, 297, 98, 1, 0, 0, 0, 298, 299, 5, 44, 0, 0, + 299, 100, 1, 0, 0, 0, 300, 301, 5, 46, 0, 0, 301, 102, 1, 0, 0, 0, 302, + 303, 5, 63, 0, 0, 303, 104, 1, 0, 0, 0, 304, 305, 5, 58, 0, 0, 305, 106, + 1, 0, 0, 0, 306, 307, 5, 43, 0, 0, 307, 108, 1, 0, 0, 0, 308, 309, 5, 45, + 0, 0, 309, 110, 1, 0, 0, 0, 310, 311, 5, 126, 0, 0, 311, 112, 1, 0, 0, + 0, 312, 313, 5, 47, 0, 0, 313, 114, 1, 0, 0, 0, 314, 315, 5, 37, 0, 0, + 315, 116, 1, 0, 0, 0, 316, 317, 5, 38, 0, 0, 317, 118, 1, 0, 0, 0, 318, + 319, 5, 124, 0, 0, 319, 120, 1, 0, 0, 0, 320, 321, 5, 124, 0, 0, 321, 322, + 5, 124, 0, 0, 322, 122, 1, 0, 0, 0, 323, 324, 5, 94, 0, 0, 324, 124, 1, + 0, 0, 0, 325, 326, 5, 61, 0, 0, 326, 126, 1, 0, 0, 0, 327, 331, 7, 26, + 0, 0, 328, 330, 7, 27, 0, 0, 329, 328, 1, 0, 0, 0, 330, 333, 1, 0, 0, 0, + 331, 329, 1, 0, 0, 0, 331, 332, 1, 0, 0, 0, 332, 128, 1, 0, 0, 0, 333, + 331, 1, 0, 0, 0, 334, 335, 7, 28, 0, 0, 335, 336, 1, 0, 0, 0, 336, 337, + 6, 64, 0, 0, 337, 130, 1, 0, 0, 0, 338, 339, 7, 29, 0, 0, 339, 132, 1, + 0, 0, 0, 340, 342, 3, 131, 65, 0, 341, 340, 1, 0, 0, 0, 342, 343, 1, 0, + 0, 0, 343, 341, 1, 0, 0, 0, 343, 344, 1, 0, 0, 0, 344, 345, 1, 0, 0, 0, + 345, 347, 5, 46, 0, 0, 346, 348, 3, 131, 65, 0, 347, 346, 1, 0, 0, 0, 348, + 349, 1, 0, 0, 0, 349, 347, 1, 0, 0, 0, 349, 350, 1, 0, 0, 0, 350, 365, + 1, 0, 0, 0, 351, 353, 3, 131, 65, 0, 352, 351, 1, 0, 0, 0, 353, 354, 1, + 0, 0, 0, 354, 352, 1, 0, 0, 0, 354, 355, 1, 0, 0, 0, 355, 356, 1, 0, 0, + 0, 356, 357, 5, 46, 0, 0, 357, 365, 1, 0, 0, 0, 358, 360, 5, 46, 0, 0, + 359, 361, 3, 131, 65, 0, 360, 359, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, + 360, 1, 0, 0, 0, 362, 363, 1, 0, 0, 0, 363, 365, 1, 0, 0, 0, 364, 341, + 1, 0, 0, 0, 364, 352, 1, 0, 0, 0, 364, 358, 1, 0, 0, 0, 365, 134, 1, 0, + 0, 0, 366, 368, 3, 131, 65, 0, 367, 366, 1, 0, 0, 0, 368, 369, 1, 0, 0, + 0, 369, 367, 1, 0, 0, 0, 369, 370, 1, 0, 0, 0, 370, 136, 1, 0, 0, 0, 371, + 374, 3, 135, 67, 0, 372, 374, 3, 133, 66, 0, 373, 371, 1, 0, 0, 0, 373, + 372, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 377, 7, 4, 0, 0, 376, 378, + 7, 30, 0, 0, 377, 376, 1, 0, 0, 0, 377, 378, 1, 0, 0, 0, 378, 380, 1, 0, + 0, 0, 379, 381, 3, 131, 65, 0, 380, 379, 1, 0, 0, 0, 381, 382, 1, 0, 0, + 0, 382, 380, 1, 0, 0, 0, 382, 383, 1, 0, 0, 0, 383, 138, 1, 0, 0, 0, 384, + 385, 3, 133, 66, 0, 385, 140, 1, 0, 0, 0, 386, 387, 7, 31, 0, 0, 387, 142, + 1, 0, 0, 0, 388, 389, 5, 48, 0, 0, 389, 391, 7, 23, 0, 0, 390, 392, 3, + 141, 70, 0, 391, 390, 1, 0, 0, 0, 392, 393, 1, 0, 0, 0, 393, 391, 1, 0, + 0, 0, 393, 394, 1, 0, 0, 0, 394, 144, 1, 0, 0, 0, 395, 396, 7, 32, 0, 0, + 396, 146, 1, 0, 0, 0, 397, 398, 5, 92, 0, 0, 398, 408, 7, 33, 0, 0, 399, + 400, 5, 92, 0, 0, 400, 401, 7, 20, 0, 0, 401, 402, 1, 0, 0, 0, 402, 403, + 3, 141, 70, 0, 403, 404, 3, 141, 70, 0, 404, 405, 3, 141, 70, 0, 405, 406, + 3, 141, 70, 0, 406, 408, 1, 0, 0, 0, 407, 397, 1, 0, 0, 0, 407, 399, 1, + 0, 0, 0, 408, 148, 1, 0, 0, 0, 409, 412, 3, 147, 73, 0, 410, 412, 8, 34, + 0, 0, 411, 409, 1, 0, 0, 0, 411, 410, 1, 0, 0, 0, 412, 150, 1, 0, 0, 0, + 413, 417, 3, 95, 47, 0, 414, 416, 3, 149, 74, 0, 415, 414, 1, 0, 0, 0, + 416, 419, 1, 0, 0, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, + 420, 1, 0, 0, 0, 419, 417, 1, 0, 0, 0, 420, 421, 3, 95, 47, 0, 421, 152, + 1, 0, 0, 0, 422, 426, 3, 97, 48, 0, 423, 425, 3, 149, 74, 0, 424, 423, + 1, 0, 0, 0, 425, 428, 1, 0, 0, 0, 426, 424, 1, 0, 0, 0, 426, 427, 1, 0, + 0, 0, 427, 429, 1, 0, 0, 0, 428, 426, 1, 0, 0, 0, 429, 430, 3, 97, 48, + 0, 430, 154, 1, 0, 0, 0, 16, 0, 331, 343, 349, 354, 362, 364, 369, 373, + 377, 382, 393, 407, 411, 417, 426, 1, 0, 1, 0, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// CosmosDBLexerInit initializes any static state used to implement CosmosDBLexer. By default the +// static state used to implement the lexer is lazily initialized during the first call to +// NewCosmosDBLexer(). You can call this function if you wish to initialize the static state ahead +// of time. +func CosmosDBLexerInit() { + staticData := &CosmosDBLexerLexerStaticData + staticData.once.Do(cosmosdblexerLexerInit) +} + +// NewCosmosDBLexer produces a new lexer instance for the optional input antlr.CharStream. +func NewCosmosDBLexer(input antlr.CharStream) *CosmosDBLexer { + CosmosDBLexerInit() + l := new(CosmosDBLexer) + l.BaseLexer = antlr.NewBaseLexer(input) + staticData := &CosmosDBLexerLexerStaticData + l.Interpreter = antlr.NewLexerATNSimulator(l, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + l.channelNames = staticData.ChannelNames + l.modeNames = staticData.ModeNames + l.RuleNames = staticData.RuleNames + l.LiteralNames = staticData.LiteralNames + l.SymbolicNames = staticData.SymbolicNames + l.GrammarFileName = "CosmosDBLexer.g4" + // TODO: l.EOF = antlr.TokenEOF + + return l +} + +// CosmosDBLexer tokens. +const ( + CosmosDBLexerMULTIPLY_OPERATOR = 1 + CosmosDBLexerAS_SYMBOL = 2 + CosmosDBLexerSELECT_SYMBOL = 3 + CosmosDBLexerFROM_SYMBOL = 4 + CosmosDBLexerDISTINCT_SYMBOL = 5 + CosmosDBLexerUNDEFINED_SYMBOL = 6 + CosmosDBLexerNULL_SYMBOL = 7 + CosmosDBLexerFALSE_SYMBOL = 8 + CosmosDBLexerTRUE_SYMBOL = 9 + CosmosDBLexerNOT_SYMBOL = 10 + CosmosDBLexerUDF_SYMBOL = 11 + CosmosDBLexerWHERE_SYMBOL = 12 + CosmosDBLexerAND_SYMBOL = 13 + CosmosDBLexerOR_SYMBOL = 14 + CosmosDBLexerAT_SYMBOL = 15 + CosmosDBLexerLC_BRACKET_SYMBOL = 16 + CosmosDBLexerRC_BRACKET_SYMBOL = 17 + CosmosDBLexerLS_BRACKET_SYMBOL = 18 + CosmosDBLexerRS_BRACKET_SYMBOL = 19 + CosmosDBLexerLR_BRACKET_SYMBOL = 20 + CosmosDBLexerRR_BRACKET_SYMBOL = 21 + CosmosDBLexerSINGLE_QUOTE_SYMBOL = 22 + CosmosDBLexerDOUBLE_QUOTE_SYMBOL = 23 + CosmosDBLexerCOMMA_SYMBOL = 24 + CosmosDBLexerDOT_SYMBOL = 25 + CosmosDBLexerQUESTION_MARK_SYMBOL = 26 + CosmosDBLexerCOLON_SYMBOL = 27 + CosmosDBLexerPLUS_SYMBOL = 28 + CosmosDBLexerMINUS_SYMBOL = 29 + CosmosDBLexerBIT_NOT_SYMBOL = 30 + CosmosDBLexerDIVIDE_SYMBOL = 31 + CosmosDBLexerMODULO_SYMBOL = 32 + CosmosDBLexerBIT_AND_SYMBOL = 33 + CosmosDBLexerBIT_OR_SYMBOL = 34 + CosmosDBLexerDOUBLE_BAR_SYMBOL = 35 + CosmosDBLexerBIT_XOR_SYMBOL = 36 + CosmosDBLexerEQUAL_SYMBOL = 37 + CosmosDBLexerIDENTIFIER = 38 + CosmosDBLexerWHITESPACE = 39 + CosmosDBLexerDECIMAL = 40 + CosmosDBLexerREAL = 41 + CosmosDBLexerFLOAT = 42 + CosmosDBLexerHEXADECIMAL = 43 + CosmosDBLexerSINGLE_QUOTE_STRING_LITERAL = 44 + CosmosDBLexerDOUBLE_QUOTE_STRING_LITERAL = 45 +) diff --git a/cosmosdb/cosmosdb_parser.go b/cosmosdb/cosmosdb_parser.go new file mode 100644 index 0000000..a1d0985 --- /dev/null +++ b/cosmosdb/cosmosdb_parser.go @@ -0,0 +1,6569 @@ +// Code generated from CosmosDBParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb // CosmosDBParser +import ( + "fmt" + "strconv" + "sync" + + "github.com/antlr4-go/antlr/v4" +) + +// Suppress unused import errors +var _ = fmt.Printf +var _ = strconv.Itoa +var _ = sync.Once{} + +type CosmosDBParser struct { + *antlr.BaseParser +} + +var CosmosDBParserParserStaticData struct { + once sync.Once + serializedATN []int32 + LiteralNames []string + SymbolicNames []string + RuleNames []string + PredictionContextCache *antlr.PredictionContextCache + atn *antlr.ATN + decisionToDFA []*antlr.DFA +} + +func cosmosdbparserParserInit() { + staticData := &CosmosDBParserParserStaticData + staticData.LiteralNames = []string{ + "", "'*'", "'AS'", "'SELECT'", "'FROM'", "'DISTINCT'", "'UNDEFINED'", + "'NULL'", "'FALSE'", "'TRUE'", "'NOT'", "'UDF'", "'WHERE'", "'AND'", + "'OR'", "'@'", "'{'", "'}'", "'['", "']'", "'('", "')'", "'''", "'\"'", + "','", "'.'", "'?'", "':'", "'+'", "'-'", "'~'", "'/'", "'%'", "'&'", + "'|'", "'||'", "'^'", "'='", + } + staticData.SymbolicNames = []string{ + "", "MULTIPLY_OPERATOR", "AS_SYMBOL", "SELECT_SYMBOL", "FROM_SYMBOL", + "DISTINCT_SYMBOL", "UNDEFINED_SYMBOL", "NULL_SYMBOL", "FALSE_SYMBOL", + "TRUE_SYMBOL", "NOT_SYMBOL", "UDF_SYMBOL", "WHERE_SYMBOL", "AND_SYMBOL", + "OR_SYMBOL", "AT_SYMBOL", "LC_BRACKET_SYMBOL", "RC_BRACKET_SYMBOL", + "LS_BRACKET_SYMBOL", "RS_BRACKET_SYMBOL", "LR_BRACKET_SYMBOL", "RR_BRACKET_SYMBOL", + "SINGLE_QUOTE_SYMBOL", "DOUBLE_QUOTE_SYMBOL", "COMMA_SYMBOL", "DOT_SYMBOL", + "QUESTION_MARK_SYMBOL", "COLON_SYMBOL", "PLUS_SYMBOL", "MINUS_SYMBOL", + "BIT_NOT_SYMBOL", "DIVIDE_SYMBOL", "MODULO_SYMBOL", "BIT_AND_SYMBOL", + "BIT_OR_SYMBOL", "DOUBLE_BAR_SYMBOL", "BIT_XOR_SYMBOL", "EQUAL_SYMBOL", + "IDENTIFIER", "WHITESPACE", "DECIMAL", "REAL", "FLOAT", "HEXADECIMAL", + "SINGLE_QUOTE_STRING_LITERAL", "DOUBLE_QUOTE_STRING_LITERAL", + } + staticData.RuleNames = []string{ + "root", "select", "select_clause", "select_specification", "from_clause", + "where_clause", "from_specification", "from_source", "container_expression", + "container_name", "object_property_list", "object_property", "property_alias", + "scalar_expression", "scalar_expression_in_where", "create_array_expression", + "create_object_expression", "scalar_function_expression", "udf_scalar_function_expression", + "builtin_function_expression", "binary_operator", "unary_operator", + "parameter_name", "constant", "object_constant", "object_constant_field_pair", + "array_constant", "string_constant", "undefined_constant", "null_constant", + "boolean_constant", "number_constant", "string_literal", "decimal_literal", + "hexadecimal_literal", "property_name", "array_index", "input_alias", + } + staticData.PredictionContextCache = antlr.NewPredictionContextCache() + staticData.serializedATN = []int32{ + 4, 1, 45, 308, 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, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, + 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, + 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, + 2, 37, 7, 37, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 83, 8, 1, 1, 2, + 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 90, 8, 3, 1, 3, 3, 3, 93, 8, 3, 1, 4, 1, + 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 3, 8, 107, + 8, 8, 1, 8, 3, 8, 110, 8, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 5, 10, 117, + 8, 10, 10, 10, 12, 10, 120, 9, 10, 1, 11, 1, 11, 3, 11, 124, 8, 11, 1, + 11, 3, 11, 127, 8, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, + 3, 13, 136, 8, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 3, + 13, 145, 8, 13, 1, 13, 5, 13, 148, 8, 13, 10, 13, 12, 13, 151, 9, 13, 1, + 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, + 1, 14, 1, 14, 1, 14, 3, 14, 167, 8, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, + 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, + 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 3, 14, 192, 8, + 14, 1, 14, 5, 14, 195, 8, 14, 10, 14, 12, 14, 198, 9, 14, 1, 15, 1, 15, + 1, 16, 1, 16, 1, 17, 1, 17, 3, 17, 206, 8, 17, 1, 18, 1, 18, 1, 18, 1, + 18, 1, 18, 1, 18, 1, 18, 5, 18, 215, 8, 18, 10, 18, 12, 18, 218, 9, 18, + 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 5, 19, 227, 8, 19, 10, + 19, 12, 19, 230, 9, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, + 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 248, + 8, 23, 1, 24, 1, 24, 1, 24, 1, 24, 5, 24, 254, 8, 24, 10, 24, 12, 24, 257, + 9, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 3, 25, 266, 8, + 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 275, 8, 26, + 10, 26, 12, 26, 278, 9, 26, 3, 26, 280, 8, 26, 1, 26, 1, 26, 1, 27, 1, + 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 31, 1, 31, 3, 31, 294, + 8, 31, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, + 36, 1, 37, 1, 37, 1, 37, 0, 2, 26, 28, 38, 0, 2, 4, 6, 8, 10, 12, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, + 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 0, 5, 3, 0, 1, 1, 28, 29, 31, + 37, 1, 0, 28, 30, 1, 0, 8, 9, 1, 0, 44, 45, 1, 0, 40, 42, 309, 0, 76, 1, + 0, 0, 0, 2, 79, 1, 0, 0, 0, 4, 84, 1, 0, 0, 0, 6, 92, 1, 0, 0, 0, 8, 94, + 1, 0, 0, 0, 10, 97, 1, 0, 0, 0, 12, 100, 1, 0, 0, 0, 14, 102, 1, 0, 0, + 0, 16, 104, 1, 0, 0, 0, 18, 111, 1, 0, 0, 0, 20, 113, 1, 0, 0, 0, 22, 121, + 1, 0, 0, 0, 24, 128, 1, 0, 0, 0, 26, 135, 1, 0, 0, 0, 28, 166, 1, 0, 0, + 0, 30, 199, 1, 0, 0, 0, 32, 201, 1, 0, 0, 0, 34, 205, 1, 0, 0, 0, 36, 207, + 1, 0, 0, 0, 38, 221, 1, 0, 0, 0, 40, 233, 1, 0, 0, 0, 42, 235, 1, 0, 0, + 0, 44, 237, 1, 0, 0, 0, 46, 247, 1, 0, 0, 0, 48, 249, 1, 0, 0, 0, 50, 265, + 1, 0, 0, 0, 52, 270, 1, 0, 0, 0, 54, 283, 1, 0, 0, 0, 56, 285, 1, 0, 0, + 0, 58, 287, 1, 0, 0, 0, 60, 289, 1, 0, 0, 0, 62, 293, 1, 0, 0, 0, 64, 295, + 1, 0, 0, 0, 66, 297, 1, 0, 0, 0, 68, 299, 1, 0, 0, 0, 70, 301, 1, 0, 0, + 0, 72, 303, 1, 0, 0, 0, 74, 305, 1, 0, 0, 0, 76, 77, 3, 2, 1, 0, 77, 78, + 5, 0, 0, 1, 78, 1, 1, 0, 0, 0, 79, 80, 3, 4, 2, 0, 80, 82, 3, 8, 4, 0, + 81, 83, 3, 10, 5, 0, 82, 81, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 3, 1, + 0, 0, 0, 84, 85, 5, 3, 0, 0, 85, 86, 3, 6, 3, 0, 86, 5, 1, 0, 0, 0, 87, + 93, 5, 1, 0, 0, 88, 90, 5, 5, 0, 0, 89, 88, 1, 0, 0, 0, 89, 90, 1, 0, 0, + 0, 90, 91, 1, 0, 0, 0, 91, 93, 3, 20, 10, 0, 92, 87, 1, 0, 0, 0, 92, 89, + 1, 0, 0, 0, 93, 7, 1, 0, 0, 0, 94, 95, 5, 4, 0, 0, 95, 96, 3, 12, 6, 0, + 96, 9, 1, 0, 0, 0, 97, 98, 5, 12, 0, 0, 98, 99, 3, 28, 14, 0, 99, 11, 1, + 0, 0, 0, 100, 101, 3, 14, 7, 0, 101, 13, 1, 0, 0, 0, 102, 103, 3, 16, 8, + 0, 103, 15, 1, 0, 0, 0, 104, 109, 3, 18, 9, 0, 105, 107, 5, 2, 0, 0, 106, + 105, 1, 0, 0, 0, 106, 107, 1, 0, 0, 0, 107, 108, 1, 0, 0, 0, 108, 110, + 5, 38, 0, 0, 109, 106, 1, 0, 0, 0, 109, 110, 1, 0, 0, 0, 110, 17, 1, 0, + 0, 0, 111, 112, 5, 38, 0, 0, 112, 19, 1, 0, 0, 0, 113, 118, 3, 22, 11, + 0, 114, 115, 5, 24, 0, 0, 115, 117, 3, 22, 11, 0, 116, 114, 1, 0, 0, 0, + 117, 120, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 118, 119, 1, 0, 0, 0, 119, + 21, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 121, 126, 3, 26, 13, 0, 122, 124, + 5, 2, 0, 0, 123, 122, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 125, 1, 0, + 0, 0, 125, 127, 3, 24, 12, 0, 126, 123, 1, 0, 0, 0, 126, 127, 1, 0, 0, + 0, 127, 23, 1, 0, 0, 0, 128, 129, 5, 38, 0, 0, 129, 25, 1, 0, 0, 0, 130, + 131, 6, 13, -1, 0, 131, 136, 3, 74, 37, 0, 132, 133, 3, 42, 21, 0, 133, + 134, 3, 26, 13, 1, 134, 136, 1, 0, 0, 0, 135, 130, 1, 0, 0, 0, 135, 132, + 1, 0, 0, 0, 136, 149, 1, 0, 0, 0, 137, 138, 10, 3, 0, 0, 138, 139, 5, 25, + 0, 0, 139, 148, 3, 70, 35, 0, 140, 141, 10, 2, 0, 0, 141, 144, 5, 18, 0, + 0, 142, 145, 5, 45, 0, 0, 143, 145, 3, 72, 36, 0, 144, 142, 1, 0, 0, 0, + 144, 143, 1, 0, 0, 0, 145, 146, 1, 0, 0, 0, 146, 148, 5, 19, 0, 0, 147, + 137, 1, 0, 0, 0, 147, 140, 1, 0, 0, 0, 148, 151, 1, 0, 0, 0, 149, 147, + 1, 0, 0, 0, 149, 150, 1, 0, 0, 0, 150, 27, 1, 0, 0, 0, 151, 149, 1, 0, + 0, 0, 152, 153, 6, 14, -1, 0, 153, 167, 3, 46, 23, 0, 154, 167, 3, 74, + 37, 0, 155, 167, 3, 44, 22, 0, 156, 157, 3, 42, 21, 0, 157, 158, 3, 28, + 14, 7, 158, 167, 1, 0, 0, 0, 159, 167, 3, 34, 17, 0, 160, 167, 3, 32, 16, + 0, 161, 167, 3, 30, 15, 0, 162, 163, 5, 20, 0, 0, 163, 164, 3, 28, 14, + 0, 164, 165, 5, 21, 0, 0, 165, 167, 1, 0, 0, 0, 166, 152, 1, 0, 0, 0, 166, + 154, 1, 0, 0, 0, 166, 155, 1, 0, 0, 0, 166, 156, 1, 0, 0, 0, 166, 159, + 1, 0, 0, 0, 166, 160, 1, 0, 0, 0, 166, 161, 1, 0, 0, 0, 166, 162, 1, 0, + 0, 0, 167, 196, 1, 0, 0, 0, 168, 169, 10, 11, 0, 0, 169, 170, 5, 13, 0, + 0, 170, 195, 3, 28, 14, 12, 171, 172, 10, 10, 0, 0, 172, 173, 5, 14, 0, + 0, 173, 195, 3, 28, 14, 11, 174, 175, 10, 6, 0, 0, 175, 176, 3, 40, 20, + 0, 176, 177, 3, 28, 14, 7, 177, 195, 1, 0, 0, 0, 178, 179, 10, 5, 0, 0, + 179, 180, 5, 26, 0, 0, 180, 181, 3, 28, 14, 0, 181, 182, 5, 27, 0, 0, 182, + 183, 3, 28, 14, 6, 183, 195, 1, 0, 0, 0, 184, 185, 10, 9, 0, 0, 185, 186, + 5, 25, 0, 0, 186, 195, 3, 70, 35, 0, 187, 188, 10, 8, 0, 0, 188, 191, 5, + 18, 0, 0, 189, 192, 5, 45, 0, 0, 190, 192, 3, 72, 36, 0, 191, 189, 1, 0, + 0, 0, 191, 190, 1, 0, 0, 0, 192, 193, 1, 0, 0, 0, 193, 195, 5, 19, 0, 0, + 194, 168, 1, 0, 0, 0, 194, 171, 1, 0, 0, 0, 194, 174, 1, 0, 0, 0, 194, + 178, 1, 0, 0, 0, 194, 184, 1, 0, 0, 0, 194, 187, 1, 0, 0, 0, 195, 198, + 1, 0, 0, 0, 196, 194, 1, 0, 0, 0, 196, 197, 1, 0, 0, 0, 197, 29, 1, 0, + 0, 0, 198, 196, 1, 0, 0, 0, 199, 200, 3, 52, 26, 0, 200, 31, 1, 0, 0, 0, + 201, 202, 3, 48, 24, 0, 202, 33, 1, 0, 0, 0, 203, 206, 3, 36, 18, 0, 204, + 206, 3, 38, 19, 0, 205, 203, 1, 0, 0, 0, 205, 204, 1, 0, 0, 0, 206, 35, + 1, 0, 0, 0, 207, 208, 5, 11, 0, 0, 208, 209, 5, 25, 0, 0, 209, 210, 5, + 38, 0, 0, 210, 211, 5, 20, 0, 0, 211, 216, 3, 28, 14, 0, 212, 213, 5, 24, + 0, 0, 213, 215, 3, 28, 14, 0, 214, 212, 1, 0, 0, 0, 215, 218, 1, 0, 0, + 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 219, 1, 0, 0, 0, 218, + 216, 1, 0, 0, 0, 219, 220, 5, 21, 0, 0, 220, 37, 1, 0, 0, 0, 221, 222, + 5, 38, 0, 0, 222, 223, 5, 20, 0, 0, 223, 228, 3, 28, 14, 0, 224, 225, 5, + 24, 0, 0, 225, 227, 3, 28, 14, 0, 226, 224, 1, 0, 0, 0, 227, 230, 1, 0, + 0, 0, 228, 226, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 231, 1, 0, 0, 0, + 230, 228, 1, 0, 0, 0, 231, 232, 5, 21, 0, 0, 232, 39, 1, 0, 0, 0, 233, + 234, 7, 0, 0, 0, 234, 41, 1, 0, 0, 0, 235, 236, 7, 1, 0, 0, 236, 43, 1, + 0, 0, 0, 237, 238, 5, 15, 0, 0, 238, 239, 5, 38, 0, 0, 239, 45, 1, 0, 0, + 0, 240, 248, 3, 56, 28, 0, 241, 248, 3, 58, 29, 0, 242, 248, 3, 60, 30, + 0, 243, 248, 3, 62, 31, 0, 244, 248, 3, 54, 27, 0, 245, 248, 3, 52, 26, + 0, 246, 248, 3, 48, 24, 0, 247, 240, 1, 0, 0, 0, 247, 241, 1, 0, 0, 0, + 247, 242, 1, 0, 0, 0, 247, 243, 1, 0, 0, 0, 247, 244, 1, 0, 0, 0, 247, + 245, 1, 0, 0, 0, 247, 246, 1, 0, 0, 0, 248, 47, 1, 0, 0, 0, 249, 250, 5, + 16, 0, 0, 250, 255, 3, 50, 25, 0, 251, 252, 5, 24, 0, 0, 252, 254, 3, 50, + 25, 0, 253, 251, 1, 0, 0, 0, 254, 257, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, + 255, 256, 1, 0, 0, 0, 256, 258, 1, 0, 0, 0, 257, 255, 1, 0, 0, 0, 258, + 259, 5, 17, 0, 0, 259, 49, 1, 0, 0, 0, 260, 266, 3, 70, 35, 0, 261, 262, + 5, 23, 0, 0, 262, 263, 3, 70, 35, 0, 263, 264, 5, 23, 0, 0, 264, 266, 1, + 0, 0, 0, 265, 260, 1, 0, 0, 0, 265, 261, 1, 0, 0, 0, 266, 267, 1, 0, 0, + 0, 267, 268, 5, 24, 0, 0, 268, 269, 3, 46, 23, 0, 269, 51, 1, 0, 0, 0, + 270, 279, 5, 18, 0, 0, 271, 276, 3, 46, 23, 0, 272, 273, 5, 24, 0, 0, 273, + 275, 3, 46, 23, 0, 274, 272, 1, 0, 0, 0, 275, 278, 1, 0, 0, 0, 276, 274, + 1, 0, 0, 0, 276, 277, 1, 0, 0, 0, 277, 280, 1, 0, 0, 0, 278, 276, 1, 0, + 0, 0, 279, 271, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 281, 1, 0, 0, 0, + 281, 282, 5, 19, 0, 0, 282, 53, 1, 0, 0, 0, 283, 284, 3, 64, 32, 0, 284, + 55, 1, 0, 0, 0, 285, 286, 5, 6, 0, 0, 286, 57, 1, 0, 0, 0, 287, 288, 5, + 7, 0, 0, 288, 59, 1, 0, 0, 0, 289, 290, 7, 2, 0, 0, 290, 61, 1, 0, 0, 0, + 291, 294, 3, 66, 33, 0, 292, 294, 3, 68, 34, 0, 293, 291, 1, 0, 0, 0, 293, + 292, 1, 0, 0, 0, 294, 63, 1, 0, 0, 0, 295, 296, 7, 3, 0, 0, 296, 65, 1, + 0, 0, 0, 297, 298, 7, 4, 0, 0, 298, 67, 1, 0, 0, 0, 299, 300, 5, 43, 0, + 0, 300, 69, 1, 0, 0, 0, 301, 302, 5, 38, 0, 0, 302, 71, 1, 0, 0, 0, 303, + 304, 5, 40, 0, 0, 304, 73, 1, 0, 0, 0, 305, 306, 5, 38, 0, 0, 306, 75, + 1, 0, 0, 0, 25, 82, 89, 92, 106, 109, 118, 123, 126, 135, 144, 147, 149, + 166, 191, 194, 196, 205, 216, 228, 247, 255, 265, 276, 279, 293, + } + deserializer := antlr.NewATNDeserializer(nil) + staticData.atn = deserializer.Deserialize(staticData.serializedATN) + atn := staticData.atn + staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState)) + decisionToDFA := staticData.decisionToDFA + for index, state := range atn.DecisionToState { + decisionToDFA[index] = antlr.NewDFA(state, index) + } +} + +// CosmosDBParserInit initializes any static state used to implement CosmosDBParser. By default the +// static state used to implement the parser is lazily initialized during the first call to +// NewCosmosDBParser(). You can call this function if you wish to initialize the static state ahead +// of time. +func CosmosDBParserInit() { + staticData := &CosmosDBParserParserStaticData + staticData.once.Do(cosmosdbparserParserInit) +} + +// NewCosmosDBParser produces a new parser instance for the optional input antlr.TokenStream. +func NewCosmosDBParser(input antlr.TokenStream) *CosmosDBParser { + CosmosDBParserInit() + this := new(CosmosDBParser) + this.BaseParser = antlr.NewBaseParser(input) + staticData := &CosmosDBParserParserStaticData + this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache) + this.RuleNames = staticData.RuleNames + this.LiteralNames = staticData.LiteralNames + this.SymbolicNames = staticData.SymbolicNames + this.GrammarFileName = "CosmosDBParser.g4" + + return this +} + +// CosmosDBParser tokens. +const ( + CosmosDBParserEOF = antlr.TokenEOF + CosmosDBParserMULTIPLY_OPERATOR = 1 + CosmosDBParserAS_SYMBOL = 2 + CosmosDBParserSELECT_SYMBOL = 3 + CosmosDBParserFROM_SYMBOL = 4 + CosmosDBParserDISTINCT_SYMBOL = 5 + CosmosDBParserUNDEFINED_SYMBOL = 6 + CosmosDBParserNULL_SYMBOL = 7 + CosmosDBParserFALSE_SYMBOL = 8 + CosmosDBParserTRUE_SYMBOL = 9 + CosmosDBParserNOT_SYMBOL = 10 + CosmosDBParserUDF_SYMBOL = 11 + CosmosDBParserWHERE_SYMBOL = 12 + CosmosDBParserAND_SYMBOL = 13 + CosmosDBParserOR_SYMBOL = 14 + CosmosDBParserAT_SYMBOL = 15 + CosmosDBParserLC_BRACKET_SYMBOL = 16 + CosmosDBParserRC_BRACKET_SYMBOL = 17 + CosmosDBParserLS_BRACKET_SYMBOL = 18 + CosmosDBParserRS_BRACKET_SYMBOL = 19 + CosmosDBParserLR_BRACKET_SYMBOL = 20 + CosmosDBParserRR_BRACKET_SYMBOL = 21 + CosmosDBParserSINGLE_QUOTE_SYMBOL = 22 + CosmosDBParserDOUBLE_QUOTE_SYMBOL = 23 + CosmosDBParserCOMMA_SYMBOL = 24 + CosmosDBParserDOT_SYMBOL = 25 + CosmosDBParserQUESTION_MARK_SYMBOL = 26 + CosmosDBParserCOLON_SYMBOL = 27 + CosmosDBParserPLUS_SYMBOL = 28 + CosmosDBParserMINUS_SYMBOL = 29 + CosmosDBParserBIT_NOT_SYMBOL = 30 + CosmosDBParserDIVIDE_SYMBOL = 31 + CosmosDBParserMODULO_SYMBOL = 32 + CosmosDBParserBIT_AND_SYMBOL = 33 + CosmosDBParserBIT_OR_SYMBOL = 34 + CosmosDBParserDOUBLE_BAR_SYMBOL = 35 + CosmosDBParserBIT_XOR_SYMBOL = 36 + CosmosDBParserEQUAL_SYMBOL = 37 + CosmosDBParserIDENTIFIER = 38 + CosmosDBParserWHITESPACE = 39 + CosmosDBParserDECIMAL = 40 + CosmosDBParserREAL = 41 + CosmosDBParserFLOAT = 42 + CosmosDBParserHEXADECIMAL = 43 + CosmosDBParserSINGLE_QUOTE_STRING_LITERAL = 44 + CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL = 45 +) + +// CosmosDBParser rules. +const ( + CosmosDBParserRULE_root = 0 + CosmosDBParserRULE_select = 1 + CosmosDBParserRULE_select_clause = 2 + CosmosDBParserRULE_select_specification = 3 + CosmosDBParserRULE_from_clause = 4 + CosmosDBParserRULE_where_clause = 5 + CosmosDBParserRULE_from_specification = 6 + CosmosDBParserRULE_from_source = 7 + CosmosDBParserRULE_container_expression = 8 + CosmosDBParserRULE_container_name = 9 + CosmosDBParserRULE_object_property_list = 10 + CosmosDBParserRULE_object_property = 11 + CosmosDBParserRULE_property_alias = 12 + CosmosDBParserRULE_scalar_expression = 13 + CosmosDBParserRULE_scalar_expression_in_where = 14 + CosmosDBParserRULE_create_array_expression = 15 + CosmosDBParserRULE_create_object_expression = 16 + CosmosDBParserRULE_scalar_function_expression = 17 + CosmosDBParserRULE_udf_scalar_function_expression = 18 + CosmosDBParserRULE_builtin_function_expression = 19 + CosmosDBParserRULE_binary_operator = 20 + CosmosDBParserRULE_unary_operator = 21 + CosmosDBParserRULE_parameter_name = 22 + CosmosDBParserRULE_constant = 23 + CosmosDBParserRULE_object_constant = 24 + CosmosDBParserRULE_object_constant_field_pair = 25 + CosmosDBParserRULE_array_constant = 26 + CosmosDBParserRULE_string_constant = 27 + CosmosDBParserRULE_undefined_constant = 28 + CosmosDBParserRULE_null_constant = 29 + CosmosDBParserRULE_boolean_constant = 30 + CosmosDBParserRULE_number_constant = 31 + CosmosDBParserRULE_string_literal = 32 + CosmosDBParserRULE_decimal_literal = 33 + CosmosDBParserRULE_hexadecimal_literal = 34 + CosmosDBParserRULE_property_name = 35 + CosmosDBParserRULE_array_index = 36 + CosmosDBParserRULE_input_alias = 37 +) + +// IRootContext is an interface to support dynamic dispatch. +type IRootContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Select_() ISelectContext + EOF() antlr.TerminalNode + + // IsRootContext differentiates from other interfaces. + IsRootContext() +} + +type RootContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyRootContext() *RootContext { + var p = new(RootContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_root + return p +} + +func InitEmptyRootContext(p *RootContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_root +} + +func (*RootContext) IsRootContext() {} + +func NewRootContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RootContext { + var p = new(RootContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_root + + return p +} + +func (s *RootContext) GetParser() antlr.Parser { return s.parser } + +func (s *RootContext) Select_() ISelectContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelectContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelectContext) +} + +func (s *RootContext) EOF() antlr.TerminalNode { + return s.GetToken(CosmosDBParserEOF, 0) +} + +func (s *RootContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *RootContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *RootContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterRoot(s) + } +} + +func (s *RootContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitRoot(s) + } +} + +func (s *RootContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitRoot(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Root() (localctx IRootContext) { + localctx = NewRootContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 0, CosmosDBParserRULE_root) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(76) + p.Select_() + } + { + p.SetState(77) + p.Match(CosmosDBParserEOF) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// ISelectContext is an interface to support dynamic dispatch. +type ISelectContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Select_clause() ISelect_clauseContext + From_clause() IFrom_clauseContext + Where_clause() IWhere_clauseContext + + // IsSelectContext differentiates from other interfaces. + IsSelectContext() +} + +type SelectContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelectContext() *SelectContext { + var p = new(SelectContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select + return p +} + +func InitEmptySelectContext(p *SelectContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select +} + +func (*SelectContext) IsSelectContext() {} + +func NewSelectContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SelectContext { + var p = new(SelectContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_select + + return p +} + +func (s *SelectContext) GetParser() antlr.Parser { return s.parser } + +func (s *SelectContext) Select_clause() ISelect_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_clauseContext) +} + +func (s *SelectContext) From_clause() IFrom_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_clauseContext) +} + +func (s *SelectContext) Where_clause() IWhere_clauseContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IWhere_clauseContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IWhere_clauseContext) +} + +func (s *SelectContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *SelectContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *SelectContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterSelect(s) + } +} + +func (s *SelectContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitSelect(s) + } +} + +func (s *SelectContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitSelect(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Select_() (localctx ISelectContext) { + localctx = NewSelectContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 2, CosmosDBParserRULE_select) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(79) + p.Select_clause() + } + { + p.SetState(80) + p.From_clause() + } + p.SetState(82) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserWHERE_SYMBOL { + { + p.SetState(81) + p.Where_clause() + } + + } + +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 +} + +// ISelect_clauseContext is an interface to support dynamic dispatch. +type ISelect_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SELECT_SYMBOL() antlr.TerminalNode + Select_specification() ISelect_specificationContext + + // IsSelect_clauseContext differentiates from other interfaces. + IsSelect_clauseContext() +} + +type Select_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_clauseContext() *Select_clauseContext { + var p = new(Select_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select_clause + return p +} + +func InitEmptySelect_clauseContext(p *Select_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select_clause +} + +func (*Select_clauseContext) IsSelect_clauseContext() {} + +func NewSelect_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_clauseContext { + var p = new(Select_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_select_clause + + return p +} + +func (s *Select_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_clauseContext) SELECT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserSELECT_SYMBOL, 0) +} + +func (s *Select_clauseContext) Select_specification() ISelect_specificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ISelect_specificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ISelect_specificationContext) +} + +func (s *Select_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterSelect_clause(s) + } +} + +func (s *Select_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitSelect_clause(s) + } +} + +func (s *Select_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitSelect_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Select_clause() (localctx ISelect_clauseContext) { + localctx = NewSelect_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 4, CosmosDBParserRULE_select_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(84) + p.Match(CosmosDBParserSELECT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(85) + p.Select_specification() + } + +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 +} + +// ISelect_specificationContext is an interface to support dynamic dispatch. +type ISelect_specificationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MULTIPLY_OPERATOR() antlr.TerminalNode + Object_property_list() IObject_property_listContext + DISTINCT_SYMBOL() antlr.TerminalNode + + // IsSelect_specificationContext differentiates from other interfaces. + IsSelect_specificationContext() +} + +type Select_specificationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptySelect_specificationContext() *Select_specificationContext { + var p = new(Select_specificationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select_specification + return p +} + +func InitEmptySelect_specificationContext(p *Select_specificationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_select_specification +} + +func (*Select_specificationContext) IsSelect_specificationContext() {} + +func NewSelect_specificationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Select_specificationContext { + var p = new(Select_specificationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_select_specification + + return p +} + +func (s *Select_specificationContext) GetParser() antlr.Parser { return s.parser } + +func (s *Select_specificationContext) MULTIPLY_OPERATOR() antlr.TerminalNode { + return s.GetToken(CosmosDBParserMULTIPLY_OPERATOR, 0) +} + +func (s *Select_specificationContext) Object_property_list() IObject_property_listContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_property_listContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_property_listContext) +} + +func (s *Select_specificationContext) DISTINCT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDISTINCT_SYMBOL, 0) +} + +func (s *Select_specificationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Select_specificationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Select_specificationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterSelect_specification(s) + } +} + +func (s *Select_specificationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitSelect_specification(s) + } +} + +func (s *Select_specificationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitSelect_specification(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Select_specification() (localctx ISelect_specificationContext) { + localctx = NewSelect_specificationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 6, CosmosDBParserRULE_select_specification) + var _la int + + p.SetState(92) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserMULTIPLY_OPERATOR: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(87) + p.Match(CosmosDBParserMULTIPLY_OPERATOR) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case CosmosDBParserDISTINCT_SYMBOL, CosmosDBParserPLUS_SYMBOL, CosmosDBParserMINUS_SYMBOL, CosmosDBParserBIT_NOT_SYMBOL, CosmosDBParserIDENTIFIER: + p.EnterOuterAlt(localctx, 2) + p.SetState(89) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserDISTINCT_SYMBOL { + { + p.SetState(88) + p.Match(CosmosDBParserDISTINCT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(91) + p.Object_property_list() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + 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 +} + +// IFrom_clauseContext is an interface to support dynamic dispatch. +type IFrom_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + FROM_SYMBOL() antlr.TerminalNode + From_specification() IFrom_specificationContext + + // IsFrom_clauseContext differentiates from other interfaces. + IsFrom_clauseContext() +} + +type From_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_clauseContext() *From_clauseContext { + var p = new(From_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_clause + return p +} + +func InitEmptyFrom_clauseContext(p *From_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_clause +} + +func (*From_clauseContext) IsFrom_clauseContext() {} + +func NewFrom_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_clauseContext { + var p = new(From_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_from_clause + + return p +} + +func (s *From_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_clauseContext) FROM_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserFROM_SYMBOL, 0) +} + +func (s *From_clauseContext) From_specification() IFrom_specificationContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_specificationContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_specificationContext) +} + +func (s *From_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterFrom_clause(s) + } +} + +func (s *From_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitFrom_clause(s) + } +} + +func (s *From_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitFrom_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) From_clause() (localctx IFrom_clauseContext) { + localctx = NewFrom_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 8, CosmosDBParserRULE_from_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(94) + p.Match(CosmosDBParserFROM_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(95) + p.From_specification() + } + +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 +} + +// IWhere_clauseContext is an interface to support dynamic dispatch. +type IWhere_clauseContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + WHERE_SYMBOL() antlr.TerminalNode + Scalar_expression_in_where() IScalar_expression_in_whereContext + + // IsWhere_clauseContext differentiates from other interfaces. + IsWhere_clauseContext() +} + +type Where_clauseContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyWhere_clauseContext() *Where_clauseContext { + var p = new(Where_clauseContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_where_clause + return p +} + +func InitEmptyWhere_clauseContext(p *Where_clauseContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_where_clause +} + +func (*Where_clauseContext) IsWhere_clauseContext() {} + +func NewWhere_clauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Where_clauseContext { + var p = new(Where_clauseContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_where_clause + + return p +} + +func (s *Where_clauseContext) GetParser() antlr.Parser { return s.parser } + +func (s *Where_clauseContext) WHERE_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserWHERE_SYMBOL, 0) +} + +func (s *Where_clauseContext) Scalar_expression_in_where() IScalar_expression_in_whereContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expression_in_whereContext) +} + +func (s *Where_clauseContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Where_clauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Where_clauseContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterWhere_clause(s) + } +} + +func (s *Where_clauseContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitWhere_clause(s) + } +} + +func (s *Where_clauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitWhere_clause(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Where_clause() (localctx IWhere_clauseContext) { + localctx = NewWhere_clauseContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 10, CosmosDBParserRULE_where_clause) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(97) + p.Match(CosmosDBParserWHERE_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(98) + p.scalar_expression_in_where(0) + } + +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 +} + +// IFrom_specificationContext is an interface to support dynamic dispatch. +type IFrom_specificationContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + From_source() IFrom_sourceContext + + // IsFrom_specificationContext differentiates from other interfaces. + IsFrom_specificationContext() +} + +type From_specificationContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_specificationContext() *From_specificationContext { + var p = new(From_specificationContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_specification + return p +} + +func InitEmptyFrom_specificationContext(p *From_specificationContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_specification +} + +func (*From_specificationContext) IsFrom_specificationContext() {} + +func NewFrom_specificationContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_specificationContext { + var p = new(From_specificationContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_from_specification + + return p +} + +func (s *From_specificationContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_specificationContext) From_source() IFrom_sourceContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IFrom_sourceContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IFrom_sourceContext) +} + +func (s *From_specificationContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_specificationContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_specificationContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterFrom_specification(s) + } +} + +func (s *From_specificationContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitFrom_specification(s) + } +} + +func (s *From_specificationContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitFrom_specification(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) From_specification() (localctx IFrom_specificationContext) { + localctx = NewFrom_specificationContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 12, CosmosDBParserRULE_from_specification) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(100) + p.From_source() + } + +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 +} + +// IFrom_sourceContext is an interface to support dynamic dispatch. +type IFrom_sourceContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Container_expression() IContainer_expressionContext + + // IsFrom_sourceContext differentiates from other interfaces. + IsFrom_sourceContext() +} + +type From_sourceContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyFrom_sourceContext() *From_sourceContext { + var p = new(From_sourceContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_source + return p +} + +func InitEmptyFrom_sourceContext(p *From_sourceContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_from_source +} + +func (*From_sourceContext) IsFrom_sourceContext() {} + +func NewFrom_sourceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *From_sourceContext { + var p = new(From_sourceContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_from_source + + return p +} + +func (s *From_sourceContext) GetParser() antlr.Parser { return s.parser } + +func (s *From_sourceContext) Container_expression() IContainer_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IContainer_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IContainer_expressionContext) +} + +func (s *From_sourceContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *From_sourceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *From_sourceContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterFrom_source(s) + } +} + +func (s *From_sourceContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitFrom_source(s) + } +} + +func (s *From_sourceContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitFrom_source(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) From_source() (localctx IFrom_sourceContext) { + localctx = NewFrom_sourceContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 14, CosmosDBParserRULE_from_source) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(102) + p.Container_expression() + } + +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 +} + +// IContainer_expressionContext is an interface to support dynamic dispatch. +type IContainer_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Container_name() IContainer_nameContext + IDENTIFIER() antlr.TerminalNode + AS_SYMBOL() antlr.TerminalNode + + // IsContainer_expressionContext differentiates from other interfaces. + IsContainer_expressionContext() +} + +type Container_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyContainer_expressionContext() *Container_expressionContext { + var p = new(Container_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_container_expression + return p +} + +func InitEmptyContainer_expressionContext(p *Container_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_container_expression +} + +func (*Container_expressionContext) IsContainer_expressionContext() {} + +func NewContainer_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Container_expressionContext { + var p = new(Container_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_container_expression + + return p +} + +func (s *Container_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Container_expressionContext) Container_name() IContainer_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IContainer_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IContainer_nameContext) +} + +func (s *Container_expressionContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Container_expressionContext) AS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserAS_SYMBOL, 0) +} + +func (s *Container_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Container_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Container_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterContainer_expression(s) + } +} + +func (s *Container_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitContainer_expression(s) + } +} + +func (s *Container_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitContainer_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Container_expression() (localctx IContainer_expressionContext) { + localctx = NewContainer_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 16, CosmosDBParserRULE_container_expression) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(104) + p.Container_name() + } + p.SetState(109) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserAS_SYMBOL || _la == CosmosDBParserIDENTIFIER { + p.SetState(106) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserAS_SYMBOL { + { + p.SetState(105) + p.Match(CosmosDBParserAS_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(108) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IContainer_nameContext is an interface to support dynamic dispatch. +type IContainer_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IDENTIFIER() antlr.TerminalNode + + // IsContainer_nameContext differentiates from other interfaces. + IsContainer_nameContext() +} + +type Container_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyContainer_nameContext() *Container_nameContext { + var p = new(Container_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_container_name + return p +} + +func InitEmptyContainer_nameContext(p *Container_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_container_name +} + +func (*Container_nameContext) IsContainer_nameContext() {} + +func NewContainer_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Container_nameContext { + var p = new(Container_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_container_name + + return p +} + +func (s *Container_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Container_nameContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Container_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Container_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Container_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterContainer_name(s) + } +} + +func (s *Container_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitContainer_name(s) + } +} + +func (s *Container_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitContainer_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Container_name() (localctx IContainer_nameContext) { + localctx = NewContainer_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 18, CosmosDBParserRULE_container_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(111) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IObject_property_listContext is an interface to support dynamic dispatch. +type IObject_property_listContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AllObject_property() []IObject_propertyContext + Object_property(i int) IObject_propertyContext + AllCOMMA_SYMBOL() []antlr.TerminalNode + COMMA_SYMBOL(i int) antlr.TerminalNode + + // IsObject_property_listContext differentiates from other interfaces. + IsObject_property_listContext() +} + +type Object_property_listContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_property_listContext() *Object_property_listContext { + var p = new(Object_property_listContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_property_list + return p +} + +func InitEmptyObject_property_listContext(p *Object_property_listContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_property_list +} + +func (*Object_property_listContext) IsObject_property_listContext() {} + +func NewObject_property_listContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_property_listContext { + var p = new(Object_property_listContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_object_property_list + + return p +} + +func (s *Object_property_listContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_property_listContext) AllObject_property() []IObject_propertyContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IObject_propertyContext); ok { + len++ + } + } + + tst := make([]IObject_propertyContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IObject_propertyContext); ok { + tst[i] = t.(IObject_propertyContext) + i++ + } + } + + return tst +} + +func (s *Object_property_listContext) Object_property(i int) IObject_propertyContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_propertyContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IObject_propertyContext) +} + +func (s *Object_property_listContext) AllCOMMA_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserCOMMA_SYMBOL) +} + +func (s *Object_property_listContext) COMMA_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, i) +} + +func (s *Object_property_listContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_property_listContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_property_listContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterObject_property_list(s) + } +} + +func (s *Object_property_listContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitObject_property_list(s) + } +} + +func (s *Object_property_listContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitObject_property_list(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Object_property_list() (localctx IObject_property_listContext) { + localctx = NewObject_property_listContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 20, CosmosDBParserRULE_object_property_list) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(113) + p.Object_property() + } + p.SetState(118) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == CosmosDBParserCOMMA_SYMBOL { + { + p.SetState(114) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(115) + p.Object_property() + } + + p.SetState(120) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + +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 +} + +// IObject_propertyContext is an interface to support dynamic dispatch. +type IObject_propertyContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Scalar_expression() IScalar_expressionContext + Property_alias() IProperty_aliasContext + AS_SYMBOL() antlr.TerminalNode + + // IsObject_propertyContext differentiates from other interfaces. + IsObject_propertyContext() +} + +type Object_propertyContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_propertyContext() *Object_propertyContext { + var p = new(Object_propertyContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_property + return p +} + +func InitEmptyObject_propertyContext(p *Object_propertyContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_property +} + +func (*Object_propertyContext) IsObject_propertyContext() {} + +func NewObject_propertyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_propertyContext { + var p = new(Object_propertyContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_object_property + + return p +} + +func (s *Object_propertyContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_propertyContext) Scalar_expression() IScalar_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expressionContext) +} + +func (s *Object_propertyContext) Property_alias() IProperty_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProperty_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProperty_aliasContext) +} + +func (s *Object_propertyContext) AS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserAS_SYMBOL, 0) +} + +func (s *Object_propertyContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_propertyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_propertyContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterObject_property(s) + } +} + +func (s *Object_propertyContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitObject_property(s) + } +} + +func (s *Object_propertyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitObject_property(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Object_property() (localctx IObject_propertyContext) { + localctx = NewObject_propertyContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 22, CosmosDBParserRULE_object_property) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(121) + p.scalar_expression(0) + } + p.SetState(126) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserAS_SYMBOL || _la == CosmosDBParserIDENTIFIER { + p.SetState(123) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if _la == CosmosDBParserAS_SYMBOL { + { + p.SetState(122) + p.Match(CosmosDBParserAS_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + } + { + p.SetState(125) + p.Property_alias() + } + + } + +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 +} + +// IProperty_aliasContext is an interface to support dynamic dispatch. +type IProperty_aliasContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IDENTIFIER() antlr.TerminalNode + + // IsProperty_aliasContext differentiates from other interfaces. + IsProperty_aliasContext() +} + +type Property_aliasContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProperty_aliasContext() *Property_aliasContext { + var p = new(Property_aliasContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_property_alias + return p +} + +func InitEmptyProperty_aliasContext(p *Property_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_property_alias +} + +func (*Property_aliasContext) IsProperty_aliasContext() {} + +func NewProperty_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Property_aliasContext { + var p = new(Property_aliasContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_property_alias + + return p +} + +func (s *Property_aliasContext) GetParser() antlr.Parser { return s.parser } + +func (s *Property_aliasContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Property_aliasContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Property_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Property_aliasContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterProperty_alias(s) + } +} + +func (s *Property_aliasContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitProperty_alias(s) + } +} + +func (s *Property_aliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitProperty_alias(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Property_alias() (localctx IProperty_aliasContext) { + localctx = NewProperty_aliasContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 24, CosmosDBParserRULE_property_alias) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(128) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IScalar_expressionContext is an interface to support dynamic dispatch. +type IScalar_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Input_alias() IInput_aliasContext + Unary_operator() IUnary_operatorContext + Scalar_expression() IScalar_expressionContext + DOT_SYMBOL() antlr.TerminalNode + Property_name() IProperty_nameContext + LS_BRACKET_SYMBOL() antlr.TerminalNode + RS_BRACKET_SYMBOL() antlr.TerminalNode + DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode + Array_index() IArray_indexContext + + // IsScalar_expressionContext differentiates from other interfaces. + IsScalar_expressionContext() +} + +type Scalar_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyScalar_expressionContext() *Scalar_expressionContext { + var p = new(Scalar_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_expression + return p +} + +func InitEmptyScalar_expressionContext(p *Scalar_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_expression +} + +func (*Scalar_expressionContext) IsScalar_expressionContext() {} + +func NewScalar_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Scalar_expressionContext { + var p = new(Scalar_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_scalar_expression + + return p +} + +func (s *Scalar_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Scalar_expressionContext) Input_alias() IInput_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInput_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInput_aliasContext) +} + +func (s *Scalar_expressionContext) Unary_operator() IUnary_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnary_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnary_operatorContext) +} + +func (s *Scalar_expressionContext) Scalar_expression() IScalar_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expressionContext) +} + +func (s *Scalar_expressionContext) DOT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOT_SYMBOL, 0) +} + +func (s *Scalar_expressionContext) Property_name() IProperty_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProperty_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProperty_nameContext) +} + +func (s *Scalar_expressionContext) LS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLS_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expressionContext) RS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRS_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expressionContext) DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL, 0) +} + +func (s *Scalar_expressionContext) Array_index() IArray_indexContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_indexContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_indexContext) +} + +func (s *Scalar_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Scalar_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Scalar_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterScalar_expression(s) + } +} + +func (s *Scalar_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitScalar_expression(s) + } +} + +func (s *Scalar_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitScalar_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Scalar_expression() (localctx IScalar_expressionContext) { + return p.scalar_expression(0) +} + +func (p *CosmosDBParser) scalar_expression(_p int) (localctx IScalar_expressionContext) { + var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() + + _parentState := p.GetState() + localctx = NewScalar_expressionContext(p, p.GetParserRuleContext(), _parentState) + var _prevctx IScalar_expressionContext = localctx + var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. + _startState := 26 + p.EnterRecursionRule(localctx, 26, CosmosDBParserRULE_scalar_expression, _p) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(135) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserIDENTIFIER: + { + p.SetState(131) + p.Input_alias() + } + + case CosmosDBParserPLUS_SYMBOL, CosmosDBParserMINUS_SYMBOL, CosmosDBParserBIT_NOT_SYMBOL: + { + p.SetState(132) + p.Unary_operator() + } + { + p.SetState(133) + p.scalar_expression(1) + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) + p.SetState(149) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + if p.GetParseListeners() != nil { + p.TriggerExitRuleEvent() + } + _prevctx = localctx + p.SetState(147) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) { + case 1: + localctx = NewScalar_expressionContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression) + p.SetState(137) + + if !(p.Precpred(p.GetParserRuleContext(), 3)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 3)", "")) + goto errorExit + } + { + p.SetState(138) + p.Match(CosmosDBParserDOT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(139) + p.Property_name() + } + + case 2: + localctx = NewScalar_expressionContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression) + p.SetState(140) + + if !(p.Precpred(p.GetParserRuleContext(), 2)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", "")) + goto errorExit + } + { + p.SetState(141) + p.Match(CosmosDBParserLS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(144) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL: + { + p.SetState(142) + p.Match(CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case CosmosDBParserDECIMAL: + { + p.SetState(143) + p.Array_index() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(146) + p.Match(CosmosDBParserRS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } + p.SetState(151) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 11, p.GetParserRuleContext()) + if p.HasError() { + 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.UnrollRecursionContexts(_parentctx) + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// IScalar_expression_in_whereContext is an interface to support dynamic dispatch. +type IScalar_expression_in_whereContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Constant() IConstantContext + Input_alias() IInput_aliasContext + Parameter_name() IParameter_nameContext + Unary_operator() IUnary_operatorContext + AllScalar_expression_in_where() []IScalar_expression_in_whereContext + Scalar_expression_in_where(i int) IScalar_expression_in_whereContext + Scalar_function_expression() IScalar_function_expressionContext + Create_object_expression() ICreate_object_expressionContext + Create_array_expression() ICreate_array_expressionContext + LR_BRACKET_SYMBOL() antlr.TerminalNode + RR_BRACKET_SYMBOL() antlr.TerminalNode + AND_SYMBOL() antlr.TerminalNode + OR_SYMBOL() antlr.TerminalNode + Binary_operator() IBinary_operatorContext + QUESTION_MARK_SYMBOL() antlr.TerminalNode + COLON_SYMBOL() antlr.TerminalNode + DOT_SYMBOL() antlr.TerminalNode + Property_name() IProperty_nameContext + LS_BRACKET_SYMBOL() antlr.TerminalNode + RS_BRACKET_SYMBOL() antlr.TerminalNode + DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode + Array_index() IArray_indexContext + + // IsScalar_expression_in_whereContext differentiates from other interfaces. + IsScalar_expression_in_whereContext() +} + +type Scalar_expression_in_whereContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyScalar_expression_in_whereContext() *Scalar_expression_in_whereContext { + var p = new(Scalar_expression_in_whereContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_expression_in_where + return p +} + +func InitEmptyScalar_expression_in_whereContext(p *Scalar_expression_in_whereContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_expression_in_where +} + +func (*Scalar_expression_in_whereContext) IsScalar_expression_in_whereContext() {} + +func NewScalar_expression_in_whereContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Scalar_expression_in_whereContext { + var p = new(Scalar_expression_in_whereContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_scalar_expression_in_where + + return p +} + +func (s *Scalar_expression_in_whereContext) GetParser() antlr.Parser { return s.parser } + +func (s *Scalar_expression_in_whereContext) Constant() IConstantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstantContext) +} + +func (s *Scalar_expression_in_whereContext) Input_alias() IInput_aliasContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IInput_aliasContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IInput_aliasContext) +} + +func (s *Scalar_expression_in_whereContext) Parameter_name() IParameter_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IParameter_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IParameter_nameContext) +} + +func (s *Scalar_expression_in_whereContext) Unary_operator() IUnary_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUnary_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUnary_operatorContext) +} + +func (s *Scalar_expression_in_whereContext) AllScalar_expression_in_where() []IScalar_expression_in_whereContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + len++ + } + } + + tst := make([]IScalar_expression_in_whereContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IScalar_expression_in_whereContext); ok { + tst[i] = t.(IScalar_expression_in_whereContext) + i++ + } + } + + return tst +} + +func (s *Scalar_expression_in_whereContext) Scalar_expression_in_where(i int) IScalar_expression_in_whereContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expression_in_whereContext) +} + +func (s *Scalar_expression_in_whereContext) Scalar_function_expression() IScalar_function_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_function_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IScalar_function_expressionContext) +} + +func (s *Scalar_expression_in_whereContext) Create_object_expression() ICreate_object_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_object_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_object_expressionContext) +} + +func (s *Scalar_expression_in_whereContext) Create_array_expression() ICreate_array_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(ICreate_array_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(ICreate_array_expressionContext) +} + +func (s *Scalar_expression_in_whereContext) LR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLR_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) RR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRR_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) AND_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserAND_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) OR_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserOR_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) Binary_operator() IBinary_operatorContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBinary_operatorContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBinary_operatorContext) +} + +func (s *Scalar_expression_in_whereContext) QUESTION_MARK_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserQUESTION_MARK_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) COLON_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOLON_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) DOT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOT_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) Property_name() IProperty_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProperty_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProperty_nameContext) +} + +func (s *Scalar_expression_in_whereContext) LS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLS_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) RS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRS_BRACKET_SYMBOL, 0) +} + +func (s *Scalar_expression_in_whereContext) DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL, 0) +} + +func (s *Scalar_expression_in_whereContext) Array_index() IArray_indexContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_indexContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_indexContext) +} + +func (s *Scalar_expression_in_whereContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Scalar_expression_in_whereContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Scalar_expression_in_whereContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterScalar_expression_in_where(s) + } +} + +func (s *Scalar_expression_in_whereContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitScalar_expression_in_where(s) + } +} + +func (s *Scalar_expression_in_whereContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitScalar_expression_in_where(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Scalar_expression_in_where() (localctx IScalar_expression_in_whereContext) { + return p.scalar_expression_in_where(0) +} + +func (p *CosmosDBParser) scalar_expression_in_where(_p int) (localctx IScalar_expression_in_whereContext) { + var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext() + + _parentState := p.GetState() + localctx = NewScalar_expression_in_whereContext(p, p.GetParserRuleContext(), _parentState) + var _prevctx IScalar_expression_in_whereContext = localctx + var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning. + _startState := 28 + p.EnterRecursionRule(localctx, 28, CosmosDBParserRULE_scalar_expression_in_where, _p) + var _alt int + + p.EnterOuterAlt(localctx, 1) + p.SetState(166) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 12, p.GetParserRuleContext()) { + case 1: + { + p.SetState(153) + p.Constant() + } + + case 2: + { + p.SetState(154) + p.Input_alias() + } + + case 3: + { + p.SetState(155) + p.Parameter_name() + } + + case 4: + { + p.SetState(156) + p.Unary_operator() + } + { + p.SetState(157) + p.scalar_expression_in_where(7) + } + + case 5: + { + p.SetState(159) + p.Scalar_function_expression() + } + + case 6: + { + p.SetState(160) + p.Create_object_expression() + } + + case 7: + { + p.SetState(161) + p.Create_array_expression() + } + + case 8: + { + p.SetState(162) + p.Match(CosmosDBParserLR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(163) + p.scalar_expression_in_where(0) + } + { + p.SetState(164) + p.Match(CosmosDBParserRR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1)) + p.SetState(196) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) + if p.HasError() { + goto errorExit + } + for _alt != 2 && _alt != antlr.ATNInvalidAltNumber { + if _alt == 1 { + if p.GetParseListeners() != nil { + p.TriggerExitRuleEvent() + } + _prevctx = localctx + p.SetState(194) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 14, p.GetParserRuleContext()) { + case 1: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(168) + + if !(p.Precpred(p.GetParserRuleContext(), 11)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 11)", "")) + goto errorExit + } + { + p.SetState(169) + p.Match(CosmosDBParserAND_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(170) + p.scalar_expression_in_where(12) + } + + case 2: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(171) + + if !(p.Precpred(p.GetParserRuleContext(), 10)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 10)", "")) + goto errorExit + } + { + p.SetState(172) + p.Match(CosmosDBParserOR_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(173) + p.scalar_expression_in_where(11) + } + + case 3: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(174) + + if !(p.Precpred(p.GetParserRuleContext(), 6)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 6)", "")) + goto errorExit + } + { + p.SetState(175) + p.Binary_operator() + } + { + p.SetState(176) + p.scalar_expression_in_where(7) + } + + case 4: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(178) + + if !(p.Precpred(p.GetParserRuleContext(), 5)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 5)", "")) + goto errorExit + } + { + p.SetState(179) + p.Match(CosmosDBParserQUESTION_MARK_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(180) + p.scalar_expression_in_where(0) + } + { + p.SetState(181) + p.Match(CosmosDBParserCOLON_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(182) + p.scalar_expression_in_where(6) + } + + case 5: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(184) + + if !(p.Precpred(p.GetParserRuleContext(), 9)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 9)", "")) + goto errorExit + } + { + p.SetState(185) + p.Match(CosmosDBParserDOT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(186) + p.Property_name() + } + + case 6: + localctx = NewScalar_expression_in_whereContext(p, _parentctx, _parentState) + p.PushNewRecursionContext(localctx, _startState, CosmosDBParserRULE_scalar_expression_in_where) + p.SetState(187) + + if !(p.Precpred(p.GetParserRuleContext(), 8)) { + p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 8)", "")) + goto errorExit + } + { + p.SetState(188) + p.Match(CosmosDBParserLS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(191) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL: + { + p.SetState(189) + p.Match(CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case CosmosDBParserDECIMAL: + { + p.SetState(190) + p.Array_index() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(193) + p.Match(CosmosDBParserRS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + case antlr.ATNInvalidAltNumber: + goto errorExit + } + + } + p.SetState(198) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 15, p.GetParserRuleContext()) + if p.HasError() { + 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.UnrollRecursionContexts(_parentctx) + return localctx + goto errorExit // Trick to prevent compiler error if the label is not used +} + +// ICreate_array_expressionContext is an interface to support dynamic dispatch. +type ICreate_array_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Array_constant() IArray_constantContext + + // IsCreate_array_expressionContext differentiates from other interfaces. + IsCreate_array_expressionContext() +} + +type Create_array_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_array_expressionContext() *Create_array_expressionContext { + var p = new(Create_array_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_create_array_expression + return p +} + +func InitEmptyCreate_array_expressionContext(p *Create_array_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_create_array_expression +} + +func (*Create_array_expressionContext) IsCreate_array_expressionContext() {} + +func NewCreate_array_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_array_expressionContext { + var p = new(Create_array_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_create_array_expression + + return p +} + +func (s *Create_array_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_array_expressionContext) Array_constant() IArray_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_constantContext) +} + +func (s *Create_array_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_array_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_array_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterCreate_array_expression(s) + } +} + +func (s *Create_array_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitCreate_array_expression(s) + } +} + +func (s *Create_array_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitCreate_array_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Create_array_expression() (localctx ICreate_array_expressionContext) { + localctx = NewCreate_array_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 30, CosmosDBParserRULE_create_array_expression) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(199) + p.Array_constant() + } + +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 +} + +// ICreate_object_expressionContext is an interface to support dynamic dispatch. +type ICreate_object_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Object_constant() IObject_constantContext + + // IsCreate_object_expressionContext differentiates from other interfaces. + IsCreate_object_expressionContext() +} + +type Create_object_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyCreate_object_expressionContext() *Create_object_expressionContext { + var p = new(Create_object_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_create_object_expression + return p +} + +func InitEmptyCreate_object_expressionContext(p *Create_object_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_create_object_expression +} + +func (*Create_object_expressionContext) IsCreate_object_expressionContext() {} + +func NewCreate_object_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Create_object_expressionContext { + var p = new(Create_object_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_create_object_expression + + return p +} + +func (s *Create_object_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Create_object_expressionContext) Object_constant() IObject_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_constantContext) +} + +func (s *Create_object_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Create_object_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Create_object_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterCreate_object_expression(s) + } +} + +func (s *Create_object_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitCreate_object_expression(s) + } +} + +func (s *Create_object_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitCreate_object_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Create_object_expression() (localctx ICreate_object_expressionContext) { + localctx = NewCreate_object_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 32, CosmosDBParserRULE_create_object_expression) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(201) + p.Object_constant() + } + +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 +} + +// IScalar_function_expressionContext is an interface to support dynamic dispatch. +type IScalar_function_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Udf_scalar_function_expression() IUdf_scalar_function_expressionContext + Builtin_function_expression() IBuiltin_function_expressionContext + + // IsScalar_function_expressionContext differentiates from other interfaces. + IsScalar_function_expressionContext() +} + +type Scalar_function_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyScalar_function_expressionContext() *Scalar_function_expressionContext { + var p = new(Scalar_function_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_function_expression + return p +} + +func InitEmptyScalar_function_expressionContext(p *Scalar_function_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_scalar_function_expression +} + +func (*Scalar_function_expressionContext) IsScalar_function_expressionContext() {} + +func NewScalar_function_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Scalar_function_expressionContext { + var p = new(Scalar_function_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_scalar_function_expression + + return p +} + +func (s *Scalar_function_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Scalar_function_expressionContext) Udf_scalar_function_expression() IUdf_scalar_function_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUdf_scalar_function_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUdf_scalar_function_expressionContext) +} + +func (s *Scalar_function_expressionContext) Builtin_function_expression() IBuiltin_function_expressionContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBuiltin_function_expressionContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBuiltin_function_expressionContext) +} + +func (s *Scalar_function_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Scalar_function_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Scalar_function_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterScalar_function_expression(s) + } +} + +func (s *Scalar_function_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitScalar_function_expression(s) + } +} + +func (s *Scalar_function_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitScalar_function_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Scalar_function_expression() (localctx IScalar_function_expressionContext) { + localctx = NewScalar_function_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 34, CosmosDBParserRULE_scalar_function_expression) + p.SetState(205) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserUDF_SYMBOL: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(203) + p.Udf_scalar_function_expression() + } + + case CosmosDBParserIDENTIFIER: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(204) + p.Builtin_function_expression() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + 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 +} + +// IUdf_scalar_function_expressionContext is an interface to support dynamic dispatch. +type IUdf_scalar_function_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UDF_SYMBOL() antlr.TerminalNode + DOT_SYMBOL() antlr.TerminalNode + IDENTIFIER() antlr.TerminalNode + LR_BRACKET_SYMBOL() antlr.TerminalNode + RR_BRACKET_SYMBOL() antlr.TerminalNode + AllScalar_expression_in_where() []IScalar_expression_in_whereContext + Scalar_expression_in_where(i int) IScalar_expression_in_whereContext + AllCOMMA_SYMBOL() []antlr.TerminalNode + COMMA_SYMBOL(i int) antlr.TerminalNode + + // IsUdf_scalar_function_expressionContext differentiates from other interfaces. + IsUdf_scalar_function_expressionContext() +} + +type Udf_scalar_function_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUdf_scalar_function_expressionContext() *Udf_scalar_function_expressionContext { + var p = new(Udf_scalar_function_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_udf_scalar_function_expression + return p +} + +func InitEmptyUdf_scalar_function_expressionContext(p *Udf_scalar_function_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_udf_scalar_function_expression +} + +func (*Udf_scalar_function_expressionContext) IsUdf_scalar_function_expressionContext() {} + +func NewUdf_scalar_function_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Udf_scalar_function_expressionContext { + var p = new(Udf_scalar_function_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_udf_scalar_function_expression + + return p +} + +func (s *Udf_scalar_function_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Udf_scalar_function_expressionContext) UDF_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserUDF_SYMBOL, 0) +} + +func (s *Udf_scalar_function_expressionContext) DOT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOT_SYMBOL, 0) +} + +func (s *Udf_scalar_function_expressionContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Udf_scalar_function_expressionContext) LR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLR_BRACKET_SYMBOL, 0) +} + +func (s *Udf_scalar_function_expressionContext) RR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRR_BRACKET_SYMBOL, 0) +} + +func (s *Udf_scalar_function_expressionContext) AllScalar_expression_in_where() []IScalar_expression_in_whereContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + len++ + } + } + + tst := make([]IScalar_expression_in_whereContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IScalar_expression_in_whereContext); ok { + tst[i] = t.(IScalar_expression_in_whereContext) + i++ + } + } + + return tst +} + +func (s *Udf_scalar_function_expressionContext) Scalar_expression_in_where(i int) IScalar_expression_in_whereContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expression_in_whereContext) +} + +func (s *Udf_scalar_function_expressionContext) AllCOMMA_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserCOMMA_SYMBOL) +} + +func (s *Udf_scalar_function_expressionContext) COMMA_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, i) +} + +func (s *Udf_scalar_function_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Udf_scalar_function_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Udf_scalar_function_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterUdf_scalar_function_expression(s) + } +} + +func (s *Udf_scalar_function_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitUdf_scalar_function_expression(s) + } +} + +func (s *Udf_scalar_function_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitUdf_scalar_function_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Udf_scalar_function_expression() (localctx IUdf_scalar_function_expressionContext) { + localctx = NewUdf_scalar_function_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 36, CosmosDBParserRULE_udf_scalar_function_expression) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(207) + p.Match(CosmosDBParserUDF_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(208) + p.Match(CosmosDBParserDOT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(209) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(210) + p.Match(CosmosDBParserLR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + { + p.SetState(211) + p.scalar_expression_in_where(0) + } + p.SetState(216) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == CosmosDBParserCOMMA_SYMBOL { + { + p.SetState(212) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(213) + p.scalar_expression_in_where(0) + } + + p.SetState(218) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + { + p.SetState(219) + p.Match(CosmosDBParserRR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IBuiltin_function_expressionContext is an interface to support dynamic dispatch. +type IBuiltin_function_expressionContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IDENTIFIER() antlr.TerminalNode + LR_BRACKET_SYMBOL() antlr.TerminalNode + RR_BRACKET_SYMBOL() antlr.TerminalNode + AllScalar_expression_in_where() []IScalar_expression_in_whereContext + Scalar_expression_in_where(i int) IScalar_expression_in_whereContext + AllCOMMA_SYMBOL() []antlr.TerminalNode + COMMA_SYMBOL(i int) antlr.TerminalNode + + // IsBuiltin_function_expressionContext differentiates from other interfaces. + IsBuiltin_function_expressionContext() +} + +type Builtin_function_expressionContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBuiltin_function_expressionContext() *Builtin_function_expressionContext { + var p = new(Builtin_function_expressionContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_builtin_function_expression + return p +} + +func InitEmptyBuiltin_function_expressionContext(p *Builtin_function_expressionContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_builtin_function_expression +} + +func (*Builtin_function_expressionContext) IsBuiltin_function_expressionContext() {} + +func NewBuiltin_function_expressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Builtin_function_expressionContext { + var p = new(Builtin_function_expressionContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_builtin_function_expression + + return p +} + +func (s *Builtin_function_expressionContext) GetParser() antlr.Parser { return s.parser } + +func (s *Builtin_function_expressionContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Builtin_function_expressionContext) LR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLR_BRACKET_SYMBOL, 0) +} + +func (s *Builtin_function_expressionContext) RR_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRR_BRACKET_SYMBOL, 0) +} + +func (s *Builtin_function_expressionContext) AllScalar_expression_in_where() []IScalar_expression_in_whereContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + len++ + } + } + + tst := make([]IScalar_expression_in_whereContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IScalar_expression_in_whereContext); ok { + tst[i] = t.(IScalar_expression_in_whereContext) + i++ + } + } + + return tst +} + +func (s *Builtin_function_expressionContext) Scalar_expression_in_where(i int) IScalar_expression_in_whereContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IScalar_expression_in_whereContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IScalar_expression_in_whereContext) +} + +func (s *Builtin_function_expressionContext) AllCOMMA_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserCOMMA_SYMBOL) +} + +func (s *Builtin_function_expressionContext) COMMA_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, i) +} + +func (s *Builtin_function_expressionContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Builtin_function_expressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Builtin_function_expressionContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterBuiltin_function_expression(s) + } +} + +func (s *Builtin_function_expressionContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitBuiltin_function_expression(s) + } +} + +func (s *Builtin_function_expressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitBuiltin_function_expression(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Builtin_function_expression() (localctx IBuiltin_function_expressionContext) { + localctx = NewBuiltin_function_expressionContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 38, CosmosDBParserRULE_builtin_function_expression) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(221) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(222) + p.Match(CosmosDBParserLR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + { + p.SetState(223) + p.scalar_expression_in_where(0) + } + p.SetState(228) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == CosmosDBParserCOMMA_SYMBOL { + { + p.SetState(224) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(225) + p.scalar_expression_in_where(0) + } + + p.SetState(230) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + { + p.SetState(231) + p.Match(CosmosDBParserRR_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IBinary_operatorContext is an interface to support dynamic dispatch. +type IBinary_operatorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + MULTIPLY_OPERATOR() antlr.TerminalNode + DIVIDE_SYMBOL() antlr.TerminalNode + MODULO_SYMBOL() antlr.TerminalNode + PLUS_SYMBOL() antlr.TerminalNode + MINUS_SYMBOL() antlr.TerminalNode + BIT_AND_SYMBOL() antlr.TerminalNode + BIT_XOR_SYMBOL() antlr.TerminalNode + BIT_OR_SYMBOL() antlr.TerminalNode + DOUBLE_BAR_SYMBOL() antlr.TerminalNode + EQUAL_SYMBOL() antlr.TerminalNode + + // IsBinary_operatorContext differentiates from other interfaces. + IsBinary_operatorContext() +} + +type Binary_operatorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBinary_operatorContext() *Binary_operatorContext { + var p = new(Binary_operatorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_binary_operator + return p +} + +func InitEmptyBinary_operatorContext(p *Binary_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_binary_operator +} + +func (*Binary_operatorContext) IsBinary_operatorContext() {} + +func NewBinary_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Binary_operatorContext { + var p = new(Binary_operatorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_binary_operator + + return p +} + +func (s *Binary_operatorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Binary_operatorContext) MULTIPLY_OPERATOR() antlr.TerminalNode { + return s.GetToken(CosmosDBParserMULTIPLY_OPERATOR, 0) +} + +func (s *Binary_operatorContext) DIVIDE_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDIVIDE_SYMBOL, 0) +} + +func (s *Binary_operatorContext) MODULO_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserMODULO_SYMBOL, 0) +} + +func (s *Binary_operatorContext) PLUS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserPLUS_SYMBOL, 0) +} + +func (s *Binary_operatorContext) MINUS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserMINUS_SYMBOL, 0) +} + +func (s *Binary_operatorContext) BIT_AND_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserBIT_AND_SYMBOL, 0) +} + +func (s *Binary_operatorContext) BIT_XOR_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserBIT_XOR_SYMBOL, 0) +} + +func (s *Binary_operatorContext) BIT_OR_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserBIT_OR_SYMBOL, 0) +} + +func (s *Binary_operatorContext) DOUBLE_BAR_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOUBLE_BAR_SYMBOL, 0) +} + +func (s *Binary_operatorContext) EQUAL_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserEQUAL_SYMBOL, 0) +} + +func (s *Binary_operatorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Binary_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Binary_operatorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterBinary_operator(s) + } +} + +func (s *Binary_operatorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitBinary_operator(s) + } +} + +func (s *Binary_operatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitBinary_operator(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Binary_operator() (localctx IBinary_operatorContext) { + localctx = NewBinary_operatorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 40, CosmosDBParserRULE_binary_operator) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(233) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&273535729666) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +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 +} + +// IUnary_operatorContext is an interface to support dynamic dispatch. +type IUnary_operatorContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + BIT_NOT_SYMBOL() antlr.TerminalNode + PLUS_SYMBOL() antlr.TerminalNode + MINUS_SYMBOL() antlr.TerminalNode + + // IsUnary_operatorContext differentiates from other interfaces. + IsUnary_operatorContext() +} + +type Unary_operatorContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUnary_operatorContext() *Unary_operatorContext { + var p = new(Unary_operatorContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_unary_operator + return p +} + +func InitEmptyUnary_operatorContext(p *Unary_operatorContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_unary_operator +} + +func (*Unary_operatorContext) IsUnary_operatorContext() {} + +func NewUnary_operatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Unary_operatorContext { + var p = new(Unary_operatorContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_unary_operator + + return p +} + +func (s *Unary_operatorContext) GetParser() antlr.Parser { return s.parser } + +func (s *Unary_operatorContext) BIT_NOT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserBIT_NOT_SYMBOL, 0) +} + +func (s *Unary_operatorContext) PLUS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserPLUS_SYMBOL, 0) +} + +func (s *Unary_operatorContext) MINUS_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserMINUS_SYMBOL, 0) +} + +func (s *Unary_operatorContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Unary_operatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Unary_operatorContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterUnary_operator(s) + } +} + +func (s *Unary_operatorContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitUnary_operator(s) + } +} + +func (s *Unary_operatorContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitUnary_operator(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Unary_operator() (localctx IUnary_operatorContext) { + localctx = NewUnary_operatorContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 42, CosmosDBParserRULE_unary_operator) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(235) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1879048192) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +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 +} + +// IParameter_nameContext is an interface to support dynamic dispatch. +type IParameter_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + AT_SYMBOL() antlr.TerminalNode + IDENTIFIER() antlr.TerminalNode + + // IsParameter_nameContext differentiates from other interfaces. + IsParameter_nameContext() +} + +type Parameter_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyParameter_nameContext() *Parameter_nameContext { + var p = new(Parameter_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_parameter_name + return p +} + +func InitEmptyParameter_nameContext(p *Parameter_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_parameter_name +} + +func (*Parameter_nameContext) IsParameter_nameContext() {} + +func NewParameter_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Parameter_nameContext { + var p = new(Parameter_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_parameter_name + + return p +} + +func (s *Parameter_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Parameter_nameContext) AT_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserAT_SYMBOL, 0) +} + +func (s *Parameter_nameContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Parameter_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Parameter_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Parameter_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterParameter_name(s) + } +} + +func (s *Parameter_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitParameter_name(s) + } +} + +func (s *Parameter_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitParameter_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Parameter_name() (localctx IParameter_nameContext) { + localctx = NewParameter_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 44, CosmosDBParserRULE_parameter_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(237) + p.Match(CosmosDBParserAT_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(238) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IConstantContext is an interface to support dynamic dispatch. +type IConstantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Undefined_constant() IUndefined_constantContext + Null_constant() INull_constantContext + Boolean_constant() IBoolean_constantContext + Number_constant() INumber_constantContext + String_constant() IString_constantContext + Array_constant() IArray_constantContext + Object_constant() IObject_constantContext + + // IsConstantContext differentiates from other interfaces. + IsConstantContext() +} + +type ConstantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyConstantContext() *ConstantContext { + var p = new(ConstantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_constant + return p +} + +func InitEmptyConstantContext(p *ConstantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_constant +} + +func (*ConstantContext) IsConstantContext() {} + +func NewConstantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ConstantContext { + var p = new(ConstantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_constant + + return p +} + +func (s *ConstantContext) GetParser() antlr.Parser { return s.parser } + +func (s *ConstantContext) Undefined_constant() IUndefined_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IUndefined_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IUndefined_constantContext) +} + +func (s *ConstantContext) Null_constant() INull_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INull_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INull_constantContext) +} + +func (s *ConstantContext) Boolean_constant() IBoolean_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IBoolean_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IBoolean_constantContext) +} + +func (s *ConstantContext) Number_constant() INumber_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(INumber_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(INumber_constantContext) +} + +func (s *ConstantContext) String_constant() IString_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IString_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IString_constantContext) +} + +func (s *ConstantContext) Array_constant() IArray_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IArray_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IArray_constantContext) +} + +func (s *ConstantContext) Object_constant() IObject_constantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_constantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IObject_constantContext) +} + +func (s *ConstantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *ConstantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *ConstantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterConstant(s) + } +} + +func (s *ConstantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitConstant(s) + } +} + +func (s *ConstantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitConstant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Constant() (localctx IConstantContext) { + localctx = NewConstantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 46, CosmosDBParserRULE_constant) + p.SetState(247) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserUNDEFINED_SYMBOL: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(240) + p.Undefined_constant() + } + + case CosmosDBParserNULL_SYMBOL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(241) + p.Null_constant() + } + + case CosmosDBParserFALSE_SYMBOL, CosmosDBParserTRUE_SYMBOL: + p.EnterOuterAlt(localctx, 3) + { + p.SetState(242) + p.Boolean_constant() + } + + case CosmosDBParserDECIMAL, CosmosDBParserREAL, CosmosDBParserFLOAT, CosmosDBParserHEXADECIMAL: + p.EnterOuterAlt(localctx, 4) + { + p.SetState(243) + p.Number_constant() + } + + case CosmosDBParserSINGLE_QUOTE_STRING_LITERAL, CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL: + p.EnterOuterAlt(localctx, 5) + { + p.SetState(244) + p.String_constant() + } + + case CosmosDBParserLS_BRACKET_SYMBOL: + p.EnterOuterAlt(localctx, 6) + { + p.SetState(245) + p.Array_constant() + } + + case CosmosDBParserLC_BRACKET_SYMBOL: + p.EnterOuterAlt(localctx, 7) + { + p.SetState(246) + p.Object_constant() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + 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 +} + +// IObject_constantContext is an interface to support dynamic dispatch. +type IObject_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LC_BRACKET_SYMBOL() antlr.TerminalNode + RC_BRACKET_SYMBOL() antlr.TerminalNode + AllObject_constant_field_pair() []IObject_constant_field_pairContext + Object_constant_field_pair(i int) IObject_constant_field_pairContext + AllCOMMA_SYMBOL() []antlr.TerminalNode + COMMA_SYMBOL(i int) antlr.TerminalNode + + // IsObject_constantContext differentiates from other interfaces. + IsObject_constantContext() +} + +type Object_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_constantContext() *Object_constantContext { + var p = new(Object_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_constant + return p +} + +func InitEmptyObject_constantContext(p *Object_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_constant +} + +func (*Object_constantContext) IsObject_constantContext() {} + +func NewObject_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_constantContext { + var p = new(Object_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_object_constant + + return p +} + +func (s *Object_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_constantContext) LC_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLC_BRACKET_SYMBOL, 0) +} + +func (s *Object_constantContext) RC_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRC_BRACKET_SYMBOL, 0) +} + +func (s *Object_constantContext) AllObject_constant_field_pair() []IObject_constant_field_pairContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IObject_constant_field_pairContext); ok { + len++ + } + } + + tst := make([]IObject_constant_field_pairContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IObject_constant_field_pairContext); ok { + tst[i] = t.(IObject_constant_field_pairContext) + i++ + } + } + + return tst +} + +func (s *Object_constantContext) Object_constant_field_pair(i int) IObject_constant_field_pairContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IObject_constant_field_pairContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IObject_constant_field_pairContext) +} + +func (s *Object_constantContext) AllCOMMA_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserCOMMA_SYMBOL) +} + +func (s *Object_constantContext) COMMA_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, i) +} + +func (s *Object_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterObject_constant(s) + } +} + +func (s *Object_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitObject_constant(s) + } +} + +func (s *Object_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitObject_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Object_constant() (localctx IObject_constantContext) { + localctx = NewObject_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 48, CosmosDBParserRULE_object_constant) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(249) + p.Match(CosmosDBParserLC_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + { + p.SetState(250) + p.Object_constant_field_pair() + } + p.SetState(255) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == CosmosDBParserCOMMA_SYMBOL { + { + p.SetState(251) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(252) + p.Object_constant_field_pair() + } + + p.SetState(257) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + { + p.SetState(258) + p.Match(CosmosDBParserRC_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IObject_constant_field_pairContext is an interface to support dynamic dispatch. +type IObject_constant_field_pairContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + COMMA_SYMBOL() antlr.TerminalNode + Constant() IConstantContext + Property_name() IProperty_nameContext + AllDOUBLE_QUOTE_SYMBOL() []antlr.TerminalNode + DOUBLE_QUOTE_SYMBOL(i int) antlr.TerminalNode + + // IsObject_constant_field_pairContext differentiates from other interfaces. + IsObject_constant_field_pairContext() +} + +type Object_constant_field_pairContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyObject_constant_field_pairContext() *Object_constant_field_pairContext { + var p = new(Object_constant_field_pairContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_constant_field_pair + return p +} + +func InitEmptyObject_constant_field_pairContext(p *Object_constant_field_pairContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_object_constant_field_pair +} + +func (*Object_constant_field_pairContext) IsObject_constant_field_pairContext() {} + +func NewObject_constant_field_pairContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Object_constant_field_pairContext { + var p = new(Object_constant_field_pairContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_object_constant_field_pair + + return p +} + +func (s *Object_constant_field_pairContext) GetParser() antlr.Parser { return s.parser } + +func (s *Object_constant_field_pairContext) COMMA_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, 0) +} + +func (s *Object_constant_field_pairContext) Constant() IConstantContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstantContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IConstantContext) +} + +func (s *Object_constant_field_pairContext) Property_name() IProperty_nameContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IProperty_nameContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IProperty_nameContext) +} + +func (s *Object_constant_field_pairContext) AllDOUBLE_QUOTE_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserDOUBLE_QUOTE_SYMBOL) +} + +func (s *Object_constant_field_pairContext) DOUBLE_QUOTE_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOUBLE_QUOTE_SYMBOL, i) +} + +func (s *Object_constant_field_pairContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Object_constant_field_pairContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Object_constant_field_pairContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterObject_constant_field_pair(s) + } +} + +func (s *Object_constant_field_pairContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitObject_constant_field_pair(s) + } +} + +func (s *Object_constant_field_pairContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitObject_constant_field_pair(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Object_constant_field_pair() (localctx IObject_constant_field_pairContext) { + localctx = NewObject_constant_field_pairContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 50, CosmosDBParserRULE_object_constant_field_pair) + p.EnterOuterAlt(localctx, 1) + p.SetState(265) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserIDENTIFIER: + { + p.SetState(260) + p.Property_name() + } + + case CosmosDBParserDOUBLE_QUOTE_SYMBOL: + { + p.SetState(261) + p.Match(CosmosDBParserDOUBLE_QUOTE_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(262) + p.Property_name() + } + { + p.SetState(263) + p.Match(CosmosDBParserDOUBLE_QUOTE_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + goto errorExit + } + { + p.SetState(267) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(268) + p.Constant() + } + +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 +} + +// IArray_constantContext is an interface to support dynamic dispatch. +type IArray_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + LS_BRACKET_SYMBOL() antlr.TerminalNode + RS_BRACKET_SYMBOL() antlr.TerminalNode + AllConstant() []IConstantContext + Constant(i int) IConstantContext + AllCOMMA_SYMBOL() []antlr.TerminalNode + COMMA_SYMBOL(i int) antlr.TerminalNode + + // IsArray_constantContext differentiates from other interfaces. + IsArray_constantContext() +} + +type Array_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArray_constantContext() *Array_constantContext { + var p = new(Array_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_array_constant + return p +} + +func InitEmptyArray_constantContext(p *Array_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_array_constant +} + +func (*Array_constantContext) IsArray_constantContext() {} + +func NewArray_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Array_constantContext { + var p = new(Array_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_array_constant + + return p +} + +func (s *Array_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Array_constantContext) LS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserLS_BRACKET_SYMBOL, 0) +} + +func (s *Array_constantContext) RS_BRACKET_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserRS_BRACKET_SYMBOL, 0) +} + +func (s *Array_constantContext) AllConstant() []IConstantContext { + children := s.GetChildren() + len := 0 + for _, ctx := range children { + if _, ok := ctx.(IConstantContext); ok { + len++ + } + } + + tst := make([]IConstantContext, len) + i := 0 + for _, ctx := range children { + if t, ok := ctx.(IConstantContext); ok { + tst[i] = t.(IConstantContext) + i++ + } + } + + return tst +} + +func (s *Array_constantContext) Constant(i int) IConstantContext { + var t antlr.RuleContext + j := 0 + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IConstantContext); ok { + if j == i { + t = ctx.(antlr.RuleContext) + break + } + j++ + } + } + + if t == nil { + return nil + } + + return t.(IConstantContext) +} + +func (s *Array_constantContext) AllCOMMA_SYMBOL() []antlr.TerminalNode { + return s.GetTokens(CosmosDBParserCOMMA_SYMBOL) +} + +func (s *Array_constantContext) COMMA_SYMBOL(i int) antlr.TerminalNode { + return s.GetToken(CosmosDBParserCOMMA_SYMBOL, i) +} + +func (s *Array_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Array_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Array_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterArray_constant(s) + } +} + +func (s *Array_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitArray_constant(s) + } +} + +func (s *Array_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitArray_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Array_constant() (localctx IArray_constantContext) { + localctx = NewArray_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 52, CosmosDBParserRULE_array_constant) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(270) + p.Match(CosmosDBParserLS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + p.SetState(279) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + if (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&69269232878528) != 0 { + { + p.SetState(271) + p.Constant() + } + p.SetState(276) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + + for _la == CosmosDBParserCOMMA_SYMBOL { + { + p.SetState(272) + p.Match(CosmosDBParserCOMMA_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + goto errorExit + } + } + { + p.SetState(273) + p.Constant() + } + + p.SetState(278) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + _la = p.GetTokenStream().LA(1) + } + + } + { + p.SetState(281) + p.Match(CosmosDBParserRS_BRACKET_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IString_constantContext is an interface to support dynamic dispatch. +type IString_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + String_literal() IString_literalContext + + // IsString_constantContext differentiates from other interfaces. + IsString_constantContext() +} + +type String_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyString_constantContext() *String_constantContext { + var p = new(String_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_string_constant + return p +} + +func InitEmptyString_constantContext(p *String_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_string_constant +} + +func (*String_constantContext) IsString_constantContext() {} + +func NewString_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *String_constantContext { + var p = new(String_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_string_constant + + return p +} + +func (s *String_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *String_constantContext) String_literal() IString_literalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IString_literalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IString_literalContext) +} + +func (s *String_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *String_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *String_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterString_constant(s) + } +} + +func (s *String_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitString_constant(s) + } +} + +func (s *String_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitString_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) String_constant() (localctx IString_constantContext) { + localctx = NewString_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 54, CosmosDBParserRULE_string_constant) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(283) + p.String_literal() + } + +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 +} + +// IUndefined_constantContext is an interface to support dynamic dispatch. +type IUndefined_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + UNDEFINED_SYMBOL() antlr.TerminalNode + + // IsUndefined_constantContext differentiates from other interfaces. + IsUndefined_constantContext() +} + +type Undefined_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyUndefined_constantContext() *Undefined_constantContext { + var p = new(Undefined_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_undefined_constant + return p +} + +func InitEmptyUndefined_constantContext(p *Undefined_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_undefined_constant +} + +func (*Undefined_constantContext) IsUndefined_constantContext() {} + +func NewUndefined_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Undefined_constantContext { + var p = new(Undefined_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_undefined_constant + + return p +} + +func (s *Undefined_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Undefined_constantContext) UNDEFINED_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserUNDEFINED_SYMBOL, 0) +} + +func (s *Undefined_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Undefined_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Undefined_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterUndefined_constant(s) + } +} + +func (s *Undefined_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitUndefined_constant(s) + } +} + +func (s *Undefined_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitUndefined_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Undefined_constant() (localctx IUndefined_constantContext) { + localctx = NewUndefined_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 56, CosmosDBParserRULE_undefined_constant) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(285) + p.Match(CosmosDBParserUNDEFINED_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// INull_constantContext is an interface to support dynamic dispatch. +type INull_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + NULL_SYMBOL() antlr.TerminalNode + + // IsNull_constantContext differentiates from other interfaces. + IsNull_constantContext() +} + +type Null_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNull_constantContext() *Null_constantContext { + var p = new(Null_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_null_constant + return p +} + +func InitEmptyNull_constantContext(p *Null_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_null_constant +} + +func (*Null_constantContext) IsNull_constantContext() {} + +func NewNull_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Null_constantContext { + var p = new(Null_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_null_constant + + return p +} + +func (s *Null_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Null_constantContext) NULL_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserNULL_SYMBOL, 0) +} + +func (s *Null_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Null_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Null_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterNull_constant(s) + } +} + +func (s *Null_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitNull_constant(s) + } +} + +func (s *Null_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitNull_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Null_constant() (localctx INull_constantContext) { + localctx = NewNull_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 58, CosmosDBParserRULE_null_constant) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(287) + p.Match(CosmosDBParserNULL_SYMBOL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IBoolean_constantContext is an interface to support dynamic dispatch. +type IBoolean_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + TRUE_SYMBOL() antlr.TerminalNode + FALSE_SYMBOL() antlr.TerminalNode + + // IsBoolean_constantContext differentiates from other interfaces. + IsBoolean_constantContext() +} + +type Boolean_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyBoolean_constantContext() *Boolean_constantContext { + var p = new(Boolean_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_boolean_constant + return p +} + +func InitEmptyBoolean_constantContext(p *Boolean_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_boolean_constant +} + +func (*Boolean_constantContext) IsBoolean_constantContext() {} + +func NewBoolean_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Boolean_constantContext { + var p = new(Boolean_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_boolean_constant + + return p +} + +func (s *Boolean_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Boolean_constantContext) TRUE_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserTRUE_SYMBOL, 0) +} + +func (s *Boolean_constantContext) FALSE_SYMBOL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserFALSE_SYMBOL, 0) +} + +func (s *Boolean_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Boolean_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Boolean_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterBoolean_constant(s) + } +} + +func (s *Boolean_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitBoolean_constant(s) + } +} + +func (s *Boolean_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitBoolean_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Boolean_constant() (localctx IBoolean_constantContext) { + localctx = NewBoolean_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 60, CosmosDBParserRULE_boolean_constant) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(289) + _la = p.GetTokenStream().LA(1) + + if !(_la == CosmosDBParserFALSE_SYMBOL || _la == CosmosDBParserTRUE_SYMBOL) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +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 +} + +// INumber_constantContext is an interface to support dynamic dispatch. +type INumber_constantContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + Decimal_literal() IDecimal_literalContext + Hexadecimal_literal() IHexadecimal_literalContext + + // IsNumber_constantContext differentiates from other interfaces. + IsNumber_constantContext() +} + +type Number_constantContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyNumber_constantContext() *Number_constantContext { + var p = new(Number_constantContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_number_constant + return p +} + +func InitEmptyNumber_constantContext(p *Number_constantContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_number_constant +} + +func (*Number_constantContext) IsNumber_constantContext() {} + +func NewNumber_constantContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Number_constantContext { + var p = new(Number_constantContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_number_constant + + return p +} + +func (s *Number_constantContext) GetParser() antlr.Parser { return s.parser } + +func (s *Number_constantContext) Decimal_literal() IDecimal_literalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IDecimal_literalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IDecimal_literalContext) +} + +func (s *Number_constantContext) Hexadecimal_literal() IHexadecimal_literalContext { + var t antlr.RuleContext + for _, ctx := range s.GetChildren() { + if _, ok := ctx.(IHexadecimal_literalContext); ok { + t = ctx.(antlr.RuleContext) + break + } + } + + if t == nil { + return nil + } + + return t.(IHexadecimal_literalContext) +} + +func (s *Number_constantContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Number_constantContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Number_constantContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterNumber_constant(s) + } +} + +func (s *Number_constantContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitNumber_constant(s) + } +} + +func (s *Number_constantContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitNumber_constant(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Number_constant() (localctx INumber_constantContext) { + localctx = NewNumber_constantContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 62, CosmosDBParserRULE_number_constant) + p.SetState(293) + p.GetErrorHandler().Sync(p) + if p.HasError() { + goto errorExit + } + + switch p.GetTokenStream().LA(1) { + case CosmosDBParserDECIMAL, CosmosDBParserREAL, CosmosDBParserFLOAT: + p.EnterOuterAlt(localctx, 1) + { + p.SetState(291) + p.Decimal_literal() + } + + case CosmosDBParserHEXADECIMAL: + p.EnterOuterAlt(localctx, 2) + { + p.SetState(292) + p.Hexadecimal_literal() + } + + default: + p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil)) + 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 +} + +// IString_literalContext is an interface to support dynamic dispatch. +type IString_literalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + SINGLE_QUOTE_STRING_LITERAL() antlr.TerminalNode + DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode + + // IsString_literalContext differentiates from other interfaces. + IsString_literalContext() +} + +type String_literalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyString_literalContext() *String_literalContext { + var p = new(String_literalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_string_literal + return p +} + +func InitEmptyString_literalContext(p *String_literalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_string_literal +} + +func (*String_literalContext) IsString_literalContext() {} + +func NewString_literalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *String_literalContext { + var p = new(String_literalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_string_literal + + return p +} + +func (s *String_literalContext) GetParser() antlr.Parser { return s.parser } + +func (s *String_literalContext) SINGLE_QUOTE_STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserSINGLE_QUOTE_STRING_LITERAL, 0) +} + +func (s *String_literalContext) DOUBLE_QUOTE_STRING_LITERAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL, 0) +} + +func (s *String_literalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *String_literalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *String_literalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterString_literal(s) + } +} + +func (s *String_literalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitString_literal(s) + } +} + +func (s *String_literalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitString_literal(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) String_literal() (localctx IString_literalContext) { + localctx = NewString_literalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 64, CosmosDBParserRULE_string_literal) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(295) + _la = p.GetTokenStream().LA(1) + + if !(_la == CosmosDBParserSINGLE_QUOTE_STRING_LITERAL || _la == CosmosDBParserDOUBLE_QUOTE_STRING_LITERAL) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +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 +} + +// IDecimal_literalContext is an interface to support dynamic dispatch. +type IDecimal_literalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DECIMAL() antlr.TerminalNode + REAL() antlr.TerminalNode + FLOAT() antlr.TerminalNode + + // IsDecimal_literalContext differentiates from other interfaces. + IsDecimal_literalContext() +} + +type Decimal_literalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyDecimal_literalContext() *Decimal_literalContext { + var p = new(Decimal_literalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_decimal_literal + return p +} + +func InitEmptyDecimal_literalContext(p *Decimal_literalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_decimal_literal +} + +func (*Decimal_literalContext) IsDecimal_literalContext() {} + +func NewDecimal_literalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Decimal_literalContext { + var p = new(Decimal_literalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_decimal_literal + + return p +} + +func (s *Decimal_literalContext) GetParser() antlr.Parser { return s.parser } + +func (s *Decimal_literalContext) DECIMAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDECIMAL, 0) +} + +func (s *Decimal_literalContext) REAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserREAL, 0) +} + +func (s *Decimal_literalContext) FLOAT() antlr.TerminalNode { + return s.GetToken(CosmosDBParserFLOAT, 0) +} + +func (s *Decimal_literalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Decimal_literalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Decimal_literalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterDecimal_literal(s) + } +} + +func (s *Decimal_literalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitDecimal_literal(s) + } +} + +func (s *Decimal_literalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitDecimal_literal(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Decimal_literal() (localctx IDecimal_literalContext) { + localctx = NewDecimal_literalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 66, CosmosDBParserRULE_decimal_literal) + var _la int + + p.EnterOuterAlt(localctx, 1) + { + p.SetState(297) + _la = p.GetTokenStream().LA(1) + + if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&7696581394432) != 0) { + p.GetErrorHandler().RecoverInline(p) + } else { + p.GetErrorHandler().ReportMatch(p) + p.Consume() + } + } + +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 +} + +// IHexadecimal_literalContext is an interface to support dynamic dispatch. +type IHexadecimal_literalContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + HEXADECIMAL() antlr.TerminalNode + + // IsHexadecimal_literalContext differentiates from other interfaces. + IsHexadecimal_literalContext() +} + +type Hexadecimal_literalContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyHexadecimal_literalContext() *Hexadecimal_literalContext { + var p = new(Hexadecimal_literalContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_hexadecimal_literal + return p +} + +func InitEmptyHexadecimal_literalContext(p *Hexadecimal_literalContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_hexadecimal_literal +} + +func (*Hexadecimal_literalContext) IsHexadecimal_literalContext() {} + +func NewHexadecimal_literalContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Hexadecimal_literalContext { + var p = new(Hexadecimal_literalContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_hexadecimal_literal + + return p +} + +func (s *Hexadecimal_literalContext) GetParser() antlr.Parser { return s.parser } + +func (s *Hexadecimal_literalContext) HEXADECIMAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserHEXADECIMAL, 0) +} + +func (s *Hexadecimal_literalContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Hexadecimal_literalContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Hexadecimal_literalContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterHexadecimal_literal(s) + } +} + +func (s *Hexadecimal_literalContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitHexadecimal_literal(s) + } +} + +func (s *Hexadecimal_literalContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitHexadecimal_literal(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Hexadecimal_literal() (localctx IHexadecimal_literalContext) { + localctx = NewHexadecimal_literalContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 68, CosmosDBParserRULE_hexadecimal_literal) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(299) + p.Match(CosmosDBParserHEXADECIMAL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IProperty_nameContext is an interface to support dynamic dispatch. +type IProperty_nameContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IDENTIFIER() antlr.TerminalNode + + // IsProperty_nameContext differentiates from other interfaces. + IsProperty_nameContext() +} + +type Property_nameContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyProperty_nameContext() *Property_nameContext { + var p = new(Property_nameContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_property_name + return p +} + +func InitEmptyProperty_nameContext(p *Property_nameContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_property_name +} + +func (*Property_nameContext) IsProperty_nameContext() {} + +func NewProperty_nameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Property_nameContext { + var p = new(Property_nameContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_property_name + + return p +} + +func (s *Property_nameContext) GetParser() antlr.Parser { return s.parser } + +func (s *Property_nameContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Property_nameContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Property_nameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Property_nameContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterProperty_name(s) + } +} + +func (s *Property_nameContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitProperty_name(s) + } +} + +func (s *Property_nameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitProperty_name(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Property_name() (localctx IProperty_nameContext) { + localctx = NewProperty_nameContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 70, CosmosDBParserRULE_property_name) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(301) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IArray_indexContext is an interface to support dynamic dispatch. +type IArray_indexContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + DECIMAL() antlr.TerminalNode + + // IsArray_indexContext differentiates from other interfaces. + IsArray_indexContext() +} + +type Array_indexContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyArray_indexContext() *Array_indexContext { + var p = new(Array_indexContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_array_index + return p +} + +func InitEmptyArray_indexContext(p *Array_indexContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_array_index +} + +func (*Array_indexContext) IsArray_indexContext() {} + +func NewArray_indexContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Array_indexContext { + var p = new(Array_indexContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_array_index + + return p +} + +func (s *Array_indexContext) GetParser() antlr.Parser { return s.parser } + +func (s *Array_indexContext) DECIMAL() antlr.TerminalNode { + return s.GetToken(CosmosDBParserDECIMAL, 0) +} + +func (s *Array_indexContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Array_indexContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Array_indexContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterArray_index(s) + } +} + +func (s *Array_indexContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitArray_index(s) + } +} + +func (s *Array_indexContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitArray_index(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Array_index() (localctx IArray_indexContext) { + localctx = NewArray_indexContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 72, CosmosDBParserRULE_array_index) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(303) + p.Match(CosmosDBParserDECIMAL) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +// IInput_aliasContext is an interface to support dynamic dispatch. +type IInput_aliasContext interface { + antlr.ParserRuleContext + + // GetParser returns the parser. + GetParser() antlr.Parser + + // Getter signatures + IDENTIFIER() antlr.TerminalNode + + // IsInput_aliasContext differentiates from other interfaces. + IsInput_aliasContext() +} + +type Input_aliasContext struct { + antlr.BaseParserRuleContext + parser antlr.Parser +} + +func NewEmptyInput_aliasContext() *Input_aliasContext { + var p = new(Input_aliasContext) + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_input_alias + return p +} + +func InitEmptyInput_aliasContext(p *Input_aliasContext) { + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1) + p.RuleIndex = CosmosDBParserRULE_input_alias +} + +func (*Input_aliasContext) IsInput_aliasContext() {} + +func NewInput_aliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *Input_aliasContext { + var p = new(Input_aliasContext) + + antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState) + + p.parser = parser + p.RuleIndex = CosmosDBParserRULE_input_alias + + return p +} + +func (s *Input_aliasContext) GetParser() antlr.Parser { return s.parser } + +func (s *Input_aliasContext) IDENTIFIER() antlr.TerminalNode { + return s.GetToken(CosmosDBParserIDENTIFIER, 0) +} + +func (s *Input_aliasContext) GetRuleContext() antlr.RuleContext { + return s +} + +func (s *Input_aliasContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { + return antlr.TreesStringTree(s, ruleNames, recog) +} + +func (s *Input_aliasContext) EnterRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.EnterInput_alias(s) + } +} + +func (s *Input_aliasContext) ExitRule(listener antlr.ParseTreeListener) { + if listenerT, ok := listener.(CosmosDBParserListener); ok { + listenerT.ExitInput_alias(s) + } +} + +func (s *Input_aliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { + switch t := visitor.(type) { + case CosmosDBParserVisitor: + return t.VisitInput_alias(s) + + default: + return t.VisitChildren(s) + } +} + +func (p *CosmosDBParser) Input_alias() (localctx IInput_aliasContext) { + localctx = NewInput_aliasContext(p, p.GetParserRuleContext(), p.GetState()) + p.EnterRule(localctx, 74, CosmosDBParserRULE_input_alias) + p.EnterOuterAlt(localctx, 1) + { + p.SetState(305) + p.Match(CosmosDBParserIDENTIFIER) + if p.HasError() { + // Recognition error - abort rule + 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 +} + +func (p *CosmosDBParser) Sempred(localctx antlr.RuleContext, ruleIndex, predIndex int) bool { + switch ruleIndex { + case 13: + var t *Scalar_expressionContext = nil + if localctx != nil { + t = localctx.(*Scalar_expressionContext) + } + return p.Scalar_expression_Sempred(t, predIndex) + + case 14: + var t *Scalar_expression_in_whereContext = nil + if localctx != nil { + t = localctx.(*Scalar_expression_in_whereContext) + } + return p.Scalar_expression_in_where_Sempred(t, predIndex) + + default: + panic("No predicate with index: " + fmt.Sprint(ruleIndex)) + } +} + +func (p *CosmosDBParser) Scalar_expression_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 0: + return p.Precpred(p.GetParserRuleContext(), 3) + + case 1: + return p.Precpred(p.GetParserRuleContext(), 2) + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} + +func (p *CosmosDBParser) Scalar_expression_in_where_Sempred(localctx antlr.RuleContext, predIndex int) bool { + switch predIndex { + case 2: + return p.Precpred(p.GetParserRuleContext(), 11) + + case 3: + return p.Precpred(p.GetParserRuleContext(), 10) + + case 4: + return p.Precpred(p.GetParserRuleContext(), 6) + + case 5: + return p.Precpred(p.GetParserRuleContext(), 5) + + case 6: + return p.Precpred(p.GetParserRuleContext(), 9) + + case 7: + return p.Precpred(p.GetParserRuleContext(), 8) + + default: + panic("No predicate with index: " + fmt.Sprint(predIndex)) + } +} diff --git a/cosmosdb/cosmosdbparser_base_listener.go b/cosmosdb/cosmosdbparser_base_listener.go new file mode 100644 index 0000000..bc94e4c --- /dev/null +++ b/cosmosdb/cosmosdbparser_base_listener.go @@ -0,0 +1,263 @@ +// Code generated from CosmosDBParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb // CosmosDBParser +import "github.com/antlr4-go/antlr/v4" + +// BaseCosmosDBParserListener is a complete listener for a parse tree produced by CosmosDBParser. +type BaseCosmosDBParserListener struct{} + +var _ CosmosDBParserListener = &BaseCosmosDBParserListener{} + +// VisitTerminal is called when a terminal node is visited. +func (s *BaseCosmosDBParserListener) VisitTerminal(node antlr.TerminalNode) {} + +// VisitErrorNode is called when an error node is visited. +func (s *BaseCosmosDBParserListener) VisitErrorNode(node antlr.ErrorNode) {} + +// EnterEveryRule is called when any rule is entered. +func (s *BaseCosmosDBParserListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} + +// ExitEveryRule is called when any rule is exited. +func (s *BaseCosmosDBParserListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} + +// EnterRoot is called when production root is entered. +func (s *BaseCosmosDBParserListener) EnterRoot(ctx *RootContext) {} + +// ExitRoot is called when production root is exited. +func (s *BaseCosmosDBParserListener) ExitRoot(ctx *RootContext) {} + +// EnterSelect is called when production select is entered. +func (s *BaseCosmosDBParserListener) EnterSelect(ctx *SelectContext) {} + +// ExitSelect is called when production select is exited. +func (s *BaseCosmosDBParserListener) ExitSelect(ctx *SelectContext) {} + +// EnterSelect_clause is called when production select_clause is entered. +func (s *BaseCosmosDBParserListener) EnterSelect_clause(ctx *Select_clauseContext) {} + +// ExitSelect_clause is called when production select_clause is exited. +func (s *BaseCosmosDBParserListener) ExitSelect_clause(ctx *Select_clauseContext) {} + +// EnterSelect_specification is called when production select_specification is entered. +func (s *BaseCosmosDBParserListener) EnterSelect_specification(ctx *Select_specificationContext) {} + +// ExitSelect_specification is called when production select_specification is exited. +func (s *BaseCosmosDBParserListener) ExitSelect_specification(ctx *Select_specificationContext) {} + +// EnterFrom_clause is called when production from_clause is entered. +func (s *BaseCosmosDBParserListener) EnterFrom_clause(ctx *From_clauseContext) {} + +// ExitFrom_clause is called when production from_clause is exited. +func (s *BaseCosmosDBParserListener) ExitFrom_clause(ctx *From_clauseContext) {} + +// EnterWhere_clause is called when production where_clause is entered. +func (s *BaseCosmosDBParserListener) EnterWhere_clause(ctx *Where_clauseContext) {} + +// ExitWhere_clause is called when production where_clause is exited. +func (s *BaseCosmosDBParserListener) ExitWhere_clause(ctx *Where_clauseContext) {} + +// EnterFrom_specification is called when production from_specification is entered. +func (s *BaseCosmosDBParserListener) EnterFrom_specification(ctx *From_specificationContext) {} + +// ExitFrom_specification is called when production from_specification is exited. +func (s *BaseCosmosDBParserListener) ExitFrom_specification(ctx *From_specificationContext) {} + +// EnterFrom_source is called when production from_source is entered. +func (s *BaseCosmosDBParserListener) EnterFrom_source(ctx *From_sourceContext) {} + +// ExitFrom_source is called when production from_source is exited. +func (s *BaseCosmosDBParserListener) ExitFrom_source(ctx *From_sourceContext) {} + +// EnterContainer_expression is called when production container_expression is entered. +func (s *BaseCosmosDBParserListener) EnterContainer_expression(ctx *Container_expressionContext) {} + +// ExitContainer_expression is called when production container_expression is exited. +func (s *BaseCosmosDBParserListener) ExitContainer_expression(ctx *Container_expressionContext) {} + +// EnterContainer_name is called when production container_name is entered. +func (s *BaseCosmosDBParserListener) EnterContainer_name(ctx *Container_nameContext) {} + +// ExitContainer_name is called when production container_name is exited. +func (s *BaseCosmosDBParserListener) ExitContainer_name(ctx *Container_nameContext) {} + +// EnterObject_property_list is called when production object_property_list is entered. +func (s *BaseCosmosDBParserListener) EnterObject_property_list(ctx *Object_property_listContext) {} + +// ExitObject_property_list is called when production object_property_list is exited. +func (s *BaseCosmosDBParserListener) ExitObject_property_list(ctx *Object_property_listContext) {} + +// EnterObject_property is called when production object_property is entered. +func (s *BaseCosmosDBParserListener) EnterObject_property(ctx *Object_propertyContext) {} + +// ExitObject_property is called when production object_property is exited. +func (s *BaseCosmosDBParserListener) ExitObject_property(ctx *Object_propertyContext) {} + +// EnterProperty_alias is called when production property_alias is entered. +func (s *BaseCosmosDBParserListener) EnterProperty_alias(ctx *Property_aliasContext) {} + +// ExitProperty_alias is called when production property_alias is exited. +func (s *BaseCosmosDBParserListener) ExitProperty_alias(ctx *Property_aliasContext) {} + +// EnterScalar_expression is called when production scalar_expression is entered. +func (s *BaseCosmosDBParserListener) EnterScalar_expression(ctx *Scalar_expressionContext) {} + +// ExitScalar_expression is called when production scalar_expression is exited. +func (s *BaseCosmosDBParserListener) ExitScalar_expression(ctx *Scalar_expressionContext) {} + +// EnterScalar_expression_in_where is called when production scalar_expression_in_where is entered. +func (s *BaseCosmosDBParserListener) EnterScalar_expression_in_where(ctx *Scalar_expression_in_whereContext) { +} + +// ExitScalar_expression_in_where is called when production scalar_expression_in_where is exited. +func (s *BaseCosmosDBParserListener) ExitScalar_expression_in_where(ctx *Scalar_expression_in_whereContext) { +} + +// EnterCreate_array_expression is called when production create_array_expression is entered. +func (s *BaseCosmosDBParserListener) EnterCreate_array_expression(ctx *Create_array_expressionContext) { +} + +// ExitCreate_array_expression is called when production create_array_expression is exited. +func (s *BaseCosmosDBParserListener) ExitCreate_array_expression(ctx *Create_array_expressionContext) { +} + +// EnterCreate_object_expression is called when production create_object_expression is entered. +func (s *BaseCosmosDBParserListener) EnterCreate_object_expression(ctx *Create_object_expressionContext) { +} + +// ExitCreate_object_expression is called when production create_object_expression is exited. +func (s *BaseCosmosDBParserListener) ExitCreate_object_expression(ctx *Create_object_expressionContext) { +} + +// EnterScalar_function_expression is called when production scalar_function_expression is entered. +func (s *BaseCosmosDBParserListener) EnterScalar_function_expression(ctx *Scalar_function_expressionContext) { +} + +// ExitScalar_function_expression is called when production scalar_function_expression is exited. +func (s *BaseCosmosDBParserListener) ExitScalar_function_expression(ctx *Scalar_function_expressionContext) { +} + +// EnterUdf_scalar_function_expression is called when production udf_scalar_function_expression is entered. +func (s *BaseCosmosDBParserListener) EnterUdf_scalar_function_expression(ctx *Udf_scalar_function_expressionContext) { +} + +// ExitUdf_scalar_function_expression is called when production udf_scalar_function_expression is exited. +func (s *BaseCosmosDBParserListener) ExitUdf_scalar_function_expression(ctx *Udf_scalar_function_expressionContext) { +} + +// EnterBuiltin_function_expression is called when production builtin_function_expression is entered. +func (s *BaseCosmosDBParserListener) EnterBuiltin_function_expression(ctx *Builtin_function_expressionContext) { +} + +// ExitBuiltin_function_expression is called when production builtin_function_expression is exited. +func (s *BaseCosmosDBParserListener) ExitBuiltin_function_expression(ctx *Builtin_function_expressionContext) { +} + +// EnterBinary_operator is called when production binary_operator is entered. +func (s *BaseCosmosDBParserListener) EnterBinary_operator(ctx *Binary_operatorContext) {} + +// ExitBinary_operator is called when production binary_operator is exited. +func (s *BaseCosmosDBParserListener) ExitBinary_operator(ctx *Binary_operatorContext) {} + +// EnterUnary_operator is called when production unary_operator is entered. +func (s *BaseCosmosDBParserListener) EnterUnary_operator(ctx *Unary_operatorContext) {} + +// ExitUnary_operator is called when production unary_operator is exited. +func (s *BaseCosmosDBParserListener) ExitUnary_operator(ctx *Unary_operatorContext) {} + +// EnterParameter_name is called when production parameter_name is entered. +func (s *BaseCosmosDBParserListener) EnterParameter_name(ctx *Parameter_nameContext) {} + +// ExitParameter_name is called when production parameter_name is exited. +func (s *BaseCosmosDBParserListener) ExitParameter_name(ctx *Parameter_nameContext) {} + +// EnterConstant is called when production constant is entered. +func (s *BaseCosmosDBParserListener) EnterConstant(ctx *ConstantContext) {} + +// ExitConstant is called when production constant is exited. +func (s *BaseCosmosDBParserListener) ExitConstant(ctx *ConstantContext) {} + +// EnterObject_constant is called when production object_constant is entered. +func (s *BaseCosmosDBParserListener) EnterObject_constant(ctx *Object_constantContext) {} + +// ExitObject_constant is called when production object_constant is exited. +func (s *BaseCosmosDBParserListener) ExitObject_constant(ctx *Object_constantContext) {} + +// EnterObject_constant_field_pair is called when production object_constant_field_pair is entered. +func (s *BaseCosmosDBParserListener) EnterObject_constant_field_pair(ctx *Object_constant_field_pairContext) { +} + +// ExitObject_constant_field_pair is called when production object_constant_field_pair is exited. +func (s *BaseCosmosDBParserListener) ExitObject_constant_field_pair(ctx *Object_constant_field_pairContext) { +} + +// EnterArray_constant is called when production array_constant is entered. +func (s *BaseCosmosDBParserListener) EnterArray_constant(ctx *Array_constantContext) {} + +// ExitArray_constant is called when production array_constant is exited. +func (s *BaseCosmosDBParserListener) ExitArray_constant(ctx *Array_constantContext) {} + +// EnterString_constant is called when production string_constant is entered. +func (s *BaseCosmosDBParserListener) EnterString_constant(ctx *String_constantContext) {} + +// ExitString_constant is called when production string_constant is exited. +func (s *BaseCosmosDBParserListener) ExitString_constant(ctx *String_constantContext) {} + +// EnterUndefined_constant is called when production undefined_constant is entered. +func (s *BaseCosmosDBParserListener) EnterUndefined_constant(ctx *Undefined_constantContext) {} + +// ExitUndefined_constant is called when production undefined_constant is exited. +func (s *BaseCosmosDBParserListener) ExitUndefined_constant(ctx *Undefined_constantContext) {} + +// EnterNull_constant is called when production null_constant is entered. +func (s *BaseCosmosDBParserListener) EnterNull_constant(ctx *Null_constantContext) {} + +// ExitNull_constant is called when production null_constant is exited. +func (s *BaseCosmosDBParserListener) ExitNull_constant(ctx *Null_constantContext) {} + +// EnterBoolean_constant is called when production boolean_constant is entered. +func (s *BaseCosmosDBParserListener) EnterBoolean_constant(ctx *Boolean_constantContext) {} + +// ExitBoolean_constant is called when production boolean_constant is exited. +func (s *BaseCosmosDBParserListener) ExitBoolean_constant(ctx *Boolean_constantContext) {} + +// EnterNumber_constant is called when production number_constant is entered. +func (s *BaseCosmosDBParserListener) EnterNumber_constant(ctx *Number_constantContext) {} + +// ExitNumber_constant is called when production number_constant is exited. +func (s *BaseCosmosDBParserListener) ExitNumber_constant(ctx *Number_constantContext) {} + +// EnterString_literal is called when production string_literal is entered. +func (s *BaseCosmosDBParserListener) EnterString_literal(ctx *String_literalContext) {} + +// ExitString_literal is called when production string_literal is exited. +func (s *BaseCosmosDBParserListener) ExitString_literal(ctx *String_literalContext) {} + +// EnterDecimal_literal is called when production decimal_literal is entered. +func (s *BaseCosmosDBParserListener) EnterDecimal_literal(ctx *Decimal_literalContext) {} + +// ExitDecimal_literal is called when production decimal_literal is exited. +func (s *BaseCosmosDBParserListener) ExitDecimal_literal(ctx *Decimal_literalContext) {} + +// EnterHexadecimal_literal is called when production hexadecimal_literal is entered. +func (s *BaseCosmosDBParserListener) EnterHexadecimal_literal(ctx *Hexadecimal_literalContext) {} + +// ExitHexadecimal_literal is called when production hexadecimal_literal is exited. +func (s *BaseCosmosDBParserListener) ExitHexadecimal_literal(ctx *Hexadecimal_literalContext) {} + +// EnterProperty_name is called when production property_name is entered. +func (s *BaseCosmosDBParserListener) EnterProperty_name(ctx *Property_nameContext) {} + +// ExitProperty_name is called when production property_name is exited. +func (s *BaseCosmosDBParserListener) ExitProperty_name(ctx *Property_nameContext) {} + +// EnterArray_index is called when production array_index is entered. +func (s *BaseCosmosDBParserListener) EnterArray_index(ctx *Array_indexContext) {} + +// ExitArray_index is called when production array_index is exited. +func (s *BaseCosmosDBParserListener) ExitArray_index(ctx *Array_indexContext) {} + +// EnterInput_alias is called when production input_alias is entered. +func (s *BaseCosmosDBParserListener) EnterInput_alias(ctx *Input_aliasContext) {} + +// ExitInput_alias is called when production input_alias is exited. +func (s *BaseCosmosDBParserListener) ExitInput_alias(ctx *Input_aliasContext) {} diff --git a/cosmosdb/cosmosdbparser_base_visitor.go b/cosmosdb/cosmosdbparser_base_visitor.go new file mode 100644 index 0000000..f8b3b7b --- /dev/null +++ b/cosmosdb/cosmosdbparser_base_visitor.go @@ -0,0 +1,160 @@ +// Code generated from CosmosDBParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb // CosmosDBParser +import "github.com/antlr4-go/antlr/v4" + +type BaseCosmosDBParserVisitor struct { + *antlr.BaseParseTreeVisitor +} + +func (v *BaseCosmosDBParserVisitor) VisitRoot(ctx *RootContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitSelect(ctx *SelectContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitSelect_clause(ctx *Select_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitSelect_specification(ctx *Select_specificationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitFrom_clause(ctx *From_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitWhere_clause(ctx *Where_clauseContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitFrom_specification(ctx *From_specificationContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitFrom_source(ctx *From_sourceContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitContainer_expression(ctx *Container_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitContainer_name(ctx *Container_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitObject_property_list(ctx *Object_property_listContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitObject_property(ctx *Object_propertyContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitProperty_alias(ctx *Property_aliasContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitScalar_expression(ctx *Scalar_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitScalar_expression_in_where(ctx *Scalar_expression_in_whereContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitCreate_array_expression(ctx *Create_array_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitCreate_object_expression(ctx *Create_object_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitScalar_function_expression(ctx *Scalar_function_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitUdf_scalar_function_expression(ctx *Udf_scalar_function_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitBuiltin_function_expression(ctx *Builtin_function_expressionContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitBinary_operator(ctx *Binary_operatorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitUnary_operator(ctx *Unary_operatorContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitParameter_name(ctx *Parameter_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitConstant(ctx *ConstantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitObject_constant(ctx *Object_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitObject_constant_field_pair(ctx *Object_constant_field_pairContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitArray_constant(ctx *Array_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitString_constant(ctx *String_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitUndefined_constant(ctx *Undefined_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitNull_constant(ctx *Null_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitBoolean_constant(ctx *Boolean_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitNumber_constant(ctx *Number_constantContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitString_literal(ctx *String_literalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitDecimal_literal(ctx *Decimal_literalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitHexadecimal_literal(ctx *Hexadecimal_literalContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitProperty_name(ctx *Property_nameContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitArray_index(ctx *Array_indexContext) interface{} { + return v.VisitChildren(ctx) +} + +func (v *BaseCosmosDBParserVisitor) VisitInput_alias(ctx *Input_aliasContext) interface{} { + return v.VisitChildren(ctx) +} diff --git a/cosmosdb/cosmosdbparser_listener.go b/cosmosdb/cosmosdbparser_listener.go new file mode 100644 index 0000000..1751445 --- /dev/null +++ b/cosmosdb/cosmosdbparser_listener.go @@ -0,0 +1,237 @@ +// Code generated from CosmosDBParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb // CosmosDBParser +import "github.com/antlr4-go/antlr/v4" + +// CosmosDBParserListener is a complete listener for a parse tree produced by CosmosDBParser. +type CosmosDBParserListener interface { + antlr.ParseTreeListener + + // EnterRoot is called when entering the root production. + EnterRoot(c *RootContext) + + // EnterSelect is called when entering the select production. + EnterSelect(c *SelectContext) + + // EnterSelect_clause is called when entering the select_clause production. + EnterSelect_clause(c *Select_clauseContext) + + // EnterSelect_specification is called when entering the select_specification production. + EnterSelect_specification(c *Select_specificationContext) + + // EnterFrom_clause is called when entering the from_clause production. + EnterFrom_clause(c *From_clauseContext) + + // EnterWhere_clause is called when entering the where_clause production. + EnterWhere_clause(c *Where_clauseContext) + + // EnterFrom_specification is called when entering the from_specification production. + EnterFrom_specification(c *From_specificationContext) + + // EnterFrom_source is called when entering the from_source production. + EnterFrom_source(c *From_sourceContext) + + // EnterContainer_expression is called when entering the container_expression production. + EnterContainer_expression(c *Container_expressionContext) + + // EnterContainer_name is called when entering the container_name production. + EnterContainer_name(c *Container_nameContext) + + // EnterObject_property_list is called when entering the object_property_list production. + EnterObject_property_list(c *Object_property_listContext) + + // EnterObject_property is called when entering the object_property production. + EnterObject_property(c *Object_propertyContext) + + // EnterProperty_alias is called when entering the property_alias production. + EnterProperty_alias(c *Property_aliasContext) + + // EnterScalar_expression is called when entering the scalar_expression production. + EnterScalar_expression(c *Scalar_expressionContext) + + // EnterScalar_expression_in_where is called when entering the scalar_expression_in_where production. + EnterScalar_expression_in_where(c *Scalar_expression_in_whereContext) + + // EnterCreate_array_expression is called when entering the create_array_expression production. + EnterCreate_array_expression(c *Create_array_expressionContext) + + // EnterCreate_object_expression is called when entering the create_object_expression production. + EnterCreate_object_expression(c *Create_object_expressionContext) + + // EnterScalar_function_expression is called when entering the scalar_function_expression production. + EnterScalar_function_expression(c *Scalar_function_expressionContext) + + // EnterUdf_scalar_function_expression is called when entering the udf_scalar_function_expression production. + EnterUdf_scalar_function_expression(c *Udf_scalar_function_expressionContext) + + // EnterBuiltin_function_expression is called when entering the builtin_function_expression production. + EnterBuiltin_function_expression(c *Builtin_function_expressionContext) + + // EnterBinary_operator is called when entering the binary_operator production. + EnterBinary_operator(c *Binary_operatorContext) + + // EnterUnary_operator is called when entering the unary_operator production. + EnterUnary_operator(c *Unary_operatorContext) + + // EnterParameter_name is called when entering the parameter_name production. + EnterParameter_name(c *Parameter_nameContext) + + // EnterConstant is called when entering the constant production. + EnterConstant(c *ConstantContext) + + // EnterObject_constant is called when entering the object_constant production. + EnterObject_constant(c *Object_constantContext) + + // EnterObject_constant_field_pair is called when entering the object_constant_field_pair production. + EnterObject_constant_field_pair(c *Object_constant_field_pairContext) + + // EnterArray_constant is called when entering the array_constant production. + EnterArray_constant(c *Array_constantContext) + + // EnterString_constant is called when entering the string_constant production. + EnterString_constant(c *String_constantContext) + + // EnterUndefined_constant is called when entering the undefined_constant production. + EnterUndefined_constant(c *Undefined_constantContext) + + // EnterNull_constant is called when entering the null_constant production. + EnterNull_constant(c *Null_constantContext) + + // EnterBoolean_constant is called when entering the boolean_constant production. + EnterBoolean_constant(c *Boolean_constantContext) + + // EnterNumber_constant is called when entering the number_constant production. + EnterNumber_constant(c *Number_constantContext) + + // EnterString_literal is called when entering the string_literal production. + EnterString_literal(c *String_literalContext) + + // EnterDecimal_literal is called when entering the decimal_literal production. + EnterDecimal_literal(c *Decimal_literalContext) + + // EnterHexadecimal_literal is called when entering the hexadecimal_literal production. + EnterHexadecimal_literal(c *Hexadecimal_literalContext) + + // EnterProperty_name is called when entering the property_name production. + EnterProperty_name(c *Property_nameContext) + + // EnterArray_index is called when entering the array_index production. + EnterArray_index(c *Array_indexContext) + + // EnterInput_alias is called when entering the input_alias production. + EnterInput_alias(c *Input_aliasContext) + + // ExitRoot is called when exiting the root production. + ExitRoot(c *RootContext) + + // ExitSelect is called when exiting the select production. + ExitSelect(c *SelectContext) + + // ExitSelect_clause is called when exiting the select_clause production. + ExitSelect_clause(c *Select_clauseContext) + + // ExitSelect_specification is called when exiting the select_specification production. + ExitSelect_specification(c *Select_specificationContext) + + // ExitFrom_clause is called when exiting the from_clause production. + ExitFrom_clause(c *From_clauseContext) + + // ExitWhere_clause is called when exiting the where_clause production. + ExitWhere_clause(c *Where_clauseContext) + + // ExitFrom_specification is called when exiting the from_specification production. + ExitFrom_specification(c *From_specificationContext) + + // ExitFrom_source is called when exiting the from_source production. + ExitFrom_source(c *From_sourceContext) + + // ExitContainer_expression is called when exiting the container_expression production. + ExitContainer_expression(c *Container_expressionContext) + + // ExitContainer_name is called when exiting the container_name production. + ExitContainer_name(c *Container_nameContext) + + // ExitObject_property_list is called when exiting the object_property_list production. + ExitObject_property_list(c *Object_property_listContext) + + // ExitObject_property is called when exiting the object_property production. + ExitObject_property(c *Object_propertyContext) + + // ExitProperty_alias is called when exiting the property_alias production. + ExitProperty_alias(c *Property_aliasContext) + + // ExitScalar_expression is called when exiting the scalar_expression production. + ExitScalar_expression(c *Scalar_expressionContext) + + // ExitScalar_expression_in_where is called when exiting the scalar_expression_in_where production. + ExitScalar_expression_in_where(c *Scalar_expression_in_whereContext) + + // ExitCreate_array_expression is called when exiting the create_array_expression production. + ExitCreate_array_expression(c *Create_array_expressionContext) + + // ExitCreate_object_expression is called when exiting the create_object_expression production. + ExitCreate_object_expression(c *Create_object_expressionContext) + + // ExitScalar_function_expression is called when exiting the scalar_function_expression production. + ExitScalar_function_expression(c *Scalar_function_expressionContext) + + // ExitUdf_scalar_function_expression is called when exiting the udf_scalar_function_expression production. + ExitUdf_scalar_function_expression(c *Udf_scalar_function_expressionContext) + + // ExitBuiltin_function_expression is called when exiting the builtin_function_expression production. + ExitBuiltin_function_expression(c *Builtin_function_expressionContext) + + // ExitBinary_operator is called when exiting the binary_operator production. + ExitBinary_operator(c *Binary_operatorContext) + + // ExitUnary_operator is called when exiting the unary_operator production. + ExitUnary_operator(c *Unary_operatorContext) + + // ExitParameter_name is called when exiting the parameter_name production. + ExitParameter_name(c *Parameter_nameContext) + + // ExitConstant is called when exiting the constant production. + ExitConstant(c *ConstantContext) + + // ExitObject_constant is called when exiting the object_constant production. + ExitObject_constant(c *Object_constantContext) + + // ExitObject_constant_field_pair is called when exiting the object_constant_field_pair production. + ExitObject_constant_field_pair(c *Object_constant_field_pairContext) + + // ExitArray_constant is called when exiting the array_constant production. + ExitArray_constant(c *Array_constantContext) + + // ExitString_constant is called when exiting the string_constant production. + ExitString_constant(c *String_constantContext) + + // ExitUndefined_constant is called when exiting the undefined_constant production. + ExitUndefined_constant(c *Undefined_constantContext) + + // ExitNull_constant is called when exiting the null_constant production. + ExitNull_constant(c *Null_constantContext) + + // ExitBoolean_constant is called when exiting the boolean_constant production. + ExitBoolean_constant(c *Boolean_constantContext) + + // ExitNumber_constant is called when exiting the number_constant production. + ExitNumber_constant(c *Number_constantContext) + + // ExitString_literal is called when exiting the string_literal production. + ExitString_literal(c *String_literalContext) + + // ExitDecimal_literal is called when exiting the decimal_literal production. + ExitDecimal_literal(c *Decimal_literalContext) + + // ExitHexadecimal_literal is called when exiting the hexadecimal_literal production. + ExitHexadecimal_literal(c *Hexadecimal_literalContext) + + // ExitProperty_name is called when exiting the property_name production. + ExitProperty_name(c *Property_nameContext) + + // ExitArray_index is called when exiting the array_index production. + ExitArray_index(c *Array_indexContext) + + // ExitInput_alias is called when exiting the input_alias production. + ExitInput_alias(c *Input_aliasContext) +} diff --git a/cosmosdb/cosmosdbparser_visitor.go b/cosmosdb/cosmosdbparser_visitor.go new file mode 100644 index 0000000..05fa330 --- /dev/null +++ b/cosmosdb/cosmosdbparser_visitor.go @@ -0,0 +1,123 @@ +// Code generated from CosmosDBParser.g4 by ANTLR 4.13.2. DO NOT EDIT. + +package cosmosdb // CosmosDBParser +import "github.com/antlr4-go/antlr/v4" + +// A complete Visitor for a parse tree produced by CosmosDBParser. +type CosmosDBParserVisitor interface { + antlr.ParseTreeVisitor + + // Visit a parse tree produced by CosmosDBParser#root. + VisitRoot(ctx *RootContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#select. + VisitSelect(ctx *SelectContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#select_clause. + VisitSelect_clause(ctx *Select_clauseContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#select_specification. + VisitSelect_specification(ctx *Select_specificationContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#from_clause. + VisitFrom_clause(ctx *From_clauseContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#where_clause. + VisitWhere_clause(ctx *Where_clauseContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#from_specification. + VisitFrom_specification(ctx *From_specificationContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#from_source. + VisitFrom_source(ctx *From_sourceContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#container_expression. + VisitContainer_expression(ctx *Container_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#container_name. + VisitContainer_name(ctx *Container_nameContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#object_property_list. + VisitObject_property_list(ctx *Object_property_listContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#object_property. + VisitObject_property(ctx *Object_propertyContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#property_alias. + VisitProperty_alias(ctx *Property_aliasContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#scalar_expression. + VisitScalar_expression(ctx *Scalar_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#scalar_expression_in_where. + VisitScalar_expression_in_where(ctx *Scalar_expression_in_whereContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#create_array_expression. + VisitCreate_array_expression(ctx *Create_array_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#create_object_expression. + VisitCreate_object_expression(ctx *Create_object_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#scalar_function_expression. + VisitScalar_function_expression(ctx *Scalar_function_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#udf_scalar_function_expression. + VisitUdf_scalar_function_expression(ctx *Udf_scalar_function_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#builtin_function_expression. + VisitBuiltin_function_expression(ctx *Builtin_function_expressionContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#binary_operator. + VisitBinary_operator(ctx *Binary_operatorContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#unary_operator. + VisitUnary_operator(ctx *Unary_operatorContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#parameter_name. + VisitParameter_name(ctx *Parameter_nameContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#constant. + VisitConstant(ctx *ConstantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#object_constant. + VisitObject_constant(ctx *Object_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#object_constant_field_pair. + VisitObject_constant_field_pair(ctx *Object_constant_field_pairContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#array_constant. + VisitArray_constant(ctx *Array_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#string_constant. + VisitString_constant(ctx *String_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#undefined_constant. + VisitUndefined_constant(ctx *Undefined_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#null_constant. + VisitNull_constant(ctx *Null_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#boolean_constant. + VisitBoolean_constant(ctx *Boolean_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#number_constant. + VisitNumber_constant(ctx *Number_constantContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#string_literal. + VisitString_literal(ctx *String_literalContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#decimal_literal. + VisitDecimal_literal(ctx *Decimal_literalContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#hexadecimal_literal. + VisitHexadecimal_literal(ctx *Hexadecimal_literalContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#property_name. + VisitProperty_name(ctx *Property_nameContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#array_index. + VisitArray_index(ctx *Array_indexContext) interface{} + + // Visit a parse tree produced by CosmosDBParser#input_alias. + VisitInput_alias(ctx *Input_aliasContext) interface{} +} diff --git a/cosmosdb/examples/property_array_number_project.sql b/cosmosdb/examples/property_array_number_project.sql new file mode 100644 index 0000000..8ca7fbf --- /dev/null +++ b/cosmosdb/examples/property_array_number_project.sql @@ -0,0 +1,4 @@ +select + e.addresses[1] +from + employees e \ No newline at end of file diff --git a/cosmosdb/examples/property_field_name_ls_bracket_project.sql b/cosmosdb/examples/property_field_name_ls_bracket_project.sql new file mode 100644 index 0000000..2de768b --- /dev/null +++ b/cosmosdb/examples/property_field_name_ls_bracket_project.sql @@ -0,0 +1,4 @@ +SELECT + category.name["en"] +FROM + container \ No newline at end of file diff --git a/cosmosdb/examples/property_field_name_project.sql b/cosmosdb/examples/property_field_name_project.sql new file mode 100644 index 0000000..046e7f9 --- /dev/null +++ b/cosmosdb/examples/property_field_name_project.sql @@ -0,0 +1,5 @@ +select + e.name, + e.workLocation +FROM + employees e \ No newline at end of file diff --git a/cosmosdb/examples/simple_select.sql b/cosmosdb/examples/simple_select.sql new file mode 100644 index 0000000..965f42a --- /dev/null +++ b/cosmosdb/examples/simple_select.sql @@ -0,0 +1,4 @@ +select + * +from + t \ No newline at end of file diff --git a/cosmosdb/examples/where_expression.sql b/cosmosdb/examples/where_expression.sql new file mode 100644 index 0000000..e59ac22 --- /dev/null +++ b/cosmosdb/examples/where_expression.sql @@ -0,0 +1,6 @@ +select + * +from + employees e +where + e.addresses[1] = '1234 Main St' \ No newline at end of file diff --git a/cosmosdb/parser_test.go b/cosmosdb/parser_test.go new file mode 100644 index 0000000..7d9872a --- /dev/null +++ b/cosmosdb/parser_test.go @@ -0,0 +1,87 @@ +package cosmosdb_test + +import ( + "os" + "path" + "sort" + "testing" + + "github.com/antlr4-go/antlr/v4" + cosmosdb "github.com/bytebase/parser/cosmosdb" + "github.com/stretchr/testify/require" +) + +type CustomErrorListener struct { + errors int +} + +func NewCustomErrorListener() *CustomErrorListener { + return new(CustomErrorListener) +} + +func (l *CustomErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException) { + l.errors += 1 + antlr.ConsoleErrorListenerINSTANCE.SyntaxError(recognizer, offendingSymbol, line, column, msg, e) +} + +func (l *CustomErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) +} + +func (l *CustomErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) +} + +func (l *CustomErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs *antlr.ATNConfigSet) { + antlr.ConsoleErrorListenerINSTANCE.ReportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs) +} + +func TestCosmosDBParser(t *testing.T) { + testFilePaths := scanSQLFileInDirRecursive(t, "examples") + sort.StringSlice(testFilePaths).Sort() + + for _, fp := range testFilePaths { + t.Run(fp, func(t *testing.T) { + input, err := antlr.NewFileStream(fp) + require.NoError(t, err) + + lexer := cosmosdb.NewCosmosDBLexer(input) + + stream := antlr.NewCommonTokenStream(lexer, 0) + p := cosmosdb.NewCosmosDBParser(stream) + + lexerErrors := &CustomErrorListener{} + lexer.RemoveErrorListeners() + lexer.AddErrorListener(lexerErrors) + + parserErrors := &CustomErrorListener{} + p.RemoveErrorListeners() + p.AddErrorListener(parserErrors) + + p.BuildParseTrees = true + + _ = p.Root() + + require.Equal(t, 0, lexerErrors.errors, "file: %s", fp) + require.Equal(t, 0, parserErrors.errors, "file: %s", fp) + }) + } +} + +func scanSQLFileInDirRecursive(t *testing.T, dir string) []string { + var fps []string + + files, err := os.ReadDir(dir) + require.NoError(t, err) + + for _, file := range files { + if file.IsDir() { + rfps := scanSQLFileInDirRecursive(t, path.Join(dir, file.Name())) + fps = append(fps, rfps...) + } else { + fps = append(fps, path.Join(dir, file.Name())) + } + } + + return fps +}