Skip to content

Instantly share code, notes, and snippets.

@FylmTM
Created May 16, 2016 08:54
Show Gist options
  • Save FylmTM/4b34d4d6ad8394c524c9b98bf2f35bb7 to your computer and use it in GitHub Desktop.
Save FylmTM/4b34d4d6ad8394c524c9b98bf2f35bb7 to your computer and use it in GitHub Desktop.
grammar Cypher;
cypher : allOptions statement ';'? ;
allOptions : ( anyCypherOption )* ;
anyCypherOption : cypherOption
| explain
| profile
;
cypherOption : CYPHER ( versionNumber )? ( configurationOption )* ;
versionNumber : digitString '.' digitString ;
explain : EXPLAIN ;
profile : PROFILE ;
configurationOption : symbolicNameString '=' symbolicNameString ;
statement : command
| query
;
query : regularQuery
| bulkImportQuery
;
regularQuery : singleQuery ( union )* ;
bulkImportQuery : periodicCommitHint loadCSVQuery ;
singleQuery : clause ( clause )* ;
periodicCommitHint : USING PERIODIC COMMIT ( signedIntegerLiteral )? ;
loadCSVQuery : loadCSV ( clause )* ;
union : ( UNION ALL singleQuery )
| ( UNION singleQuery )
;
clause : loadCSV
| start
| match
| unwind
| merge
| create
| setClause
| delete
| remove
| foreach
| with
| return
;
command : createUniqueConstraint
| createNodePropertyExistenceConstraint
| createRelationshipPropertyExistenceConstraint
| createIndex
| dropUniqueConstraint
| dropNodePropertyExistenceConstraint
| dropRelationshipPropertyExistenceConstraint
| dropIndex
;
createUniqueConstraint : CREATE uniqueConstraintSyntax ;
createNodePropertyExistenceConstraint : CREATE nodePropertyExistenceConstraintSyntax ;
createRelationshipPropertyExistenceConstraint : CREATE relationshipPropertyExistenceConstraintSyntax ;
createIndex : CREATE INDEX ON nodeLabel '(' propertyKeyName ')' ;
dropUniqueConstraint : DROP uniqueConstraintSyntax ;
dropNodePropertyExistenceConstraint : DROP nodePropertyExistenceConstraintSyntax ;
dropRelationshipPropertyExistenceConstraint : DROP relationshipPropertyExistenceConstraintSyntax ;
dropIndex : DROP INDEX ON nodeLabel '(' propertyKeyName ')' ;
uniqueConstraintSyntax : CONSTRAINT ON '(' variable nodeLabel ')' ASSERT propertyExpression IS UNIQUE ;
nodePropertyExistenceConstraintSyntax : CONSTRAINT ON '(' variable nodeLabel ')' ASSERT EXISTS '(' propertyExpression ')' ;
relationshipPropertyExistenceConstraintSyntax : CONSTRAINT ON relationshipPatternSyntax ASSERT EXISTS '(' propertyExpression ')' ;
relationshipPatternSyntax : ( '(' ')' dash '[' variable relType ']' dash '(' ')' )
| ( '(' ')' dash '[' variable relType ']' rightArrowHead dash '(' ')' )
| ( '(' ')' leftArrowHead dash '[' variable relType ']' dash '(' ')' )
;
loadCSV : LOAD CSV ( WITH HEADERS )? FROM expression AS variable ( FIELDTERMINATOR StringLiteral )? ;
match : ( OPTIONAL )? MATCH pattern ( hint )* where? ;
unwind : UNWIND expression AS variable ;
merge : MERGE patternPart ( mergeAction )* ;
mergeAction : ( ON MATCH setClause )
| ( ON CREATE setClause )
;
create : ( CREATE UNIQUE pattern )
| ( CREATE pattern )
;
setClause : SET setItem ( ',' setItem )* ;
setItem : ( propertyExpression '=' expression )
| ( variable '=' expression )
| ( variable '+=' expression )
| ( variable nodeLabels )
;
delete : ( DELETE expression ( ',' expression )* )
| ( DETACH DELETE expression ( ',' expression )* )
;
remove : REMOVE removeItem ( ',' removeItem )* ;
removeItem : ( variable nodeLabels )
| propertyExpression
;
foreach : FOREACH '(' variable IN expression '|' ( clause )+ ')' ;
with : ( WITH DISTINCT returnBody where? )
| ( WITH returnBody where? )
;
return : ( RETURN DISTINCT returnBody )
| ( RETURN returnBody )
;
returnBody : returnItems ( order )? ( skip )? ( limit )? ;
returnItems : ( '*' ( ',' returnItem )* )
| ( returnItem ( ',' returnItem )* )
;
returnItem : ( expression AS variable )
| expression
;
order : ORDER BY sortItem ( ',' sortItem )* ;
skip : L_SKIP expression ;
limit : LIMIT expression ;
sortItem : ( expression ( DESCENDING | DESC ) )
| ( expression ( ASCENDING | ASC )? )
;
hint : ( USING INDEX variable nodeLabel '(' propertyKeyName ')' )
| ( USING JOIN ON variable ( ',' variable )* )
| ( USING SCAN variable nodeLabel )
;
start : START startPoint ( ',' startPoint )* where? ;
startPoint : variable '=' lookup ;
lookup : nodeLookup
| relationshipLookup
;
nodeLookup : NODE ( identifiedIndexLookup | indexQuery | idLookup ) ;
relationshipLookup : ( RELATIONSHIP | REL ) ( identifiedIndexLookup | indexQuery | idLookup ) ;
identifiedIndexLookup : ':' symbolicNameString '(' symbolicNameString '=' ( StringLiteral | parameter ) ')' ;
indexQuery : ':' symbolicNameString '(' ( StringLiteral | parameter ) ')' ;
idLookup : '(' ( literalIds | parameter | '*' ) ')' ;
literalIds : unsignedIntegerLiteral ( ',' unsignedIntegerLiteral )* ;
where : WHERE expression ;
pattern : patternPart ( ',' patternPart )* ;
patternPart : ( variable '=' anonymousPatternPart )
| anonymousPatternPart
;
anonymousPatternPart : shortestPathPattern
| patternElement
;
shortestPathPattern : ( SHORTESTPATH '(' patternElement ')' )
| ( ALLSHORTESTPATHS '(' patternElement ')' )
;
patternElement : ( nodePattern ( patternElementChain )* )
| ( '(' patternElement ')' )
;
nodePattern : '(' variable? nodeLabels? properties? ')' ;
patternElementChain : relationshipPattern nodePattern ;
relationshipPattern : ( leftArrowHead dash relationshipDetail? dash rightArrowHead )
| ( leftArrowHead dash relationshipDetail? dash )
| ( dash relationshipDetail? dash rightArrowHead )
| ( dash relationshipDetail? dash )
;
relationshipDetail : '[' variable? '?'? relationshipTypes? ( '*' rangeLiteral? )? properties? ']' ;
properties : mapLiteral
| parameter
;
relType : ':' relTypeName ;
relationshipTypes : ':' relTypeName ( '|' ':'? relTypeName )* ;
nodeLabels : nodeLabel ( nodeLabel )* ;
nodeLabel : ':' labelName ;
rangeLiteral : ( unsignedIntegerLiteral )? '..' ( unsignedIntegerLiteral )? ;
labelName : symbolicNameString ;
relTypeName : symbolicNameString ;
expression : expression12 ;
expression12 : expression11 ( OR expression11 )* ;
expression11 : expression10 ( XOR expression10 )* ;
expression10 : expression9 ( AND expression9 )* ;
expression9 : ( NOT expression9 )
| expression8
;
expression8 : expression7 ( partialComparisonExpression )* ;
expression7 : expression6 ( ( '+' expression6 ) | ( '-' expression6 ) )* ;
expression6 : expression5 ( ( '*' expression5 ) | ( '/' expression5 ) | ( '%' expression5 ) )* ;
expression5 : expression4 ( '^' expression4 )* ;
expression4 : expression3
| ( '+' expression3 )
| ( '-' expression3 )
;
expression3 : expression2 ( ( '[' expression ']' )
| ( '[' expression? '..' expression? ']' )
| ( '=~' expression2 )
| ( IN expression2 )
| ( STARTS WITH expression2 )
| ( ENDS WITH expression2 )
| ( CONTAINS expression2 )
| ( IS NULL )
| ( IS NOT NULL ) )* ;
expression2 : expression1 ( propertyLookup | nodeLabels )* ;
expression1 : numberLiteral
| StringLiteral
| parameter
| TRUE
| FALSE
| NULL
| caseExpression
| ( COUNT '(' '*' ')' )
| mapLiteral
| listComprehension
| ( '[' expression ( ',' expression )* ']' )
| ( FILTER '(' filterExpression ')' )
| ( EXTRACT '(' filterExpression ( '|' expression )? ')' )
| reduce
| ( ALL '(' filterExpression ')' )
| ( ANY '(' filterExpression ')' )
| ( NONE '(' filterExpression ')' )
| ( SINGLE '(' filterExpression ')' )
| shortestPathPattern
| relationshipsPattern
| parenthesizedExpression
| functionInvocation
| variable
;
reduce : REDUCE '(' variable '=' expression ',' idInColl '|' expression ')' ;
partialComparisonExpression : ( '=' expression7 )
| ( '<>' expression7 )
| ( '!=' expression7 )
| ( '<' expression7 )
| ( '>' expression7 )
| ( '<=' expression7 )
| ( '>=' expression7 )
;
parenthesizedExpression : '(' expression ')' ;
relationshipsPattern : nodePattern ( patternElementChain )+ ;
filterExpression : idInColl ( where )? ;
idInColl : variable IN expression ;
functionInvocation : functionName '(' DISTINCT? ( expression ( ',' expression )* )? ')' ;
functionName : symbolicNameString ;
listComprehension : '[' filterExpression ( '|' expression )? ']' ;
propertyLookup : '.' ( ( propertyKeyName ( '?' | '!' ) ) | propertyKeyName ) ;
caseExpression : ( ( CASE ( caseAlternatives )+ ) | ( CASE expression ( caseAlternatives )+ ) ) ( ELSE expression )? END ;
caseAlternatives : WHEN expression THEN expression ;
variable : symbolicNameString ;
StringLiteral : ( '"' ( StringLiteral_0 | EscapedChar )* '"' )
| ( '\'' ( StringLiteral_1 | EscapedChar )* '\'' )
;
EscapedChar : '\\' ( '\\' | '\'' | '"' | ( 'B' | 'b' ) | ( 'F' | 'f' ) | ( 'N' | 'n' ) | ( 'R' | 'r' ) | ( 'T' | 't' ) | '_' | '%' | ( ( 'U' | 'u' ) ( HexDigit HexDigit HexDigit HexDigit ) ) | ( ( 'U' | 'u' ) ( HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit ) ) ) ;
numberLiteral : doubleLiteral
| signedIntegerLiteral
;
mapLiteral : '{' ( propertyKeyName ':' expression ( ',' propertyKeyName ':' expression )* )? '}' ;
parameter : '{' ( symbolicNameString | unsignedDecimalInteger ) '}' ;
propertyExpression : expression1 ( propertyLookup )+ ;
propertyKeyName : symbolicNameString ;
signedIntegerLiteral : hexInteger
| octalInteger
| decimalInteger
;
unsignedIntegerLiteral : unsignedDecimalInteger ;
hexInteger : '-'? unsignedHexInteger ;
decimalInteger : '-'? unsignedDecimalInteger ;
octalInteger : '-'? unsignedOctalInteger ;
unsignedHexInteger : L_0X hexString ;
unsignedDecimalInteger : ( ( '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ) digitString? )
| '0'
;
unsignedOctalInteger : '0' octalString ;
hexString : ( HexDigit )+ ;
digitString : ( digit )+ ;
octalString : ( octDigit )+ ;
HexDigit : '0'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
| ( 'A' | 'a' )
| ( 'B' | 'b' )
| ( 'C' | 'c' )
| ( 'D' | 'd' )
| ( 'E' | 'e' )
| ( 'F' | 'f' )
;
digit : '0'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
| '8'
| '9'
;
octDigit : '0'
| '1'
| '2'
| '3'
| '4'
| '5'
| '6'
| '7'
;
doubleLiteral : exponentDecimalReal
| regularDecimalReal
;
exponentDecimalReal : '-'? ( digit | '.' )+ ( ( 'E' | 'e' ) | ( 'E' | 'e' ) ) '-'? digitString ;
regularDecimalReal : '-'? ( digit )* '.' digitString ;
symbolicNameString : UnescapedSymbolicNameString
| EscapedSymbolicNameString
| CYPHER
| EXPLAIN
| PROFILE
| USING
| PERIODIC
| COMMIT
| UNION
| ALL
| CREATE
| INDEX
| ON
| DROP
| CONSTRAINT
| ASSERT
| IS
| UNIQUE
| EXISTS
| LOAD
| CSV
| WITH
| HEADERS
| FROM
| AS
| FIELDTERMINATOR
| OPTIONAL
| MATCH
| UNWIND
| MERGE
| SET
| DELETE
| DETACH
| REMOVE
| FOREACH
| IN
| DISTINCT
| RETURN
| ORDER
| BY
| L_SKIP
| LIMIT
| DESCENDING
| DESC
| ASCENDING
| ASC
| JOIN
| SCAN
| START
| NODE
| RELATIONSHIP
| REL
| WHERE
| SHORTESTPATH
| ALLSHORTESTPATHS
| OR
| XOR
| AND
| NOT
| STARTS
| ENDS
| CONTAINS
| NULL
| TRUE
| FALSE
| COUNT
| FILTER
| EXTRACT
| ANY
| NONE
| SINGLE
| REDUCE
| CASE
| ELSE
| END
| WHEN
| THEN
| L_0X
| HexDigit
;
CYPHER : ( 'C' | 'c' ) ( 'Y' | 'y' ) ( 'P' | 'p' ) ( 'H' | 'h' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ;
EXPLAIN : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'P' | 'p' ) ( 'L' | 'l' ) ( 'A' | 'a' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ;
PROFILE : ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'F' | 'f' ) ( 'I' | 'i' ) ( 'L' | 'l' ) ( 'E' | 'e' ) ;
USING : ( 'U' | 'u' ) ( 'S' | 's' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'G' | 'g' ) ;
PERIODIC : ( 'P' | 'p' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'C' | 'c' ) ;
COMMIT : ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'M' | 'm' ) ( 'M' | 'm' ) ( 'I' | 'i' ) ( 'T' | 't' ) ;
UNION : ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ;
ALL : ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'L' | 'l' ) ;
CREATE : ( 'C' | 'c' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'E' | 'e' ) ;
INDEX : ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'X' | 'x' ) ;
ON : ( 'O' | 'o' ) ( 'N' | 'n' ) ;
DROP : ( 'D' | 'd' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'P' | 'p' ) ;
CONSTRAINT : ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'S' | 's' ) ( 'T' | 't' ) ( 'R' | 'r' ) ( 'A' | 'a' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'T' | 't' ) ;
ASSERT : ( 'A' | 'a' ) ( 'S' | 's' ) ( 'S' | 's' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'T' | 't' ) ;
IS : ( 'I' | 'i' ) ( 'S' | 's' ) ;
UNIQUE : ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'I' | 'i' ) ( 'Q' | 'q' ) ( 'U' | 'u' ) ( 'E' | 'e' ) ;
EXISTS : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'I' | 'i' ) ( 'S' | 's' ) ( 'T' | 't' ) ( 'S' | 's' ) ;
LOAD : ( 'L' | 'l' ) ( 'O' | 'o' ) ( 'A' | 'a' ) ( 'D' | 'd' ) ;
CSV : ( 'C' | 'c' ) ( 'S' | 's' ) ( 'V' | 'v' ) ;
WITH : ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' ) ;
HEADERS : ( 'H' | 'h' ) ( 'E' | 'e' ) ( 'A' | 'a' ) ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'S' | 's' ) ;
FROM : ( 'F' | 'f' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'M' | 'm' ) ;
AS : ( 'A' | 'a' ) ( 'S' | 's' ) ;
FIELDTERMINATOR : ( 'F' | 'f' ) ( 'I' | 'i' ) ( 'E' | 'e' ) ( 'L' | 'l' ) ( 'D' | 'd' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'M' | 'm' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ;
OPTIONAL : ( 'O' | 'o' ) ( 'P' | 'p' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ;
MATCH : ( 'M' | 'm' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'C' | 'c' ) ( 'H' | 'h' ) ;
UNWIND : ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ;
MERGE : ( 'M' | 'm' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'G' | 'g' ) ( 'E' | 'e' ) ;
SET : ( 'S' | 's' ) ( 'E' | 'e' ) ( 'T' | 't' ) ;
DELETE : ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'L' | 'l' ) ( 'E' | 'e' ) ( 'T' | 't' ) ( 'E' | 'e' ) ;
DETACH : ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'C' | 'c' ) ( 'H' | 'h' ) ;
REMOVE : ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'M' | 'm' ) ( 'O' | 'o' ) ( 'V' | 'v' ) ( 'E' | 'e' ) ;
FOREACH : ( 'F' | 'f' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'A' | 'a' ) ( 'C' | 'c' ) ( 'H' | 'h' ) ;
IN : ( 'I' | 'i' ) ( 'N' | 'n' ) ;
DISTINCT : ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'S' | 's' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' ) ;
RETURN : ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'T' | 't' ) ( 'U' | 'u' ) ( 'R' | 'r' ) ( 'N' | 'n' ) ;
ORDER : ( 'O' | 'o' ) ( 'R' | 'r' ) ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ;
BY : ( 'B' | 'b' ) ( 'Y' | 'y' ) ;
L_SKIP : ( 'S' | 's' ) ( 'K' | 'k' ) ( 'I' | 'i' ) ( 'P' | 'p' ) ;
LIMIT : ( 'L' | 'l' ) ( 'I' | 'i' ) ( 'M' | 'm' ) ( 'I' | 'i' ) ( 'T' | 't' ) ;
DESCENDING : ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'C' | 'c' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'G' | 'g' ) ;
DESC : ( 'D' | 'd' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'C' | 'c' ) ;
ASCENDING : ( 'A' | 'a' ) ( 'S' | 's' ) ( 'C' | 'c' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'G' | 'g' ) ;
ASC : ( 'A' | 'a' ) ( 'S' | 's' ) ( 'C' | 'c' ) ;
JOIN : ( 'J' | 'j' ) ( 'O' | 'o' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ;
SCAN : ( 'S' | 's' ) ( 'C' | 'c' ) ( 'A' | 'a' ) ( 'N' | 'n' ) ;
START : ( 'S' | 's' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'R' | 'r' ) ( 'T' | 't' ) ;
NODE : ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'D' | 'd' ) ( 'E' | 'e' ) ;
RELATIONSHIP : ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'L' | 'l' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'I' | 'i' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'S' | 's' ) ( 'H' | 'h' ) ( 'I' | 'i' ) ( 'P' | 'p' ) ;
REL : ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'L' | 'l' ) ;
WHERE : ( 'W' | 'w' ) ( 'H' | 'h' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ( 'E' | 'e' ) ;
SHORTESTPATH : ( 'S' | 's' ) ( 'H' | 'h' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'T' | 't' ) ( 'P' | 'p' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'H' | 'h' ) ;
ALLSHORTESTPATHS : ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'H' | 'h' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'S' | 's' ) ( 'T' | 't' ) ( 'P' | 'p' ) ( 'A' | 'a' ) ( 'T' | 't' ) ( 'H' | 'h' ) ( 'S' | 's' ) ;
OR : ( 'O' | 'o' ) ( 'R' | 'r' ) ;
XOR : ( 'X' | 'x' ) ( 'O' | 'o' ) ( 'R' | 'r' ) ;
AND : ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ;
NOT : ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' ) ;
STARTS : ( 'S' | 's' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'R' | 'r' ) ( 'T' | 't' ) ( 'S' | 's' ) ;
ENDS : ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ( 'S' | 's' ) ;
CONTAINS : ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'T' | 't' ) ( 'A' | 'a' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'S' | 's' ) ;
NULL : ( 'N' | 'n' ) ( 'U' | 'u' ) ( 'L' | 'l' ) ( 'L' | 'l' ) ;
TRUE : ( 'T' | 't' ) ( 'R' | 'r' ) ( 'U' | 'u' ) ( 'E' | 'e' ) ;
FALSE : ( 'F' | 'f' ) ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) ;
COUNT : ( 'C' | 'c' ) ( 'O' | 'o' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'T' | 't' ) ;
FILTER : ( 'F' | 'f' ) ( 'I' | 'i' ) ( 'L' | 'l' ) ( 'T' | 't' ) ( 'E' | 'e' ) ( 'R' | 'r' ) ;
EXTRACT : ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'T' | 't' ) ( 'R' | 'r' ) ( 'A' | 'a' ) ( 'C' | 'c' ) ( 'T' | 't' ) ;
ANY : ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'Y' | 'y' ) ;
NONE : ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'N' | 'n' ) ( 'E' | 'e' ) ;
SINGLE : ( 'S' | 's' ) ( 'I' | 'i' ) ( 'N' | 'n' ) ( 'G' | 'g' ) ( 'L' | 'l' ) ( 'E' | 'e' ) ;
REDUCE : ( 'R' | 'r' ) ( 'E' | 'e' ) ( 'D' | 'd' ) ( 'U' | 'u' ) ( 'C' | 'c' ) ( 'E' | 'e' ) ;
CASE : ( 'C' | 'c' ) ( 'A' | 'a' ) ( 'S' | 's' ) ( 'E' | 'e' ) ;
ELSE : ( 'E' | 'e' ) ( 'L' | 'l' ) ( 'S' | 's' ) ( 'E' | 'e' ) ;
END : ( 'E' | 'e' ) ( 'N' | 'n' ) ( 'D' | 'd' ) ;
WHEN : ( 'W' | 'w' ) ( 'H' | 'h' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ;
THEN : ( 'T' | 't' ) ( 'H' | 'h' ) ( 'E' | 'e' ) ( 'N' | 'n' ) ;
L_0X : ( '0' | '0' ) ( 'X' | 'x' ) ;
UnescapedSymbolicNameString : IdentifierStart ( IdentifierPart )* ;
/**
* Based on the unicode identifier and pattern syntax
* (http://www.unicode.org/reports/tr31/)
* And extended with a few characters.
*/
IdentifierStart : ID_Start
| Sc
| '_'
| '‿'
| '⁀'
| '⁔'
| '︳'
| '︴'
| '﹍'
| '﹎'
| '﹏'
| '_'
;
/**
* Based on the unicode identifier and pattern syntax
* (http://www.unicode.org/reports/tr31/)
* And extended with a few characters.
*/
IdentifierPart : ID_Continue
| Sc
;
/**
* Any character except "`", enclosed within `backticks`. Backticks are escaped with double backticks. */
EscapedSymbolicNameString : ( '`' ( EscapedSymbolicNameString_0 )* '`' )+ ;
WS : WHITESPACE+ -> channel(HIDDEN);
WHITESPACE : SPACE
| TAB
| LF
| VT
| FF
| CR
| FS
| GS
| RS
| US
| ' '
| '᠎'
| ' '
| ' '
| ' '
| ' '
| ' '
| ' '
| ' '
| ' '
| ' '
| ' '
| '
'
| '
'
| ' '
| ' '
| ' '
| ' '
| ' '
| Comment
;
Comment : ( '/*' ( Comment_0 | ( '*' Comment_1 ) )* '*/' )
| ( '//' Comment_2 CR? ( LF | EOF ) )
;
leftArrowHead : '<'
| '⟨'
| '〈'
| '﹤'
| '<'
;
rightArrowHead : '>'
| '⟩'
| '〉'
| '﹥'
| '>'
;
dash : '-'
| '­'
| '‐'
| '‑'
| '‒'
| '–'
| '—'
| '―'
| '−'
| '﹘'
| '﹣'
| '-'
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment