FHIRPath Parser & Lexer
FHIRPath lexer and parser components
FhirPathLexer
Path: fhircraft.fhir.path.lexer.FhirPathLexer
A Lexical analyzer for JsonPath.
Methods:
| Name | Description |
|---|---|
tokenize |
Maps a string to an iterator over tokens. In other words: [char] -> [token] |
t_ignore_WHITESPACE |
[\s] |
t_ignore_COMMENT |
\/*([\s\S]?)*\/|\/\/(.) |
t_CHOICE_ELEMENT |
(?:`[a-zA-Z][a-zA-Z0-9-][^`][x]`)|(?:(?:|[a-zA-Z])[a-zA-Z0-9][x]) |
t_ENVIRONMENTAL_VARIABLE |
(?:\%[a-zA-Z][a-zA-Z0-9-]|\%`[a-zA-Z][a-zA-Z0-9-][^`]`) |
t_CONTEXTUAL_OPERATOR |
\$(\w*)? |
t_DATETIME |
@\d{4}(?:-\d{2}(?:-\d{2})?)?T(?:\d{2}(?::\d{2}(?::\d{2}(?:.\d{3}(?:[+|-]\d{2}(?::\d{2})?)?)?)?)?)? |
t_DATE |
@\d{4}(?:-\d{2}(?:-\d{2})?)? |
t_TIME |
\@T\d{2}(?::\d{2}(?::\d{2}(?:.\d{3}(?:[+|-]\d{2}(?::\d{2})?)?)?)?)? |
t_NUMBER |
-?\d+(.\d+)? |
t_STRING |
\'((?:[^\'\]|\.)*)\' |
t_IDENTIFIER |
(?:`[a-zA-Z][a-zA-Z0-9-][^`]`)|(?:(?:|[a-zA-Z])[a-zA-Z0-9]) |
t_NOT_EQUAL |
!= |
t_NOT_EQUIVALENT |
!~ |
t_GREATER_EQUAL_THAN |
|
t_LESS_EQUAL_THAN |
<= |
t_LESS_THAN |
< |
t_GREATER_THAN |
|
t_EQUAL |
= |
t_EQUIVALENT |
~ |
t_error_invalid_function |
[a-zA-Z][a-zA-Z_0-9]((?:.)?) |
t_error_doublequote_string |
\"([^\"]*)?\" |
Source code in fhircraft/fhir/path/lexer.py
tokenize
Maps a string to an iterator over tokens. In other words: [char] -> [token]
Source code in fhircraft/fhir/path/lexer.py
t_ignore_WHITESPACE
[\s]
Source code in fhircraft/fhir/path/lexer.py
t_ignore_COMMENT
\/*([\s\S]?)*\/|\/\/(.)
Source code in fhircraft/fhir/path/lexer.py
t_CHOICE_ELEMENT
t_ENVIRONMENTAL_VARIABLE
(?:\%[a-zA-Z][a-zA-Z0-9-]|\%`[a-zA-Z][a-zA-Z0-9-][^`]`)
Source code in fhircraft/fhir/path/lexer.py
t_CONTEXTUAL_OPERATOR
\$(\w*)?
Source code in fhircraft/fhir/path/lexer.py
t_DATETIME
@\d{4}(?:-\d{2}(?:-\d{2})?)?T(?:\d{2}(?::\d{2}(?::\d{2}(?:.\d{3}(?:[+|-]\d{2}(?::\d{2})?)?)?)?)?)?
Source code in fhircraft/fhir/path/lexer.py
t_DATE
@\d{4}(?:-\d{2}(?:-\d{2})?)?
Source code in fhircraft/fhir/path/lexer.py
t_TIME
\@T\d{2}(?::\d{2}(?::\d{2}(?:.\d{3}(?:[+|-]\d{2}(?::\d{2})?)?)?)?)?
Source code in fhircraft/fhir/path/lexer.py
t_NUMBER
-?\d+(.\d+)?
Source code in fhircraft/fhir/path/lexer.py
t_STRING
\'((?:[^\'\]|\.)*)\'
Source code in fhircraft/fhir/path/lexer.py
t_IDENTIFIER
(?:`[a-zA-Z][a-zA-Z0-9-][^`]`)|(?:(?:|[a-zA-Z])[a-zA-Z0-9])
Source code in fhircraft/fhir/path/lexer.py
t_NOT_EQUAL
t_NOT_EQUIVALENT
t_GREATER_EQUAL_THAN
t_LESS_EQUAL_THAN
t_LESS_THAN
t_GREATER_THAN
t_EQUAL
t_EQUIVALENT
t_error_invalid_function
[a-zA-Z][a-zA-Z_0-9]((?:.)?)
Source code in fhircraft/fhir/path/lexer.py
t_error_doublequote_string
\"([^\"]*)?\"
Source code in fhircraft/fhir/path/lexer.py
FhirPathParser
Path: fhircraft.fhir.path.parser.FhirPathParser
An LALR-parser for FHIRPath
Methods:
| Name | Description |
|---|---|
p_fhirpath_term_expression |
expression : term |
p_fhirpath_invocation_expression |
expression : expression '.' invocation |
p_fhirpath_indexer_expression |
expression : expression '[' expression ']' |
p_fhirpath_multiplicative_operation |
expression : expression '*' expression |
p_fhirpath_additive_operation |
expression : expression '+' expression |
p_fhirpath_type_operation |
expression : expression IS type_specifier |
p_fhirpath_union_operation |
expression : expression '|' expression |
p_fhirpath_equality_operation |
expression : expression EQUAL expression |
p_fhirpath_inequality_operation |
expression : expression GREATER_THAN expression |
p_fhirpath_membership_fhirpath_operation |
expression : expression IN expression |
p_fhirpath_and_operation |
expression : expression AND expression |
p_fhirpath_or_operation |
expression : expression OR expression |
p_fhirpath_implies_operation |
expression : expression IMPLIES expression |
p_fhirpath_term |
term : invocation |
p_fhirpath_parenthesized_expression |
parenthesized_expression : '(' expression ')' |
p_fhirpath_invocation |
invocation : element |
p_fhirpath_root |
root : ROOT_NODE |
p_fhirpath_element |
element : identifier |
p_fhirpath_typechoice_invocation |
type_choice : CHOICE_ELEMENT |
p_fhirpath_constant |
constant : ENVIRONMENTAL_VARIABLE |
p_fhirpath_contextual |
contextual : CONTEXTUAL_OPERATOR |
p_fhirpath_type_specifier |
type_specifier : identifier |
p_fhirpath_type_specifier_context |
type_specifier : identifier '.' identifier |
p_fhirpath_function |
function : function_name '(' arguments ')' |
p_fhirpath_type_function |
function : OFTYPE '(' type_specifier ')' |
p_fhirpath_function_name |
function_name : identifier |
p_fhirpath_function_arguments |
arguments : arguments ',' argument |
p_fhirpath_function_argument |
argument : expression |
p_fhirpath_identifier |
identifier : IDENTIFIER |
p_fhirpath_literal |
literal : number |
p_fhirpath_literal_empty |
literal : '{' '}' |
p_fhirpath_boolean |
boolean : BOOLEAN |
p_fhirpath_datetime |
datetime : DATETIME |
p_fhirpath_time |
time : TIME |
p_fhirpath_date |
date : DATE |
p_fhirpath_quantity |
quantity : number unit |
p_fhirpath_unit |
unit : STRING |
p_fhirpath_number |
number : INTEGER |
p_fhirpath_empty |
empty : |
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_term_expression
p_fhirpath_invocation_expression
p_fhirpath_indexer_expression
p_fhirpath_multiplicative_operation
expression : expression '*' expression | expression '/' expression | expression DIV expression | expression MOD expression
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_additive_operation
expression : expression '+' expression | expression '-' expression | expression '&' expression
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_type_operation
expression : expression IS type_specifier | expression AS type_specifier
p_fhirpath_union_operation
p_fhirpath_equality_operation
expression : expression EQUAL expression | expression EQUIVALENT expression | expression NOT_EQUAL expression | expression NOT_EQUIVALENT expression
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_inequality_operation
expression : expression GREATER_THAN expression | expression GREATER_EQUAL_THAN expression | expression LESS_THAN expression | expression LESS_EQUAL_THAN expression
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_membership_fhirpath_operation
expression : expression IN expression | expression CONTAINS expression
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_and_operation
p_fhirpath_or_operation
expression : expression OR expression | expression XOR expression
p_fhirpath_implies_operation
p_fhirpath_term
p_fhirpath_parenthesized_expression
p_fhirpath_invocation
p_fhirpath_root
p_fhirpath_element
p_fhirpath_typechoice_invocation
p_fhirpath_constant
p_fhirpath_contextual
contextual : CONTEXTUAL_OPERATOR
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_type_specifier
p_fhirpath_type_specifier_context
p_fhirpath_function
function : function_name '(' arguments ')'
Source code in fhircraft/fhir/path/parser.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
p_fhirpath_type_function
function : OFTYPE '(' type_specifier ')' | IS '(' type_specifier ')' | AS '(' type_specifier ')'
Source code in fhircraft/fhir/path/parser.py
p_fhirpath_function_name
p_fhirpath_function_arguments
p_fhirpath_function_argument
p_fhirpath_identifier
p_fhirpath_literal
p_fhirpath_literal_empty
p_fhirpath_boolean
p_fhirpath_datetime
p_fhirpath_time
p_fhirpath_date
p_fhirpath_quantity
p_fhirpath_unit
p_fhirpath_number
IteratorToTokenStream
Path: fhircraft.fhir.path.parser.IteratorToTokenStream