@synanetics/fhir-fml-convert
Version:
Converts StructureMaps written in FML to JSON ($convert operation)
1,051 lines (1,050 loc) • 99.3 kB
JavaScript
"use strict";
// Generated from fhirpath.g4 by ANTLR 4.9.0-SNAPSHOT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentifierContext = exports.QualifiedIdentifierContext = exports.TypeSpecifierContext = exports.PluralDateTimePrecisionContext = exports.DateTimePrecisionContext = exports.UnitContext = exports.QuantityContext = exports.ParamListContext = exports.FunctionContext = exports.TotalInvocationContext = exports.IndexInvocationContext = exports.ThisInvocationContext = exports.FunctionInvocationContext = exports.MemberInvocationContext = exports.InvocationContext = exports.ExternalConstantContext = exports.QuantityLiteralContext = exports.TimeLiteralContext = exports.DateTimeLiteralContext = exports.DateLiteralContext = exports.NumberLiteralContext = exports.StringLiteralContext = exports.BooleanLiteralContext = exports.NullLiteralContext = exports.LiteralContext = exports.ParenthesizedTermContext = exports.ExternalConstantTermContext = exports.LiteralTermContext = exports.InvocationTermContext = exports.TermContext = exports.ImpliesExpressionContext = exports.OrExpressionContext = exports.AndExpressionContext = exports.MembershipExpressionContext = exports.EqualityExpressionContext = exports.InequalityExpressionContext = exports.UnionExpressionContext = exports.TypeExpressionContext = exports.AdditiveExpressionContext = exports.MultiplicativeExpressionContext = exports.PolarityExpressionContext = exports.IndexerExpressionContext = exports.InvocationExpressionContext = exports.TermExpressionContext = exports.ExpressionContext = exports.fhirpathParser = void 0;
const ATN_1 = require("antlr4ts/atn/ATN");
const ATNDeserializer_1 = require("antlr4ts/atn/ATNDeserializer");
const FailedPredicateException_1 = require("antlr4ts/FailedPredicateException");
const NoViableAltException_1 = require("antlr4ts/NoViableAltException");
const Parser_1 = require("antlr4ts/Parser");
const ParserRuleContext_1 = require("antlr4ts/ParserRuleContext");
const ParserATNSimulator_1 = require("antlr4ts/atn/ParserATNSimulator");
const RecognitionException_1 = require("antlr4ts/RecognitionException");
const Token_1 = require("antlr4ts/Token");
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
const Utils = __importStar(require("antlr4ts/misc/Utils"));
class fhirpathParser extends Parser_1.Parser {
static T__0 = 1;
static T__1 = 2;
static T__2 = 3;
static T__3 = 4;
static T__4 = 5;
static T__5 = 6;
static T__6 = 7;
static T__7 = 8;
static T__8 = 9;
static T__9 = 10;
static T__10 = 11;
static T__11 = 12;
static T__12 = 13;
static T__13 = 14;
static T__14 = 15;
static T__15 = 16;
static T__16 = 17;
static T__17 = 18;
static T__18 = 19;
static T__19 = 20;
static T__20 = 21;
static T__21 = 22;
static T__22 = 23;
static T__23 = 24;
static T__24 = 25;
static T__25 = 26;
static T__26 = 27;
static T__27 = 28;
static T__28 = 29;
static T__29 = 30;
static T__30 = 31;
static T__31 = 32;
static T__32 = 33;
static T__33 = 34;
static T__34 = 35;
static T__35 = 36;
static T__36 = 37;
static T__37 = 38;
static T__38 = 39;
static T__39 = 40;
static T__40 = 41;
static T__41 = 42;
static T__42 = 43;
static T__43 = 44;
static T__44 = 45;
static T__45 = 46;
static T__46 = 47;
static T__47 = 48;
static T__48 = 49;
static T__49 = 50;
static T__50 = 51;
static T__51 = 52;
static T__52 = 53;
static T__53 = 54;
static DATE = 55;
static DATETIME = 56;
static TIME = 57;
static IDENTIFIER = 58;
static DELIMITEDIDENTIFIER = 59;
static STRING = 60;
static NUMBER = 61;
static WS = 62;
static COMMENT = 63;
static LINE_COMMENT = 64;
static RULE_expression = 0;
static RULE_term = 1;
static RULE_literal = 2;
static RULE_externalConstant = 3;
static RULE_invocation = 4;
static RULE_function = 5;
static RULE_paramList = 6;
static RULE_quantity = 7;
static RULE_unit = 8;
static RULE_dateTimePrecision = 9;
static RULE_pluralDateTimePrecision = 10;
static RULE_typeSpecifier = 11;
static RULE_qualifiedIdentifier = 12;
static RULE_identifier = 13;
// tslint:disable:no-trailing-whitespace
static ruleNames = [
"expression", "term", "literal", "externalConstant", "invocation", "function",
"paramList", "quantity", "unit", "dateTimePrecision", "pluralDateTimePrecision",
"typeSpecifier", "qualifiedIdentifier", "identifier",
];
static _LITERAL_NAMES = [
undefined, "'.'", "'['", "']'", "'+'", "'-'", "'*'", "'/'", "'div'", "'mod'",
"'&'", "'is'", "'as'", "'|'", "'<='", "'<'", "'>'", "'>='", "'='", "'~'",
"'!='", "'!~'", "'in'", "'contains'", "'and'", "'or'", "'xor'", "'implies'",
"'('", "')'", "'{'", "'}'", "'true'", "'false'", "'%'", "'$this'", "'$index'",
"'$total'", "','", "'year'", "'month'", "'week'", "'day'", "'hour'", "'minute'",
"'second'", "'millisecond'", "'years'", "'months'", "'weeks'", "'days'",
"'hours'", "'minutes'", "'seconds'", "'milliseconds'",
];
static _SYMBOLIC_NAMES = [
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, undefined, undefined, undefined, undefined, "DATE",
"DATETIME", "TIME", "IDENTIFIER", "DELIMITEDIDENTIFIER", "STRING", "NUMBER",
"WS", "COMMENT", "LINE_COMMENT",
];
static VOCABULARY = new VocabularyImpl_1.VocabularyImpl(fhirpathParser._LITERAL_NAMES, fhirpathParser._SYMBOLIC_NAMES, []);
// @Override
// @NotNull
get vocabulary() {
return fhirpathParser.VOCABULARY;
}
// tslint:enable:no-trailing-whitespace
// @Override
get grammarFileName() { return "fhirpath.g4"; }
// @Override
get ruleNames() { return fhirpathParser.ruleNames; }
// @Override
get serializedATN() { return fhirpathParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new FailedPredicateException_1.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this._interp = new ParserATNSimulator_1.ParserATNSimulator(fhirpathParser._ATN, this);
}
// @RuleVersion(0)
expression(_p) {
if (_p === undefined) {
_p = 0;
}
let _parentctx = this._ctx;
let _parentState = this.state;
let _localctx = new ExpressionContext(this._ctx, _parentState);
let _prevctx = _localctx;
let _startState = 0;
this.enterRecursionRule(_localctx, 0, fhirpathParser.RULE_expression, _p);
let _la;
try {
let _alt;
this.enterOuterAlt(_localctx, 1);
{
this.state = 32;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case fhirpathParser.T__10:
case fhirpathParser.T__11:
case fhirpathParser.T__21:
case fhirpathParser.T__22:
case fhirpathParser.T__27:
case fhirpathParser.T__29:
case fhirpathParser.T__31:
case fhirpathParser.T__32:
case fhirpathParser.T__33:
case fhirpathParser.T__34:
case fhirpathParser.T__35:
case fhirpathParser.T__36:
case fhirpathParser.DATE:
case fhirpathParser.DATETIME:
case fhirpathParser.TIME:
case fhirpathParser.IDENTIFIER:
case fhirpathParser.DELIMITEDIDENTIFIER:
case fhirpathParser.STRING:
case fhirpathParser.NUMBER:
{
_localctx = new TermExpressionContext(_localctx);
this._ctx = _localctx;
_prevctx = _localctx;
this.state = 29;
this.term();
}
break;
case fhirpathParser.T__3:
case fhirpathParser.T__4:
{
_localctx = new PolarityExpressionContext(_localctx);
this._ctx = _localctx;
_prevctx = _localctx;
this.state = 30;
_la = this._input.LA(1);
if (!(_la === fhirpathParser.T__3 || _la === fhirpathParser.T__4)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 31;
this.expression(11);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
this._ctx._stop = this._input.tryLT(-1);
this.state = 74;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
if (this._parseListeners != null) {
this.triggerExitRuleEvent();
}
_prevctx = _localctx;
{
this.state = 72;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 1, this._ctx)) {
case 1:
{
_localctx = new MultiplicativeExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 34;
if (!(this.precpred(this._ctx, 10))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 10)");
}
this.state = 35;
_la = this._input.LA(1);
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << fhirpathParser.T__5) | (1 << fhirpathParser.T__6) | (1 << fhirpathParser.T__7) | (1 << fhirpathParser.T__8))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 36;
this.expression(11);
}
break;
case 2:
{
_localctx = new AdditiveExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 37;
if (!(this.precpred(this._ctx, 9))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 9)");
}
this.state = 38;
_la = this._input.LA(1);
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << fhirpathParser.T__3) | (1 << fhirpathParser.T__4) | (1 << fhirpathParser.T__9))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 39;
this.expression(10);
}
break;
case 3:
{
_localctx = new UnionExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 40;
if (!(this.precpred(this._ctx, 7))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 7)");
}
this.state = 41;
this.match(fhirpathParser.T__12);
this.state = 42;
this.expression(8);
}
break;
case 4:
{
_localctx = new InequalityExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 43;
if (!(this.precpred(this._ctx, 6))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 6)");
}
this.state = 44;
_la = this._input.LA(1);
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << fhirpathParser.T__13) | (1 << fhirpathParser.T__14) | (1 << fhirpathParser.T__15) | (1 << fhirpathParser.T__16))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 45;
this.expression(7);
}
break;
case 5:
{
_localctx = new EqualityExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 46;
if (!(this.precpred(this._ctx, 5))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");
}
this.state = 47;
_la = this._input.LA(1);
if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << fhirpathParser.T__17) | (1 << fhirpathParser.T__18) | (1 << fhirpathParser.T__19) | (1 << fhirpathParser.T__20))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 48;
this.expression(6);
}
break;
case 6:
{
_localctx = new MembershipExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 49;
if (!(this.precpred(this._ctx, 4))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");
}
this.state = 50;
_la = this._input.LA(1);
if (!(_la === fhirpathParser.T__21 || _la === fhirpathParser.T__22)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 51;
this.expression(5);
}
break;
case 7:
{
_localctx = new AndExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 52;
if (!(this.precpred(this._ctx, 3))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 3)");
}
this.state = 53;
this.match(fhirpathParser.T__23);
this.state = 54;
this.expression(4);
}
break;
case 8:
{
_localctx = new OrExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 55;
if (!(this.precpred(this._ctx, 2))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 2)");
}
this.state = 56;
_la = this._input.LA(1);
if (!(_la === fhirpathParser.T__24 || _la === fhirpathParser.T__25)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 57;
this.expression(3);
}
break;
case 9:
{
_localctx = new ImpliesExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 58;
if (!(this.precpred(this._ctx, 1))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 1)");
}
this.state = 59;
this.match(fhirpathParser.T__26);
this.state = 60;
this.expression(2);
}
break;
case 10:
{
_localctx = new InvocationExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 61;
if (!(this.precpred(this._ctx, 13))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 13)");
}
this.state = 62;
this.match(fhirpathParser.T__0);
this.state = 63;
this.invocation();
}
break;
case 11:
{
_localctx = new IndexerExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 64;
if (!(this.precpred(this._ctx, 12))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 12)");
}
this.state = 65;
this.match(fhirpathParser.T__1);
this.state = 66;
this.expression(0);
this.state = 67;
this.match(fhirpathParser.T__2);
}
break;
case 12:
{
_localctx = new TypeExpressionContext(new ExpressionContext(_parentctx, _parentState));
this.pushNewRecursionContext(_localctx, _startState, fhirpathParser.RULE_expression);
this.state = 69;
if (!(this.precpred(this._ctx, 8))) {
throw this.createFailedPredicateException("this.precpred(this._ctx, 8)");
}
this.state = 70;
_la = this._input.LA(1);
if (!(_la === fhirpathParser.T__10 || _la === fhirpathParser.T__11)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
this.state = 71;
this.typeSpecifier();
}
break;
}
}
}
this.state = 76;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.unrollRecursionContexts(_parentctx);
}
return _localctx;
}
// @RuleVersion(0)
term() {
let _localctx = new TermContext(this._ctx, this.state);
this.enterRule(_localctx, 2, fhirpathParser.RULE_term);
try {
this.state = 84;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case fhirpathParser.T__10:
case fhirpathParser.T__11:
case fhirpathParser.T__21:
case fhirpathParser.T__22:
case fhirpathParser.T__34:
case fhirpathParser.T__35:
case fhirpathParser.T__36:
case fhirpathParser.IDENTIFIER:
case fhirpathParser.DELIMITEDIDENTIFIER:
_localctx = new InvocationTermContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 77;
this.invocation();
}
break;
case fhirpathParser.T__29:
case fhirpathParser.T__31:
case fhirpathParser.T__32:
case fhirpathParser.DATE:
case fhirpathParser.DATETIME:
case fhirpathParser.TIME:
case fhirpathParser.STRING:
case fhirpathParser.NUMBER:
_localctx = new LiteralTermContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 78;
this.literal();
}
break;
case fhirpathParser.T__33:
_localctx = new ExternalConstantTermContext(_localctx);
this.enterOuterAlt(_localctx, 3);
{
this.state = 79;
this.externalConstant();
}
break;
case fhirpathParser.T__27:
_localctx = new ParenthesizedTermContext(_localctx);
this.enterOuterAlt(_localctx, 4);
{
this.state = 80;
this.match(fhirpathParser.T__27);
this.state = 81;
this.expression(0);
this.state = 82;
this.match(fhirpathParser.T__28);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
literal() {
let _localctx = new LiteralContext(this._ctx, this.state);
this.enterRule(_localctx, 4, fhirpathParser.RULE_literal);
let _la;
try {
this.state = 95;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 4, this._ctx)) {
case 1:
_localctx = new NullLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 86;
this.match(fhirpathParser.T__29);
this.state = 87;
this.match(fhirpathParser.T__30);
}
break;
case 2:
_localctx = new BooleanLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 88;
_la = this._input.LA(1);
if (!(_la === fhirpathParser.T__31 || _la === fhirpathParser.T__32)) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
}
break;
case 3:
_localctx = new StringLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 3);
{
this.state = 89;
this.match(fhirpathParser.STRING);
}
break;
case 4:
_localctx = new NumberLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 4);
{
this.state = 90;
this.match(fhirpathParser.NUMBER);
}
break;
case 5:
_localctx = new DateLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 5);
{
this.state = 91;
this.match(fhirpathParser.DATE);
}
break;
case 6:
_localctx = new DateTimeLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 6);
{
this.state = 92;
this.match(fhirpathParser.DATETIME);
}
break;
case 7:
_localctx = new TimeLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 7);
{
this.state = 93;
this.match(fhirpathParser.TIME);
}
break;
case 8:
_localctx = new QuantityLiteralContext(_localctx);
this.enterOuterAlt(_localctx, 8);
{
this.state = 94;
this.quantity();
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
externalConstant() {
let _localctx = new ExternalConstantContext(this._ctx, this.state);
this.enterRule(_localctx, 6, fhirpathParser.RULE_externalConstant);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 97;
this.match(fhirpathParser.T__33);
this.state = 100;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case fhirpathParser.T__10:
case fhirpathParser.T__11:
case fhirpathParser.T__21:
case fhirpathParser.T__22:
case fhirpathParser.IDENTIFIER:
case fhirpathParser.DELIMITEDIDENTIFIER:
{
this.state = 98;
this.identifier();
}
break;
case fhirpathParser.STRING:
{
this.state = 99;
this.match(fhirpathParser.STRING);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
invocation() {
let _localctx = new InvocationContext(this._ctx, this.state);
this.enterRule(_localctx, 8, fhirpathParser.RULE_invocation);
try {
this.state = 107;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 6, this._ctx)) {
case 1:
_localctx = new MemberInvocationContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 102;
this.identifier();
}
break;
case 2:
_localctx = new FunctionInvocationContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 103;
this.function();
}
break;
case 3:
_localctx = new ThisInvocationContext(_localctx);
this.enterOuterAlt(_localctx, 3);
{
this.state = 104;
this.match(fhirpathParser.T__34);
}
break;
case 4:
_localctx = new IndexInvocationContext(_localctx);
this.enterOuterAlt(_localctx, 4);
{
this.state = 105;
this.match(fhirpathParser.T__35);
}
break;
case 5:
_localctx = new TotalInvocationContext(_localctx);
this.enterOuterAlt(_localctx, 5);
{
this.state = 106;
this.match(fhirpathParser.T__36);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
function() {
let _localctx = new FunctionContext(this._ctx, this.state);
this.enterRule(_localctx, 10, fhirpathParser.RULE_function);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 109;
this.identifier();
this.state = 110;
this.match(fhirpathParser.T__27);
this.state = 112;
this._errHandler.sync(this);
_la = this._input.LA(1);
if ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << fhirpathParser.T__3) | (1 << fhirpathParser.T__4) | (1 << fhirpathParser.T__10) | (1 << fhirpathParser.T__11) | (1 << fhirpathParser.T__21) | (1 << fhirpathParser.T__22) | (1 << fhirpathParser.T__27) | (1 << fhirpathParser.T__29))) !== 0) || ((((_la - 32)) & ~0x1F) === 0 && ((1 << (_la - 32)) & ((1 << (fhirpathParser.T__31 - 32)) | (1 << (fhirpathParser.T__32 - 32)) | (1 << (fhirpathParser.T__33 - 32)) | (1 << (fhirpathParser.T__34 - 32)) | (1 << (fhirpathParser.T__35 - 32)) | (1 << (fhirpathParser.T__36 - 32)) | (1 << (fhirpathParser.DATE - 32)) | (1 << (fhirpathParser.DATETIME - 32)) | (1 << (fhirpathParser.TIME - 32)) | (1 << (fhirpathParser.IDENTIFIER - 32)) | (1 << (fhirpathParser.DELIMITEDIDENTIFIER - 32)) | (1 << (fhirpathParser.STRING - 32)) | (1 << (fhirpathParser.NUMBER - 32)))) !== 0)) {
{
this.state = 111;
this.paramList();
}
}
this.state = 114;
this.match(fhirpathParser.T__28);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
paramList() {
let _localctx = new ParamListContext(this._ctx, this.state);
this.enterRule(_localctx, 12, fhirpathParser.RULE_paramList);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 116;
this.expression(0);
this.state = 121;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === fhirpathParser.T__37) {
{
{
this.state = 117;
this.match(fhirpathParser.T__37);
this.state = 118;
this.expression(0);
}
}
this.state = 123;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
quantity() {
let _localctx = new QuantityContext(this._ctx, this.state);
this.enterRule(_localctx, 14, fhirpathParser.RULE_quantity);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 124;
this.match(fhirpathParser.NUMBER);
this.state = 126;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 9, this._ctx)) {
case 1:
{
this.state = 125;
this.unit();
}
break;
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
unit() {
let _localctx = new UnitContext(this._ctx, this.state);
this.enterRule(_localctx, 16, fhirpathParser.RULE_unit);
try {
this.state = 131;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case fhirpathParser.T__38:
case fhirpathParser.T__39:
case fhirpathParser.T__40:
case fhirpathParser.T__41:
case fhirpathParser.T__42:
case fhirpathParser.T__43:
case fhirpathParser.T__44:
case fhirpathParser.T__45:
this.enterOuterAlt(_localctx, 1);
{
this.state = 128;
this.dateTimePrecision();
}
break;
case fhirpathParser.T__46:
case fhirpathParser.T__47:
case fhirpathParser.T__48:
case fhirpathParser.T__49:
case fhirpathParser.T__50:
case fhirpathParser.T__51:
case fhirpathParser.T__52:
case fhirpathParser.T__53:
this.enterOuterAlt(_localctx, 2);
{
this.state = 129;
this.pluralDateTimePrecision();
}
break;
case fhirpathParser.STRING:
this.enterOuterAlt(_localctx, 3);
{
this.state = 130;
this.match(fhirpathParser.STRING);
}
break;
default:
throw new NoViableAltException_1.NoViableAltException(this);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
dateTimePrecision() {
let _localctx = new DateTimePrecisionContext(this._ctx, this.state);
this.enterRule(_localctx, 18, fhirpathParser.RULE_dateTimePrecision);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 133;
_la = this._input.LA(1);
if (!(((((_la - 39)) & ~0x1F) === 0 && ((1 << (_la - 39)) & ((1 << (fhirpathParser.T__38 - 39)) | (1 << (fhirpathParser.T__39 - 39)) | (1 << (fhirpathParser.T__40 - 39)) | (1 << (fhirpathParser.T__41 - 39)) | (1 << (fhirpathParser.T__42 - 39)) | (1 << (fhirpathParser.T__43 - 39)) | (1 << (fhirpathParser.T__44 - 39)) | (1 << (fhirpathParser.T__45 - 39)))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {
this.matchedEOF = true;
}
this._errHandler.reportMatch(this);
this.consume();
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
pluralDateTimePrecision() {
let _localctx = new PluralDateTimePrecisionContext(this._ctx, this.state);
this.enterRule(_localctx, 20, fhirpathParser.RULE_pluralDateTimePrecision);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 135;
_la = this._input.LA(1);
if (!(((((_la - 47)) & ~0x1F) === 0 && ((1 << (_la - 47)) & ((1 << (fhirpathParser.T__46 - 47)) | (1 << (fhirpathParser.T__47 - 47)) | (1 << (fhirpathParser.T__48 - 47)) | (1 << (fhirpathParser.T__49 - 47)) | (1 << (fhirpathParser.T__50 - 47)) | (1 << (fhirpathParser.T__51 - 47)) | (1 << (fhirpathParser.T__52 - 47)) | (1 << (fhirpathParser.T__53 - 47)))) !== 0))) {
this._errHandler.recoverInline(this);
}
else {
if (this._input.LA(1) === Token_1.Token.EOF) {