github.com/MontFerret/ferret@v0.18.0/pkg/parser/antlr/FqlLexer.g4 (about) 1 lexer grammar FqlLexer; 2 3 // Skip 4 MultiLineComment: '/*' .*? '*/' -> channel(HIDDEN); 5 SingleLineComment: '//' ~[\r\n\u2028\u2029]* -> channel(HIDDEN); 6 WhiteSpaces: [\t\u000B\u000C\u0020\u00A0]+ -> channel(HIDDEN); 7 LineTerminator: [\r\n\u2028\u2029] -> channel(HIDDEN); 8 9 // Punctuation 10 Colon: ':'; 11 SemiColon: ';'; 12 Dot: '.'; 13 Comma: ','; 14 OpenBracket: '['; 15 CloseBracket: ']'; 16 OpenParen: '('; 17 CloseParen: ')'; 18 OpenBrace: '{'; 19 CloseBrace: '}'; 20 21 // Comparison operators 22 Gt: '>'; 23 Lt: '<'; 24 Eq: '=='; 25 Gte: '>='; 26 Lte: '<='; 27 Neq: '!='; 28 29 // Arithmetic operators 30 Multi: '*'; 31 Div: '/'; 32 Mod: '%'; 33 Plus: '+'; 34 Minus: '-'; 35 MinusMinus: '--'; 36 PlusPlus: '++'; 37 38 // Logical operators 39 And: 'AND' | '&&'; 40 Or: 'OR' | '||'; 41 42 // Other operators 43 Range: Dot Dot; 44 Assign: '='; 45 QuestionMark: '?'; 46 RegexNotMatch: '!~'; 47 RegexMatch: '=~'; 48 49 // Keywords 50 // Common Keywords 51 For: 'FOR'; 52 Return: 'RETURN'; 53 Waitfor: 'WAITFOR'; 54 Options: 'OPTIONS'; 55 Timeout: 'TIMEOUT'; 56 Distinct: 'DISTINCT'; 57 Filter: 'FILTER'; 58 Current: 'CURRENT'; 59 Sort: 'SORT'; 60 Limit: 'LIMIT'; 61 Let: 'LET'; 62 Collect: 'COLLECT'; 63 SortDirection: 'ASC' | 'DESC'; 64 None: 'NONE'; 65 Null: 'NULL'; 66 BooleanLiteral: 'TRUE' | 'true' | 'FALSE' | 'false'; 67 Use: 'USE'; 68 69 // Group operators 70 Into: 'INTO'; 71 Keep: 'KEEP'; 72 With: 'WITH'; 73 Count: 'COUNT'; 74 All: 'ALL'; 75 Any: 'ANY'; 76 Aggregate: 'AGGREGATE'; 77 78 // Wait operators 79 Event: 'EVENT'; 80 81 // Unary operators 82 Like: 'LIKE'; 83 Not: 'NOT' | '!'; 84 In: 'IN'; 85 Do: 'DO'; 86 While: 'WHILE'; 87 88 // Literals 89 Param: '@'; 90 Identifier: Letter+ (Symbols (Identifier)*)* (Digit (Identifier)*)*; 91 IgnoreIdentifier: Underscore; 92 StringLiteral: SQString | DQSring | BacktickString | TickString; 93 IntegerLiteral: [0-9]+; 94 FloatLiteral 95 : DecimalIntegerLiteral Dot [0-9]+ ExponentPart? 96 | DecimalIntegerLiteral ExponentPart? 97 ; 98 99 NamespaceSegment: Identifier NamespaceSeparator; 100 101 UnknownIdentifier: .; 102 103 // Fragments 104 fragment HexDigit 105 : [0-9a-fA-F] 106 ; 107 fragment DecimalIntegerLiteral 108 : '0' 109 | [1-9] [0-9]* 110 ; 111 fragment ExponentPart 112 : [eE] [+-]? [0-9]+ 113 ; 114 fragment Letter 115 : 'A'..'Z' | 'a'..'z' 116 ; 117 fragment Symbols: Underscore; 118 fragment Underscore: '_'; 119 fragment Digit 120 : '0'..'9' 121 ; 122 fragment DQSring: '"' ( '\\'. | '""' | ~('"'| '\\') )* '"'; 123 fragment SQString: '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\''; 124 fragment BacktickString: '`' ('\\`' | ~'`')* '`'; 125 fragment TickString: '´' ('\\´' | ~'´')* '´'; 126 fragment NamespaceSeparator: '::';