Created
April 21, 2023 14:08
-
-
Save niquola/61703a2a83d6f851e4cb2a6c021f08ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grammar fhirpathmin; | |
expression | |
: expression '.' expression #chain | |
| expression '[' int ']' #index | |
| FIRST #first | |
| WHERE predicate ')' #where | |
| element #term | |
; | |
predicate : expression eqop (expression | string) #eqpred | |
| expression compop (expression | number) #mathpred | |
| predicate boolop predicate #boolpred | |
| '(' predicate ')' #predicateGroup | |
; | |
eqop: ('=' | '!='); | |
compop: ('<=' | '<' | '>' | '>=' | '=' ); | |
boolop: ('or' | 'and'); | |
element: NAME; | |
string: STRING; | |
number: NUMBER; | |
int: INT; | |
NAME : [_a-zA-Z][_a-zA-Z0-9]* ; | |
WHERE : 'where('; | |
FIRST : 'first()'; | |
INT : [0-9]+ ; | |
NUMBER : [0-9]+('.' [0-9]+)? ; | |
STRING : '\'' ~('\'')* '\'' ; | |
WS : [ \t\n\r]+ -> skip ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment