Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: add generated parser files for go (#7538)

Srikanth Chekuric8c56c544e97
diff --git a/go.mod b/go.mod
index f4514c1f05..14617ed3c9 100644
--- a/go.mod
+++ b/go.mod
@@ -91,6 +91,7 @@ require (
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
+ github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
diff --git a/go.sum b/go.sum
index 8235f2fd28..2070a6c41d 100644
--- a/go.sum
+++ b/go.sum
@@ -113,6 +113,8 @@ github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
+github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
github.com/antonmedv/expr v1.15.3 h1:q3hOJZNvLvhqE8OHBs1cFRdbXFNKuA+bHmRaI+AmRmI=
github.com/antonmedv/expr v1.15.3/go.mod h1:0E/6TxnOlRNp81GMzX9QfDPAmHo2Phg00y4JUv1ihsE=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
diff --git a/grammar/FilterQuery.g4 b/grammar/FilterQuery.g4
new file mode 100644
index 0000000000..99e14bb1c9
--- /dev/null
+++ b/grammar/FilterQuery.g4
@@ -0,0 +1,221 @@
+grammar FilterQuery;
+
+/*
+ * Parser Rules
+ */
+
+query
+ : expression
+ EOF
+ ;
+
+// Expression with standard boolean precedence:
+// - parentheses > NOT > AND > OR
+// - consecutive expressions with no AND/OR => implicit AND
+expression
+ : orExpression
+ ;
+
+// OR expressions
+orExpression
+ : andExpression ( OR andExpression )*
+ ;
+
+// AND expressions + optional chaining with implicit AND if no OR is present
+andExpression
+ : unaryExpression ( AND unaryExpression | unaryExpression )*
+ ;
+
+// A unary expression handles optional NOT
+unaryExpression
+ : NOT? primary
+ ;
+
+// Primary constructs: grouped expressions, a comparison (key op value),
+// a function call, or a full-text string
+primary
+ : LPAREN orExpression RPAREN
+ | comparison
+ | functionCall
+ | fullText
+ | key
+ ;
+
+/*
+ * Comparison-like filters
+ *
+ * Includes all operators: =, !=, <>, <, <=, >, >=, [NOT] LIKE, [NOT] ILIKE,
+ * [NOT] BETWEEN, [NOT] IN, [NOT] EXISTS, [NOT] REGEXP, [NOT] CONTAINS, etc.
+ */
+comparison
+ : key EQUALS value
+ | key (NOT_EQUALS | NEQ) value
+ | key LT value
+ | key LE value
+ | key GT value
+ | key GE value
+
+ | key (LIKE | ILIKE) value
+ | key (NOT_LIKE | NOT_ILIKE) value
+
+ | key BETWEEN value AND value
+ | key NOT BETWEEN value AND value
+
+ | key inClause
+ | key notInClause
+
+ | key EXISTS
+ | key NOT EXISTS
+
+ | key REGEXP value
+ | key NOT REGEXP value
+
+ | key CONTAINS value
+ | key NOT CONTAINS value
+ ;
+
+// in(...) or in[...]
+inClause
+ : IN LPAREN valueList RPAREN
+ | IN LBRACK valueList RBRACK
+ ;
+
+notInClause
+ : NOT IN LPAREN valueList RPAREN
+ | NOT IN LBRACK valueList RBRACK
+ ;
+
+// List of values for in(...) or in[...]
+valueList
+ : value ( COMMA value )*
+ ;
+
+// Full-text search: a standalone quoted string is allowed as a "primary"
+// e.g. `"Waiting for response" http.status_code=200`
+fullText
+ : QUOTED_TEXT
+ | FREETEXT
+ ;
+
+/*
+ * Function calls like:
+ * has(payload.user_ids, 123)
+ * hasAny(payload.user_ids, [123, 456])
+ * ...
+ */
+functionCall
+ : (HAS | HASANY | HASALL | HASNONE) LPAREN functionParamList RPAREN
+ ;
+
+// Function parameters can be keys, single scalar values, or arrays
+functionParamList
+ : functionParam ( COMMA functionParam )*
+ ;
+
+functionParam
+ : key
+ | value
+ | array
+ ;
+
+// An array: [ item1, item2, item3 ]
+array
+ : LBRACK valueList RBRACK
+ ;
+
+/*
+ * A 'value' can be a string literal (double or single-quoted),
+// a numeric literal, boolean, or a "bare" token as needed.
+ */
+value
+ : QUOTED_TEXT
+ | NUMBER
+ | BOOL
+ | KEY
+ ;
+
+/*
+ * A key can include letters, digits, underscores, dots, brackets
+ * E.g. service.name, query_log.query_duration_ms, proto.user_objects[].name
+ */
+key
+ : KEY
+ ;
+
+
+/*
+ * Lexer Rules
+ */
+
+// Common punctuation / symbols
+LPAREN : '(' ;
+RPAREN : ')' ;
+LBRACK : '[' ;
+RBRACK : ']' ;
+COMMA : ',' ;
+
+EQUALS : '=' | '==' ;
+NOT_EQUALS : '!=' ;
+NEQ : '<>' ; // alternate not-equals operator
+LT : '<' ;
+LE : '<=' ;
+GT : '>' ;
+GE : '>=' ;
+
+// Operators that are made of multiple keywords
+LIKE : [Ll][Ii][Kk][Ee] ;
+NOT_LIKE : [Nn][Oo][Tt] [ \t]+ [Ll][Ii][Kk][Ee] ;
+ILIKE : [Ii][Ll][Ii][Kk][Ee] ;
+NOT_ILIKE : [Nn][Oo][Tt] [ \t]+ [Ii][Ll][Ii][Kk][Ee] ;
+BETWEEN : [Bb][Ee][Tt][Ww][Ee][Ee][Nn] ;
+EXISTS : [Ee][Xx][Ii][Ss][Tt][Ss]? ;
+REGEXP : [Rr][Ee][Gg][Ee][Xx][Pp] ;
+CONTAINS : [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]? ;
+IN : [Ii][Nn] ;
+
+// Boolean logic
+NOT : [Nn][Oo][Tt] ;
+AND : [Aa][Nn][Dd] ;
+OR : [Oo][Rr] ;
+
+// For easy referencing in function calls
+HAS : [Hh][Aa][Ss] ;
+HASANY : [Hh][Aa][Ss][Aa][Nn][Yy] ;
+HASALL : [Hh][Aa][Ss][Aa][Ll][Ll] ;
+HASNONE : [Hh][Aa][Ss][Nn][Oo][Nn][Ee] ;
+
+// Potential boolean constants
+BOOL
+ : [Tt][Rr][Uu][Ee]
+ | [Ff][Aa][Ll][Ss][Ee]
+ ;
+
+// Numbers (integer or float). Adjust as needed for your domain.
+NUMBER
+ : DIGIT+ ( '.' DIGIT+ )?
+ ;
+
+// Double/single-quoted text, capturing full text search strings, values, etc.
+QUOTED_TEXT
+ : ( '"' ( ~["\\] | '\\' . )* '"' // double-quoted
+ | '\'' ( ~['\\] | '\\' . )* '\'' // single-quoted
+ )
+ ;
+
+// Keys can have letters, digits, underscores, dots, and bracket pairs
+// e.g. service.name, service.namespace, db.queries[].query_duration
+KEY
+ : [a-zA-Z0-9_] [a-zA-Z0-9_.[\]]*
+ ;
+
+// Ignore whitespace
+WS
+ : [ \t\r\n]+ -> skip
+ ;
+
+// Digits used by NUMBER
+fragment DIGIT
+ : [0-9]
+ ;
+
+FREETEXT : (~[ \t\r\n=()'"<>![\]])+ ;
\ No newline at end of file
diff --git a/pkg/parser/grammar/FilterQuery.interp b/pkg/parser/grammar/FilterQuery.interp
new file mode 100644
index 0000000000..5acc28a53a
--- /dev/null
+++ b/pkg/parser/grammar/FilterQuery.interp
@@ -0,0 +1,96 @@
+token literal names:
+null
+'('
+')'
+'['
+']'
+','
+null
+'!='
+'<>'
+'<'
+'<='
+'>'
+'>='
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+
+token symbolic names:
+null
+LPAREN
+RPAREN
+LBRACK
+RBRACK
+COMMA
+EQUALS
+NOT_EQUALS
+NEQ
+LT
+LE
+GT
+GE
+LIKE
+NOT_LIKE
+ILIKE
+NOT_ILIKE
+BETWEEN
+EXISTS
+REGEXP
+CONTAINS
+IN
+NOT
+AND
+OR
+HAS
+HASANY
+HASALL
+HASNONE
+BOOL
+NUMBER
+QUOTED_TEXT
+KEY
+WS
+FREETEXT
+
+rule names:
+query
+expression
+orExpression
+andExpression
+unaryExpression
+primary
+comparison
+inClause
+notInClause
+valueList
+fullText
+functionCall
+functionParamList
+functionParam
+array
+value
+key
+
+
+atn:
+[4, 1, 34, 212, 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, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 5, 2, 43, 8, 2, 10, 2, 12, 2, 46, 9, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 52, 8, 3, 10, 3, 12, 3, 55, 9, 3, 1, 4, 3, 4, 58, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 70, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 148, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 3, 7, 160, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 174, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 179, 8, 9, 10, 9, 12, 9, 182, 9, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 194, 8, 12, 10, 12, 12, 12, 197, 9, 12, 1, 13, 1, 13, 1, 13, 3, 13, 202, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 0, 0, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 0, 6, 1, 0, 7, 8, 2, 0, 13, 13, 15, 15, 2, 0, 14, 14, 16, 16, 2, 0, 31, 31, 34, 34, 1, 0, 25, 28, 1, 0, 29, 32, 225, 0, 34, 1, 0, 0, 0, 2, 37, 1, 0, 0, 0, 4, 39, 1, 0, 0, 0, 6, 47, 1, 0, 0, 0, 8, 57, 1, 0, 0, 0, 10, 69, 1, 0, 0, 0, 12, 147, 1, 0, 0, 0, 14, 159, 1, 0, 0, 0, 16, 173, 1, 0, 0, 0, 18, 175, 1, 0, 0, 0, 20, 183, 1, 0, 0, 0, 22, 185, 1, 0, 0, 0, 24, 190, 1, 0, 0, 0, 26, 201, 1, 0, 0, 0, 28, 203, 1, 0, 0, 0, 30, 207, 1, 0, 0, 0, 32, 209, 1, 0, 0, 0, 34, 35, 3, 2, 1, 0, 35, 36, 5, 0, 0, 1, 36, 1, 1, 0, 0, 0, 37, 38, 3, 4, 2, 0, 38, 3, 1, 0, 0, 0, 39, 44, 3, 6, 3, 0, 40, 41, 5, 24, 0, 0, 41, 43, 3, 6, 3, 0, 42, 40, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 5, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 53, 3, 8, 4, 0, 48, 49, 5, 23, 0, 0, 49, 52, 3, 8, 4, 0, 50, 52, 3, 8, 4, 0, 51, 48, 1, 0, 0, 0, 51, 50, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 7, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 58, 5, 22, 0, 0, 57, 56, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 60, 3, 10, 5, 0, 60, 9, 1, 0, 0, 0, 61, 62, 5, 1, 0, 0, 62, 63, 3, 4, 2, 0, 63, 64, 5, 2, 0, 0, 64, 70, 1, 0, 0, 0, 65, 70, 3, 12, 6, 0, 66, 70, 3, 22, 11, 0, 67, 70, 3, 20, 10, 0, 68, 70, 3, 32, 16, 0, 69, 61, 1, 0, 0, 0, 69, 65, 1, 0, 0, 0, 69, 66, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 68, 1, 0, 0, 0, 70, 11, 1, 0, 0, 0, 71, 72, 3, 32, 16, 0, 72, 73, 5, 6, 0, 0, 73, 74, 3, 30, 15, 0, 74, 148, 1, 0, 0, 0, 75, 76, 3, 32, 16, 0, 76, 77, 7, 0, 0, 0, 77, 78, 3, 30, 15, 0, 78, 148, 1, 0, 0, 0, 79, 80, 3, 32, 16, 0, 80, 81, 5, 9, 0, 0, 81, 82, 3, 30, 15, 0, 82, 148, 1, 0, 0, 0, 83, 84, 3, 32, 16, 0, 84, 85, 5, 10, 0, 0, 85, 86, 3, 30, 15, 0, 86, 148, 1, 0, 0, 0, 87, 88, 3, 32, 16, 0, 88, 89, 5, 11, 0, 0, 89, 90, 3, 30, 15, 0, 90, 148, 1, 0, 0, 0, 91, 92, 3, 32, 16, 0, 92, 93, 5, 12, 0, 0, 93, 94, 3, 30, 15, 0, 94, 148, 1, 0, 0, 0, 95, 96, 3, 32, 16, 0, 96, 97, 7, 1, 0, 0, 97, 98, 3, 30, 15, 0, 98, 148, 1, 0, 0, 0, 99, 100, 3, 32, 16, 0, 100, 101, 7, 2, 0, 0, 101, 102, 3, 30, 15, 0, 102, 148, 1, 0, 0, 0, 103, 104, 3, 32, 16, 0, 104, 105, 5, 17, 0, 0, 105, 106, 3, 30, 15, 0, 106, 107, 5, 23, 0, 0, 107, 108, 3, 30, 15, 0, 108, 148, 1, 0, 0, 0, 109, 110, 3, 32, 16, 0, 110, 111, 5, 22, 0, 0, 111, 112, 5, 17, 0, 0, 112, 113, 3, 30, 15, 0, 113, 114, 5, 23, 0, 0, 114, 115, 3, 30, 15, 0, 115, 148, 1, 0, 0, 0, 116, 117, 3, 32, 16, 0, 117, 118, 3, 14, 7, 0, 118, 148, 1, 0, 0, 0, 119, 120, 3, 32, 16, 0, 120, 121, 3, 16, 8, 0, 121, 148, 1, 0, 0, 0, 122, 123, 3, 32, 16, 0, 123, 124, 5, 18, 0, 0, 124, 148, 1, 0, 0, 0, 125, 126, 3, 32, 16, 0, 126, 127, 5, 22, 0, 0, 127, 128, 5, 18, 0, 0, 128, 148, 1, 0, 0, 0, 129, 130, 3, 32, 16, 0, 130, 131, 5, 19, 0, 0, 131, 132, 3, 30, 15, 0, 132, 148, 1, 0, 0, 0, 133, 134, 3, 32, 16, 0, 134, 135, 5, 22, 0, 0, 135, 136, 5, 19, 0, 0, 136, 137, 3, 30, 15, 0, 137, 148, 1, 0, 0, 0, 138, 139, 3, 32, 16, 0, 139, 140, 5, 20, 0, 0, 140, 141, 3, 30, 15, 0, 141, 148, 1, 0, 0, 0, 142, 143, 3, 32, 16, 0, 143, 144, 5, 22, 0, 0, 144, 145, 5, 20, 0, 0, 145, 146, 3, 30, 15, 0, 146, 148, 1, 0, 0, 0, 147, 71, 1, 0, 0, 0, 147, 75, 1, 0, 0, 0, 147, 79, 1, 0, 0, 0, 147, 83, 1, 0, 0, 0, 147, 87, 1, 0, 0, 0, 147, 91, 1, 0, 0, 0, 147, 95, 1, 0, 0, 0, 147, 99, 1, 0, 0, 0, 147, 103, 1, 0, 0, 0, 147, 109, 1, 0, 0, 0, 147, 116, 1, 0, 0, 0, 147, 119, 1, 0, 0, 0, 147, 122, 1, 0, 0, 0, 147, 125, 1, 0, 0, 0, 147, 129, 1, 0, 0, 0, 147, 133, 1, 0, 0, 0, 147, 138, 1, 0, 0, 0, 147, 142, 1, 0, 0, 0, 148, 13, 1, 0, 0, 0, 149, 150, 5, 21, 0, 0, 150, 151, 5, 1, 0, 0, 151, 152, 3, 18, 9, 0, 152, 153, 5, 2, 0, 0, 153, 160, 1, 0, 0, 0, 154, 155, 5, 21, 0, 0, 155, 156, 5, 3, 0, 0, 156, 157, 3, 18, 9, 0, 157, 158, 5, 4, 0, 0, 158, 160, 1, 0, 0, 0, 159, 149, 1, 0, 0, 0, 159, 154, 1, 0, 0, 0, 160, 15, 1, 0, 0, 0, 161, 162, 5, 22, 0, 0, 162, 163, 5, 21, 0, 0, 163, 164, 5, 1, 0, 0, 164, 165, 3, 18, 9, 0, 165, 166, 5, 2, 0, 0, 166, 174, 1, 0, 0, 0, 167, 168, 5, 22, 0, 0, 168, 169, 5, 21, 0, 0, 169, 170, 5, 3, 0, 0, 170, 171, 3, 18, 9, 0, 171, 172, 5, 4, 0, 0, 172, 174, 1, 0, 0, 0, 173, 161, 1, 0, 0, 0, 173, 167, 1, 0, 0, 0, 174, 17, 1, 0, 0, 0, 175, 180, 3, 30, 15, 0, 176, 177, 5, 5, 0, 0, 177, 179, 3, 30, 15, 0, 178, 176, 1, 0, 0, 0, 179, 182, 1, 0, 0, 0, 180, 178, 1, 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 19, 1, 0, 0, 0, 182, 180, 1, 0, 0, 0, 183, 184, 7, 3, 0, 0, 184, 21, 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186, 187, 5, 1, 0, 0, 187, 188, 3, 24, 12, 0, 188, 189, 5, 2, 0, 0, 189, 23, 1, 0, 0, 0, 190, 195, 3, 26, 13, 0, 191, 192, 5, 5, 0, 0, 192, 194, 3, 26, 13, 0, 193, 191, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0, 0, 0, 195, 196, 1, 0, 0, 0, 196, 25, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 198, 202, 3, 32, 16, 0, 199, 202, 3, 30, 15, 0, 200, 202, 3, 28, 14, 0, 201, 198, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 201, 200, 1, 0, 0, 0, 202, 27, 1, 0, 0, 0, 203, 204, 5, 3, 0, 0, 204, 205, 3, 18, 9, 0, 205, 206, 5, 4, 0, 0, 206, 29, 1, 0, 0, 0, 207, 208, 7, 5, 0, 0, 208, 31, 1, 0, 0, 0, 209, 210, 5, 32, 0, 0, 210, 33, 1, 0, 0, 0, 11, 44, 51, 53, 57, 69, 147, 159, 173, 180, 195, 201]
\ No newline at end of file
diff --git a/pkg/parser/grammar/FilterQuery.tokens b/pkg/parser/grammar/FilterQuery.tokens
new file mode 100644
index 0000000000..ca38d44fa5
--- /dev/null
+++ b/pkg/parser/grammar/FilterQuery.tokens
@@ -0,0 +1,45 @@
+LPAREN=1
+RPAREN=2
+LBRACK=3
+RBRACK=4
+COMMA=5
+EQUALS=6
+NOT_EQUALS=7
+NEQ=8
+LT=9
+LE=10
+GT=11
+GE=12
+LIKE=13
+NOT_LIKE=14
+ILIKE=15
+NOT_ILIKE=16
+BETWEEN=17
+EXISTS=18
+REGEXP=19
+CONTAINS=20
+IN=21
+NOT=22
+AND=23
+OR=24
+HAS=25
+HASANY=26
+HASALL=27
+HASNONE=28
+BOOL=29
+NUMBER=30
+QUOTED_TEXT=31
+KEY=32
+WS=33
+FREETEXT=34
+'('=1
+')'=2
+'['=3
+']'=4
+','=5
+'!='=7
+'<>'=8
+'<'=9
+'<='=10
+'>'=11
+'>='=12
diff --git a/pkg/parser/grammar/FilterQueryLexer.interp b/pkg/parser/grammar/FilterQueryLexer.interp
new file mode 100644
index 0000000000..3808e111e1
--- /dev/null
+++ b/pkg/parser/grammar/FilterQueryLexer.interp
@@ -0,0 +1,120 @@
+token literal names:
+null
+'('
+')'
+'['
+']'
+','
+null
+'!='
+'<>'
+'<'
+'<='
+'>'
+'>='
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+null
+
+token symbolic names:
+null
+LPAREN
+RPAREN
+LBRACK
+RBRACK
+COMMA
+EQUALS
+NOT_EQUALS
+NEQ
+LT
+LE
+GT
+GE
+LIKE
+NOT_LIKE
+ILIKE
+NOT_ILIKE
+BETWEEN
+EXISTS
+REGEXP
+CONTAINS
+IN
+NOT
+AND
+OR
+HAS
+HASANY
+HASALL
+HASNONE
+BOOL
+NUMBER
+QUOTED_TEXT
+KEY
+WS
+FREETEXT
+
+rule names:
+LPAREN
+RPAREN
+LBRACK
+RBRACK
+COMMA
+EQUALS
+NOT_EQUALS
+NEQ
+LT
+LE
+GT
+GE
+LIKE
+NOT_LIKE
+ILIKE
+NOT_ILIKE
+BETWEEN
+EXISTS
+REGEXP
+CONTAINS
+IN
+NOT
+AND
+OR
+HAS
+HASANY
+HASALL
+HASNONE
+BOOL
+NUMBER
+QUOTED_TEXT
+KEY
+WS
+DIGIT
+FREETEXT
+
+channel names:
+DEFAULT_TOKEN_CHANNEL
+HIDDEN
+
+mode names:
+DEFAULT_MODE
+
+atn:
+[4, 0, 34, 280, 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, 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, 5, 3, 5, 85, 8, 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 4, 13, 112, 8, 13, 11, 13, 12, 13, 113, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 4, 15, 131, 8, 15, 11, 15, 12, 15, 132, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 155, 8, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 172, 8, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 223, 8, 28, 1, 29, 4, 29, 226, 8, 29, 11, 29, 12, 29, 227, 1, 29, 1, 29, 4, 29, 232, 8, 29, 11, 29, 12, 29, 233, 3, 29, 236, 8, 29, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 242, 8, 30, 10, 30, 12, 30, 245, 9, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 252, 8, 30, 10, 30, 12, 30, 255, 9, 30, 1, 30, 3, 30, 258, 8, 30, 1, 31, 1, 31, 5, 31, 262, 8, 31, 10, 31, 12, 31, 265, 9, 31, 1, 32, 4, 32, 268, 8, 32, 11, 32, 12, 32, 269, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 4, 34, 277, 8, 34, 11, 34, 12, 34, 278, 0, 0, 35, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 0, 69, 34, 1, 0, 29, 2, 0, 76, 76, 108, 108, 2, 0, 73, 73, 105, 105, 2, 0, 75, 75, 107, 107, 2, 0, 69, 69, 101, 101, 2, 0, 78, 78, 110, 110, 2, 0, 79, 79, 111, 111, 2, 0, 84, 84, 116, 116, 2, 0, 9, 9, 32, 32, 2, 0, 66, 66, 98, 98, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0, 83, 83, 115, 115, 2, 0, 82, 82, 114, 114, 2, 0, 71, 71, 103, 103, 2, 0, 80, 80, 112, 112, 2, 0, 67, 67, 99, 99, 2, 0, 65, 65, 97, 97, 2, 0, 68, 68, 100, 100, 2, 0, 72, 72, 104, 104, 2, 0, 89, 89, 121, 121, 2, 0, 85, 85, 117, 117, 2, 0, 70, 70, 102, 102, 2, 0, 34, 34, 92, 92, 2, 0, 39, 39, 92, 92, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 6, 0, 46, 46, 48, 57, 65, 91, 93, 93, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57, 7, 0, 9, 10, 13, 13, 32, 34, 39, 41, 60, 62, 91, 91, 93, 93, 295, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 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, 69, 1, 0, 0, 0, 1, 71, 1, 0, 0, 0, 3, 73, 1, 0, 0, 0, 5, 75, 1, 0, 0, 0, 7, 77, 1, 0, 0, 0, 9, 79, 1, 0, 0, 0, 11, 84, 1, 0, 0, 0, 13, 86, 1, 0, 0, 0, 15, 89, 1, 0, 0, 0, 17, 92, 1, 0, 0, 0, 19, 94, 1, 0, 0, 0, 21, 97, 1, 0, 0, 0, 23, 99, 1, 0, 0, 0, 25, 102, 1, 0, 0, 0, 27, 107, 1, 0, 0, 0, 29, 120, 1, 0, 0, 0, 31, 126, 1, 0, 0, 0, 33, 140, 1, 0, 0, 0, 35, 148, 1, 0, 0, 0, 37, 156, 1, 0, 0, 0, 39, 163, 1, 0, 0, 0, 41, 173, 1, 0, 0, 0, 43, 176, 1, 0, 0, 0, 45, 180, 1, 0, 0, 0, 47, 184, 1, 0, 0, 0, 49, 187, 1, 0, 0, 0, 51, 191, 1, 0, 0, 0, 53, 198, 1, 0, 0, 0, 55, 205, 1, 0, 0, 0, 57, 222, 1, 0, 0, 0, 59, 225, 1, 0, 0, 0, 61, 257, 1, 0, 0, 0, 63, 259, 1, 0, 0, 0, 65, 267, 1, 0, 0, 0, 67, 273, 1, 0, 0, 0, 69, 276, 1, 0, 0, 0, 71, 72, 5, 40, 0, 0, 72, 2, 1, 0, 0, 0, 73, 74, 5, 41, 0, 0, 74, 4, 1, 0, 0, 0, 75, 76, 5, 91, 0, 0, 76, 6, 1, 0, 0, 0, 77, 78, 5, 93, 0, 0, 78, 8, 1, 0, 0, 0, 79, 80, 5, 44, 0, 0, 80, 10, 1, 0, 0, 0, 81, 85, 5, 61, 0, 0, 82, 83, 5, 61, 0, 0, 83, 85, 5, 61, 0, 0, 84, 81, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 12, 1, 0, 0, 0, 86, 87, 5, 33, 0, 0, 87, 88, 5, 61, 0, 0, 88, 14, 1, 0, 0, 0, 89, 90, 5, 60, 0, 0, 90, 91, 5, 62, 0, 0, 91, 16, 1, 0, 0, 0, 92, 93, 5, 60, 0, 0, 93, 18, 1, 0, 0, 0, 94, 95, 5, 60, 0, 0, 95, 96, 5, 61, 0, 0, 96, 20, 1, 0, 0, 0, 97, 98, 5, 62, 0, 0, 98, 22, 1, 0, 0, 0, 99, 100, 5, 62, 0, 0, 100, 101, 5, 61, 0, 0, 101, 24, 1, 0, 0, 0, 102, 103, 7, 0, 0, 0, 103, 104, 7, 1, 0, 0, 104, 105, 7, 2, 0, 0, 105, 106, 7, 3, 0, 0, 106, 26, 1, 0, 0, 0, 107, 108, 7, 4, 0, 0, 108, 109, 7, 5, 0, 0, 109, 111, 7, 6, 0, 0, 110, 112, 7, 7, 0, 0, 111, 110, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 7, 0, 0, 0, 116, 117, 7, 1, 0, 0, 117, 118, 7, 2, 0, 0, 118, 119, 7, 3, 0, 0, 119, 28, 1, 0, 0, 0, 120, 121, 7, 1, 0, 0, 121, 122, 7, 0, 0, 0, 122, 123, 7, 1, 0, 0, 123, 124, 7, 2, 0, 0, 124, 125, 7, 3, 0, 0, 125, 30, 1, 0, 0, 0, 126, 127, 7, 4, 0, 0, 127, 128, 7, 5, 0, 0, 128, 130, 7, 6, 0, 0, 129, 131, 7, 7, 0, 0, 130, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0, 134, 135, 7, 1, 0, 0, 135, 136, 7, 0, 0, 0, 136, 137, 7, 1, 0, 0, 137, 138, 7, 2, 0, 0, 138, 139, 7, 3, 0, 0, 139, 32, 1, 0, 0, 0, 140, 141, 7, 8, 0, 0, 141, 142, 7, 3, 0, 0, 142, 143, 7, 6, 0, 0, 143, 144, 7, 9, 0, 0, 144, 145, 7, 3, 0, 0, 145, 146, 7, 3, 0, 0, 146, 147, 7, 4, 0, 0, 147, 34, 1, 0, 0, 0, 148, 149, 7, 3, 0, 0, 149, 150, 7, 10, 0, 0, 150, 151, 7, 1, 0, 0, 151, 152, 7, 11, 0, 0, 152, 154, 7, 6, 0, 0, 153, 155, 7, 11, 0, 0, 154, 153, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 36, 1, 0, 0, 0, 156, 157, 7, 12, 0, 0, 157, 158, 7, 3, 0, 0, 158, 159, 7, 13, 0, 0, 159, 160, 7, 3, 0, 0, 160, 161, 7, 10, 0, 0, 161, 162, 7, 14, 0, 0, 162, 38, 1, 0, 0, 0, 163, 164, 7, 15, 0, 0, 164, 165, 7, 5, 0, 0, 165, 166, 7, 4, 0, 0, 166, 167, 7, 6, 0, 0, 167, 168, 7, 16, 0, 0, 168, 169, 7, 1, 0, 0, 169, 171, 7, 4, 0, 0, 170, 172, 7, 11, 0, 0, 171, 170, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 40, 1, 0, 0, 0, 173, 174, 7, 1, 0, 0, 174, 175, 7, 4, 0, 0, 175, 42, 1, 0, 0, 0, 176, 177, 7, 4, 0, 0, 177, 178, 7, 5, 0, 0, 178, 179, 7, 6, 0, 0, 179, 44, 1, 0, 0, 0, 180, 181, 7, 16, 0, 0, 181, 182, 7, 4, 0, 0, 182, 183, 7, 17, 0, 0, 183, 46, 1, 0, 0, 0, 184, 185, 7, 5, 0, 0, 185, 186, 7, 12, 0, 0, 186, 48, 1, 0, 0, 0, 187, 188, 7, 18, 0, 0, 188, 189, 7, 16, 0, 0, 189, 190, 7, 11, 0, 0, 190, 50, 1, 0, 0, 0, 191, 192, 7, 18, 0, 0, 192, 193, 7, 16, 0, 0, 193, 194, 7, 11, 0, 0, 194, 195, 7, 16, 0, 0, 195, 196, 7, 4, 0, 0, 196, 197, 7, 19, 0, 0, 197, 52, 1, 0, 0, 0, 198, 199, 7, 18, 0, 0, 199, 200, 7, 16, 0, 0, 200, 201, 7, 11, 0, 0, 201, 202, 7, 16, 0, 0, 202, 203, 7, 0, 0, 0, 203, 204, 7, 0, 0, 0, 204, 54, 1, 0, 0, 0, 205, 206, 7, 18, 0, 0, 206, 207, 7, 16, 0, 0, 207, 208, 7, 11, 0, 0, 208, 209, 7, 4, 0, 0, 209, 210, 7, 5, 0, 0, 210, 211, 7, 4, 0, 0, 211, 212, 7, 3, 0, 0, 212, 56, 1, 0, 0, 0, 213, 214, 7, 6, 0, 0, 214, 215, 7, 12, 0, 0, 215, 216, 7, 20, 0, 0, 216, 223, 7, 3, 0, 0, 217, 218, 7, 21, 0, 0, 218, 219, 7, 16, 0, 0, 219, 220, 7, 0, 0, 0, 220, 221, 7, 11, 0, 0, 221, 223, 7, 3, 0, 0, 222, 213, 1, 0, 0, 0, 222, 217, 1, 0, 0, 0, 223, 58, 1, 0, 0, 0, 224, 226, 3, 67, 33, 0, 225, 224, 1, 0, 0, 0, 226, 227, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, 227, 228, 1, 0, 0, 0, 228, 235, 1, 0, 0, 0, 229, 231, 5, 46, 0, 0, 230, 232, 3, 67, 33, 0, 231, 230, 1, 0, 0, 0, 232, 233, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 229, 1, 0, 0, 0, 235, 236, 1, 0, 0, 0, 236, 60, 1, 0, 0, 0, 237, 243, 5, 34, 0, 0, 238, 242, 8, 22, 0, 0, 239, 240, 5, 92, 0, 0, 240, 242, 9, 0, 0, 0, 241, 238, 1, 0, 0, 0, 241, 239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 246, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 258, 5, 34, 0, 0, 247, 253, 5, 39, 0, 0, 248, 252, 8, 23, 0, 0, 249, 250, 5, 92, 0, 0, 250, 252, 9, 0, 0, 0, 251, 248, 1, 0, 0, 0, 251, 249, 1, 0, 0, 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254, 256, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 39, 0, 0, 257, 237, 1, 0, 0, 0, 257, 247, 1, 0, 0, 0, 258, 62, 1, 0, 0, 0, 259, 263, 7, 24, 0, 0, 260, 262, 7, 25, 0, 0, 261, 260, 1, 0, 0, 0, 262, 265, 1, 0, 0, 0, 263, 261, 1, 0, 0, 0, 263, 264, 1, 0, 0, 0, 264, 64, 1, 0, 0, 0, 265, 263, 1, 0, 0, 0, 266, 268, 7, 26, 0, 0, 267, 266, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0, 271, 272, 6, 32, 0, 0, 272, 66, 1, 0, 0, 0, 273, 274, 7, 27, 0, 0, 274, 68, 1, 0, 0, 0, 275, 277, 8, 28, 0, 0, 276, 275, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 70, 1, 0, 0, 0, 18, 0, 84, 113, 132, 154, 171, 222, 227, 233, 235, 241, 243, 251, 253, 257, 263, 269, 278, 1, 6, 0, 0]
\ No newline at end of file
diff --git a/pkg/parser/grammar/FilterQueryLexer.tokens b/pkg/parser/grammar/FilterQueryLexer.tokens
new file mode 100644
index 0000000000..ca38d44fa5
--- /dev/null
+++ b/pkg/parser/grammar/FilterQueryLexer.tokens
@@ -0,0 +1,45 @@
+LPAREN=1
+RPAREN=2
+LBRACK=3
+RBRACK=4
+COMMA=5
+EQUALS=6
+NOT_EQUALS=7
+NEQ=8
+LT=9
+LE=10
+GT=11
+GE=12
+LIKE=13
+NOT_LIKE=14
+ILIKE=15
+NOT_ILIKE=16
+BETWEEN=17
+EXISTS=18
+REGEXP=19
+CONTAINS=20
+IN=21
+NOT=22
+AND=23
+OR=24
+HAS=25
+HASANY=26
+HASALL=27
+HASNONE=28
+BOOL=29
+NUMBER=30
+QUOTED_TEXT=31
+KEY=32
+WS=33
+FREETEXT=34
+'('=1
+')'=2
+'['=3
+']'=4
+','=5
+'!='=7
+'<>'=8
+'<'=9
+'<='=10
+'>'=11
+'>='=12
diff --git a/pkg/parser/grammar/filterquery_base_listener.go b/pkg/parser/grammar/filterquery_base_listener.go
new file mode 100644
index 0000000000..5bf4d4671c
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_base_listener.go
@@ -0,0 +1,124 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser // FilterQuery
+
+import "github.com/antlr4-go/antlr/v4"
+
+// BaseFilterQueryListener is a complete listener for a parse tree produced by FilterQueryParser.
+type BaseFilterQueryListener struct{}
+
+var _ FilterQueryListener = &BaseFilterQueryListener{}
+
+// VisitTerminal is called when a terminal node is visited.
+func (s *BaseFilterQueryListener) VisitTerminal(node antlr.TerminalNode) {}
+
+// VisitErrorNode is called when an error node is visited.
+func (s *BaseFilterQueryListener) VisitErrorNode(node antlr.ErrorNode) {}
+
+// EnterEveryRule is called when any rule is entered.
+func (s *BaseFilterQueryListener) EnterEveryRule(ctx antlr.ParserRuleContext) {}
+
+// ExitEveryRule is called when any rule is exited.
+func (s *BaseFilterQueryListener) ExitEveryRule(ctx antlr.ParserRuleContext) {}
+
+// EnterQuery is called when production query is entered.
+func (s *BaseFilterQueryListener) EnterQuery(ctx *QueryContext) {}
+
+// ExitQuery is called when production query is exited.
+func (s *BaseFilterQueryListener) ExitQuery(ctx *QueryContext) {}
+
+// EnterExpression is called when production expression is entered.
+func (s *BaseFilterQueryListener) EnterExpression(ctx *ExpressionContext) {}
+
+// ExitExpression is called when production expression is exited.
+func (s *BaseFilterQueryListener) ExitExpression(ctx *ExpressionContext) {}
+
+// EnterOrExpression is called when production orExpression is entered.
+func (s *BaseFilterQueryListener) EnterOrExpression(ctx *OrExpressionContext) {}
+
+// ExitOrExpression is called when production orExpression is exited.
+func (s *BaseFilterQueryListener) ExitOrExpression(ctx *OrExpressionContext) {}
+
+// EnterAndExpression is called when production andExpression is entered.
+func (s *BaseFilterQueryListener) EnterAndExpression(ctx *AndExpressionContext) {}
+
+// ExitAndExpression is called when production andExpression is exited.
+func (s *BaseFilterQueryListener) ExitAndExpression(ctx *AndExpressionContext) {}
+
+// EnterUnaryExpression is called when production unaryExpression is entered.
+func (s *BaseFilterQueryListener) EnterUnaryExpression(ctx *UnaryExpressionContext) {}
+
+// ExitUnaryExpression is called when production unaryExpression is exited.
+func (s *BaseFilterQueryListener) ExitUnaryExpression(ctx *UnaryExpressionContext) {}
+
+// EnterPrimary is called when production primary is entered.
+func (s *BaseFilterQueryListener) EnterPrimary(ctx *PrimaryContext) {}
+
+// ExitPrimary is called when production primary is exited.
+func (s *BaseFilterQueryListener) ExitPrimary(ctx *PrimaryContext) {}
+
+// EnterComparison is called when production comparison is entered.
+func (s *BaseFilterQueryListener) EnterComparison(ctx *ComparisonContext) {}
+
+// ExitComparison is called when production comparison is exited.
+func (s *BaseFilterQueryListener) ExitComparison(ctx *ComparisonContext) {}
+
+// EnterInClause is called when production inClause is entered.
+func (s *BaseFilterQueryListener) EnterInClause(ctx *InClauseContext) {}
+
+// ExitInClause is called when production inClause is exited.
+func (s *BaseFilterQueryListener) ExitInClause(ctx *InClauseContext) {}
+
+// EnterNotInClause is called when production notInClause is entered.
+func (s *BaseFilterQueryListener) EnterNotInClause(ctx *NotInClauseContext) {}
+
+// ExitNotInClause is called when production notInClause is exited.
+func (s *BaseFilterQueryListener) ExitNotInClause(ctx *NotInClauseContext) {}
+
+// EnterValueList is called when production valueList is entered.
+func (s *BaseFilterQueryListener) EnterValueList(ctx *ValueListContext) {}
+
+// ExitValueList is called when production valueList is exited.
+func (s *BaseFilterQueryListener) ExitValueList(ctx *ValueListContext) {}
+
+// EnterFullText is called when production fullText is entered.
+func (s *BaseFilterQueryListener) EnterFullText(ctx *FullTextContext) {}
+
+// ExitFullText is called when production fullText is exited.
+func (s *BaseFilterQueryListener) ExitFullText(ctx *FullTextContext) {}
+
+// EnterFunctionCall is called when production functionCall is entered.
+func (s *BaseFilterQueryListener) EnterFunctionCall(ctx *FunctionCallContext) {}
+
+// ExitFunctionCall is called when production functionCall is exited.
+func (s *BaseFilterQueryListener) ExitFunctionCall(ctx *FunctionCallContext) {}
+
+// EnterFunctionParamList is called when production functionParamList is entered.
+func (s *BaseFilterQueryListener) EnterFunctionParamList(ctx *FunctionParamListContext) {}
+
+// ExitFunctionParamList is called when production functionParamList is exited.
+func (s *BaseFilterQueryListener) ExitFunctionParamList(ctx *FunctionParamListContext) {}
+
+// EnterFunctionParam is called when production functionParam is entered.
+func (s *BaseFilterQueryListener) EnterFunctionParam(ctx *FunctionParamContext) {}
+
+// ExitFunctionParam is called when production functionParam is exited.
+func (s *BaseFilterQueryListener) ExitFunctionParam(ctx *FunctionParamContext) {}
+
+// EnterArray is called when production array is entered.
+func (s *BaseFilterQueryListener) EnterArray(ctx *ArrayContext) {}
+
+// ExitArray is called when production array is exited.
+func (s *BaseFilterQueryListener) ExitArray(ctx *ArrayContext) {}
+
+// EnterValue is called when production value is entered.
+func (s *BaseFilterQueryListener) EnterValue(ctx *ValueContext) {}
+
+// ExitValue is called when production value is exited.
+func (s *BaseFilterQueryListener) ExitValue(ctx *ValueContext) {}
+
+// EnterKey is called when production key is entered.
+func (s *BaseFilterQueryListener) EnterKey(ctx *KeyContext) {}
+
+// ExitKey is called when production key is exited.
+func (s *BaseFilterQueryListener) ExitKey(ctx *KeyContext) {}
diff --git a/pkg/parser/grammar/filterquery_base_visitor.go b/pkg/parser/grammar/filterquery_base_visitor.go
new file mode 100644
index 0000000000..dad3452551
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_base_visitor.go
@@ -0,0 +1,77 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser // FilterQuery
+
+import "github.com/antlr4-go/antlr/v4"
+
+type BaseFilterQueryVisitor struct {
+ *antlr.BaseParseTreeVisitor
+}
+
+func (v *BaseFilterQueryVisitor) VisitQuery(ctx *QueryContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitExpression(ctx *ExpressionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitOrExpression(ctx *OrExpressionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitAndExpression(ctx *AndExpressionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitUnaryExpression(ctx *UnaryExpressionContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitPrimary(ctx *PrimaryContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitComparison(ctx *ComparisonContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitInClause(ctx *InClauseContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitNotInClause(ctx *NotInClauseContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitValueList(ctx *ValueListContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitFullText(ctx *FullTextContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitFunctionCall(ctx *FunctionCallContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitFunctionParamList(ctx *FunctionParamListContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitFunctionParam(ctx *FunctionParamContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitArray(ctx *ArrayContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitValue(ctx *ValueContext) interface{} {
+ return v.VisitChildren(ctx)
+}
+
+func (v *BaseFilterQueryVisitor) VisitKey(ctx *KeyContext) interface{} {
+ return v.VisitChildren(ctx)
+}
diff --git a/pkg/parser/grammar/filterquery_lexer.go b/pkg/parser/grammar/filterquery_lexer.go
new file mode 100644
index 0000000000..82109bf036
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_lexer.go
@@ -0,0 +1,271 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser
+
+import (
+ "fmt"
+ "github.com/antlr4-go/antlr/v4"
+ "sync"
+ "unicode"
+)
+
+// Suppress unused import error
+var _ = fmt.Printf
+var _ = sync.Once{}
+var _ = unicode.IsLetter
+
+type FilterQueryLexer struct {
+ *antlr.BaseLexer
+ channelNames []string
+ modeNames []string
+ // TODO: EOF string
+}
+
+var FilterQueryLexerLexerStaticData 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 filterquerylexerLexerInit() {
+ staticData := &FilterQueryLexerLexerStaticData
+ staticData.ChannelNames = []string{
+ "DEFAULT_TOKEN_CHANNEL", "HIDDEN",
+ }
+ staticData.ModeNames = []string{
+ "DEFAULT_MODE",
+ }
+ staticData.LiteralNames = []string{
+ "", "'('", "')'", "'['", "']'", "','", "", "'!='", "'<>'", "'<'", "'<='",
+ "'>'", "'>='",
+ }
+ staticData.SymbolicNames = []string{
+ "", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
+ "NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
+ "BETWEEN", "EXISTS", "REGEXP", "CONTAINS", "IN", "NOT", "AND", "OR",
+ "HAS", "HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT",
+ "KEY", "WS", "FREETEXT",
+ }
+ staticData.RuleNames = []string{
+ "LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
+ "NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
+ "BETWEEN", "EXISTS", "REGEXP", "CONTAINS", "IN", "NOT", "AND", "OR",
+ "HAS", "HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT",
+ "KEY", "WS", "DIGIT", "FREETEXT",
+ }
+ staticData.PredictionContextCache = antlr.NewPredictionContextCache()
+ staticData.serializedATN = []int32{
+ 4, 0, 34, 280, 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, 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, 5, 3, 5, 85, 8,
+ 5, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1,
+ 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13,
+ 1, 13, 1, 13, 1, 13, 4, 13, 112, 8, 13, 11, 13, 12, 13, 113, 1, 13, 1,
+ 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15,
+ 1, 15, 1, 15, 1, 15, 4, 15, 131, 8, 15, 11, 15, 12, 15, 132, 1, 15, 1,
+ 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16,
+ 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 155, 8,
+ 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19,
+ 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 172, 8, 19, 1, 20, 1, 20, 1,
+ 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23,
+ 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1,
+ 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27,
+ 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1,
+ 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 223, 8, 28, 1, 29, 4, 29, 226, 8,
+ 29, 11, 29, 12, 29, 227, 1, 29, 1, 29, 4, 29, 232, 8, 29, 11, 29, 12, 29,
+ 233, 3, 29, 236, 8, 29, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 242, 8, 30,
+ 10, 30, 12, 30, 245, 9, 30, 1, 30, 1, 30, 1, 30, 1, 30, 1, 30, 5, 30, 252,
+ 8, 30, 10, 30, 12, 30, 255, 9, 30, 1, 30, 3, 30, 258, 8, 30, 1, 31, 1,
+ 31, 5, 31, 262, 8, 31, 10, 31, 12, 31, 265, 9, 31, 1, 32, 4, 32, 268, 8,
+ 32, 11, 32, 12, 32, 269, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 4, 34, 277,
+ 8, 34, 11, 34, 12, 34, 278, 0, 0, 35, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11,
+ 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15,
+ 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24,
+ 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33,
+ 67, 0, 69, 34, 1, 0, 29, 2, 0, 76, 76, 108, 108, 2, 0, 73, 73, 105, 105,
+ 2, 0, 75, 75, 107, 107, 2, 0, 69, 69, 101, 101, 2, 0, 78, 78, 110, 110,
+ 2, 0, 79, 79, 111, 111, 2, 0, 84, 84, 116, 116, 2, 0, 9, 9, 32, 32, 2,
+ 0, 66, 66, 98, 98, 2, 0, 87, 87, 119, 119, 2, 0, 88, 88, 120, 120, 2, 0,
+ 83, 83, 115, 115, 2, 0, 82, 82, 114, 114, 2, 0, 71, 71, 103, 103, 2, 0,
+ 80, 80, 112, 112, 2, 0, 67, 67, 99, 99, 2, 0, 65, 65, 97, 97, 2, 0, 68,
+ 68, 100, 100, 2, 0, 72, 72, 104, 104, 2, 0, 89, 89, 121, 121, 2, 0, 85,
+ 85, 117, 117, 2, 0, 70, 70, 102, 102, 2, 0, 34, 34, 92, 92, 2, 0, 39, 39,
+ 92, 92, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 6, 0, 46, 46, 48, 57, 65,
+ 91, 93, 93, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 1, 0, 48, 57,
+ 7, 0, 9, 10, 13, 13, 32, 34, 39, 41, 60, 62, 91, 91, 93, 93, 295, 0, 1,
+ 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9,
+ 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0,
+ 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0,
+ 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0,
+ 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0,
+ 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1,
+ 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 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, 69, 1, 0, 0, 0, 1, 71, 1, 0, 0, 0,
+ 3, 73, 1, 0, 0, 0, 5, 75, 1, 0, 0, 0, 7, 77, 1, 0, 0, 0, 9, 79, 1, 0, 0,
+ 0, 11, 84, 1, 0, 0, 0, 13, 86, 1, 0, 0, 0, 15, 89, 1, 0, 0, 0, 17, 92,
+ 1, 0, 0, 0, 19, 94, 1, 0, 0, 0, 21, 97, 1, 0, 0, 0, 23, 99, 1, 0, 0, 0,
+ 25, 102, 1, 0, 0, 0, 27, 107, 1, 0, 0, 0, 29, 120, 1, 0, 0, 0, 31, 126,
+ 1, 0, 0, 0, 33, 140, 1, 0, 0, 0, 35, 148, 1, 0, 0, 0, 37, 156, 1, 0, 0,
+ 0, 39, 163, 1, 0, 0, 0, 41, 173, 1, 0, 0, 0, 43, 176, 1, 0, 0, 0, 45, 180,
+ 1, 0, 0, 0, 47, 184, 1, 0, 0, 0, 49, 187, 1, 0, 0, 0, 51, 191, 1, 0, 0,
+ 0, 53, 198, 1, 0, 0, 0, 55, 205, 1, 0, 0, 0, 57, 222, 1, 0, 0, 0, 59, 225,
+ 1, 0, 0, 0, 61, 257, 1, 0, 0, 0, 63, 259, 1, 0, 0, 0, 65, 267, 1, 0, 0,
+ 0, 67, 273, 1, 0, 0, 0, 69, 276, 1, 0, 0, 0, 71, 72, 5, 40, 0, 0, 72, 2,
+ 1, 0, 0, 0, 73, 74, 5, 41, 0, 0, 74, 4, 1, 0, 0, 0, 75, 76, 5, 91, 0, 0,
+ 76, 6, 1, 0, 0, 0, 77, 78, 5, 93, 0, 0, 78, 8, 1, 0, 0, 0, 79, 80, 5, 44,
+ 0, 0, 80, 10, 1, 0, 0, 0, 81, 85, 5, 61, 0, 0, 82, 83, 5, 61, 0, 0, 83,
+ 85, 5, 61, 0, 0, 84, 81, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 12, 1, 0,
+ 0, 0, 86, 87, 5, 33, 0, 0, 87, 88, 5, 61, 0, 0, 88, 14, 1, 0, 0, 0, 89,
+ 90, 5, 60, 0, 0, 90, 91, 5, 62, 0, 0, 91, 16, 1, 0, 0, 0, 92, 93, 5, 60,
+ 0, 0, 93, 18, 1, 0, 0, 0, 94, 95, 5, 60, 0, 0, 95, 96, 5, 61, 0, 0, 96,
+ 20, 1, 0, 0, 0, 97, 98, 5, 62, 0, 0, 98, 22, 1, 0, 0, 0, 99, 100, 5, 62,
+ 0, 0, 100, 101, 5, 61, 0, 0, 101, 24, 1, 0, 0, 0, 102, 103, 7, 0, 0, 0,
+ 103, 104, 7, 1, 0, 0, 104, 105, 7, 2, 0, 0, 105, 106, 7, 3, 0, 0, 106,
+ 26, 1, 0, 0, 0, 107, 108, 7, 4, 0, 0, 108, 109, 7, 5, 0, 0, 109, 111, 7,
+ 6, 0, 0, 110, 112, 7, 7, 0, 0, 111, 110, 1, 0, 0, 0, 112, 113, 1, 0, 0,
+ 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115,
+ 116, 7, 0, 0, 0, 116, 117, 7, 1, 0, 0, 117, 118, 7, 2, 0, 0, 118, 119,
+ 7, 3, 0, 0, 119, 28, 1, 0, 0, 0, 120, 121, 7, 1, 0, 0, 121, 122, 7, 0,
+ 0, 0, 122, 123, 7, 1, 0, 0, 123, 124, 7, 2, 0, 0, 124, 125, 7, 3, 0, 0,
+ 125, 30, 1, 0, 0, 0, 126, 127, 7, 4, 0, 0, 127, 128, 7, 5, 0, 0, 128, 130,
+ 7, 6, 0, 0, 129, 131, 7, 7, 0, 0, 130, 129, 1, 0, 0, 0, 131, 132, 1, 0,
+ 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 1, 0, 0, 0,
+ 134, 135, 7, 1, 0, 0, 135, 136, 7, 0, 0, 0, 136, 137, 7, 1, 0, 0, 137,
+ 138, 7, 2, 0, 0, 138, 139, 7, 3, 0, 0, 139, 32, 1, 0, 0, 0, 140, 141, 7,
+ 8, 0, 0, 141, 142, 7, 3, 0, 0, 142, 143, 7, 6, 0, 0, 143, 144, 7, 9, 0,
+ 0, 144, 145, 7, 3, 0, 0, 145, 146, 7, 3, 0, 0, 146, 147, 7, 4, 0, 0, 147,
+ 34, 1, 0, 0, 0, 148, 149, 7, 3, 0, 0, 149, 150, 7, 10, 0, 0, 150, 151,
+ 7, 1, 0, 0, 151, 152, 7, 11, 0, 0, 152, 154, 7, 6, 0, 0, 153, 155, 7, 11,
+ 0, 0, 154, 153, 1, 0, 0, 0, 154, 155, 1, 0, 0, 0, 155, 36, 1, 0, 0, 0,
+ 156, 157, 7, 12, 0, 0, 157, 158, 7, 3, 0, 0, 158, 159, 7, 13, 0, 0, 159,
+ 160, 7, 3, 0, 0, 160, 161, 7, 10, 0, 0, 161, 162, 7, 14, 0, 0, 162, 38,
+ 1, 0, 0, 0, 163, 164, 7, 15, 0, 0, 164, 165, 7, 5, 0, 0, 165, 166, 7, 4,
+ 0, 0, 166, 167, 7, 6, 0, 0, 167, 168, 7, 16, 0, 0, 168, 169, 7, 1, 0, 0,
+ 169, 171, 7, 4, 0, 0, 170, 172, 7, 11, 0, 0, 171, 170, 1, 0, 0, 0, 171,
+ 172, 1, 0, 0, 0, 172, 40, 1, 0, 0, 0, 173, 174, 7, 1, 0, 0, 174, 175, 7,
+ 4, 0, 0, 175, 42, 1, 0, 0, 0, 176, 177, 7, 4, 0, 0, 177, 178, 7, 5, 0,
+ 0, 178, 179, 7, 6, 0, 0, 179, 44, 1, 0, 0, 0, 180, 181, 7, 16, 0, 0, 181,
+ 182, 7, 4, 0, 0, 182, 183, 7, 17, 0, 0, 183, 46, 1, 0, 0, 0, 184, 185,
+ 7, 5, 0, 0, 185, 186, 7, 12, 0, 0, 186, 48, 1, 0, 0, 0, 187, 188, 7, 18,
+ 0, 0, 188, 189, 7, 16, 0, 0, 189, 190, 7, 11, 0, 0, 190, 50, 1, 0, 0, 0,
+ 191, 192, 7, 18, 0, 0, 192, 193, 7, 16, 0, 0, 193, 194, 7, 11, 0, 0, 194,
+ 195, 7, 16, 0, 0, 195, 196, 7, 4, 0, 0, 196, 197, 7, 19, 0, 0, 197, 52,
+ 1, 0, 0, 0, 198, 199, 7, 18, 0, 0, 199, 200, 7, 16, 0, 0, 200, 201, 7,
+ 11, 0, 0, 201, 202, 7, 16, 0, 0, 202, 203, 7, 0, 0, 0, 203, 204, 7, 0,
+ 0, 0, 204, 54, 1, 0, 0, 0, 205, 206, 7, 18, 0, 0, 206, 207, 7, 16, 0, 0,
+ 207, 208, 7, 11, 0, 0, 208, 209, 7, 4, 0, 0, 209, 210, 7, 5, 0, 0, 210,
+ 211, 7, 4, 0, 0, 211, 212, 7, 3, 0, 0, 212, 56, 1, 0, 0, 0, 213, 214, 7,
+ 6, 0, 0, 214, 215, 7, 12, 0, 0, 215, 216, 7, 20, 0, 0, 216, 223, 7, 3,
+ 0, 0, 217, 218, 7, 21, 0, 0, 218, 219, 7, 16, 0, 0, 219, 220, 7, 0, 0,
+ 0, 220, 221, 7, 11, 0, 0, 221, 223, 7, 3, 0, 0, 222, 213, 1, 0, 0, 0, 222,
+ 217, 1, 0, 0, 0, 223, 58, 1, 0, 0, 0, 224, 226, 3, 67, 33, 0, 225, 224,
+ 1, 0, 0, 0, 226, 227, 1, 0, 0, 0, 227, 225, 1, 0, 0, 0, 227, 228, 1, 0,
+ 0, 0, 228, 235, 1, 0, 0, 0, 229, 231, 5, 46, 0, 0, 230, 232, 3, 67, 33,
+ 0, 231, 230, 1, 0, 0, 0, 232, 233, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233,
+ 234, 1, 0, 0, 0, 234, 236, 1, 0, 0, 0, 235, 229, 1, 0, 0, 0, 235, 236,
+ 1, 0, 0, 0, 236, 60, 1, 0, 0, 0, 237, 243, 5, 34, 0, 0, 238, 242, 8, 22,
+ 0, 0, 239, 240, 5, 92, 0, 0, 240, 242, 9, 0, 0, 0, 241, 238, 1, 0, 0, 0,
+ 241, 239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243,
+ 244, 1, 0, 0, 0, 244, 246, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 258,
+ 5, 34, 0, 0, 247, 253, 5, 39, 0, 0, 248, 252, 8, 23, 0, 0, 249, 250, 5,
+ 92, 0, 0, 250, 252, 9, 0, 0, 0, 251, 248, 1, 0, 0, 0, 251, 249, 1, 0, 0,
+ 0, 252, 255, 1, 0, 0, 0, 253, 251, 1, 0, 0, 0, 253, 254, 1, 0, 0, 0, 254,
+ 256, 1, 0, 0, 0, 255, 253, 1, 0, 0, 0, 256, 258, 5, 39, 0, 0, 257, 237,
+ 1, 0, 0, 0, 257, 247, 1, 0, 0, 0, 258, 62, 1, 0, 0, 0, 259, 263, 7, 24,
+ 0, 0, 260, 262, 7, 25, 0, 0, 261, 260, 1, 0, 0, 0, 262, 265, 1, 0, 0, 0,
+ 263, 261, 1, 0, 0, 0, 263, 264, 1, 0, 0, 0, 264, 64, 1, 0, 0, 0, 265, 263,
+ 1, 0, 0, 0, 266, 268, 7, 26, 0, 0, 267, 266, 1, 0, 0, 0, 268, 269, 1, 0,
+ 0, 0, 269, 267, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 1, 0, 0, 0,
+ 271, 272, 6, 32, 0, 0, 272, 66, 1, 0, 0, 0, 273, 274, 7, 27, 0, 0, 274,
+ 68, 1, 0, 0, 0, 275, 277, 8, 28, 0, 0, 276, 275, 1, 0, 0, 0, 277, 278,
+ 1, 0, 0, 0, 278, 276, 1, 0, 0, 0, 278, 279, 1, 0, 0, 0, 279, 70, 1, 0,
+ 0, 0, 18, 0, 84, 113, 132, 154, 171, 222, 227, 233, 235, 241, 243, 251,
+ 253, 257, 263, 269, 278, 1, 6, 0, 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)
+ }
+}
+
+// FilterQueryLexerInit initializes any static state used to implement FilterQueryLexer. By default the
+// static state used to implement the lexer is lazily initialized during the first call to
+// NewFilterQueryLexer(). You can call this function if you wish to initialize the static state ahead
+// of time.
+func FilterQueryLexerInit() {
+ staticData := &FilterQueryLexerLexerStaticData
+ staticData.once.Do(filterquerylexerLexerInit)
+}
+
+// NewFilterQueryLexer produces a new lexer instance for the optional input antlr.CharStream.
+func NewFilterQueryLexer(input antlr.CharStream) *FilterQueryLexer {
+ FilterQueryLexerInit()
+ l := new(FilterQueryLexer)
+ l.BaseLexer = antlr.NewBaseLexer(input)
+ staticData := &FilterQueryLexerLexerStaticData
+ 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 = "FilterQuery.g4"
+ // TODO: l.EOF = antlr.TokenEOF
+
+ return l
+}
+
+// FilterQueryLexer tokens.
+const (
+ FilterQueryLexerLPAREN = 1
+ FilterQueryLexerRPAREN = 2
+ FilterQueryLexerLBRACK = 3
+ FilterQueryLexerRBRACK = 4
+ FilterQueryLexerCOMMA = 5
+ FilterQueryLexerEQUALS = 6
+ FilterQueryLexerNOT_EQUALS = 7
+ FilterQueryLexerNEQ = 8
+ FilterQueryLexerLT = 9
+ FilterQueryLexerLE = 10
+ FilterQueryLexerGT = 11
+ FilterQueryLexerGE = 12
+ FilterQueryLexerLIKE = 13
+ FilterQueryLexerNOT_LIKE = 14
+ FilterQueryLexerILIKE = 15
+ FilterQueryLexerNOT_ILIKE = 16
+ FilterQueryLexerBETWEEN = 17
+ FilterQueryLexerEXISTS = 18
+ FilterQueryLexerREGEXP = 19
+ FilterQueryLexerCONTAINS = 20
+ FilterQueryLexerIN = 21
+ FilterQueryLexerNOT = 22
+ FilterQueryLexerAND = 23
+ FilterQueryLexerOR = 24
+ FilterQueryLexerHAS = 25
+ FilterQueryLexerHASANY = 26
+ FilterQueryLexerHASALL = 27
+ FilterQueryLexerHASNONE = 28
+ FilterQueryLexerBOOL = 29
+ FilterQueryLexerNUMBER = 30
+ FilterQueryLexerQUOTED_TEXT = 31
+ FilterQueryLexerKEY = 32
+ FilterQueryLexerWS = 33
+ FilterQueryLexerFREETEXT = 34
+)
diff --git a/pkg/parser/grammar/filterquery_listener.go b/pkg/parser/grammar/filterquery_listener.go
new file mode 100644
index 0000000000..8eb79b63e1
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_listener.go
@@ -0,0 +1,112 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser // FilterQuery
+
+import "github.com/antlr4-go/antlr/v4"
+
+// FilterQueryListener is a complete listener for a parse tree produced by FilterQueryParser.
+type FilterQueryListener interface {
+ antlr.ParseTreeListener
+
+ // EnterQuery is called when entering the query production.
+ EnterQuery(c *QueryContext)
+
+ // EnterExpression is called when entering the expression production.
+ EnterExpression(c *ExpressionContext)
+
+ // EnterOrExpression is called when entering the orExpression production.
+ EnterOrExpression(c *OrExpressionContext)
+
+ // EnterAndExpression is called when entering the andExpression production.
+ EnterAndExpression(c *AndExpressionContext)
+
+ // EnterUnaryExpression is called when entering the unaryExpression production.
+ EnterUnaryExpression(c *UnaryExpressionContext)
+
+ // EnterPrimary is called when entering the primary production.
+ EnterPrimary(c *PrimaryContext)
+
+ // EnterComparison is called when entering the comparison production.
+ EnterComparison(c *ComparisonContext)
+
+ // EnterInClause is called when entering the inClause production.
+ EnterInClause(c *InClauseContext)
+
+ // EnterNotInClause is called when entering the notInClause production.
+ EnterNotInClause(c *NotInClauseContext)
+
+ // EnterValueList is called when entering the valueList production.
+ EnterValueList(c *ValueListContext)
+
+ // EnterFullText is called when entering the fullText production.
+ EnterFullText(c *FullTextContext)
+
+ // EnterFunctionCall is called when entering the functionCall production.
+ EnterFunctionCall(c *FunctionCallContext)
+
+ // EnterFunctionParamList is called when entering the functionParamList production.
+ EnterFunctionParamList(c *FunctionParamListContext)
+
+ // EnterFunctionParam is called when entering the functionParam production.
+ EnterFunctionParam(c *FunctionParamContext)
+
+ // EnterArray is called when entering the array production.
+ EnterArray(c *ArrayContext)
+
+ // EnterValue is called when entering the value production.
+ EnterValue(c *ValueContext)
+
+ // EnterKey is called when entering the key production.
+ EnterKey(c *KeyContext)
+
+ // ExitQuery is called when exiting the query production.
+ ExitQuery(c *QueryContext)
+
+ // ExitExpression is called when exiting the expression production.
+ ExitExpression(c *ExpressionContext)
+
+ // ExitOrExpression is called when exiting the orExpression production.
+ ExitOrExpression(c *OrExpressionContext)
+
+ // ExitAndExpression is called when exiting the andExpression production.
+ ExitAndExpression(c *AndExpressionContext)
+
+ // ExitUnaryExpression is called when exiting the unaryExpression production.
+ ExitUnaryExpression(c *UnaryExpressionContext)
+
+ // ExitPrimary is called when exiting the primary production.
+ ExitPrimary(c *PrimaryContext)
+
+ // ExitComparison is called when exiting the comparison production.
+ ExitComparison(c *ComparisonContext)
+
+ // ExitInClause is called when exiting the inClause production.
+ ExitInClause(c *InClauseContext)
+
+ // ExitNotInClause is called when exiting the notInClause production.
+ ExitNotInClause(c *NotInClauseContext)
+
+ // ExitValueList is called when exiting the valueList production.
+ ExitValueList(c *ValueListContext)
+
+ // ExitFullText is called when exiting the fullText production.
+ ExitFullText(c *FullTextContext)
+
+ // ExitFunctionCall is called when exiting the functionCall production.
+ ExitFunctionCall(c *FunctionCallContext)
+
+ // ExitFunctionParamList is called when exiting the functionParamList production.
+ ExitFunctionParamList(c *FunctionParamListContext)
+
+ // ExitFunctionParam is called when exiting the functionParam production.
+ ExitFunctionParam(c *FunctionParamContext)
+
+ // ExitArray is called when exiting the array production.
+ ExitArray(c *ArrayContext)
+
+ // ExitValue is called when exiting the value production.
+ ExitValue(c *ValueContext)
+
+ // ExitKey is called when exiting the key production.
+ ExitKey(c *KeyContext)
+}
diff --git a/pkg/parser/grammar/filterquery_parser.go b/pkg/parser/grammar/filterquery_parser.go
new file mode 100644
index 0000000000..dbbb547e0a
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_parser.go
@@ -0,0 +1,3539 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser // FilterQuery
+
+import (
+ "fmt"
+ "strconv"
+ "sync"
+
+ "github.com/antlr4-go/antlr/v4"
+)
+
+// Suppress unused import errors
+var _ = fmt.Printf
+var _ = strconv.Itoa
+var _ = sync.Once{}
+
+type FilterQueryParser struct {
+ *antlr.BaseParser
+}
+
+var FilterQueryParserStaticData struct {
+ once sync.Once
+ serializedATN []int32
+ LiteralNames []string
+ SymbolicNames []string
+ RuleNames []string
+ PredictionContextCache *antlr.PredictionContextCache
+ atn *antlr.ATN
+ decisionToDFA []*antlr.DFA
+}
+
+func filterqueryParserInit() {
+ staticData := &FilterQueryParserStaticData
+ staticData.LiteralNames = []string{
+ "", "'('", "')'", "'['", "']'", "','", "", "'!='", "'<>'", "'<'", "'<='",
+ "'>'", "'>='",
+ }
+ staticData.SymbolicNames = []string{
+ "", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
+ "NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
+ "BETWEEN", "EXISTS", "REGEXP", "CONTAINS", "IN", "NOT", "AND", "OR",
+ "HAS", "HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT",
+ "KEY", "WS", "FREETEXT",
+ }
+ staticData.RuleNames = []string{
+ "query", "expression", "orExpression", "andExpression", "unaryExpression",
+ "primary", "comparison", "inClause", "notInClause", "valueList", "fullText",
+ "functionCall", "functionParamList", "functionParam", "array", "value",
+ "key",
+ }
+ staticData.PredictionContextCache = antlr.NewPredictionContextCache()
+ staticData.serializedATN = []int32{
+ 4, 1, 34, 212, 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, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 5, 2, 43,
+ 8, 2, 10, 2, 12, 2, 46, 9, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 52, 8, 3, 10,
+ 3, 12, 3, 55, 9, 3, 1, 4, 3, 4, 58, 8, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5,
+ 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 70, 8, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1,
+ 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3,
+ 6, 148, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1,
+ 7, 3, 7, 160, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1,
+ 8, 1, 8, 1, 8, 1, 8, 3, 8, 174, 8, 8, 1, 9, 1, 9, 1, 9, 5, 9, 179, 8, 9,
+ 10, 9, 12, 9, 182, 9, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11,
+ 1, 12, 1, 12, 1, 12, 5, 12, 194, 8, 12, 10, 12, 12, 12, 197, 9, 12, 1,
+ 13, 1, 13, 1, 13, 3, 13, 202, 8, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15,
+ 1, 15, 1, 16, 1, 16, 1, 16, 0, 0, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
+ 20, 22, 24, 26, 28, 30, 32, 0, 6, 1, 0, 7, 8, 2, 0, 13, 13, 15, 15, 2,
+ 0, 14, 14, 16, 16, 2, 0, 31, 31, 34, 34, 1, 0, 25, 28, 1, 0, 29, 32, 225,
+ 0, 34, 1, 0, 0, 0, 2, 37, 1, 0, 0, 0, 4, 39, 1, 0, 0, 0, 6, 47, 1, 0, 0,
+ 0, 8, 57, 1, 0, 0, 0, 10, 69, 1, 0, 0, 0, 12, 147, 1, 0, 0, 0, 14, 159,
+ 1, 0, 0, 0, 16, 173, 1, 0, 0, 0, 18, 175, 1, 0, 0, 0, 20, 183, 1, 0, 0,
+ 0, 22, 185, 1, 0, 0, 0, 24, 190, 1, 0, 0, 0, 26, 201, 1, 0, 0, 0, 28, 203,
+ 1, 0, 0, 0, 30, 207, 1, 0, 0, 0, 32, 209, 1, 0, 0, 0, 34, 35, 3, 2, 1,
+ 0, 35, 36, 5, 0, 0, 1, 36, 1, 1, 0, 0, 0, 37, 38, 3, 4, 2, 0, 38, 3, 1,
+ 0, 0, 0, 39, 44, 3, 6, 3, 0, 40, 41, 5, 24, 0, 0, 41, 43, 3, 6, 3, 0, 42,
+ 40, 1, 0, 0, 0, 43, 46, 1, 0, 0, 0, 44, 42, 1, 0, 0, 0, 44, 45, 1, 0, 0,
+ 0, 45, 5, 1, 0, 0, 0, 46, 44, 1, 0, 0, 0, 47, 53, 3, 8, 4, 0, 48, 49, 5,
+ 23, 0, 0, 49, 52, 3, 8, 4, 0, 50, 52, 3, 8, 4, 0, 51, 48, 1, 0, 0, 0, 51,
+ 50, 1, 0, 0, 0, 52, 55, 1, 0, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0,
+ 0, 54, 7, 1, 0, 0, 0, 55, 53, 1, 0, 0, 0, 56, 58, 5, 22, 0, 0, 57, 56,
+ 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 60, 3, 10, 5, 0,
+ 60, 9, 1, 0, 0, 0, 61, 62, 5, 1, 0, 0, 62, 63, 3, 4, 2, 0, 63, 64, 5, 2,
+ 0, 0, 64, 70, 1, 0, 0, 0, 65, 70, 3, 12, 6, 0, 66, 70, 3, 22, 11, 0, 67,
+ 70, 3, 20, 10, 0, 68, 70, 3, 32, 16, 0, 69, 61, 1, 0, 0, 0, 69, 65, 1,
+ 0, 0, 0, 69, 66, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 68, 1, 0, 0, 0, 70,
+ 11, 1, 0, 0, 0, 71, 72, 3, 32, 16, 0, 72, 73, 5, 6, 0, 0, 73, 74, 3, 30,
+ 15, 0, 74, 148, 1, 0, 0, 0, 75, 76, 3, 32, 16, 0, 76, 77, 7, 0, 0, 0, 77,
+ 78, 3, 30, 15, 0, 78, 148, 1, 0, 0, 0, 79, 80, 3, 32, 16, 0, 80, 81, 5,
+ 9, 0, 0, 81, 82, 3, 30, 15, 0, 82, 148, 1, 0, 0, 0, 83, 84, 3, 32, 16,
+ 0, 84, 85, 5, 10, 0, 0, 85, 86, 3, 30, 15, 0, 86, 148, 1, 0, 0, 0, 87,
+ 88, 3, 32, 16, 0, 88, 89, 5, 11, 0, 0, 89, 90, 3, 30, 15, 0, 90, 148, 1,
+ 0, 0, 0, 91, 92, 3, 32, 16, 0, 92, 93, 5, 12, 0, 0, 93, 94, 3, 30, 15,
+ 0, 94, 148, 1, 0, 0, 0, 95, 96, 3, 32, 16, 0, 96, 97, 7, 1, 0, 0, 97, 98,
+ 3, 30, 15, 0, 98, 148, 1, 0, 0, 0, 99, 100, 3, 32, 16, 0, 100, 101, 7,
+ 2, 0, 0, 101, 102, 3, 30, 15, 0, 102, 148, 1, 0, 0, 0, 103, 104, 3, 32,
+ 16, 0, 104, 105, 5, 17, 0, 0, 105, 106, 3, 30, 15, 0, 106, 107, 5, 23,
+ 0, 0, 107, 108, 3, 30, 15, 0, 108, 148, 1, 0, 0, 0, 109, 110, 3, 32, 16,
+ 0, 110, 111, 5, 22, 0, 0, 111, 112, 5, 17, 0, 0, 112, 113, 3, 30, 15, 0,
+ 113, 114, 5, 23, 0, 0, 114, 115, 3, 30, 15, 0, 115, 148, 1, 0, 0, 0, 116,
+ 117, 3, 32, 16, 0, 117, 118, 3, 14, 7, 0, 118, 148, 1, 0, 0, 0, 119, 120,
+ 3, 32, 16, 0, 120, 121, 3, 16, 8, 0, 121, 148, 1, 0, 0, 0, 122, 123, 3,
+ 32, 16, 0, 123, 124, 5, 18, 0, 0, 124, 148, 1, 0, 0, 0, 125, 126, 3, 32,
+ 16, 0, 126, 127, 5, 22, 0, 0, 127, 128, 5, 18, 0, 0, 128, 148, 1, 0, 0,
+ 0, 129, 130, 3, 32, 16, 0, 130, 131, 5, 19, 0, 0, 131, 132, 3, 30, 15,
+ 0, 132, 148, 1, 0, 0, 0, 133, 134, 3, 32, 16, 0, 134, 135, 5, 22, 0, 0,
+ 135, 136, 5, 19, 0, 0, 136, 137, 3, 30, 15, 0, 137, 148, 1, 0, 0, 0, 138,
+ 139, 3, 32, 16, 0, 139, 140, 5, 20, 0, 0, 140, 141, 3, 30, 15, 0, 141,
+ 148, 1, 0, 0, 0, 142, 143, 3, 32, 16, 0, 143, 144, 5, 22, 0, 0, 144, 145,
+ 5, 20, 0, 0, 145, 146, 3, 30, 15, 0, 146, 148, 1, 0, 0, 0, 147, 71, 1,
+ 0, 0, 0, 147, 75, 1, 0, 0, 0, 147, 79, 1, 0, 0, 0, 147, 83, 1, 0, 0, 0,
+ 147, 87, 1, 0, 0, 0, 147, 91, 1, 0, 0, 0, 147, 95, 1, 0, 0, 0, 147, 99,
+ 1, 0, 0, 0, 147, 103, 1, 0, 0, 0, 147, 109, 1, 0, 0, 0, 147, 116, 1, 0,
+ 0, 0, 147, 119, 1, 0, 0, 0, 147, 122, 1, 0, 0, 0, 147, 125, 1, 0, 0, 0,
+ 147, 129, 1, 0, 0, 0, 147, 133, 1, 0, 0, 0, 147, 138, 1, 0, 0, 0, 147,
+ 142, 1, 0, 0, 0, 148, 13, 1, 0, 0, 0, 149, 150, 5, 21, 0, 0, 150, 151,
+ 5, 1, 0, 0, 151, 152, 3, 18, 9, 0, 152, 153, 5, 2, 0, 0, 153, 160, 1, 0,
+ 0, 0, 154, 155, 5, 21, 0, 0, 155, 156, 5, 3, 0, 0, 156, 157, 3, 18, 9,
+ 0, 157, 158, 5, 4, 0, 0, 158, 160, 1, 0, 0, 0, 159, 149, 1, 0, 0, 0, 159,
+ 154, 1, 0, 0, 0, 160, 15, 1, 0, 0, 0, 161, 162, 5, 22, 0, 0, 162, 163,
+ 5, 21, 0, 0, 163, 164, 5, 1, 0, 0, 164, 165, 3, 18, 9, 0, 165, 166, 5,
+ 2, 0, 0, 166, 174, 1, 0, 0, 0, 167, 168, 5, 22, 0, 0, 168, 169, 5, 21,
+ 0, 0, 169, 170, 5, 3, 0, 0, 170, 171, 3, 18, 9, 0, 171, 172, 5, 4, 0, 0,
+ 172, 174, 1, 0, 0, 0, 173, 161, 1, 0, 0, 0, 173, 167, 1, 0, 0, 0, 174,
+ 17, 1, 0, 0, 0, 175, 180, 3, 30, 15, 0, 176, 177, 5, 5, 0, 0, 177, 179,
+ 3, 30, 15, 0, 178, 176, 1, 0, 0, 0, 179, 182, 1, 0, 0, 0, 180, 178, 1,
+ 0, 0, 0, 180, 181, 1, 0, 0, 0, 181, 19, 1, 0, 0, 0, 182, 180, 1, 0, 0,
+ 0, 183, 184, 7, 3, 0, 0, 184, 21, 1, 0, 0, 0, 185, 186, 7, 4, 0, 0, 186,
+ 187, 5, 1, 0, 0, 187, 188, 3, 24, 12, 0, 188, 189, 5, 2, 0, 0, 189, 23,
+ 1, 0, 0, 0, 190, 195, 3, 26, 13, 0, 191, 192, 5, 5, 0, 0, 192, 194, 3,
+ 26, 13, 0, 193, 191, 1, 0, 0, 0, 194, 197, 1, 0, 0, 0, 195, 193, 1, 0,
+ 0, 0, 195, 196, 1, 0, 0, 0, 196, 25, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0,
+ 198, 202, 3, 32, 16, 0, 199, 202, 3, 30, 15, 0, 200, 202, 3, 28, 14, 0,
+ 201, 198, 1, 0, 0, 0, 201, 199, 1, 0, 0, 0, 201, 200, 1, 0, 0, 0, 202,
+ 27, 1, 0, 0, 0, 203, 204, 5, 3, 0, 0, 204, 205, 3, 18, 9, 0, 205, 206,
+ 5, 4, 0, 0, 206, 29, 1, 0, 0, 0, 207, 208, 7, 5, 0, 0, 208, 31, 1, 0, 0,
+ 0, 209, 210, 5, 32, 0, 0, 210, 33, 1, 0, 0, 0, 11, 44, 51, 53, 57, 69,
+ 147, 159, 173, 180, 195, 201,
+ }
+ 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)
+ }
+}
+
+// FilterQueryParserInit initializes any static state used to implement FilterQueryParser. By default the
+// static state used to implement the parser is lazily initialized during the first call to
+// NewFilterQueryParser(). You can call this function if you wish to initialize the static state ahead
+// of time.
+func FilterQueryParserInit() {
+ staticData := &FilterQueryParserStaticData
+ staticData.once.Do(filterqueryParserInit)
+}
+
+// NewFilterQueryParser produces a new parser instance for the optional input antlr.TokenStream.
+func NewFilterQueryParser(input antlr.TokenStream) *FilterQueryParser {
+ FilterQueryParserInit()
+ this := new(FilterQueryParser)
+ this.BaseParser = antlr.NewBaseParser(input)
+ staticData := &FilterQueryParserStaticData
+ 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 = "FilterQuery.g4"
+
+ return this
+}
+
+// FilterQueryParser tokens.
+const (
+ FilterQueryParserEOF = antlr.TokenEOF
+ FilterQueryParserLPAREN = 1
+ FilterQueryParserRPAREN = 2
+ FilterQueryParserLBRACK = 3
+ FilterQueryParserRBRACK = 4
+ FilterQueryParserCOMMA = 5
+ FilterQueryParserEQUALS = 6
+ FilterQueryParserNOT_EQUALS = 7
+ FilterQueryParserNEQ = 8
+ FilterQueryParserLT = 9
+ FilterQueryParserLE = 10
+ FilterQueryParserGT = 11
+ FilterQueryParserGE = 12
+ FilterQueryParserLIKE = 13
+ FilterQueryParserNOT_LIKE = 14
+ FilterQueryParserILIKE = 15
+ FilterQueryParserNOT_ILIKE = 16
+ FilterQueryParserBETWEEN = 17
+ FilterQueryParserEXISTS = 18
+ FilterQueryParserREGEXP = 19
+ FilterQueryParserCONTAINS = 20
+ FilterQueryParserIN = 21
+ FilterQueryParserNOT = 22
+ FilterQueryParserAND = 23
+ FilterQueryParserOR = 24
+ FilterQueryParserHAS = 25
+ FilterQueryParserHASANY = 26
+ FilterQueryParserHASALL = 27
+ FilterQueryParserHASNONE = 28
+ FilterQueryParserBOOL = 29
+ FilterQueryParserNUMBER = 30
+ FilterQueryParserQUOTED_TEXT = 31
+ FilterQueryParserKEY = 32
+ FilterQueryParserWS = 33
+ FilterQueryParserFREETEXT = 34
+)
+
+// FilterQueryParser rules.
+const (
+ FilterQueryParserRULE_query = 0
+ FilterQueryParserRULE_expression = 1
+ FilterQueryParserRULE_orExpression = 2
+ FilterQueryParserRULE_andExpression = 3
+ FilterQueryParserRULE_unaryExpression = 4
+ FilterQueryParserRULE_primary = 5
+ FilterQueryParserRULE_comparison = 6
+ FilterQueryParserRULE_inClause = 7
+ FilterQueryParserRULE_notInClause = 8
+ FilterQueryParserRULE_valueList = 9
+ FilterQueryParserRULE_fullText = 10
+ FilterQueryParserRULE_functionCall = 11
+ FilterQueryParserRULE_functionParamList = 12
+ FilterQueryParserRULE_functionParam = 13
+ FilterQueryParserRULE_array = 14
+ FilterQueryParserRULE_value = 15
+ FilterQueryParserRULE_key = 16
+)
+
+// IQueryContext is an interface to support dynamic dispatch.
+type IQueryContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ Expression() IExpressionContext
+ EOF() antlr.TerminalNode
+
+ // IsQueryContext differentiates from other interfaces.
+ IsQueryContext()
+}
+
+type QueryContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyQueryContext() *QueryContext {
+ var p = new(QueryContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_query
+ return p
+}
+
+func InitEmptyQueryContext(p *QueryContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_query
+}
+
+func (*QueryContext) IsQueryContext() {}
+
+func NewQueryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *QueryContext {
+ var p = new(QueryContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_query
+
+ return p
+}
+
+func (s *QueryContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *QueryContext) Expression() IExpressionContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IExpressionContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IExpressionContext)
+}
+
+func (s *QueryContext) EOF() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserEOF, 0)
+}
+
+func (s *QueryContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *QueryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *QueryContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterQuery(s)
+ }
+}
+
+func (s *QueryContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitQuery(s)
+ }
+}
+
+func (s *QueryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitQuery(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Query() (localctx IQueryContext) {
+ localctx = NewQueryContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 0, FilterQueryParserRULE_query)
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(34)
+ p.Expression()
+ }
+ {
+ p.SetState(35)
+ p.Match(FilterQueryParserEOF)
+ 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
+}
+
+// IExpressionContext is an interface to support dynamic dispatch.
+type IExpressionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ OrExpression() IOrExpressionContext
+
+ // IsExpressionContext differentiates from other interfaces.
+ IsExpressionContext()
+}
+
+type ExpressionContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyExpressionContext() *ExpressionContext {
+ var p = new(ExpressionContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_expression
+ return p
+}
+
+func InitEmptyExpressionContext(p *ExpressionContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_expression
+}
+
+func (*ExpressionContext) IsExpressionContext() {}
+
+func NewExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExpressionContext {
+ var p = new(ExpressionContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_expression
+
+ return p
+}
+
+func (s *ExpressionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ExpressionContext) OrExpression() IOrExpressionContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IOrExpressionContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IOrExpressionContext)
+}
+
+func (s *ExpressionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ExpressionContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterExpression(s)
+ }
+}
+
+func (s *ExpressionContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitExpression(s)
+ }
+}
+
+func (s *ExpressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitExpression(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Expression() (localctx IExpressionContext) {
+ localctx = NewExpressionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 2, FilterQueryParserRULE_expression)
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(37)
+ p.OrExpression()
+ }
+
+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
+}
+
+// IOrExpressionContext is an interface to support dynamic dispatch.
+type IOrExpressionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ AllAndExpression() []IAndExpressionContext
+ AndExpression(i int) IAndExpressionContext
+ AllOR() []antlr.TerminalNode
+ OR(i int) antlr.TerminalNode
+
+ // IsOrExpressionContext differentiates from other interfaces.
+ IsOrExpressionContext()
+}
+
+type OrExpressionContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyOrExpressionContext() *OrExpressionContext {
+ var p = new(OrExpressionContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_orExpression
+ return p
+}
+
+func InitEmptyOrExpressionContext(p *OrExpressionContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_orExpression
+}
+
+func (*OrExpressionContext) IsOrExpressionContext() {}
+
+func NewOrExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *OrExpressionContext {
+ var p = new(OrExpressionContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_orExpression
+
+ return p
+}
+
+func (s *OrExpressionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *OrExpressionContext) AllAndExpression() []IAndExpressionContext {
+ children := s.GetChildren()
+ len := 0
+ for _, ctx := range children {
+ if _, ok := ctx.(IAndExpressionContext); ok {
+ len++
+ }
+ }
+
+ tst := make([]IAndExpressionContext, len)
+ i := 0
+ for _, ctx := range children {
+ if t, ok := ctx.(IAndExpressionContext); ok {
+ tst[i] = t.(IAndExpressionContext)
+ i++
+ }
+ }
+
+ return tst
+}
+
+func (s *OrExpressionContext) AndExpression(i int) IAndExpressionContext {
+ var t antlr.RuleContext
+ j := 0
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IAndExpressionContext); ok {
+ if j == i {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ j++
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IAndExpressionContext)
+}
+
+func (s *OrExpressionContext) AllOR() []antlr.TerminalNode {
+ return s.GetTokens(FilterQueryParserOR)
+}
+
+func (s *OrExpressionContext) OR(i int) antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserOR, i)
+}
+
+func (s *OrExpressionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *OrExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *OrExpressionContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterOrExpression(s)
+ }
+}
+
+func (s *OrExpressionContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitOrExpression(s)
+ }
+}
+
+func (s *OrExpressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitOrExpression(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) OrExpression() (localctx IOrExpressionContext) {
+ localctx = NewOrExpressionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 4, FilterQueryParserRULE_orExpression)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(39)
+ p.AndExpression()
+ }
+ p.SetState(44)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == FilterQueryParserOR {
+ {
+ p.SetState(40)
+ p.Match(FilterQueryParserOR)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(41)
+ p.AndExpression()
+ }
+
+ p.SetState(46)
+ 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
+}
+
+// IAndExpressionContext is an interface to support dynamic dispatch.
+type IAndExpressionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ AllUnaryExpression() []IUnaryExpressionContext
+ UnaryExpression(i int) IUnaryExpressionContext
+ AllAND() []antlr.TerminalNode
+ AND(i int) antlr.TerminalNode
+
+ // IsAndExpressionContext differentiates from other interfaces.
+ IsAndExpressionContext()
+}
+
+type AndExpressionContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyAndExpressionContext() *AndExpressionContext {
+ var p = new(AndExpressionContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_andExpression
+ return p
+}
+
+func InitEmptyAndExpressionContext(p *AndExpressionContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_andExpression
+}
+
+func (*AndExpressionContext) IsAndExpressionContext() {}
+
+func NewAndExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AndExpressionContext {
+ var p = new(AndExpressionContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_andExpression
+
+ return p
+}
+
+func (s *AndExpressionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *AndExpressionContext) AllUnaryExpression() []IUnaryExpressionContext {
+ children := s.GetChildren()
+ len := 0
+ for _, ctx := range children {
+ if _, ok := ctx.(IUnaryExpressionContext); ok {
+ len++
+ }
+ }
+
+ tst := make([]IUnaryExpressionContext, len)
+ i := 0
+ for _, ctx := range children {
+ if t, ok := ctx.(IUnaryExpressionContext); ok {
+ tst[i] = t.(IUnaryExpressionContext)
+ i++
+ }
+ }
+
+ return tst
+}
+
+func (s *AndExpressionContext) UnaryExpression(i int) IUnaryExpressionContext {
+ var t antlr.RuleContext
+ j := 0
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IUnaryExpressionContext); ok {
+ if j == i {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ j++
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IUnaryExpressionContext)
+}
+
+func (s *AndExpressionContext) AllAND() []antlr.TerminalNode {
+ return s.GetTokens(FilterQueryParserAND)
+}
+
+func (s *AndExpressionContext) AND(i int) antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserAND, i)
+}
+
+func (s *AndExpressionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *AndExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *AndExpressionContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterAndExpression(s)
+ }
+}
+
+func (s *AndExpressionContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitAndExpression(s)
+ }
+}
+
+func (s *AndExpressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitAndExpression(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) AndExpression() (localctx IAndExpressionContext) {
+ localctx = NewAndExpressionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 6, FilterQueryParserRULE_andExpression)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(47)
+ p.UnaryExpression()
+ }
+ p.SetState(53)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+ _la = p.GetTokenStream().LA(1)
+
+ for (int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&24138219522) != 0 {
+ p.SetState(51)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetTokenStream().LA(1) {
+ case FilterQueryParserAND:
+ {
+ p.SetState(48)
+ p.Match(FilterQueryParserAND)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(49)
+ p.UnaryExpression()
+ }
+
+ case FilterQueryParserLPAREN, FilterQueryParserNOT, FilterQueryParserHAS, FilterQueryParserHASANY, FilterQueryParserHASALL, FilterQueryParserHASNONE, FilterQueryParserQUOTED_TEXT, FilterQueryParserKEY, FilterQueryParserFREETEXT:
+ {
+ p.SetState(50)
+ p.UnaryExpression()
+ }
+
+ default:
+ p.SetError(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
+ goto errorExit
+ }
+
+ p.SetState(55)
+ 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
+}
+
+// IUnaryExpressionContext is an interface to support dynamic dispatch.
+type IUnaryExpressionContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ Primary() IPrimaryContext
+ NOT() antlr.TerminalNode
+
+ // IsUnaryExpressionContext differentiates from other interfaces.
+ IsUnaryExpressionContext()
+}
+
+type UnaryExpressionContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyUnaryExpressionContext() *UnaryExpressionContext {
+ var p = new(UnaryExpressionContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_unaryExpression
+ return p
+}
+
+func InitEmptyUnaryExpressionContext(p *UnaryExpressionContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_unaryExpression
+}
+
+func (*UnaryExpressionContext) IsUnaryExpressionContext() {}
+
+func NewUnaryExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *UnaryExpressionContext {
+ var p = new(UnaryExpressionContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_unaryExpression
+
+ return p
+}
+
+func (s *UnaryExpressionContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *UnaryExpressionContext) Primary() IPrimaryContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IPrimaryContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IPrimaryContext)
+}
+
+func (s *UnaryExpressionContext) NOT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT, 0)
+}
+
+func (s *UnaryExpressionContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *UnaryExpressionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *UnaryExpressionContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterUnaryExpression(s)
+ }
+}
+
+func (s *UnaryExpressionContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitUnaryExpression(s)
+ }
+}
+
+func (s *UnaryExpressionContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitUnaryExpression(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) UnaryExpression() (localctx IUnaryExpressionContext) {
+ localctx = NewUnaryExpressionContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 8, FilterQueryParserRULE_unaryExpression)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ p.SetState(57)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+ _la = p.GetTokenStream().LA(1)
+
+ if _la == FilterQueryParserNOT {
+ {
+ p.SetState(56)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ }
+ {
+ p.SetState(59)
+ p.Primary()
+ }
+
+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
+}
+
+// IPrimaryContext is an interface to support dynamic dispatch.
+type IPrimaryContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ LPAREN() antlr.TerminalNode
+ OrExpression() IOrExpressionContext
+ RPAREN() antlr.TerminalNode
+ Comparison() IComparisonContext
+ FunctionCall() IFunctionCallContext
+ FullText() IFullTextContext
+ Key() IKeyContext
+
+ // IsPrimaryContext differentiates from other interfaces.
+ IsPrimaryContext()
+}
+
+type PrimaryContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyPrimaryContext() *PrimaryContext {
+ var p = new(PrimaryContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_primary
+ return p
+}
+
+func InitEmptyPrimaryContext(p *PrimaryContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_primary
+}
+
+func (*PrimaryContext) IsPrimaryContext() {}
+
+func NewPrimaryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PrimaryContext {
+ var p = new(PrimaryContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_primary
+
+ return p
+}
+
+func (s *PrimaryContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *PrimaryContext) LPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLPAREN, 0)
+}
+
+func (s *PrimaryContext) OrExpression() IOrExpressionContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IOrExpressionContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IOrExpressionContext)
+}
+
+func (s *PrimaryContext) RPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRPAREN, 0)
+}
+
+func (s *PrimaryContext) Comparison() IComparisonContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IComparisonContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IComparisonContext)
+}
+
+func (s *PrimaryContext) FunctionCall() IFunctionCallContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IFunctionCallContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IFunctionCallContext)
+}
+
+func (s *PrimaryContext) FullText() IFullTextContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IFullTextContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IFullTextContext)
+}
+
+func (s *PrimaryContext) Key() IKeyContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IKeyContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IKeyContext)
+}
+
+func (s *PrimaryContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *PrimaryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *PrimaryContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterPrimary(s)
+ }
+}
+
+func (s *PrimaryContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitPrimary(s)
+ }
+}
+
+func (s *PrimaryContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitPrimary(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Primary() (localctx IPrimaryContext) {
+ localctx = NewPrimaryContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 10, FilterQueryParserRULE_primary)
+ p.SetState(69)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) {
+ case 1:
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(61)
+ p.Match(FilterQueryParserLPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(62)
+ p.OrExpression()
+ }
+ {
+ p.SetState(63)
+ p.Match(FilterQueryParserRPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case 2:
+ p.EnterOuterAlt(localctx, 2)
+ {
+ p.SetState(65)
+ p.Comparison()
+ }
+
+ case 3:
+ p.EnterOuterAlt(localctx, 3)
+ {
+ p.SetState(66)
+ p.FunctionCall()
+ }
+
+ case 4:
+ p.EnterOuterAlt(localctx, 4)
+ {
+ p.SetState(67)
+ p.FullText()
+ }
+
+ case 5:
+ p.EnterOuterAlt(localctx, 5)
+ {
+ p.SetState(68)
+ p.Key()
+ }
+
+ case antlr.ATNInvalidAltNumber:
+ goto errorExit
+ }
+
+errorExit:
+ if p.HasError() {
+ v := p.GetError()
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ p.SetError(nil)
+ }
+ p.ExitRule()
+ return localctx
+ goto errorExit // Trick to prevent compiler error if the label is not used
+}
+
+// IComparisonContext is an interface to support dynamic dispatch.
+type IComparisonContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ Key() IKeyContext
+ EQUALS() antlr.TerminalNode
+ AllValue() []IValueContext
+ Value(i int) IValueContext
+ NOT_EQUALS() antlr.TerminalNode
+ NEQ() antlr.TerminalNode
+ LT() antlr.TerminalNode
+ LE() antlr.TerminalNode
+ GT() antlr.TerminalNode
+ GE() antlr.TerminalNode
+ LIKE() antlr.TerminalNode
+ ILIKE() antlr.TerminalNode
+ NOT_LIKE() antlr.TerminalNode
+ NOT_ILIKE() antlr.TerminalNode
+ BETWEEN() antlr.TerminalNode
+ AND() antlr.TerminalNode
+ NOT() antlr.TerminalNode
+ InClause() IInClauseContext
+ NotInClause() INotInClauseContext
+ EXISTS() antlr.TerminalNode
+ REGEXP() antlr.TerminalNode
+ CONTAINS() antlr.TerminalNode
+
+ // IsComparisonContext differentiates from other interfaces.
+ IsComparisonContext()
+}
+
+type ComparisonContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyComparisonContext() *ComparisonContext {
+ var p = new(ComparisonContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_comparison
+ return p
+}
+
+func InitEmptyComparisonContext(p *ComparisonContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_comparison
+}
+
+func (*ComparisonContext) IsComparisonContext() {}
+
+func NewComparisonContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ComparisonContext {
+ var p = new(ComparisonContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_comparison
+
+ return p
+}
+
+func (s *ComparisonContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ComparisonContext) Key() IKeyContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IKeyContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IKeyContext)
+}
+
+func (s *ComparisonContext) EQUALS() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserEQUALS, 0)
+}
+
+func (s *ComparisonContext) AllValue() []IValueContext {
+ children := s.GetChildren()
+ len := 0
+ for _, ctx := range children {
+ if _, ok := ctx.(IValueContext); ok {
+ len++
+ }
+ }
+
+ tst := make([]IValueContext, len)
+ i := 0
+ for _, ctx := range children {
+ if t, ok := ctx.(IValueContext); ok {
+ tst[i] = t.(IValueContext)
+ i++
+ }
+ }
+
+ return tst
+}
+
+func (s *ComparisonContext) Value(i int) IValueContext {
+ var t antlr.RuleContext
+ j := 0
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueContext); ok {
+ if j == i {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ j++
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueContext)
+}
+
+func (s *ComparisonContext) NOT_EQUALS() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT_EQUALS, 0)
+}
+
+func (s *ComparisonContext) NEQ() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNEQ, 0)
+}
+
+func (s *ComparisonContext) LT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLT, 0)
+}
+
+func (s *ComparisonContext) LE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLE, 0)
+}
+
+func (s *ComparisonContext) GT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserGT, 0)
+}
+
+func (s *ComparisonContext) GE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserGE, 0)
+}
+
+func (s *ComparisonContext) LIKE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLIKE, 0)
+}
+
+func (s *ComparisonContext) ILIKE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserILIKE, 0)
+}
+
+func (s *ComparisonContext) NOT_LIKE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT_LIKE, 0)
+}
+
+func (s *ComparisonContext) NOT_ILIKE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT_ILIKE, 0)
+}
+
+func (s *ComparisonContext) BETWEEN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserBETWEEN, 0)
+}
+
+func (s *ComparisonContext) AND() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserAND, 0)
+}
+
+func (s *ComparisonContext) NOT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT, 0)
+}
+
+func (s *ComparisonContext) InClause() IInClauseContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IInClauseContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IInClauseContext)
+}
+
+func (s *ComparisonContext) NotInClause() INotInClauseContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(INotInClauseContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(INotInClauseContext)
+}
+
+func (s *ComparisonContext) EXISTS() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserEXISTS, 0)
+}
+
+func (s *ComparisonContext) REGEXP() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserREGEXP, 0)
+}
+
+func (s *ComparisonContext) CONTAINS() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserCONTAINS, 0)
+}
+
+func (s *ComparisonContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ComparisonContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ComparisonContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterComparison(s)
+ }
+}
+
+func (s *ComparisonContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitComparison(s)
+ }
+}
+
+func (s *ComparisonContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitComparison(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Comparison() (localctx IComparisonContext) {
+ localctx = NewComparisonContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 12, FilterQueryParserRULE_comparison)
+ var _la int
+
+ p.SetState(147)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) {
+ case 1:
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(71)
+ p.Key()
+ }
+ {
+ p.SetState(72)
+ p.Match(FilterQueryParserEQUALS)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(73)
+ p.Value()
+ }
+
+ case 2:
+ p.EnterOuterAlt(localctx, 2)
+ {
+ p.SetState(75)
+ p.Key()
+ }
+ {
+ p.SetState(76)
+ _la = p.GetTokenStream().LA(1)
+
+ if !(_la == FilterQueryParserNOT_EQUALS || _la == FilterQueryParserNEQ) {
+ p.GetErrorHandler().RecoverInline(p)
+ } else {
+ p.GetErrorHandler().ReportMatch(p)
+ p.Consume()
+ }
+ }
+ {
+ p.SetState(77)
+ p.Value()
+ }
+
+ case 3:
+ p.EnterOuterAlt(localctx, 3)
+ {
+ p.SetState(79)
+ p.Key()
+ }
+ {
+ p.SetState(80)
+ p.Match(FilterQueryParserLT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(81)
+ p.Value()
+ }
+
+ case 4:
+ p.EnterOuterAlt(localctx, 4)
+ {
+ p.SetState(83)
+ p.Key()
+ }
+ {
+ p.SetState(84)
+ p.Match(FilterQueryParserLE)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(85)
+ p.Value()
+ }
+
+ case 5:
+ p.EnterOuterAlt(localctx, 5)
+ {
+ p.SetState(87)
+ p.Key()
+ }
+ {
+ p.SetState(88)
+ p.Match(FilterQueryParserGT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(89)
+ p.Value()
+ }
+
+ case 6:
+ p.EnterOuterAlt(localctx, 6)
+ {
+ p.SetState(91)
+ p.Key()
+ }
+ {
+ p.SetState(92)
+ p.Match(FilterQueryParserGE)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(93)
+ p.Value()
+ }
+
+ case 7:
+ p.EnterOuterAlt(localctx, 7)
+ {
+ p.SetState(95)
+ p.Key()
+ }
+ {
+ p.SetState(96)
+ _la = p.GetTokenStream().LA(1)
+
+ if !(_la == FilterQueryParserLIKE || _la == FilterQueryParserILIKE) {
+ p.GetErrorHandler().RecoverInline(p)
+ } else {
+ p.GetErrorHandler().ReportMatch(p)
+ p.Consume()
+ }
+ }
+ {
+ p.SetState(97)
+ p.Value()
+ }
+
+ case 8:
+ p.EnterOuterAlt(localctx, 8)
+ {
+ p.SetState(99)
+ p.Key()
+ }
+ {
+ p.SetState(100)
+ _la = p.GetTokenStream().LA(1)
+
+ if !(_la == FilterQueryParserNOT_LIKE || _la == FilterQueryParserNOT_ILIKE) {
+ p.GetErrorHandler().RecoverInline(p)
+ } else {
+ p.GetErrorHandler().ReportMatch(p)
+ p.Consume()
+ }
+ }
+ {
+ p.SetState(101)
+ p.Value()
+ }
+
+ case 9:
+ p.EnterOuterAlt(localctx, 9)
+ {
+ p.SetState(103)
+ p.Key()
+ }
+ {
+ p.SetState(104)
+ p.Match(FilterQueryParserBETWEEN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(105)
+ p.Value()
+ }
+ {
+ p.SetState(106)
+ p.Match(FilterQueryParserAND)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(107)
+ p.Value()
+ }
+
+ case 10:
+ p.EnterOuterAlt(localctx, 10)
+ {
+ p.SetState(109)
+ p.Key()
+ }
+ {
+ p.SetState(110)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(111)
+ p.Match(FilterQueryParserBETWEEN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(112)
+ p.Value()
+ }
+ {
+ p.SetState(113)
+ p.Match(FilterQueryParserAND)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(114)
+ p.Value()
+ }
+
+ case 11:
+ p.EnterOuterAlt(localctx, 11)
+ {
+ p.SetState(116)
+ p.Key()
+ }
+ {
+ p.SetState(117)
+ p.InClause()
+ }
+
+ case 12:
+ p.EnterOuterAlt(localctx, 12)
+ {
+ p.SetState(119)
+ p.Key()
+ }
+ {
+ p.SetState(120)
+ p.NotInClause()
+ }
+
+ case 13:
+ p.EnterOuterAlt(localctx, 13)
+ {
+ p.SetState(122)
+ p.Key()
+ }
+ {
+ p.SetState(123)
+ p.Match(FilterQueryParserEXISTS)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case 14:
+ p.EnterOuterAlt(localctx, 14)
+ {
+ p.SetState(125)
+ p.Key()
+ }
+ {
+ p.SetState(126)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(127)
+ p.Match(FilterQueryParserEXISTS)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case 15:
+ p.EnterOuterAlt(localctx, 15)
+ {
+ p.SetState(129)
+ p.Key()
+ }
+ {
+ p.SetState(130)
+ p.Match(FilterQueryParserREGEXP)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(131)
+ p.Value()
+ }
+
+ case 16:
+ p.EnterOuterAlt(localctx, 16)
+ {
+ p.SetState(133)
+ p.Key()
+ }
+ {
+ p.SetState(134)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(135)
+ p.Match(FilterQueryParserREGEXP)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(136)
+ p.Value()
+ }
+
+ case 17:
+ p.EnterOuterAlt(localctx, 17)
+ {
+ p.SetState(138)
+ p.Key()
+ }
+ {
+ p.SetState(139)
+ p.Match(FilterQueryParserCONTAINS)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(140)
+ p.Value()
+ }
+
+ case 18:
+ p.EnterOuterAlt(localctx, 18)
+ {
+ p.SetState(142)
+ p.Key()
+ }
+ {
+ p.SetState(143)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(144)
+ p.Match(FilterQueryParserCONTAINS)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(145)
+ p.Value()
+ }
+
+ case antlr.ATNInvalidAltNumber:
+ goto errorExit
+ }
+
+errorExit:
+ if p.HasError() {
+ v := p.GetError()
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ p.SetError(nil)
+ }
+ p.ExitRule()
+ return localctx
+ goto errorExit // Trick to prevent compiler error if the label is not used
+}
+
+// IInClauseContext is an interface to support dynamic dispatch.
+type IInClauseContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ IN() antlr.TerminalNode
+ LPAREN() antlr.TerminalNode
+ ValueList() IValueListContext
+ RPAREN() antlr.TerminalNode
+ LBRACK() antlr.TerminalNode
+ RBRACK() antlr.TerminalNode
+
+ // IsInClauseContext differentiates from other interfaces.
+ IsInClauseContext()
+}
+
+type InClauseContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyInClauseContext() *InClauseContext {
+ var p = new(InClauseContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_inClause
+ return p
+}
+
+func InitEmptyInClauseContext(p *InClauseContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_inClause
+}
+
+func (*InClauseContext) IsInClauseContext() {}
+
+func NewInClauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *InClauseContext {
+ var p = new(InClauseContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_inClause
+
+ return p
+}
+
+func (s *InClauseContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *InClauseContext) IN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserIN, 0)
+}
+
+func (s *InClauseContext) LPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLPAREN, 0)
+}
+
+func (s *InClauseContext) ValueList() IValueListContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueListContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueListContext)
+}
+
+func (s *InClauseContext) RPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRPAREN, 0)
+}
+
+func (s *InClauseContext) LBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLBRACK, 0)
+}
+
+func (s *InClauseContext) RBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRBRACK, 0)
+}
+
+func (s *InClauseContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *InClauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *InClauseContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterInClause(s)
+ }
+}
+
+func (s *InClauseContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitInClause(s)
+ }
+}
+
+func (s *InClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitInClause(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) InClause() (localctx IInClauseContext) {
+ localctx = NewInClauseContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 14, FilterQueryParserRULE_inClause)
+ p.SetState(159)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 6, p.GetParserRuleContext()) {
+ case 1:
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(149)
+ p.Match(FilterQueryParserIN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(150)
+ p.Match(FilterQueryParserLPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(151)
+ p.ValueList()
+ }
+ {
+ p.SetState(152)
+ p.Match(FilterQueryParserRPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case 2:
+ p.EnterOuterAlt(localctx, 2)
+ {
+ p.SetState(154)
+ p.Match(FilterQueryParserIN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(155)
+ p.Match(FilterQueryParserLBRACK)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(156)
+ p.ValueList()
+ }
+ {
+ p.SetState(157)
+ p.Match(FilterQueryParserRBRACK)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case antlr.ATNInvalidAltNumber:
+ goto errorExit
+ }
+
+errorExit:
+ if p.HasError() {
+ v := p.GetError()
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ p.SetError(nil)
+ }
+ p.ExitRule()
+ return localctx
+ goto errorExit // Trick to prevent compiler error if the label is not used
+}
+
+// INotInClauseContext is an interface to support dynamic dispatch.
+type INotInClauseContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ NOT() antlr.TerminalNode
+ IN() antlr.TerminalNode
+ LPAREN() antlr.TerminalNode
+ ValueList() IValueListContext
+ RPAREN() antlr.TerminalNode
+ LBRACK() antlr.TerminalNode
+ RBRACK() antlr.TerminalNode
+
+ // IsNotInClauseContext differentiates from other interfaces.
+ IsNotInClauseContext()
+}
+
+type NotInClauseContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyNotInClauseContext() *NotInClauseContext {
+ var p = new(NotInClauseContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_notInClause
+ return p
+}
+
+func InitEmptyNotInClauseContext(p *NotInClauseContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_notInClause
+}
+
+func (*NotInClauseContext) IsNotInClauseContext() {}
+
+func NewNotInClauseContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *NotInClauseContext {
+ var p = new(NotInClauseContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_notInClause
+
+ return p
+}
+
+func (s *NotInClauseContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *NotInClauseContext) NOT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNOT, 0)
+}
+
+func (s *NotInClauseContext) IN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserIN, 0)
+}
+
+func (s *NotInClauseContext) LPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLPAREN, 0)
+}
+
+func (s *NotInClauseContext) ValueList() IValueListContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueListContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueListContext)
+}
+
+func (s *NotInClauseContext) RPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRPAREN, 0)
+}
+
+func (s *NotInClauseContext) LBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLBRACK, 0)
+}
+
+func (s *NotInClauseContext) RBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRBRACK, 0)
+}
+
+func (s *NotInClauseContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *NotInClauseContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *NotInClauseContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterNotInClause(s)
+ }
+}
+
+func (s *NotInClauseContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitNotInClause(s)
+ }
+}
+
+func (s *NotInClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitNotInClause(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) NotInClause() (localctx INotInClauseContext) {
+ localctx = NewNotInClauseContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 16, FilterQueryParserRULE_notInClause)
+ p.SetState(173)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 7, p.GetParserRuleContext()) {
+ case 1:
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(161)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(162)
+ p.Match(FilterQueryParserIN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(163)
+ p.Match(FilterQueryParserLPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(164)
+ p.ValueList()
+ }
+ {
+ p.SetState(165)
+ p.Match(FilterQueryParserRPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case 2:
+ p.EnterOuterAlt(localctx, 2)
+ {
+ p.SetState(167)
+ p.Match(FilterQueryParserNOT)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(168)
+ p.Match(FilterQueryParserIN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(169)
+ p.Match(FilterQueryParserLBRACK)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(170)
+ p.ValueList()
+ }
+ {
+ p.SetState(171)
+ p.Match(FilterQueryParserRBRACK)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+
+ case antlr.ATNInvalidAltNumber:
+ goto errorExit
+ }
+
+errorExit:
+ if p.HasError() {
+ v := p.GetError()
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ p.SetError(nil)
+ }
+ p.ExitRule()
+ return localctx
+ goto errorExit // Trick to prevent compiler error if the label is not used
+}
+
+// IValueListContext is an interface to support dynamic dispatch.
+type IValueListContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ AllValue() []IValueContext
+ Value(i int) IValueContext
+ AllCOMMA() []antlr.TerminalNode
+ COMMA(i int) antlr.TerminalNode
+
+ // IsValueListContext differentiates from other interfaces.
+ IsValueListContext()
+}
+
+type ValueListContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyValueListContext() *ValueListContext {
+ var p = new(ValueListContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_valueList
+ return p
+}
+
+func InitEmptyValueListContext(p *ValueListContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_valueList
+}
+
+func (*ValueListContext) IsValueListContext() {}
+
+func NewValueListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueListContext {
+ var p = new(ValueListContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_valueList
+
+ return p
+}
+
+func (s *ValueListContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ValueListContext) AllValue() []IValueContext {
+ children := s.GetChildren()
+ len := 0
+ for _, ctx := range children {
+ if _, ok := ctx.(IValueContext); ok {
+ len++
+ }
+ }
+
+ tst := make([]IValueContext, len)
+ i := 0
+ for _, ctx := range children {
+ if t, ok := ctx.(IValueContext); ok {
+ tst[i] = t.(IValueContext)
+ i++
+ }
+ }
+
+ return tst
+}
+
+func (s *ValueListContext) Value(i int) IValueContext {
+ var t antlr.RuleContext
+ j := 0
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueContext); ok {
+ if j == i {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ j++
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueContext)
+}
+
+func (s *ValueListContext) AllCOMMA() []antlr.TerminalNode {
+ return s.GetTokens(FilterQueryParserCOMMA)
+}
+
+func (s *ValueListContext) COMMA(i int) antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserCOMMA, i)
+}
+
+func (s *ValueListContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ValueListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ValueListContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterValueList(s)
+ }
+}
+
+func (s *ValueListContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitValueList(s)
+ }
+}
+
+func (s *ValueListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitValueList(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) ValueList() (localctx IValueListContext) {
+ localctx = NewValueListContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 18, FilterQueryParserRULE_valueList)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(175)
+ p.Value()
+ }
+ p.SetState(180)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == FilterQueryParserCOMMA {
+ {
+ p.SetState(176)
+ p.Match(FilterQueryParserCOMMA)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(177)
+ p.Value()
+ }
+
+ p.SetState(182)
+ 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
+}
+
+// IFullTextContext is an interface to support dynamic dispatch.
+type IFullTextContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ QUOTED_TEXT() antlr.TerminalNode
+ FREETEXT() antlr.TerminalNode
+
+ // IsFullTextContext differentiates from other interfaces.
+ IsFullTextContext()
+}
+
+type FullTextContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyFullTextContext() *FullTextContext {
+ var p = new(FullTextContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_fullText
+ return p
+}
+
+func InitEmptyFullTextContext(p *FullTextContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_fullText
+}
+
+func (*FullTextContext) IsFullTextContext() {}
+
+func NewFullTextContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FullTextContext {
+ var p = new(FullTextContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_fullText
+
+ return p
+}
+
+func (s *FullTextContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *FullTextContext) QUOTED_TEXT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserQUOTED_TEXT, 0)
+}
+
+func (s *FullTextContext) FREETEXT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserFREETEXT, 0)
+}
+
+func (s *FullTextContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *FullTextContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *FullTextContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterFullText(s)
+ }
+}
+
+func (s *FullTextContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitFullText(s)
+ }
+}
+
+func (s *FullTextContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitFullText(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) FullText() (localctx IFullTextContext) {
+ localctx = NewFullTextContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 20, FilterQueryParserRULE_fullText)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(183)
+ _la = p.GetTokenStream().LA(1)
+
+ if !(_la == FilterQueryParserQUOTED_TEXT || _la == FilterQueryParserFREETEXT) {
+ 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
+}
+
+// IFunctionCallContext is an interface to support dynamic dispatch.
+type IFunctionCallContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ LPAREN() antlr.TerminalNode
+ FunctionParamList() IFunctionParamListContext
+ RPAREN() antlr.TerminalNode
+ HAS() antlr.TerminalNode
+ HASANY() antlr.TerminalNode
+ HASALL() antlr.TerminalNode
+ HASNONE() antlr.TerminalNode
+
+ // IsFunctionCallContext differentiates from other interfaces.
+ IsFunctionCallContext()
+}
+
+type FunctionCallContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyFunctionCallContext() *FunctionCallContext {
+ var p = new(FunctionCallContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionCall
+ return p
+}
+
+func InitEmptyFunctionCallContext(p *FunctionCallContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionCall
+}
+
+func (*FunctionCallContext) IsFunctionCallContext() {}
+
+func NewFunctionCallContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FunctionCallContext {
+ var p = new(FunctionCallContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_functionCall
+
+ return p
+}
+
+func (s *FunctionCallContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *FunctionCallContext) LPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLPAREN, 0)
+}
+
+func (s *FunctionCallContext) FunctionParamList() IFunctionParamListContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IFunctionParamListContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IFunctionParamListContext)
+}
+
+func (s *FunctionCallContext) RPAREN() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRPAREN, 0)
+}
+
+func (s *FunctionCallContext) HAS() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserHAS, 0)
+}
+
+func (s *FunctionCallContext) HASANY() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserHASANY, 0)
+}
+
+func (s *FunctionCallContext) HASALL() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserHASALL, 0)
+}
+
+func (s *FunctionCallContext) HASNONE() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserHASNONE, 0)
+}
+
+func (s *FunctionCallContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *FunctionCallContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *FunctionCallContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterFunctionCall(s)
+ }
+}
+
+func (s *FunctionCallContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitFunctionCall(s)
+ }
+}
+
+func (s *FunctionCallContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitFunctionCall(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) FunctionCall() (localctx IFunctionCallContext) {
+ localctx = NewFunctionCallContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 22, FilterQueryParserRULE_functionCall)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(185)
+ _la = p.GetTokenStream().LA(1)
+
+ if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&503316480) != 0) {
+ p.GetErrorHandler().RecoverInline(p)
+ } else {
+ p.GetErrorHandler().ReportMatch(p)
+ p.Consume()
+ }
+ }
+ {
+ p.SetState(186)
+ p.Match(FilterQueryParserLPAREN)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(187)
+ p.FunctionParamList()
+ }
+ {
+ p.SetState(188)
+ p.Match(FilterQueryParserRPAREN)
+ 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
+}
+
+// IFunctionParamListContext is an interface to support dynamic dispatch.
+type IFunctionParamListContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ AllFunctionParam() []IFunctionParamContext
+ FunctionParam(i int) IFunctionParamContext
+ AllCOMMA() []antlr.TerminalNode
+ COMMA(i int) antlr.TerminalNode
+
+ // IsFunctionParamListContext differentiates from other interfaces.
+ IsFunctionParamListContext()
+}
+
+type FunctionParamListContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyFunctionParamListContext() *FunctionParamListContext {
+ var p = new(FunctionParamListContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionParamList
+ return p
+}
+
+func InitEmptyFunctionParamListContext(p *FunctionParamListContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionParamList
+}
+
+func (*FunctionParamListContext) IsFunctionParamListContext() {}
+
+func NewFunctionParamListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FunctionParamListContext {
+ var p = new(FunctionParamListContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_functionParamList
+
+ return p
+}
+
+func (s *FunctionParamListContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *FunctionParamListContext) AllFunctionParam() []IFunctionParamContext {
+ children := s.GetChildren()
+ len := 0
+ for _, ctx := range children {
+ if _, ok := ctx.(IFunctionParamContext); ok {
+ len++
+ }
+ }
+
+ tst := make([]IFunctionParamContext, len)
+ i := 0
+ for _, ctx := range children {
+ if t, ok := ctx.(IFunctionParamContext); ok {
+ tst[i] = t.(IFunctionParamContext)
+ i++
+ }
+ }
+
+ return tst
+}
+
+func (s *FunctionParamListContext) FunctionParam(i int) IFunctionParamContext {
+ var t antlr.RuleContext
+ j := 0
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IFunctionParamContext); ok {
+ if j == i {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ j++
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IFunctionParamContext)
+}
+
+func (s *FunctionParamListContext) AllCOMMA() []antlr.TerminalNode {
+ return s.GetTokens(FilterQueryParserCOMMA)
+}
+
+func (s *FunctionParamListContext) COMMA(i int) antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserCOMMA, i)
+}
+
+func (s *FunctionParamListContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *FunctionParamListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *FunctionParamListContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterFunctionParamList(s)
+ }
+}
+
+func (s *FunctionParamListContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitFunctionParamList(s)
+ }
+}
+
+func (s *FunctionParamListContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitFunctionParamList(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) FunctionParamList() (localctx IFunctionParamListContext) {
+ localctx = NewFunctionParamListContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 24, FilterQueryParserRULE_functionParamList)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(190)
+ p.FunctionParam()
+ }
+ p.SetState(195)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+ _la = p.GetTokenStream().LA(1)
+
+ for _la == FilterQueryParserCOMMA {
+ {
+ p.SetState(191)
+ p.Match(FilterQueryParserCOMMA)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(192)
+ p.FunctionParam()
+ }
+
+ p.SetState(197)
+ 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
+}
+
+// IFunctionParamContext is an interface to support dynamic dispatch.
+type IFunctionParamContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ Key() IKeyContext
+ Value() IValueContext
+ Array() IArrayContext
+
+ // IsFunctionParamContext differentiates from other interfaces.
+ IsFunctionParamContext()
+}
+
+type FunctionParamContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyFunctionParamContext() *FunctionParamContext {
+ var p = new(FunctionParamContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionParam
+ return p
+}
+
+func InitEmptyFunctionParamContext(p *FunctionParamContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_functionParam
+}
+
+func (*FunctionParamContext) IsFunctionParamContext() {}
+
+func NewFunctionParamContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *FunctionParamContext {
+ var p = new(FunctionParamContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_functionParam
+
+ return p
+}
+
+func (s *FunctionParamContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *FunctionParamContext) Key() IKeyContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IKeyContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IKeyContext)
+}
+
+func (s *FunctionParamContext) Value() IValueContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueContext)
+}
+
+func (s *FunctionParamContext) Array() IArrayContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IArrayContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IArrayContext)
+}
+
+func (s *FunctionParamContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *FunctionParamContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *FunctionParamContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterFunctionParam(s)
+ }
+}
+
+func (s *FunctionParamContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitFunctionParam(s)
+ }
+}
+
+func (s *FunctionParamContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitFunctionParam(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) FunctionParam() (localctx IFunctionParamContext) {
+ localctx = NewFunctionParamContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 26, FilterQueryParserRULE_functionParam)
+ p.SetState(201)
+ p.GetErrorHandler().Sync(p)
+ if p.HasError() {
+ goto errorExit
+ }
+
+ switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 10, p.GetParserRuleContext()) {
+ case 1:
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(198)
+ p.Key()
+ }
+
+ case 2:
+ p.EnterOuterAlt(localctx, 2)
+ {
+ p.SetState(199)
+ p.Value()
+ }
+
+ case 3:
+ p.EnterOuterAlt(localctx, 3)
+ {
+ p.SetState(200)
+ p.Array()
+ }
+
+ case antlr.ATNInvalidAltNumber:
+ goto errorExit
+ }
+
+errorExit:
+ if p.HasError() {
+ v := p.GetError()
+ localctx.SetException(v)
+ p.GetErrorHandler().ReportError(p, v)
+ p.GetErrorHandler().Recover(p, v)
+ p.SetError(nil)
+ }
+ p.ExitRule()
+ return localctx
+ goto errorExit // Trick to prevent compiler error if the label is not used
+}
+
+// IArrayContext is an interface to support dynamic dispatch.
+type IArrayContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ LBRACK() antlr.TerminalNode
+ ValueList() IValueListContext
+ RBRACK() antlr.TerminalNode
+
+ // IsArrayContext differentiates from other interfaces.
+ IsArrayContext()
+}
+
+type ArrayContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyArrayContext() *ArrayContext {
+ var p = new(ArrayContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_array
+ return p
+}
+
+func InitEmptyArrayContext(p *ArrayContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_array
+}
+
+func (*ArrayContext) IsArrayContext() {}
+
+func NewArrayContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayContext {
+ var p = new(ArrayContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_array
+
+ return p
+}
+
+func (s *ArrayContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ArrayContext) LBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserLBRACK, 0)
+}
+
+func (s *ArrayContext) ValueList() IValueListContext {
+ var t antlr.RuleContext
+ for _, ctx := range s.GetChildren() {
+ if _, ok := ctx.(IValueListContext); ok {
+ t = ctx.(antlr.RuleContext)
+ break
+ }
+ }
+
+ if t == nil {
+ return nil
+ }
+
+ return t.(IValueListContext)
+}
+
+func (s *ArrayContext) RBRACK() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserRBRACK, 0)
+}
+
+func (s *ArrayContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ArrayContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ArrayContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterArray(s)
+ }
+}
+
+func (s *ArrayContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitArray(s)
+ }
+}
+
+func (s *ArrayContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitArray(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Array() (localctx IArrayContext) {
+ localctx = NewArrayContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 28, FilterQueryParserRULE_array)
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(203)
+ p.Match(FilterQueryParserLBRACK)
+ if p.HasError() {
+ // Recognition error - abort rule
+ goto errorExit
+ }
+ }
+ {
+ p.SetState(204)
+ p.ValueList()
+ }
+ {
+ p.SetState(205)
+ p.Match(FilterQueryParserRBRACK)
+ 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
+}
+
+// IValueContext is an interface to support dynamic dispatch.
+type IValueContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ QUOTED_TEXT() antlr.TerminalNode
+ NUMBER() antlr.TerminalNode
+ BOOL() antlr.TerminalNode
+ KEY() antlr.TerminalNode
+
+ // IsValueContext differentiates from other interfaces.
+ IsValueContext()
+}
+
+type ValueContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyValueContext() *ValueContext {
+ var p = new(ValueContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_value
+ return p
+}
+
+func InitEmptyValueContext(p *ValueContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_value
+}
+
+func (*ValueContext) IsValueContext() {}
+
+func NewValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueContext {
+ var p = new(ValueContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_value
+
+ return p
+}
+
+func (s *ValueContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *ValueContext) QUOTED_TEXT() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserQUOTED_TEXT, 0)
+}
+
+func (s *ValueContext) NUMBER() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserNUMBER, 0)
+}
+
+func (s *ValueContext) BOOL() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserBOOL, 0)
+}
+
+func (s *ValueContext) KEY() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserKEY, 0)
+}
+
+func (s *ValueContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterValue(s)
+ }
+}
+
+func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitValue(s)
+ }
+}
+
+func (s *ValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitValue(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Value() (localctx IValueContext) {
+ localctx = NewValueContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 30, FilterQueryParserRULE_value)
+ var _la int
+
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(207)
+ _la = p.GetTokenStream().LA(1)
+
+ if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&8053063680) != 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
+}
+
+// IKeyContext is an interface to support dynamic dispatch.
+type IKeyContext interface {
+ antlr.ParserRuleContext
+
+ // GetParser returns the parser.
+ GetParser() antlr.Parser
+
+ // Getter signatures
+ KEY() antlr.TerminalNode
+
+ // IsKeyContext differentiates from other interfaces.
+ IsKeyContext()
+}
+
+type KeyContext struct {
+ antlr.BaseParserRuleContext
+ parser antlr.Parser
+}
+
+func NewEmptyKeyContext() *KeyContext {
+ var p = new(KeyContext)
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_key
+ return p
+}
+
+func InitEmptyKeyContext(p *KeyContext) {
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
+ p.RuleIndex = FilterQueryParserRULE_key
+}
+
+func (*KeyContext) IsKeyContext() {}
+
+func NewKeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeyContext {
+ var p = new(KeyContext)
+
+ antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
+
+ p.parser = parser
+ p.RuleIndex = FilterQueryParserRULE_key
+
+ return p
+}
+
+func (s *KeyContext) GetParser() antlr.Parser { return s.parser }
+
+func (s *KeyContext) KEY() antlr.TerminalNode {
+ return s.GetToken(FilterQueryParserKEY, 0)
+}
+
+func (s *KeyContext) GetRuleContext() antlr.RuleContext {
+ return s
+}
+
+func (s *KeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
+ return antlr.TreesStringTree(s, ruleNames, recog)
+}
+
+func (s *KeyContext) EnterRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.EnterKey(s)
+ }
+}
+
+func (s *KeyContext) ExitRule(listener antlr.ParseTreeListener) {
+ if listenerT, ok := listener.(FilterQueryListener); ok {
+ listenerT.ExitKey(s)
+ }
+}
+
+func (s *KeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
+ switch t := visitor.(type) {
+ case FilterQueryVisitor:
+ return t.VisitKey(s)
+
+ default:
+ return t.VisitChildren(s)
+ }
+}
+
+func (p *FilterQueryParser) Key() (localctx IKeyContext) {
+ localctx = NewKeyContext(p, p.GetParserRuleContext(), p.GetState())
+ p.EnterRule(localctx, 32, FilterQueryParserRULE_key)
+ p.EnterOuterAlt(localctx, 1)
+ {
+ p.SetState(209)
+ p.Match(FilterQueryParserKEY)
+ 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
+}
diff --git a/pkg/parser/grammar/filterquery_visitor.go b/pkg/parser/grammar/filterquery_visitor.go
new file mode 100644
index 0000000000..50d61ea8d5
--- /dev/null
+++ b/pkg/parser/grammar/filterquery_visitor.go
@@ -0,0 +1,61 @@
+// Code generated from grammar/FilterQuery.g4 by ANTLR 4.13.2. DO NOT EDIT.
+
+package parser // FilterQuery
+
+import "github.com/antlr4-go/antlr/v4"
+
+// A complete Visitor for a parse tree produced by FilterQueryParser.
+type FilterQueryVisitor interface {
+ antlr.ParseTreeVisitor
+
+ // Visit a parse tree produced by FilterQueryParser#query.
+ VisitQuery(ctx *QueryContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#expression.
+ VisitExpression(ctx *ExpressionContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#orExpression.
+ VisitOrExpression(ctx *OrExpressionContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#andExpression.
+ VisitAndExpression(ctx *AndExpressionContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#unaryExpression.
+ VisitUnaryExpression(ctx *UnaryExpressionContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#primary.
+ VisitPrimary(ctx *PrimaryContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#comparison.
+ VisitComparison(ctx *ComparisonContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#inClause.
+ VisitInClause(ctx *InClauseContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#notInClause.
+ VisitNotInClause(ctx *NotInClauseContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#valueList.
+ VisitValueList(ctx *ValueListContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#fullText.
+ VisitFullText(ctx *FullTextContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#functionCall.
+ VisitFunctionCall(ctx *FunctionCallContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#functionParamList.
+ VisitFunctionParamList(ctx *FunctionParamListContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#functionParam.
+ VisitFunctionParam(ctx *FunctionParamContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#array.
+ VisitArray(ctx *ArrayContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#value.
+ VisitValue(ctx *ValueContext) interface{}
+
+ // Visit a parse tree produced by FilterQueryParser#key.
+ VisitKey(ctx *KeyContext) interface{}
+}
diff --git a/scripts/grammar/generate-go-parser.sh b/scripts/grammar/generate-go-parser.sh
new file mode 100755
index 0000000000..b46169d4b5
--- /dev/null
+++ b/scripts/grammar/generate-go-parser.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+echo "Generating Go parser..."
+# Create output directory if it doesn't exist
+mkdir -p pkg/parser
+
+# Generate Go parser
+antlr -visitor -Dlanguage=Go -o pkg/parser grammar/FilterQuery.g4
+
+echo "Go parser generation complete"