UNPKG

@sap/cds-compiler

Version:

CDS (Core Data Services) compiler and backends

2,122 lines 139 kB
// Parser generated by redepage v0.4.0 'use strict;' const { XsnSource, XsnArtifact, XsnName } = require( '../compiler/xsn-model' ) const { isValidEnumValue } = require( '../compiler/base' ) const AstBuildingParser = require('../parsers/AstBuildingParser') const keywords={ abstract:0, action:0, actions:0, all:1, and:0, annotate:0, annotation:0, any:1, array:0, as:1, asc:0, aspect:0, association:0, between:0, by:1, case:1, cast:1, columns:0, composition:0, context:0, cross:0, current:0, default:0, define:0, definitions:0, desc:0, distinct:1, element:0, elements:0, else:0, end:0, entity:0, enum:0, escape:0, event:0, exact:0, except:0, excluding:0, exists:1, extend:0, false:1, first:0, floating:0, following:0, from:1, full:0, function:0, group:0, having:0, in:1, inner:0, intersect:0, into:0, is:0, join:0, key:1, last:0, left:0, like:0, limit:0, localized:0, many:0, minus:0, mixin:0, namespace:0, new:0, not:1, null:1, nulls:0, of:1, offset:0, on:1, one:0, or:0, order:0, outer:0, over:0, parameters:0, partition:0, preceding:0, projection:0, redirected:0, returns:0, right:0, row:0, rows:0, select:1, service:0, some:1, stored:0, then:0, to:0, true:1, type:0, unbounded:0, union:0, up:0, using:0, variable:0, view:0, virtual:0, when:1, where:1, with:1, } const table=[ 'start', { namespace:[2,16,,'namespaceRestriction'], using:[2,19], '@':[2,10,,,,'namespaceRestriction'],type:'@',view:'@',event:'@',action:'@',aspect:'@',define:'@',entity:'@',extend:'@',context:'@',service:'@',abstract:'@',annotate:'@',function:'@',annotation:'@', '':3 }, { ';':['c',1,,,,'afterBrace'], EOF:3, '@':['g',1,,'afterBrace','orSloppy'],type:'@',view:'@',event:'@',using:'@',action:'@',aspect:'@',define:'@',entity:'@',extend:'@',context:'@',service:'@',abstract:'@',annotate:'@',function:'@',namespace:'@',annotation:'@', }, ['m',0,'EOF'], 'artifactsBlock', ['m',6,'{'], {Id:[7,10],'@':'Id','':8}, { ';':['c',6,,,,'afterBrace'], '}':8, '@':['g',6,,'afterBrace','orSloppy'],type:'@',view:'@',event:'@',action:'@',aspect:'@',define:'@',entity:'@',extend:'@',context:'@',service:'@',abstract:'@',annotate:'@',function:'@',annotation:'@', }, ['m',0,'}',,,'afterBrace'], 'artifactDefOrExtend', {'@':[10,782],'':11}, { type:12,view:'type',event:'type',action:'type',aspect:'type',entity:'type',context:'type',service:'type',abstract:'type',function:'type',annotation:'type', define:['ck',12], extend:['ck',13,,'extensionRestriction'], annotate:['ck',14,,'extensionRestriction'], }, { service:[0,43], context:[0,48], annotation:[0,53,,'vocabularyRestriction'], type:[0,58], aspect:[0,63],abstract:'aspect', entity:[0,73], view:[0,88,,'hide_'], event:[0,100], action:[0,112], function:[0,118], }, { Id:[0,227], service:[0,248,[]], context:[0,255,[],'hide_'], type:[0,262,[],'hide_'], aspect:[0,274,[],'hide_'],entity:'aspect', projection:[0,285,[],'hide_'], }, [0,214], 'namespaceDeclaration', ['mk',17,'namespace'], [0,35], 'usingDeclaration', ['mk',20,'using'], { from:['ck',21], Id:[22,31], '{':24, }, ['m',0,'String'], {from:['ck',23],'':0}, ['m',0,'String'], ['m',25,'{'], {Id:[26,31],'':27}, { ',':['c',25], '}':27, }, ['m',28,'}',,,'afterBrace'], {from:['ck',29],'':0}, ['m',0,'String'], 'usingProxy', [32,39], {as:['ck',33],'':0}, ['mi',0], 'namePath', ['mi',36], {'.':['c',37],'':0}, ['my',36], 'simplePath', ['mi',40], {'.':['c',41],'':0}, ['my',40], 'serviceDef', ['mk',44,'service',,,'vocabularyRestriction'], [45,35], {'@':[45,788],'':46}, {'{':[0,5],'':0}, 'contextDef', ['mk',49,'context',,,'vocabularyRestriction'], [50,35], {'@':[50,788],'':51}, {'{':[0,5],'':0}, 'annotationDef', ['mk',54,'annotation'], [55,35], {'@':[55,788],'':56}, [0,357], 'typeDef', ['mk',59,'type'], [60,35], {'@':[60,788],'':61}, [0,357], 'aspectDef', { aspect:['ck',65], abstract:['ck',64,,'hide_'], }, ['mk',65,'entity'], [66,35], {'@':[66,788],'':67}, { '{':[71,157], ':':['c',68], '':0 }, {Id:[69,39],'':70}, { ',':['c',68], '{':70, '':0 }, [71,157], {actions:[0,124],'':0}, 'entityDef', ['mk',74,'entity'], [75,35], {'@':[75,788],'':76}, {'(':[77,141],'':77}, { '{':81, ':':['c',78], as:['ck',82], }, {Id:79}, {Id:[80,39],'':81}, { ',':['c',79], '{':81, }, [86,157], { '(':[86,461],select:'(', projection:['g',83,,,'sloppyOn','afterBrace'], }, [84,455,,,'sloppyOn','afterBrace'], {group:[85,619],where:'group',having:'group','':85}, {limit:[86,631],order:'limit','':86}, {actions:[0,124],'':0}, 'viewDef', ['mk',89,'view'], [90,35], {'@':[90,788],'':91}, { '(':[97,141], with:['ck',92,,'hide_'], '':97 }, ['mk',93,'parameters'], [94,146], {',':['c',95],'':96}, [94,146], ['g',97], ['mk',98,'as'], [0,461], 'eventDef', ['mk',101,'event'], [102,35], {'@':[102,788],'':103}, { '{':[0,157], ':':['c',104], }, { '{':[0,157], Id:[105,39], projection:[0,455,[]], }, {',':106,'{':',','':110}, {',':['c',107],'':109}, {Id:[108,39],'':109}, { ',':['c',107], '{':109, }, [0,157], {'@':[110,782],'':0}, 'actionMainDef', ['mk',113,'action'], [114,35], {'@':[114,788],'':115}, [116,141], {returns:[0,153],'':0}, 'functionMainDef', ['mk',119,'function'], [120,35], {'@':[120,788],'':121}, [122,141], [0,153], 'actionsBlock', ['mk',125,'actions'], ['m',126,'{'], {Id:[127,130],'@':'Id','':128}, { ';':['c',126], '}':128, '@':['g',126,,'afterBrace'],action:'@',function:'@', }, ['m',0,'}',,,'afterBrace'], 'boundActionFunctionDef', {'@':[130,782],'':131}, { action:['ck',132], function:['ck',136], }, ['mi',133], {'@':[133,788],'':134}, [135,141], {returns:[0,153],'':0}, ['mi',137], {'@':[137,788],'':138}, [139,141], [0,153], 'paramsList', ['m',142,'('], {Id:[143,146],'@':'Id','':144}, { ',':['c',142], ')':144, }, ['m',0,')'], 'paramDef', {'@':[146,782],'':147}, ['my',148], {'@':[148,788],'':149}, { '{':[150,157], ':':['c',151], }, {not:[0,448],null:'not','':0}, [0,367], 'returnsSpec', ['mk',154,'returns',,'default','elementRestriction'], {'@':[154,782],'':155}, [0,367], 'elementsBlock', ['m',158,'{'], {Id:[159,162],'@':'Id','':160}, { ';':['c',158], '}':160, Id:['g',158,,'afterBrace'],'@':'Id',key:'Id', }, ['m',0,'}',,,'afterBrace'], 'elementDef', {'@':[162,782],'':163}, {virtual:['ck',164,['Id','key']],'':164}, {key:['ck',165],'':165}, {element:['ck',166,['Id'],'hide_'],'':166}, ['mi',167,,,'elem','elementRestriction'], {'@':[167,788],'':168}, { '{':[169,157], ':':['c',170], '':171 }, {not:[171,448],null:'not','':171}, [171,367], {'=':['c',172,,'elementRestriction','calc'],'':0}, [173,653], {stored:['ck',174],'':174}, ['g',175], {'@':[175,782,,'elementRestriction','anno'],'':0}, 'enumSymbolsBlock', ['mk',178,'enum'], ['m',179,'{'], {Id:[180,183],'@':'Id','':181}, { ';':['c',179], '}':181, Id:['g',179,,'fail'],'@':'Id', }, ['m',0,'}',,,'afterBrace'], 'enumSymbolDef', {'@':[183,782],'':184}, ['mi',185], {'@':[185,782],'':186}, {'=':['c',187],'':0}, { String:['c',189], Number:['c',189], '+':['c',188],'-':'+', Id:[189,779,,'hide_'],'#':'Id',QuotedLiteral:'Id', }, ['m',189,'Number'], ['g',190], {'@':[190,782],'':0}, 'foreignKeysBlock', ['m',193,'{'], {Id:[194,197],'@':'Id','':195}, { ',':['c',193], '}':195, }, ['m',0,'}'], 'foreignKeyDef', {'@':[197,782],'':198}, [199,39], {as:['ck',200],'':0}, ['mi',0], 'mixinElementDef', ['mi',203], ['m',204,':'], { association:['ck',205], composition:['ck',207], }, {'[':[206,436],'':206}, ['mk',209,'to'], {'[':[208,436],'':208}, ['mk',209,'of'], {one:['ck',210,['Id'],'noRepeatedCardinality'],many:'one','':210}, [211,39], ['mk',212,'on'], [0,651], 'annotateArtifact', [215,35], { ':':['c',216], with:['ck',221], '':221 }, [217,35], {with:['ck',218],'':218}, ['g',219], {'@':[219,782],'':220}, {'{':[0,318],'':0}, ['g',222], {'@':[222,782],'':223}, {'(':[224,305],'':224}, { returns:[0,314], '{':[225,318], '':225 }, {actions:[0,293],'':0}, 'extendArtifact', [228,35], { ':':['c',229], with:['ck',238], '':235 }, [230,35], {with:['ck',231],'':231}, ['g',232], {'@':[232,782],'':233}, { '{':234, elements:['ck',234], enum:[0,344], '(':[0,427], '':0 }, [0,328], {'@':[235,782],'':236}, {'{':[237,328],'':0}, {actions:[0,124],'':0}, {'@':[238,782],'':239}, { Id:[240,39], '{':244, elements:['ck',244,['{']], actions:[0,124,[]], enum:[0,344,[]], '(':[0,427], group:[0,614,[]],limit:'group',order:'group',where:'group',having:'group',columns:'group', definitions:['ck',246,['{']], '':0 }, {',':['c',241],'':242}, [240,39], {'{':[243,328],'':243}, {actions:[0,124],'':0}, [245,328], {actions:[0,124],'':0}, [0,5], 'extendService', ['mk',249,'service'], [250,35], {with:['ck',251],'':251}, ['g',252], {'@':[252,782],'':253}, {'{':[0,5],'':0}, 'extendContext', ['mk',256,'context'], [257,35], {with:['ck',258],'':258}, ['g',259], {'@':[259,782],'':260}, {'{':[0,5],'':0}, 'extendType', ['mk',263,'type'], [264,35], {with:['ck',267],'':265}, {'@':[265,782],'':266}, {'{':[0,328],'':0}, {'@':[267,782],'':268}, { Id:[269,39], '{':272, elements:['ck',272,['{']], enum:[0,177,[]], '(':[0,427], '':0 }, {',':['c',270],'':271}, [269,39], {'{':[0,328],'':0}, [0,328], 'extendEntityOrAspect', {aspect:['ck',275],entity:'aspect'}, [276,35], {with:['ck',278],'':277}, {'@':[277,782],'':282}, {'@':[278,782],'':279}, {Id:[280,39],'':['g',282,[]],actions:''}, {',':['c',281],'':282}, [280,39], {'{':[283,328],'':283}, {actions:[0,124],'':0}, 'extendProjection', ['mk',286,'projection'], [287,35], {with:['ck',288],'':288}, ['g',289], {'@':[289,782],'':290}, {'{':[291,564],'':291}, {actions:[0,124],'':0}, 'annotateActionsBlock', ['mk',294,'actions'], ['m',295,'{'], {Id:[296,299],'@':'Id','':297}, { ';':['c',295], '}':297, Id:['g',295,,'afterBrace'],'@':'Id', }, ['m',0,'}',,,'afterBrace'], 'annotateBoundAction', {'@':[299,782],'':300}, ['mi',301], {'@':[301,782],'':302}, {'(':[303,305],'':303}, {returns:[0,314],'':0}, 'annotateParamsBlock', ['m',306,'('], {Id:[307,310],'@':'Id','':308}, { ',':['c',306], ')':308, }, ['m',0,')'], 'annotateParam', {'@':[310,782],'':311}, ['mi',312], {'@':[312,782],'':0}, 'annotateReturns', ['mk',315,'returns'], {'@':[315,782],'':316}, {'{':[0,318],'':0}, 'annotateElementsBlock', ['m',319,'{'], {Id:[320,323],'@':'Id','':321}, { ';':['c',319], '}':321, Id:['g',319,,'afterBrace'],'@':'Id', }, ['m',0,'}',,,'afterBrace'], 'annotateElement', {'@':[323,782],'':324}, ['mi',325], {'@':[325,782],'':326}, {'{':[0,318],'':0}, 'extendElementsBlock', ['m',329,'{'], {Id:[330,333],'@':'Id','':331}, { ';':['c',329], '}':331, Id:['g',329,,'afterBrace'],'@':'Id',key:'Id', }, ['m',0,'}',,,'afterBrace'], 'elementDefOrExtend', {'@':[333,782],'':334}, { Id:[0,162],'@':'Id',key:'Id', extend:['ck',335,['Id']], }, {element:['ck',336,['Id']],'':336}, ['mi',337], {with:['ck',340],'':338}, {'@':[338,782],'':339}, {'{':[0,328],'':0}, {'@':[340,782],'':341}, { '{':342, elements:['ck',342], enum:[0,344], '(':[0,427], '':0 }, [0,328], 'extendEnumSymbolsBlock', ['mk',345,'enum'], ['m',346,'{'], {Id:[347,350],'@':'Id','':348}, { ';':['c',346], '}':348, Id:['g',346,,'fail'],'@':'Id', }, ['m',0,'}',,,'afterBrace'], 'enumSymbolDefOrExtend', {'@':[350,782],'':351}, { Id:[0,183],'@':'Id', extend:['ck',352,['Id']], }, ['mi',353], {with:['ck',354],'':354}, ['g',355], {'@':[355,782],'':0}, 'typeOrIncludesSpec', { '{':[358,157], ':':['c',359], }, {not:[0,448],null:'not','':0}, { projection:[0,455,[]], '{':[0,367,[]],many:'{',type:'{',array:'{',localized:'{',association:'{',composition:'{', Id:[360,39], }, { ',':361,'{':',', '(':[365,414],':':'(', '@':[0,368],not:'@',enum:'@',null:'@',default:'@', '':0 }, {',':['c',362],'':363}, { Id:[361,39], '{':363, }, [364,157], {not:[0,448],null:'not','':0}, {'@':[0,368],not:'@',enum:'@',null:'@',default:'@','':0}, 'typeExpression', { Id:[368,413], type:[368,405,[]], localized:['ck',377,['Id']], association:['ck',379,['[','to'],,'calc','elementRestriction'], composition:['ck',383,['[','of'],,'calc','elementRestriction'], array:['ck',387,['of'],,'calc','elementRestriction'], many:['ck',388,['Id','{'],,'calc','elementRestriction'], '{':[393,157,,,'calc','elementRestriction'], }, ['g',369], {'@':[369,782],'':370}, {not:[371,448,,'elementRestriction','notNull'],null:'not','':372}, {'@':[371,782],'':372}, { enum:[373,177,,,'anno','elementRestriction'], '@':[0,402],not:'@',null:'@',default:'@', '':0 }, {not:[374,448,,'elementRestriction','notNull'],null:'not','':374}, {default:['ck',375,,'elementRestriction','default'],'':376}, [376,653], {not:[0,448,,'elementRestriction','notNull'],null:'not','':0}, [378,413], {'@':[0,402],not:'@',null:'@',default:'@','':0}, {'[':[380,436],'':380}, ['mk',381,'to'], {one:['ck',382,['Id'],'noRepeatedCardinality'],many:'one','':382}, [0,395], {'[':[384,436],'':384}, ['mk',385,'of'], {one:['ck',386,['Id','{'],'noRepeatedCardinality'],many:'one','':386}, { Id:[0,395], '{':[0,157], }, ['mk',388,'of'], { Id:[389,413], type:[389,405,[]], '{':[392,157], }, {not:[390,448,,'elementRestriction','notNull'],null:'not','':390}, {enum:[392,177],'':391}, {'@':[391,782],'':0}, {not:[0,448,,'elementRestriction','notNull'],null:'not','':0}, {not:[0,448],null:'not','':0}, 'typeAssocProperties', [396,39], {'@':[396,782],'':397}, { on:['ck',398], '{':[400,192], '@':[0,402],not:'@',null:'@',default:'@', '':0 }, [399,651], {'@':[399,782],'':0}, {'@':[0,402],not:'@',null:'@',default:'@','':0}, 'typeProperties', { '@':[402,782], not:[402,448,,'elementRestriction','notNull'],null:'not', default:['ck',403,,'elementRestriction','default'], '':0 }, [402,653], 'typeTypeOf', ['mk',406,'type'], ['mk',407,'of'], [408,39], {':':['c',409],'':0}, ['my',410], {'.':['c',411],'':0}, ['my',410], 'typeRefOptArgs', [414,39], { ':':['c',415], '(':['c',419], '':0 }, ['my',416], {'.':['c',417],'':418}, ['my',416], ['g',0], { Number:['c',420], Id:423, }, {',':['c',421],'':422}, { Number:['c',420], floating:['ck',420],variable:'floating', ')':422, }, ['g',425], {Id:[424,432],'':425}, { ',':['c',423], ')':425, }, ['m',0,')'], 'typeNamedArgsList', ['m',428,'('], {Id:[429,432],'':430}, { ',':['c',428], ')':430, }, ['m',0,')'], 'typeNamedArg', ['mi',433], ['m',434,':'], { Number:['c',0], floating:['ck',0],variable:'floating', }, 'cardinality', ['m',437,'['], { '*':['c',438], Number:['c',440], ']':442, }, {',':['c',439],'':442}, [442,444], { ',':['c',441], '..':[442,445], '':442 }, [442,444], ['m',0,']'], 'targetCardinality', { '*':['c',0], Number:['c',445], }, {'..':['c',446],'':0}, { '*':['c',0], Number:['c',0], }, 'nullability', { null:['ck',0], not:['ck',449], }, ['mk',0,'null'], 'queryEOF', [452,461], {';':['c',453],'':453}, ['m',0,'EOF'], 'projectionSpec', ['mk',456,'projection'], ['mk',457,'on'], [458,520], {'{':[459,564],'':459}, {excluding:[0,557],'':0}, 'queryExpression', { '(':['c',462], Id:[464,470,,,,'orderByLimitRestriction'], }, [463,461], ['m',464,')'], { intersect:['ck',465,,'precLeft_',4], minus:['ck',465,,'precLeft_',2],except:'minus', union:['ck',466,,'precLeft_',2], '':468 }, {distinct:['ck',467],'':467}, {all:['ck',467],distinct:'all','':467}, [464,461,,,,'orderByLimitRestriction'], {limit:[0,631,,'orderByLimitRestriction'],order:'limit','':0}, 'selectQuery', ['mk',471,'select'], { from:['ck',472], Id:482,'#':'Id','(':'Id','*':'Id','+':'Id','-':'Id',':':'Id','?':'Id','@':'Id','{':'Id',key:'Id',not:'Id',case:'Id',cast:'Id',null:'Id',true:'Id',false:'Id',Number:'Id',String:'Id',exists:'Id',QuotedLiteral:'Id', all:['ck',482],distinct:'all', }, [473,490], {mixin:['ck',474],'':479}, ['m',475,'{'], {Id:[476,202],'':477}, { ';':['c',475], '}':477, Id:['g',475,,'fail'], }, ['m',478,'}'], ['mk',479,'into'], {all:['ck',480],distinct:'all','':480}, {'{':[481,564],'':481}, {excluding:[488,557],'':488}, ['g',483,,,'sqlStyle','inSelectItem'], { '*':['c',484], Id:[484,574],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id','@':'Id','{':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', }, {',':['c',485],'':486}, { '*':['c',484], Id:[484,574],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id','@':'Id','{':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', }, ['mk',487,'from'], [488,490], {group:[0,619],where:'group',having:'group','':0}, 'querySource', [491,495], {',':492,'':0}, {',':['c',493],'':0}, [492,495], 'tableExpression', { '(':[496,507], Id:[496,520], }, { cross:['ck',497], inner:['ck',500], full:['ck',499],left:'full',right:'full', join:['ck',502], '':0 }, ['mk',498,'join'], { '(':[496,507], Id:[496,520], }, {outer:['ck',500],'':500}, {one:[501,514],many:'one',exact:'one','':501}, ['mk',502,'join'], ['g',503], [504,495], ['mk',505,'on'], [496,651], 'tableOrQueryParens', ['m',508,'(',,,'queryOnLeft'], { '(':[509,507], Id:[510,495,,,'table','queryOnLeft'], select:[510,461], }, { full:[510,496,,,'table','queryOnLeft'],join:'full',left:'full',cross:'full',inner:'full',right:'full', limit:[510,464,,'queryOnLeft'],minus:'limit',order:'limit',union:'limit',except:'limit',intersect:'limit', '':510 }, ['m',511,')'], { as:['ck',512,,'queryOnLeft','table'], Id:['ci',0,,'queryOnLeftSloppyAlias'], '':0,on:'',all:'',where:'',distinct:'' }, ['mi',0], 'joinCardinality', { one:515, exact:['ck',515], many:['ck',516], }, ['mk',516,'one'], ['mk',517,'to'], { one:518, exact:['ck',518], many:['ck',0], }, ['mk',0,'one'], 'fromRefWithOptAlias', [521,527], {':':['c',522],'':523}, [523,527], { as:['ck',524], Id:['ci',0,,'isNoKeywordInRuleFollow'], '':525,on:'',all:'',where:'',distinct:'' }, ['mi',0], ['g',0], 'fromPath', ['mi',528], {'(':[529,533],'[':'(','':529}, {'.':['c',530,,'notAfterEntityArgOrFilter'],'':0}, ['my',531], {'(':[529,533],'[':'(','':529}, 'fromArgumentsAndFilter', {'(':['c',534],'':538}, {Id:535}, {Id:[536,540],'':537}, { ',':['c',535], ')':537, }, ['m',538,')'], {'[':[0,544],'':0}, 'fromNamedArgument', ['mi',541], ['m',542,':'], [0,653], 'cardinalityAndFilter', ['m',545,'['], {Number:['c',546,,'beforeColon'],'':547}, ['m',547,':'], { group:['g',549,[]],limit:'group',order:'group',having:'group', where:['ck',548], ']':['c',0], '':548 }, [549,651], {group:['g',550,,'hide_'],'':551}, [551,625], {having:['ck',552,,'hide_'],'':553}, [553,651], {Id:['g',554,,'hide_'],'':555}, [555,631], ['m',0,']'], 'excludingClause', ['mk',558,'excluding'], ['m',559,'{'], {Id:560}, {Id:['cy',561],'':562}, { ',':['c',560], '}':562, }, ['m',0,'}',,,'afterBrace'], 'selectItemsList', ['m',565,'{',,'top','inSelectItem'], { '*':['c',566], Id:[566,574],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id','@':'Id','{':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', '':567 }, { ',':['c',565], '}':567, }, ['m',0,'}',,,'afterBrace'], 'nestedSelectItemsList', ['m',570,'{',,,'inSelectItem'], { '*':['c',571], Id:[571,574],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id','@':'Id','{':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', '':572 }, { ',':['c',570], '}':572, }, ['m',0,'}',,,'afterBrace'], 'selectItemDef', {'@':[574,785],'':575}, {virtual:['ck',576,['Id','#','(','+','-',':','?','{','key','not','case','cast','null','true','false','Number','String','exists','QuotedLiteral'],'modifierRestriction'],'':576}, ['g',577,,,'key','columnExpr'], {key:['ck',578,,'modifierRestriction'],'':578}, { '#':[579,653,[]],'(':'#','+':'#','-':'#',':':'#','?':'#',new:'#',not:'#',case:'#',cast:'#',null:'#',true:'#',false:'#',Number:'#',String:'#',exists:'#',QuotedLiteral:'#', Id:[581,681], '{':[592,569], }, { as:['ck',580], Id:['ci',589,,'hide_'], '':589,from:'' }, ['mi',589], { over:['ck',582], '*':[584,664],'+':'*','-':'*','/':'*','<':'*','=':'*','>':'*','?':'*','!=':'*','<=':'*','<>':'*','==':'*','>=':'*',in:'*',is:'*',or:'*','||':'*',and:'*',not:'*',like:'*',between:'*', as:['ck',586], Id:['ci',589,,'hide_',,'nestedExpand'], '.':['c',587], '':['g',589,,,,'nestedExpand'],from:'' }, [583,743], {'*':[584,664],'+':'*','-':'*','/':'*','<':'*','=':'*','>':'*','?':'*','!=':'*','<=':'*','<>':'*','==':'*','>=':'*',in:'*',is:'*',or:'*','||':'*',and:'*',not:'*',like:'*',between:'*','':584}, { as:['ck',585], Id:['ci',589,,'hide_'], '':589,from:'' }, ['mi',589], ['mi',589,,,,'nestedExpand'], { '{':[588,569], '*':['c',0], }, {excluding:[0,557],'':0}, {'{':['g',590,,'nestedExpand'],'':595}, [591,569], {excluding:[595,557],'':595}, {excluding:[593,557],'':593}, ['mk',594,'as'], ['mi',595], ['g',596,,,,'columnExpr'], {'@':[596,788],'':597}, {':':['c',598],'':0}, { Id:[611,367],'{':'Id', redirected:['ck',599,['to']], association:['ck',603,['[','to'],'columnExpr'], composition:['ck',605,['[','of'],'columnExpr'], }, ['mk',600,'to'], [601,39], { on:['ck',602], '{':[611,192], '':611 }, [611,651], {'[':[604,436],'':604}, ['mk',607,'to'], {'[':[606,436],'':606}, ['mk',607,'of'], {one:['ck',608,['Id'],'noRepeatedCardinality'],many:'one','':608}, [609,39], ['mk',610,'on'], [611,651], ['g',612], {'@':[612,782],'':0}, 'queryClauses', {columns:['ck',615],'':616}, [616,564], {group:[617,619],where:'group',having:'group','':617}, {limit:[0,631],order:'limit','':0}, 'whereGroupByHaving', {where:['ck',620],'':621}, [621,651], {group:[622,625],'':622}, {having:['ck',623],'':0}, [0,651], 'groupByClause', ['mk',626,'group'], ['mk',627,'by'], [628,653], {',':['c',629],'':0}, [628,653], 'orderByLimitOffset', {order:[632,637],'':632}, {limit:['ck',633],'':0}, [634,653], {offset:['ck',635],'':0}, [0,653], 'orderByClause', ['mk',638,'order'], ['mk',639,'by'], [640,643], {',':['c',641],'':0}, [640,643], 'orderByExpression', [644,653], {asc:['ck',645],desc:'asc','':645}, {nulls:['ck',646],'':0}, {last:['ck',0],first:'last'}, 'conditionEOF', [649,653], ['m',0,'EOF'], 'condition', [0,653], 'expression', { '(':[664,687], '#':[664,779],null:'#',true:'#',false:'#',Number:'#',String:'#',QuotedLiteral:'#', ':':['c',654], '?':['c',664,,'hide_'], Id:[656,681], new:['ck',659,['Id']], exists:['ck',660], case:[664,699], cast:[664,710], '+':['c',663,,'precRight_',30],'-':'+', not:['ck',663,,'precRight_',8], }, { Id:['cy',655], Number:['c',664,,'hide_'], }, {'.':[664,683],'':664}, {over:['ck',657],'':658}, [658,743], ['g',664], [664,681], { '(':['c',661], Id:[664,681], '?':['c',664,,'hide_'], }, [662,461], ['m',664,')'], [664,653], { '*':['c',668,,'precLeft_',24],'/':'*', '+':['c',668,,'precLeft_',22],'-':'+', '||':['c',668,,'precLeft_',20], and:['ck',668,,'precLeft_',4], or:['ck',668,,'precLeft_',2], '?':['c',665,,'precRight_',0], '<':['c',667,,'precNone_',10],'=':'<','>':'<','!=':'<','<=':'<','<>':'<','>=':'<', '==':['c',668,,'precNone_',10], is:['ck',669,,'precNone_',10], not:['ck',671,,'isNegatedRelation',10], in:['g',671,,'precNone_',10],like:'in',between:'in', '':0 }, [666,653], ['m',668,':'], {all:['ck',668],any:'all',some:'all','':668}, [679,653], {not:['ck',670],'':670}, ['mk',679,'null'], { between:['ck',672], in:['ck',675], like:['ck',676], }, [673,653], ['mk',674,'and'], [679,653], [679,653], [677,653], {escape:['ck',678],'':679}, [679,653], ['g',664], 'valuePath', ['mi',682], {'(':[683,717],'[':'(','':683}, {'.':['c',684,,'isDotForPath'],'':0}, ['my',685], {'(':[683,717],'[':'(','':683}, 'expressionOrQueryParens', ['m',688,'(',,,'queryOnLeft'], { '(':[689,687], Id:[691,653,,,'expr','queryOnLeft'],'#':'Id','+':'Id','-':'Id',':':'Id','?':'Id',not:'Id',case:'Id',cast:'Id',null:'Id',true:'Id',false:'Id',Number:'Id',String:'Id',exists:'Id',QuotedLiteral:'Id', select:[692,461], }, { '*':[690,664,,,'expr','queryOnLeft'],'+':'*','-':'*','/':'*','<':'*','=':'*','>':'*','?':'*','!=':'*','<=':'*','<>':'*','==':'*','>=':'*',in:'*',is:'*',or:'*','||':'*',and:'*',not:'*',like:'*',between:'*', ',':[692,694,,,'expr','queryOnLeft'], limit:[692,464,,'queryOnLeft'],minus:'limit',order:'limit',union:'limit',except:'limit',intersect:'limit', '':692 }, {',':[692,694],'':692}, {',':[692,694],'':692}, ['m',0,')'], 'continueExpressionslist', ['m',695,','], {Id:696,'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id',not:'Id',case:'Id',cast:'Id',null:'Id',true:'Id',false:'Id',Number:'Id',String:'Id',exists:'Id',QuotedLiteral:'Id'}, {Id:[697,653],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id','':0}, {',':['c',696],'':0}, 'caseExpression', ['mk',700,'case'], {Id:[701,653],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id',not:'Id',case:'Id',cast:'Id',null:'Id',true:'Id',false:'Id',Number:'Id',String:'Id',exists:'Id',QuotedLiteral:'Id','':701,when:''}, {when:702}, {when:['ck',703],'':706}, [704,653], ['mk',705,'then'], [702,653], {else:['ck',707],'':708}, [708,653], ['mk',0,'end'], 'castFunction', ['mk',711,'cast'], ['m',712,'('], [713,653], ['mk',714,'as'], [715,413], ['m',0,')'], 'argumentsAndFilter', {'(':['c',718,,,,'prepareSpecialFunction'],'':736}, { ')':735, Id:['cy',719,,'isNamedArg'], '':728 }, { ':':['c',720], '=>':['c',724], }, [721,653], { ',':['c',722], ')':735, }, { Id:['cy',723], ')':735, }, ['m',720,':'], [725,653], { ',':['c',726], ')':735, }, { Id:['cy',727], ')':735, }, ['m',724,'=>'], [729,738], {',':['c',730,,,,'nextFunctionArgument'],'':732}, {')':['c',731],'':728}, {'[':[0,544],'':0}, {order:['ck',733],'':735}, ['mk',734,'by'], [735,758], ['m',736,')'], {'[':[0,544],'':0}, 'funcExpression', { ' lookahead':'lGenericIntroOrExpr', Id:[740,653],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', GenericExpr:['cx',740], GenericIntro:['cx',739], }, [740,653], { ' lookahead':'lGenericSeparator', GenericSeparator:['cx',741], '':0 }, { ' lookahead':'lGenericExpr', Id:[740,653],'#':'Id','(':'Id','+':'Id','-':'Id',':':'Id','?':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', GenericExpr:['cx',740], }, 'overClause', ['m',744,'('], {partition:['ck',745],'':747}, ['mk',746,'by'], [747,754], {order:['ck',748],'':750}, ['mk',749,'by'], [750,758], {rows:['ck',751],'':752}, [752,767], ['m',0,')'], 'expressionsAsXpr', [755,653], {',':['c',756],'':0}, [755,653], 'orderByClauseAsXpr', [759,762], {',':['c',760],'':0}, [759,762], 'orderBySpecAsXpr', [763,653], {asc:['ck',764],desc:'asc','':764}, {nulls:['ck',765],'':0}, {last:['ck',0],first:'last'}, 'windowFrameClause', { unbounded:['ck',768], Number:['c',768], current:['ck',769], between:['ck',770], }, ['mk',0,'preceding'], ['mk',0,'row'], [771,774], ['mk',772,'and'], [0,774], 'windowFrameBoundSpec', { unbounded:['ck',775], Number:['c',775], current:['ck',777], }, { following:['ck',776], preceding:['ck',776], }, ['g',0], ['mk',0,'row'], 'literalValue', { '#':['c',780], null:['ck',0], true:['ck',0],false:'true', Number:['c',0], String:['c',0], QuotedLiteral:['c',0], }, ['my',0], 'annoAssignStd', ['m',783,'@',,,'annoInSameLine'], { '(':[0,791], Id:[0,796], }, 'annoAssignCol', ['m',786,'@'], { '(':[0,791], Id:[0,796], }, 'annoAssignMid', ['m',789,'@',,,'annoInSameLine'], { '(':[0,791], Id:[0,800], }, 'annoAssignParen', ['m',792,'(',,,'annoInSameLine'], {Id:[793,796],'':794}, { ',':['c',792], ')':794, }, ['m',0,')'], 'annoAssignBase', [797,800], {':':['c',798,,'annoInSameLine'],'':0}, [0,822], 'annoNamePath', ['my',801], {'.':['c',802],'':804}, { Id:['cy',801], '@':['c',803], }, ['my',801], {'#':[0,813,,'annoInSameLine'],'':0}, 'annoPath', { Id:['cy',808], '@':['c',807], }, ['my',808], {'.':['c',809],'':811}, { Id:['cy',808], '@':['c',810], }, ['my',808], {'#':[0,813],'':0}, 'annoPathVariant', ['m',814,'#'], ['my',815], {'.':['c',816],'':0}, ['my',815], 'annoStructValue', [819,806], {':':['c',820],'':0}, [0,822], 'annoValue', { '#':[0,779],null:'#',true:'#',false:'#',Number:'#',String:'#',QuotedLiteral:'#', '+':['c',823],'-':'+', Id:[0,806],'@':'Id', '{':['c',824], '[':['c',827,,,,'arrayAnno'], '(':['c',833], }, ['m',0,'Number'], {Id:[825,818],'@':'Id','':826}, { ',':['c',824], '}':826, Id:['g',824,,'fail'],'@':'Id', }, {'}':['c',0,,'arrayAnno','orNotEmpty']}, { Id:[831,822],'#':'Id','(':'Id','+':'Id','-':'Id','@':'Id','[':'Id','{':'Id',Number:'Id',String:'Id',QuotedLiteral:'Id', '...':['c',828,,'arrayAnno','ellipsis'], '':832 }, { up:['ck',829], ',':831,']':',', }, ['mk',830,'to'], [831,822], { ',':['c',827], ']':832, }, {']':['c',0,,'arrayAnno','bracket']}, {')':['c',0,,'fail'],'':834}, [835,651], ['m',0,')'], ] class CdlParser extends AstBuildingParser{ hardGuards={afterBrace:true,fail:true} constructor(lexer,...args){super(lexer,keywords,table,...args)} start($,$next){ $.source??=new XsnSource( 'cdl' ) this.rule_(1,$next) for(;;)switch(this.s){ case 1:switch(this.l()){ case'namespace':this.namespaceDeclaration({source:$.source},2);continue case'using':this.usingDeclaration({source:$.source},2);continue case'@':case'type':case'view':case'event':case'action':case'aspect':case'define':case'entity':case'extend':case'context':case'service':case'abstract':case'annotate':case'function':case'annotation':if(this.artifactDefOrExtend({outer:$.source},2)){this.namespaceRestriction()}continue; default:this.s=3;continue } case 2:switch(this.l()){ case';':if(this.c(1)){this.afterBrace()}continue; case'EOF':this.s=3;continue case'@':case'type':case'view':case'event':case'using':case'action':case'aspect':case'define':case'entity':case'extend':case'context':case'service':case'abstract':case'annotate':case'function':case'namespace':case'annotation':this.s=1;{ this.noAssignmentInSameLine(); }continue default:this.e();continue } case 3:if(this.m(0,'EOF')){ this.docComment( null ); }continue default:return this.exit_() } } artifactsBlock($,$next){ this.rule_(5,$next) for(;;)switch(this.s){ case 5:if(this.m(6,'{')){ $.art.artifacts = this.createDict( $.start ); $.art.extensions = []; }continue case 6:switch(this.lt()){ case'Id':case'@':this.artifactDefOrExtend({outer:$.art},7);continue default:this.s=8;continue } case 7:switch(this.l()){ case';':if(this.c(6)){this.afterBrace()}continue; case'}':this.s=8;continue case'@':case'type':case'view':case'event':case'action':case'aspect':case'define':case'entity':case'extend':case'context':case'service':case'abstract':case'annotate':case'function':case'annotation':this.s=6;{ this.noAssignmentInSameLine(); }continue default:this.e();continue } case 8:if(this.m(0,'}')){this.afterBrace(); this.finalizeDictOrArray( $.art.artifacts ); }continue default:return this.exit_() } } artifactDefOrExtend($,$next){ let art=new XsnArtifact() this.rule_(10,$next) { art.location = this.startLocation(); this.docComment( art ); } for(;;)switch(this.s){ case 10:switch(this.lt()){ case'@':this.annoAssignStd({art},10);continue default:this.s=11;continue } case 11:switch(this.l()){ case'type':case'view':case'event':case'action':case'aspect':case'entity':case'context':case'service':case'abstract':case'function':case'annotation':this.s=12;continue case'define':this.ck(12);continue case'extend':if(this.ck(13)){ art.kind = 'extend'; }continue case'annotate':this.ck(14);continue default:this.e();continue } case 12:switch(this.l()){ case'service':this.serviceDef({art,outer:$.outer},0);continue case'context':this.contextDef({art,outer:$.outer},0);continue case'annotation':this.annotationDef({art,outer:$.outer},0);continue case'type':this.typeDef({art,outer:$.outer},0);continue case'aspect':case'abstract':this.aspectDef({art,outer:$.outer},0);continue case'entity':this.entityDef({art,outer:$.outer},0);continue case'view':this.viewDef({art,outer:$.outer},0);continue case'event':this.eventDef({art,outer:$.outer},0);continue case'action':this.actionMainDef({art,outer:$.outer},0);continue case'function':this.functionMainDef({art,outer:$.outer},0);continue default:this.e();continue } case 13:switch(this.l()){ case'Id':this.extendArtifact({art,outer:$.outer},0);continue case'service':this.extendService({art,outer:$.outer},0);continue case'context':this.extendContext({art,outer:$.outer},0);continue case'type':this.extendType({art,outer:$.outer},0);continue case'aspect':case'entity':this.extendEntityOrAspect({art,outer:$.outer},0);continue case'projection':this.extendProjection({art,outer:$.outer},0);continue default:this.e();continue } case 14:this.annotateArtifact({art,outer:$.outer},0);continue default:return this.exit_() } } namespaceDeclaration($,$next){ let name;let _ this.rule_(16,$next) for(;;)switch(this.s){ case 16:this.mk(17,'namespace');continue case 17:if(this.namePath(_={category:'Namespace'},0)){name=_.name; $.source.namespace ??= { kind: 'namespace', name: name }; }continue default: this.attachLocation( $.source.namespace ) return this.exit_() } } usingDeclaration($,$next){ let decl={ kind: 'using' } this.rule_(19,$next) for(;;)switch(this.s){ case 19:this.mk(20,'using');continue case 20:switch(this.l()){ case'from':this.ck(21);continue case'Id':this.usingProxy({outer:$.source,proxy:decl},22);continue case'{':this.s=24;{ $.source.usings.push( decl ); }continue default:this.e();continue } case 21:if(this.m(0,'String')){ $.source.dependencies.push( this.quotedLiteral() ); }continue case 22:switch(this.lk()){ case'from':this.ck(23);continue default:this.gr([';']);continue } case 23:if(this.m(0,'String')){ $.source.dependencies.push( decl.fileDep = this.quotedLiteral() ); }continue case 24:if(this.m(25,'{')){ decl.usings = this.createArray(); }continue case 25:switch(this.lt()){ case'Id':this.usingProxy({outer:decl,proxy:{ kind: 'using' }},26);continue default:this.s=27;continue } case 26:switch(this.lt()){ case',':this.c(25);continue case'}':this.s=27;continue default:this.e();continue } case 27:if(this.m(28,'}')){this.afterBrace(); this.finalizeDictOrArray( decl.usings ); }continue case 28:switch(this.lk()){ case'from':this.ck(29);continue default:this.gr([';']);continue } case 29:if(this.m(0,'String')){ $.source.dependencies.push( decl.fileDep = this.quotedLiteral() ); }continue default: this.attachLocation( decl ) return this.exit_() } } usingProxy($,$next){ let extern;let _ this.rule_(31,$next) for(;;)switch(this.s){ case 31:if(this.simplePath(_={category:'global'},32)){extern=_.ref; $.proxy.extern = extern; $.outer.usings.push( $.proxy ); }continue case 32:switch(this.lk()){ case'as':this.ck(33);continue default:if(this.gr()){ this.classifyImplicitName( 'Using' ); }continue } case 33:if(this.mi(0,'UsingAlias')){ $.proxy.name = this.identAst(); }continue default: this.attachLocation( $.proxy ) return this.exit_() } } namePath($,$next){ $.name??=new XsnName() this.rule_(35,$next) for(;;)switch(this.s){ case 35:if(this.mi(36,$.category)){ $.name.path = [ this.identAst() ]; }continue case 36:switch(this.lt()){ case'.':this.c(37);continue default:this.gr(['@']);continue } case 37:if(this.my(36,$.category)){ $.name.path.push( this.identAst() ); }continue default: this.attachLocation( $.name ) return this.exit_() } } simplePath($,$next){ $.ref??={} this.rule_(39,$next) for(;;)switch(this.s){ case 39:if(this.mi(40,$.category)){ $.ref.path = [ this.identAst() ]; }continue case 40:switch(this.lt()){ case'.':this.c(41);continue default:this.gr();continue } case 41:if(this.my(40,$.category)){ $.ref.path.push( this.identAst() ); }continue default: this.attachLocation( $.ref ) return this.exit_() } } serviceDef($,$next){ let name;let _ this.rule_(43,$next) for(;;)switch(this.s){ case 43:if(this.mk(44,'service')){this.vocabularyRestriction()}continue; case 44:if(this.namePath(_={category:'Service'},45)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'service', name ); this.docComment( $.art ); }continue case 45:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},45);continue default:this.s=46;continue } case 46:switch(this.lt()){ case'{':this.artifactsBlock({art:$.art,start:undefined},0);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } contextDef($,$next){ let name;let _ this.rule_(48,$next) for(;;)switch(this.s){ case 48:if(this.mk(49,'context')){this.vocabularyRestriction()}continue; case 49:if(this.namePath(_={category:'Context'},50)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'context', name ); this.docComment( $.art ); }continue case 50:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},50);continue default:this.s=51;continue } case 51:switch(this.lt()){ case'{':this.artifactsBlock({art:$.art,start:undefined},0);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } annotationDef($,$next){ let name;let _ this.rule_(53,$next) for(;;)switch(this.s){ case 53:this.mk(54,'annotation');continue case 54:if(this.namePath(_={category:'AnnoDef'},55)){name=_.name; this.addDef( $.art, $.outer, ($.outer.kind === 'source' ? 'vocabularies' : 'artifacts'), 'annotation', name ); this.docComment( $.art ); }continue case 55:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},55);continue default:this.s=56;continue } case 56:this.typeOrIncludesSpec({art:$.art},0);continue default: this.attachLocation( $.art ) return this.exit_() } } typeDef($,$next){ let name;let _ this.rule_(58,$next) for(;;)switch(this.s){ case 58:this.mk(59,'type');continue case 59:if(this.namePath(_={category:'Type'},60)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'type', name ); this.docComment( $.art ); }continue case 60:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},60);continue default:this.s=61;continue } case 61:this.typeOrIncludesSpec({art:$.art},0);continue default: this.attachLocation( $.art ) return this.exit_() } } aspectDef($,$next){ let name;let incl;let _ this.rule_(63,$next) for(;;)switch(this.s){ case 63:switch(this.lk()){ case'aspect':this.ck(65);continue case'abstract':if(this.ck(64)){ this.warning( 'syntax-deprecated-abstract', this.combineLocation( this.lb(), this.la() ) ); }continue default:this.e();continue } case 64:this.mk(65,'entity');continue case 65:if(this.namePath(_={category:'Type'},66)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'aspect', name ); this.docComment( $.art ); }continue case 66:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},66);continue default:this.s=67;continue } case 67:switch(this.lt()){ case'{':this.elementsBlock({art:$.art},71);continue case':':this.c(68);continue default:this.gr([';']);continue } case 68:switch(this.lt()){ case'Id':if(this.simplePath(_={category:'artref'},69)){incl=_.ref; $.art.includes ??= []; $.art.includes.push( incl ); }continue default:this.s=70;continue } case 69:switch(this.lt()){ case',':this.c(68);continue case'{':this.s=70;continue default:this.gr([';']);continue } case 70:this.elementsBlock({art:$.art},71);continue case 71:switch(this.lk()){ case'actions':this.actionsBlock({art:$.art},0);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } entityDef($,$next){ let name;let incl;let query;let _ this.rule_(73,$next) for(;;)switch(this.s){ case 73:this.mk(74,'entity');continue case 74:if(this.namePath(_={category:'Entity'},75)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'entity', name ); this.docComment( $.art ); }continue case 75:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},75);continue default:this.s=76;continue } case 76:switch(this.lt()){ case'(':this.paramsList({art:$.art},77);continue default:this.s=77;continue } case 77:switch(this.lk()){ case'{':this.s=81;continue case':':if(this.c(78)){ $.art.includes ??= []; }continue case'as':this.ck(82);continue default:this.e();continue } case 78:switch(this.l()){ case'Id':this.s=79;continue default:this.e();continue } case 79:switch(this.lt()){ case'Id':if(this.simplePath(_={category:'artref'},80)){incl=_.ref; $.art.includes.push( incl ); }continue default:this.s=81;continue } case 80:switch(this.lt()){ case',':this.c(79);continue case'{':this.s=81;continue default:this.e();continue } case 81:this.elementsBlock({art:$.art},86);continue case 82:switch(this.lk()){ case'(':case'select':if(this.queryExpression(_={},86)){query=_.expr; $.art.query = query; $.art.$syntax = 'entity'; }continue case'projection':this.s=83;{this.afterBrace('sloppyOn')}continue; default:this.e();continue } case 83:if(this.projectionSpec(_={},84)){query=_.query;this.afterBrace('sloppyOn'); $.art.query = query; $.art.$syntax = 'projection'; }continue case 84:switch(this.lk()){ case'group':case'where':case'having':this.whereGroupByHaving({query},85);continue default:this.s=85;continue } case 85:switch(this.lk()){ case'limit':case'order':this.orderByLimitOffset({query},86);continue default:this.s=86;continue } case 86:switch(this.lk()){ case'actions':this.actionsBlock({art:$.art},0);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } viewDef($,$next){ let name;let query;let _ this.rule_(88,$next) for(;;)switch(this.s){ case 88:this.mk(89,'view');continue case 89:if(this.namePath(_={category:'Entity'},90)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'entity', name ); this.docComment( $.art ); }continue case 90:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},90);continue default:this.s=91;continue } case 91:switch(this.lk()){ case'(':this.paramsList({art:$.art},97);continue case'with':this.ck(92);continue default:this.s=97;continue } case 92:if(this.mk(93,'parameters')){ $.art.params = this.createDict(); }continue case 93:this.paramDef({outer:$.art},94);continue case 94:switch(this.lt()){ case',':this.c(95);continue default:this.s=96;continue } case 95:this.paramDef({outer:$.art},94);continue case 96:this.s=97;{ this.finalizeDictOrArray( $.art.params ); }continue case 97:this.mk(98,'as');continue case 98:if(this.queryExpression(_={},0)){query=_.expr; $.art.query = query; $.art.$syntax = 'view'; }continue default: this.attachLocation( $.art ) return this.exit_() } } eventDef($,$next){ let name;let incl;let query;let _ this.rule_(100,$next) for(;;)switch(this.s){ case 100:this.mk(101,'event');continue case 101:if(this.namePath(_={category:'Event'},102)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'event', name ); this.docComment( $.art ); }continue case 102:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},102);continue default:this.s=103;continue } case 103:switch(this.lt()){ case'{':this.elementsBlock({art:$.art},0);continue case':':this.c(104);continue default:this.e();continue } case 104:switch(this.l()){ case'{':this.elementsBlock({art:$.art},0);continue case'Id':if(this.simplePath(_={category:'artref'},105)){incl=_.ref; $.art.type = incl; }continue case'projection':if(this.projectionSpec(_={},0)){query=_.query; $.art.query = query; $.art.$syntax = 'projection'; }continue default:this.e();continue } case 105:switch(this.lt()){ case',':case'{':this.s=106;{ $.art.includes = [ $.art.type ]; delete $.art.type; }continue default:this.s=110;{ this.docComment( $.art ); }continue } case 106:switch(this.lt()){ case',':this.c(107);continue default:this.s=109;continue } case 107:switch(this.lt()){ case'Id':if(this.simplePath(_={category:'artref'},108)){incl=_.ref; $.art.includes.push( incl ); }continue default:this.s=109;continue } case 108:switch(this.lt()){ case',':this.c(107);continue case'{':this.s=109;continue default:this.e();continue } case 109:this.elementsBlock({art:$.art},0);continue case 110:switch(this.lt()){ case'@':this.annoAssignStd({art:$.art},110);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } actionMainDef($,$next){ let name;let _ this.rule_(112,$next) for(;;)switch(this.s){ case 112:this.mk(113,'action');continue case 113:if(this.namePath(_={category:'Action'},114)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'action', name ); this.docComment( $.art ); }continue case 114:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},114);continue default:this.s=115;continue } case 115:this.paramsList({art:$.art},116);continue case 116:switch(this.lk()){ case'returns':this.returnsSpec({outer:$.art},0);continue default:this.gr([';']);continue } default: this.attachLocation( $.art ) return this.exit_() } } functionMainDef($,$next){ let name;let _ this.rule_(118,$next) for(;;)switch(this.s){ case 118:this.mk(119,'function');continue case 119:if(this.namePath(_={category:'Action'},120)){name=_.name; this.addDef( $.art, $.outer, 'artifacts', 'function', name ); this.docComment( $.art ); }continue case 120:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},120);continue default:this.s=121;continue } case 121:this.paramsList({art:$.art},122);continue case 122:this.returnsSpec({outer:$.art},0);continue default: this.attachLocation( $.art ) return this.exit_() } } actionsBlock($,$next){ this.rule_(124,$next) for(;;)switch(this.s){ case 124:if(this.mk(125,'actions')){ $.art.actions = this.createDict(); }continue case 125:this.m(126,'{');continue case 126:switch(this.lt()){ case'Id':case'@':this.boundActionFunctionDef({outer:$.art},127);continue default:this.s=128;continue } case 127:switch(this.l()){ case';':this.c(126);continue case'}':this.s=128;continue case'@':case'action':case'function':this.s=126;{ this.noAssignmentInSameLine(); }continue default:this.e();continue } case 128:if(this.m(0,'}')){this.afterBrace(); this.finalizeDictOrArray( $.art.actions ); }continue default:return this.exit_() } } boundActionFunctionDef($,$next){ let art=new XsnArtifact() this.rule_(130,$next) { this.docComment( art ); } for(;;)switch(this.s){ case 130:switch(this.lt()){ case'@':this.annoAssignStd({art},130);continue default:this.s=131;continue } case 131:switch(this.lk()){ case'action':this.ck(132);continue case'function':this.ck(136);continue default:this.e();continue } case 132:if(this.mi(133,'BoundAction')){ this.addDef( art, $.outer, 'actions', 'action', this.identAst() ); this.docComment( art ); }continue case 133:switch(this.lt()){ case'@':this.annoAssignMid({art},133);continue default:this.s=134;continue } case 134:this.paramsList({art},135);continue case 135:switch(this.lk()){ case'returns':this.returnsSpec({outer:art},0);continue default:this.gr([';']);continue } case 136:if(this.mi(137,'BoundAction')){ this.addDef( art, $.outer, 'actions', 'function', this.identAst() ); this.docComment( art ); }continue case 137:switch(this.lt()){ case'@':this.annoAssignMid({art},137);continue default:this.s=138;continue } case 138:this.paramsList({art},139);continue case 139:this.returnsSpec({outer:art},0);continue default: this.attachLocation( art ) return this.exit_() } } paramsList($,$next){ this.rule_(141,$next) for(;;)switch(this.s){ case 141:if(this.m(142,'(')){ $.art.params = this.createDict(); }continue case 142:switch(this.lt()){ case'Id':case'@':this.paramDef({outer:$.art},143);continue default:this.s=144;continue } case 143:switch(this.lt()){ case',':this.c(142);continue case')':this.s=144;continue default:this.e();continue } case 144:if(this.m(0,')')){ this.finalizeDictOrArray( $.art.params ); }continue default:return this.exit_() } } paramDef($,$next){ let art=new XsnArtifact() this.rule_(146,$next) { this.docComment( art ); } for(;;)switch(this.s){ case 146:switch(this.lt()){ case'@':this.annoAssignStd({art},146);continue default:this.s=147;continue } case 147:if(this.my(148,'Param')){ this.addDef( art, $.outer, 'params', 'param', this.identAst() ); this.docComment( art ); }continue case 148:switch(this.lt()){ case'@':this.annoAssignMid({art},148);continue default:this.s=149;continue } case 149:switch(this.lt()){ case'{':this.elementsBlock({art},150);continue case':':this.c(151);continue default:this.e();continue } case 150:switch(this.lk()){ case'not':case'null':this.nullability({art},0);continue default:this.gr([',']);continue } case 151:this.typeExpression({art},0);continue default: this.attachLocation( art ) return this.exit_() } } returnsSpec($,$next){ let art=new XsnArtifact() let ret this.rule_(153,$next) for(;;)switch(this.s){ case 153:if(this.mk(154,'returns')){ret=this.lb();this.elementRestriction('default'); art.kind = 'param'; $.outer.returns = art; this.docComment( art ); }continue case 154:switch(this.lt()){ case'@':this.annoAssignStd({art},154);continue default:this.s=155;continue } case 155:this.typeExpression({art},0);continue default: this.attachLocation( art ); if (ret) art.location.tokenIndex = ret.location.tokenIndex return this.exit_() } } elementsBlock($,$next){ this.rule_(157,$next) for(;;)switch(this.s){ case 157:if(this.m(158,'{')){ $.art.elements = this.createDict(); }continue case 158:switch(this.lt()){ case'Id':case'@':this.elementDef({outer:$.art,art:undefined},159);continue default:this.s=160;continue } case 159:switch(this.l()){ case';':this.c(158);continue case'}':this.s=160;continue case'Id':case'@':case'key':this.s=158;{ this.noAssignmentInSameLine(); }continue default:this.e();continue } case 160:if(this.m(0,'}')){this.afterBrace(); this.finalizeDictOrArray( $.art.elements ); }continue default:return this.exit_() } } elementDef($,$next){ let expr;let _ this.rule_(162,$next) { $.art ??= new XsnArtifact(); this.docComment( $.art ); } for(;;)switch(this.s){ case 162:switch(this.lt()){ case'@':this.annoAssignStd({art:$.art},162);continue default:this.s=163;continue } case 163:switch(this.l()){ case'virtual':if(this.ck(164)){ $.art.virtual = this.valueWithLocation( true ); }continue default:this.s=164;continue } case 164:switch(this.l()){ case'key':if(this.ck(165)){ $.art.key = this.valueWithLocation( true ); }continue default:this.s=165;continue } case 165:switch(this.l()){ case'element':if(this.ck(166)){ $.art.$syntax = 'element'; }continue default:this.s=166;continue } case 166:if(this.mi(167,'Element')){this.elementRestriction('elem'); this.addDef( $.art, $.outer, 'elements', 'element', this.identAst() ); this.docComment( $.art ); }continue case 167:switch(this.lt()){ case'@':this.annoAssignMid({art:$.art},167);continue default:this.s=168;continue } case 168:switch(this.lt()){ case'{':this.elementsBlock({art:$.art},169);continue case':':this.c(170);continue default:this.s=171;continue } case 169:switch(this.lk()){ case'not':case'null':this.nullability({art:$.art},171);continue default:this.s=171;continue } case 170:this.typeExpression({art:$.art},171);continue case 171:switch(this.l()){ case'=':this.c(172);continue default:this.gr([';']);continue } case 172:if(this.expression(_={},173)){expr=_.expr; $.art.value = expr; }continue case 173:switch(this.lk()){ case'stored':if(this.ck(174)){ $.art.value.stored = this.valueWithLocation( true ); }continue default:this.s=174;continue } case 174:this.s=175;{ if (!this.elementRestriction( true, 'anno' )) this.docComment( $.art ); }continue case 175:switch(this.l()){ case'@':this.annoAssignStd({art:$.art},175);continue default