UNPKG

@lcap/nasl-parser

Version:

Take Nasl text to Nasl AST with the help of generalized parsing.

583 lines (552 loc) 87.8 kB
// Generated automatically by nearley, version 2.20.1 // http://github.com/Hardmath123/nearley // Bypasses TS6133. Allow declared but unused functions. // @ts-ignore function id(d: any[]): any { return d[0]; } declare var or: any; declare var and: any; declare var eqeq: any; declare var neq: any; declare var rangle: any; declare var langle: any; declare var geq: any; declare var leq: any; declare var plus: any; declare var minus: any; declare var mul: any; declare var div: any; declare var percent: any; declare var exclam: any; declare var lparen: any; declare var rparen: any; declare var lbrack: any; declare var rbrack: any; declare var dot: any; declare var coma: any; declare var colon: any; declare var sarrow: any; declare var lbrace: any; declare var rbrace: any; declare var arrow: any; declare var eq: any; declare var trueTok: any; declare var falseTok: any; declare var sqString: any; declare var dqString: any; declare var intpStrStart: any; declare var intpStrEnd: any; declare var constLit: any; declare var intpExprS: any; declare var int: any; declare var decimal: any; declare var sident: any; declare var dbcolon: any; declare var semi: any; declare var eq: any; declare var lbrace: any; declare var rbrace: any; declare var lparen: any; declare var rparen: any; declare var arrow: any; declare var wildcard: any; declare var coma: any; declare var lparen: any; declare var rparen: any; declare var lbrace: any; declare var rbrace: any; declare var arrow: any; declare var wildcard: any; declare var mid: any; declare var coma: any; declare var langle: any; declare var rangle: any; declare var mid: any; declare var lparen: any; declare var rparen: any; declare var arrow: any; declare var lbrace: any; declare var rbrace: any; declare var colon: any; declare var lbrace: any; declare var rbrace: any; declare var coma: any; declare var lparen: any; declare var rparen: any; declare var semi: any; declare var eq: any; declare var coma: any; declare var lbrace: any; declare var rbrace: any; declare var colon: any; declare var builtinAnnStart: any; declare var coma: any; declare var rparen: any; declare var customAnnS: any; declare var lparen: any; declare var eq: any; declare var mlcomment: any; declare var slcomment: any; declare var ws: any; import * as nasl from '@lcap/nasl'; import { toNaslLogic, toNaslLogicSig, toNaslVarsAndStmts, toNaslNamespace, toNaslUsingNamespace, toNaslLogicDeclare } from './toAST/to-nasl-definition'; import { TYPE, AutoPackNaslAndCst, PackNaslAndCstSeq, PackNaslAndCst, createQIdentifier } from './toAST/common-util'; const KEYWORDS = ['asc', 'ascending', 'desc', 'descending'].concat( ['abstract', 'annotation', 'any', 'arguments', 'as', 'assert', 'attr', 'attrs', 'auth', 'authentication', 'authorization', 'await', 'boolean', 'break', 'browser', 'by', 'byte', 'case', 'cases', 'catch', 'char', 'class', 'com', 'component', 'components', 'coms', 'config', 'configuration', 'const', 'constant', 'constants', 'constructor', 'continue', 'dataSet', 'dataSource', 'database', 'date', 'datetime', 'debug', 'debugger', 'def', 'default', 'delegate', 'delete', 'dep', 'dependencies', 'dependency', 'deps', 'do', 'double', 'dynamic', 'else', 'entity', 'eval', 'events', 'expect', 'experimental', 'export', 'exports', 'ext', 'extends', 'extension', 'extensions', 'external', 'exts', 'field', 'file', 'final', 'finally', 'float', 'for', 'fs', 'function', 'get', 'goto', 'h5', 'i18n', 'if', 'implements', 'implicit', 'import', 'in', 'inspect', 'instanceof', 'int', 'interface', 'interfaces', 'internal', 'is', 'it', 'let', 'logic', 'logics', 'long', 'match', 'math', 'message', 'method', 'methods', 'mod', 'mods', 'module', 'modules', 'native', 'new', 'number', 'null', 'object', 'operator', 'org', 'organization', 'out', 'override', 'package', 'path', 'pc', 'private', 'process', 'processComponent', 'processComponents', 'processes', 'property', 'protected', 'public', 'require', 'requires', 'resource', 'return', 'returns', 'role', 'roles', 'sealed', 'serialization', 'set', 'short', 'slot', 'slots', 'static', 'storage', 'strictfp', 'string', 'super', 'suspend', 'switch', 'synchronized', 'system', 'theme', 'this', 'throw', 'throws', 'time', 'trait', 'transient', 'try', 'typealias', 'typeof', 'ui', 'val', 'validation', 'var', 'variable', 'variables', 'view', 'viewComponent', 'viewComponents', 'views', 'void', 'volatile', 'when', 'where', 'while', 'with', 'yield', 'end', 'declare']) function EMPTY_LIST() { return [] } const INJ = (idx: number) => (d: any) => d[idx] const MakeSeq = ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2]))) // Define the Moo lexer const moo = require('moo'); const lexer = moo.states({ main: { intpStrStart: { match: 's"', push: 'lit' }, slcomment: /\/\/.*?$/, mlcomment: /\/\*[\s\S]*?\*\//, decimal: /-?\d+\.\d+/, int: /-?\d+/, sqString: { match: /'(?:\\['\\bfnrtv]|[^'\\])*'/, value: s => s.slice(1, -1).replace(/\\(.)/g, '$1') }, dqString: { match: /"(?:\\["\\bfnrtv]|[^"\\])*"/, value: s => s.slice(1, -1).replace(/\\(.)/g, '$1') }, trueTok: { match: 'true', type: moo.keywords({ KW: KEYWORDS })}, falseTok: { match: 'false', type: moo.keywords({ KW: KEYWORDS })}, sident: { match: /[a-zA-Z][A-Za-z0-9_]*/, type: moo.keywords({ KW: KEYWORDS, })}, sarrow: '->', leq: '<=', geq: '>=', neq: '!=', eqeq: '==', and: '&&', or: '||', arrow: '=>', dbcolon: '::', semi: ';', coma: ',', lparen: '(', rparen: ')', lbrack: '[', rbrack: ']', lbrace: '{', rbrace: { match: '}', pop: 1 }, builtinAnnStart: '@(', customAnnS: '@', plus: '+', minus: '-', mul: '*', div: '/', percent: '%', eq: '=', exclam: '!', colon: ':', mid: '|', wildcard: '_', langle: '<', rangle: '>', dot: '.', ws: { match: /\s+/, lineBreaks: true }, keyword: KEYWORDS, }, lit: { intpExprS: { match: '${', push: 'main' }, escape: /\\./, intpStrEnd: {match: '"', pop: 1}, constLit: {match: /(?:[^$"]|\$(?!\{))+/, lineBreaks: true}, } }); import { toNaslIdentifier, toNaslIntegerLit, toNaslDecimalLit, toNaslBooleanLit, toNaslStringLit, toNaslNullLit, toNaslArrayLit, toNaslMapLit, toNaslEnumIntRef, toNaslEmptyBrackets, toNaslPrefix, toNaslPostfix, BuildBinary, toNaslCallSuffix, toNaslValArg, toNaslValArgList, toNaslLambda, toNaslSubLogic, toNaslLamParam, toNaslLogicParam, toNaslTyParam, toNaslArrayAccessSuffix, toNaslMemberAccessSuffix, toNaslSQLFilterSuffix, toNaslStringInterpolation, toNaslUnparsed } from './toAST/to-nasl-expression'; import { toNaslSingleAssign, toNaslIf, toNaslElseIf, toNaslWhile, toNaslForeach, toNaslAbort, toNaslEnd, toNaslSwitch, toNaslSwitchCase, toNaslBatchAsgn, } from './toAST/to-nasl-statement'; import { toNaslVarInit } from './toAST/to-nasl-definition'; import { toNaslMatchCase, toNaslMatchStmt, toNaslMatchExpr } from './toAST/to-nasl-match'; import { namedTypeToNaslTypeAnno, fnTypeToNaslTypeAnno, unionTypeToNaslTypeAnno } from './toAST/to-nasl-type'; import { toNaslStructure, toNaslStructureProperty, pCtorToProperty, toNaslEntity, toNaslEnum, toNaslEnumItem } from './toAST/to-nasl-definition'; import { toNaslSqlGroupBy, toNaslQJExpr, toNaslCallQueryComponentImpl, handleSqlSingleProp, handleSqlMultiProp, mkNamedProp, mkSelVProp, toNaslCallQueryOrderBy, collapseSqlJoinCondProp } from './toAST/to-nasl-call-query'; import { toNaslCstAnnArg, toNaslCstAnn } from './toAST/to-nasl-definition'; interface NearleyToken { value: any; [key: string]: any; }; interface NearleyLexer { reset: (chunk: string, info: any) => void; next: () => NearleyToken | undefined; save: () => any; formatError: (token: never) => string; has: (tokenType: string) => boolean; }; interface NearleyRule { name: string; symbols: NearleySymbol[]; postprocess?: (d: any[], loc?: number, reject?: {}) => any; }; type NearleySymbol = string | { literal: any } | { test: (token: any) => boolean }; interface Grammar { Lexer: NearleyLexer | undefined; ParserRules: NearleyRule[]; ParserStart: string; }; const grammar: Grammar = { Lexer: lexer, ParserRules: [ {"name": "AnnExpression", "symbols": ["Expression"], "postprocess": id}, {"name": "Expression", "symbols": ["InfixSQLFilter"], "postprocess": id}, {"name": "InfixSQLFilter", "symbols": ["LogicOr"], "postprocess": id}, {"name": "InfixSQLFilter$subexpression$1", "symbols": [{"literal":"startWith"}]}, {"name": "InfixSQLFilter$subexpression$1", "symbols": [{"literal":"endWith"}]}, {"name": "InfixSQLFilter$subexpression$1", "symbols": [{"literal":"in"}]}, {"name": "InfixSQLFilter$subexpression$1", "symbols": [{"literal":"like"}]}, {"name": "InfixSQLFilter", "symbols": ["InfixSQLFilter", "InfixSQLFilter$subexpression$1", "__", "LogicOr"], "postprocess": BuildBinary}, {"name": "LogicOr", "symbols": ["LogicAnd"], "postprocess": id}, {"name": "LogicOr", "symbols": ["LogicOr", (lexer.has("or") ? {type: "or"} : or), "_", "LogicAnd"], "postprocess": BuildBinary}, {"name": "LogicAnd", "symbols": ["Comparison"], "postprocess": id}, {"name": "LogicAnd", "symbols": ["LogicAnd", (lexer.has("and") ? {type: "and"} : and), "_", "Comparison"], "postprocess": BuildBinary}, {"name": "Comparison", "symbols": ["Addition"], "postprocess": id}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("eqeq") ? {type: "eqeq"} : eqeq)]}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("neq") ? {type: "neq"} : neq)]}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("rangle") ? {type: "rangle"} : rangle)]}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("langle") ? {type: "langle"} : langle)]}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("geq") ? {type: "geq"} : geq)]}, {"name": "Comparison$subexpression$1", "symbols": [(lexer.has("leq") ? {type: "leq"} : leq)]}, {"name": "Comparison", "symbols": ["Comparison", "Comparison$subexpression$1", "_", "Addition"], "postprocess": BuildBinary}, {"name": "Addition", "symbols": ["Multiplication"], "postprocess": id}, {"name": "Addition$subexpression$1", "symbols": [(lexer.has("plus") ? {type: "plus"} : plus)]}, {"name": "Addition$subexpression$1", "symbols": [(lexer.has("minus") ? {type: "minus"} : minus)]}, {"name": "Addition", "symbols": ["Addition", "Addition$subexpression$1", "_", "Multiplication"], "postprocess": BuildBinary}, {"name": "Multiplication", "symbols": ["UnaryExpr"], "postprocess": id}, {"name": "Multiplication$subexpression$1", "symbols": [(lexer.has("mul") ? {type: "mul"} : mul)]}, {"name": "Multiplication$subexpression$1", "symbols": [(lexer.has("div") ? {type: "div"} : div)]}, {"name": "Multiplication$subexpression$1", "symbols": [(lexer.has("percent") ? {type: "percent"} : percent)]}, {"name": "Multiplication", "symbols": ["Multiplication", "Multiplication$subexpression$1", "_", "UnaryExpr"], "postprocess": BuildBinary}, {"name": "UnaryExpr", "symbols": ["PrefixExpr"], "postprocess": id}, {"name": "PrefixExpr", "symbols": ["PostfixExpr"], "postprocess": id}, {"name": "PrefixExpr", "symbols": [(lexer.has("exclam") ? {type: "exclam"} : exclam), "_", "PrefixExpr"], "postprocess": ([prefix, , expr]) => toNaslPrefix(expr)}, {"name": "PostfixExpr", "symbols": ["HighestPriorityExpression"], "postprocess": id}, {"name": "PostfixExpr", "symbols": ["PostfixExpr", "PostfixSuffix"], "postprocess": toNaslPostfix}, {"name": "HighestPriorityExpression", "symbols": ["LiteralExpression"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["ParensizedExpr"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["TermRef"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["EnumIntRef"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["WeakSQL"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["MatchExpr"], "postprocess": id}, {"name": "HighestPriorityExpression", "symbols": ["SimpleLambda"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["BooleanLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["StringLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["IntegerLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["DecimalLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["NullLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["ArrayLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["MapLit"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["SubLogic"], "postprocess": id}, {"name": "LiteralExpression", "symbols": ["EmptyBrackets"], "postprocess": id}, {"name": "TermRef", "symbols": ["QIdentifier"], "postprocess": toNaslIdentifier}, {"name": "ParensizedExpr$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "ParensizedExpr$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "ParensizedExpr$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ParensizedExpr", "symbols": ["ParensizedExpr$macrocall$1"], "postprocess": id}, {"name": "PostfixSuffix", "symbols": ["ArrayAccessSuffix"], "postprocess": id}, {"name": "PostfixSuffix", "symbols": ["CallSuffix"], "postprocess": id}, {"name": "PostfixSuffix", "symbols": ["MemberAccessSuffix"], "postprocess": id}, {"name": "PostfixSuffix", "symbols": ["SQLFilterSuffix"], "postprocess": id}, {"name": "ArrayAccessSuffix$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "ArrayAccessSuffix$macrocall$1", "symbols": [(lexer.has("lbrack") ? {type: "lbrack"} : lbrack), "_", "ArrayAccessSuffix$macrocall$2", (lexer.has("rbrack") ? {type: "rbrack"} : rbrack), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ArrayAccessSuffix", "symbols": ["ArrayAccessSuffix$macrocall$1"], "postprocess": toNaslArrayAccessSuffix}, {"name": "MemberAccessSuffix", "symbols": [(lexer.has("dot") ? {type: "dot"} : dot), "_", "SimpleIdentifier"], "postprocess": ([_0, _1, member]) => toNaslMemberAccessSuffix(member)}, {"name": "SQLFilterSuffix", "symbols": [{"literal":"isNull"}, "_"], "postprocess": ([d, _1]) => toNaslSQLFilterSuffix()}, {"name": "ArrayLit$macrocall$2$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "ArrayLit$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "ArrayLit$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "ArrayLit$macrocall$2$macrocall$2"]}, {"name": "ArrayLit$macrocall$2$macrocall$1$ebnf$1", "symbols": ["ArrayLit$macrocall$2$macrocall$1$ebnf$1", "ArrayLit$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "ArrayLit$macrocall$2$macrocall$1", "symbols": ["ArrayLit$macrocall$2$macrocall$2", "ArrayLit$macrocall$2$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "ArrayLit$macrocall$2", "symbols": ["ArrayLit$macrocall$2$macrocall$1"]}, {"name": "ArrayLit$macrocall$1", "symbols": [(lexer.has("lbrack") ? {type: "lbrack"} : lbrack), "_", "ArrayLit$macrocall$2", (lexer.has("rbrack") ? {type: "rbrack"} : rbrack), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ArrayLit$ebnf$1$subexpression$1", "symbols": [(lexer.has("colon") ? {type: "colon"} : colon), "_", "Type"]}, {"name": "ArrayLit$ebnf$1", "symbols": ["ArrayLit$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "ArrayLit$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "ArrayLit", "symbols": ["ArrayLit$macrocall$1", "ArrayLit$ebnf$1"], "postprocess": ([exprs, _ty]) => toNaslArrayLit(exprs, _ty ? _ty[2] : null)}, {"name": "ArrayLit$macrocall$4", "symbols": []}, {"name": "ArrayLit$macrocall$3", "symbols": [(lexer.has("lbrack") ? {type: "lbrack"} : lbrack), "_", "ArrayLit$macrocall$4", (lexer.has("rbrack") ? {type: "rbrack"} : rbrack), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ArrayLit$subexpression$1", "symbols": [(lexer.has("colon") ? {type: "colon"} : colon), "_", "Type"]}, {"name": "ArrayLit", "symbols": ["ArrayLit$macrocall$3", "ArrayLit$subexpression$1"], "postprocess": ([exprs, _ty]) => toNaslArrayLit(exprs, _ty[2])}, {"name": "MapLit$macrocall$2$macrocall$2", "symbols": ["MapEntry"]}, {"name": "MapLit$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "MapLit$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "MapLit$macrocall$2$macrocall$2"]}, {"name": "MapLit$macrocall$2$macrocall$1$ebnf$1", "symbols": ["MapLit$macrocall$2$macrocall$1$ebnf$1", "MapLit$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "MapLit$macrocall$2$macrocall$1", "symbols": ["MapLit$macrocall$2$macrocall$2", "MapLit$macrocall$2$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "MapLit$macrocall$2", "symbols": ["MapLit$macrocall$2$macrocall$1"]}, {"name": "MapLit$macrocall$1", "symbols": [(lexer.has("lbrack") ? {type: "lbrack"} : lbrack), "_", "MapLit$macrocall$2", (lexer.has("rbrack") ? {type: "rbrack"} : rbrack), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MapLit", "symbols": ["MapLit$macrocall$1"], "postprocess": toNaslMapLit}, {"name": "MapEntry", "symbols": ["AnnExpression", (lexer.has("sarrow") ? {type: "sarrow"} : sarrow), "_", "AnnExpression"], "postprocess": ([key, _1, _2, val]) => AutoPackNaslAndCst({ key, val })}, {"name": "EmptyBrackets", "symbols": [(lexer.has("lbrack") ? {type: "lbrack"} : lbrack), "_", (lexer.has("rbrack") ? {type: "rbrack"} : rbrack), "_"], "postprocess": toNaslEmptyBrackets}, {"name": "SimpleLambda$macrocall$2", "symbols": ["SimpleLambdaDef"]}, {"name": "SimpleLambda$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "SimpleLambda$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "SimpleLambda", "symbols": ["SimpleLambda$macrocall$1"], "postprocess": id}, {"name": "SimpleLambdaDef$ebnf$1", "symbols": ["LamParamList"], "postprocess": id}, {"name": "SimpleLambdaDef$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "SimpleLambdaDef$ebnf$2", "symbols": [(lexer.has("arrow") ? {type: "arrow"} : arrow)], "postprocess": id}, {"name": "SimpleLambdaDef$ebnf$2", "symbols": [], "postprocess": () => null}, {"name": "SimpleLambdaDef", "symbols": ["SimpleLambdaDef$ebnf$1", "SimpleLambdaDef$ebnf$2", "__", "Expression"], "postprocess": ([params, , , expr]) => toNaslLambda(expr, params)}, {"name": "LamParamList$macrocall$2", "symbols": ["LamParam"]}, {"name": "LamParamList$macrocall$1$ebnf$1", "symbols": []}, {"name": "LamParamList$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "LamParamList$macrocall$2"]}, {"name": "LamParamList$macrocall$1$ebnf$1", "symbols": ["LamParamList$macrocall$1$ebnf$1", "LamParamList$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "LamParamList$macrocall$1", "symbols": ["LamParamList$macrocall$2", "LamParamList$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "LamParamList", "symbols": ["LamParamList$macrocall$1"], "postprocess": id}, {"name": "LamParamList$macrocall$4$macrocall$2", "symbols": ["LamParam"]}, {"name": "LamParamList$macrocall$4$macrocall$1$ebnf$1", "symbols": []}, {"name": "LamParamList$macrocall$4$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "LamParamList$macrocall$4$macrocall$2"]}, {"name": "LamParamList$macrocall$4$macrocall$1$ebnf$1", "symbols": ["LamParamList$macrocall$4$macrocall$1$ebnf$1", "LamParamList$macrocall$4$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "LamParamList$macrocall$4$macrocall$1", "symbols": ["LamParamList$macrocall$4$macrocall$2", "LamParamList$macrocall$4$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "LamParamList$macrocall$4$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "LamParamList$macrocall$4", "symbols": ["LamParamList$macrocall$4$macrocall$1"]}, {"name": "LamParamList$macrocall$3", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "LamParamList$macrocall$4", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "LamParamList", "symbols": ["LamParamList$macrocall$3"], "postprocess": id}, {"name": "LamParam$ebnf$1$subexpression$1", "symbols": ["TyAnn"]}, {"name": "LamParam$ebnf$1", "symbols": ["LamParam$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "LamParam$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "LamParam", "symbols": ["SimpleIdentifier", "LamParam$ebnf$1"], "postprocess": ([name, ty]) => toNaslLamParam(name, ty)}, {"name": "TyParamList$macrocall$2$macrocall$2", "symbols": ["TypeVariable"]}, {"name": "TyParamList$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "TyParamList$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "TyParamList$macrocall$2$macrocall$2"]}, {"name": "TyParamList$macrocall$2$macrocall$1$ebnf$1", "symbols": ["TyParamList$macrocall$2$macrocall$1$ebnf$1", "TyParamList$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "TyParamList$macrocall$2$macrocall$1", "symbols": ["TyParamList$macrocall$2$macrocall$2", "TyParamList$macrocall$2$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "TyParamList$macrocall$2$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "TyParamList$macrocall$2", "symbols": ["TyParamList$macrocall$2$macrocall$1"]}, {"name": "TyParamList$macrocall$1", "symbols": [(lexer.has("langle") ? {type: "langle"} : langle), "_", "TyParamList$macrocall$2", (lexer.has("rangle") ? {type: "rangle"} : rangle), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "TyParamList", "symbols": ["TyParamList$macrocall$1"], "postprocess": TYPE("TyParamList")}, {"name": "LogicParam", "symbols": ["VarInit"], "postprocess": toNaslLogicParam}, {"name": "TyAnn", "symbols": [(lexer.has("colon") ? {type: "colon"} : colon), "_", "Type"], "postprocess": ([_0, _1, ty]) => ty}, {"name": "CallSuffix$ebnf$1", "symbols": ["TypeArgList"], "postprocess": id}, {"name": "CallSuffix$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "CallSuffix", "symbols": ["CallSuffix$ebnf$1", "ValueArgList"], "postprocess": toNaslCallSuffix}, {"name": "TypeArgList$macrocall$2$macrocall$2", "symbols": ["Type"]}, {"name": "TypeArgList$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "TypeArgList$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "TypeArgList$macrocall$2$macrocall$2"]}, {"name": "TypeArgList$macrocall$2$macrocall$1$ebnf$1", "symbols": ["TypeArgList$macrocall$2$macrocall$1$ebnf$1", "TypeArgList$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "TypeArgList$macrocall$2$macrocall$1", "symbols": ["TypeArgList$macrocall$2$macrocall$2", "TypeArgList$macrocall$2$macrocall$1$ebnf$1"], "postprocess": ([d0, d1]) => PackNaslAndCstSeq(d0.concat(...d1.map(item => item[2])) )}, {"name": "TypeArgList$macrocall$2$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "TypeArgList$macrocall$2", "symbols": ["TypeArgList$macrocall$2$macrocall$1"]}, {"name": "TypeArgList$macrocall$1", "symbols": [(lexer.has("langle") ? {type: "langle"} : langle), "_", "TypeArgList$macrocall$2", (lexer.has("rangle") ? {type: "rangle"} : rangle), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "TypeArgList", "symbols": ["TypeArgList$macrocall$1"], "postprocess": id}, {"name": "ValueArgList$macrocall$2$macrocall$2", "symbols": ["ValueArg"]}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "ValueArgList$macrocall$2$macrocall$2"]}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$1", "symbols": ["ValueArgList$macrocall$2$macrocall$1$ebnf$1", "ValueArgList$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$2$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_"]}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$2", "symbols": ["ValueArgList$macrocall$2$macrocall$1$ebnf$2$subexpression$1"], "postprocess": id}, {"name": "ValueArgList$macrocall$2$macrocall$1$ebnf$2", "symbols": [], "postprocess": () => null}, {"name": "ValueArgList$macrocall$2$macrocall$1", "symbols": ["ValueArgList$macrocall$2$macrocall$2", "ValueArgList$macrocall$2$macrocall$1$ebnf$1", "ValueArgList$macrocall$2$macrocall$1$ebnf$2"], "postprocess": MakeSeq}, {"name": "ValueArgList$macrocall$2$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "ValueArgList$macrocall$2", "symbols": ["ValueArgList$macrocall$2$macrocall$1"]}, {"name": "ValueArgList$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "ValueArgList$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ValueArgList$ebnf$1", "symbols": ["TrailingLambda"], "postprocess": id}, {"name": "ValueArgList$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "ValueArgList", "symbols": ["ValueArgList$macrocall$1", "ValueArgList$ebnf$1"], "postprocess": ([args, lam]) => toNaslValArgList(args, lam)}, {"name": "TrailingLambda", "symbols": ["SimpleLambda"], "postprocess": id}, {"name": "ValueArg", "symbols": ["NamedArg"], "postprocess": id}, {"name": "ValueArg", "symbols": ["UnnamedArg"], "postprocess": id}, {"name": "UnnamedArg", "symbols": ["AnnExpression"], "postprocess": ([expr]) => toNaslValArg(expr)}, {"name": "NamedArg", "symbols": ["SimpleIdentifier", (lexer.has("eq") ? {type: "eq"} : eq), "_", "AnnExpression"], "postprocess": ([name, _1, _2, expr]) => toNaslValArg(expr, name)}, {"name": "BooleanLit$subexpression$1", "symbols": [(lexer.has("trueTok") ? {type: "trueTok"} : trueTok)]}, {"name": "BooleanLit$subexpression$1", "symbols": [(lexer.has("falseTok") ? {type: "falseTok"} : falseTok)]}, {"name": "BooleanLit", "symbols": ["BooleanLit$subexpression$1", "_"], "postprocess": toNaslBooleanLit}, {"name": "StringLit$subexpression$1", "symbols": [(lexer.has("sqString") ? {type: "sqString"} : sqString)]}, {"name": "StringLit$subexpression$1", "symbols": [(lexer.has("dqString") ? {type: "dqString"} : dqString)]}, {"name": "StringLit", "symbols": ["StringLit$subexpression$1", "_"], "postprocess": toNaslStringLit}, {"name": "StringLit", "symbols": ["JSString", "_"], "postprocess": id}, {"name": "StringLit", "symbols": ["StringInterpolation", "_"], "postprocess": id}, {"name": "JSString$ebnf$1", "symbols": []}, {"name": "JSString$ebnf$1", "symbols": ["JSString$ebnf$1", "dstrchar"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "JSString", "symbols": [{"literal":"js\""}, "JSString$ebnf$1", {"literal":"\""}], "postprocess": ([, d, ]) => toNaslUnparsed(d.join(""))}, {"name": "JSString$ebnf$2", "symbols": []}, {"name": "JSString$ebnf$2", "symbols": ["JSString$ebnf$2", "sstrchar"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "JSString", "symbols": [{"literal":"js'"}, "JSString$ebnf$2", {"literal":"'"}], "postprocess": ([, d, ]) => toNaslUnparsed(d.join(""))}, {"name": "StringInterpolation$ebnf$1", "symbols": []}, {"name": "StringInterpolation$ebnf$1", "symbols": ["StringInterpolation$ebnf$1", "IntpPart"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "StringInterpolation", "symbols": [(lexer.has("intpStrStart") ? {type: "intpStrStart"} : intpStrStart), "StringInterpolation$ebnf$1", (lexer.has("intpStrEnd") ? {type: "intpStrEnd"} : intpStrEnd)], "postprocess": ([, ds, ]) => toNaslStringInterpolation(ds)}, {"name": "IntpPart", "symbols": ["IntpExpr"], "postprocess": d => { let xxx = ({ __type: 'Expression', expr: d[0] }); return xxx} }, {"name": "IntpPart", "symbols": [(lexer.has("constLit") ? {type: "constLit"} : constLit)], "postprocess": ([d]) => { return ({ __type: 'InterpString', str: d }) } }, {"name": "ItpStr", "symbols": [/[^`$]/], "postprocess": id}, {"name": "IntpExpr", "symbols": [(lexer.has("intpExprS") ? {type: "intpExprS"} : intpExprS), "Expression", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace)], "postprocess": INJ(1)}, {"name": "IntegerLit", "symbols": [(lexer.has("int") ? {type: "int"} : int), "_"], "postprocess": ([d]) => toNaslIntegerLit(d.value)}, {"name": "DecimalLit", "symbols": [(lexer.has("decimal") ? {type: "decimal"} : decimal), "_"], "postprocess": ([d]) => toNaslDecimalLit(d.value)}, {"name": "NullLit", "symbols": [{"literal":"null"}, "_"], "postprocess": toNaslNullLit}, {"name": "QIdentifier", "symbols": ["SimpleIdentifier"], "postprocess": ([name]) => createQIdentifier(name)}, {"name": "QIdentifier$ebnf$1", "symbols": ["QNotation"]}, {"name": "QIdentifier$ebnf$1", "symbols": ["QIdentifier$ebnf$1", "QNotation"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "QIdentifier", "symbols": ["QIdentifier$ebnf$1", "SimpleIdentifier"], "postprocess": ([namespace, name]) => TYPE('QIdentifier', { namespace: namespace.flat(), name })}, {"name": "SimpleIdentifier", "symbols": [(lexer.has("sident") ? {type: "sident"} : sident), "_"], "postprocess": ([d]) => d.value}, {"name": "QNotation", "symbols": ["SimpleIdentifier", (lexer.has("dbcolon") ? {type: "dbcolon"} : dbcolon)], "postprocess": INJ(0)}, {"name": "EnumIntRef$ebnf$1", "symbols": ["QNotation"]}, {"name": "EnumIntRef$ebnf$1", "symbols": ["EnumIntRef$ebnf$1", "QNotation"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "EnumIntRef", "symbols": ["EnumIntRef$ebnf$1", "IntegerLit"], "postprocess": toNaslEnumIntRef}, {"name": "VarDecl", "symbols": [{"literal":"let"}, "_", "VarInit", "StmtHardSep"], "postprocess": ([_0, _1, init, _3]) => init}, {"name": "VarInit$ebnf$1", "symbols": ["TyAnn"], "postprocess": id}, {"name": "VarInit$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "VarInit$ebnf$2", "symbols": ["AssignValue"], "postprocess": id}, {"name": "VarInit$ebnf$2", "symbols": [], "postprocess": () => null}, {"name": "VarInit", "symbols": ["SimpleIdentifier", "VarInit$ebnf$1", "VarInit$ebnf$2"], "postprocess": toNaslVarInit}, {"name": "Statement$subexpression$1", "symbols": ["If"]}, {"name": "Statement$subexpression$1", "symbols": ["Assignment"]}, {"name": "Statement$subexpression$1", "symbols": ["Switch"]}, {"name": "Statement$subexpression$1", "symbols": ["While"]}, {"name": "Statement$subexpression$1", "symbols": ["Foreach"]}, {"name": "Statement$subexpression$1", "symbols": ["MatchStmt"]}, {"name": "Statement$subexpression$1", "symbols": ["PageRedirection"]}, {"name": "Statement$subexpression$1", "symbols": ["ValidationRuleCall"]}, {"name": "Statement$subexpression$1", "symbols": ["End"]}, {"name": "Statement$subexpression$1", "symbols": ["Abort"]}, {"name": "Statement$subexpression$1", "symbols": ["ExprStmt"]}, {"name": "Statement$ebnf$1$subexpression$1", "symbols": [(lexer.has("semi") ? {type: "semi"} : semi), "__"]}, {"name": "Statement$ebnf$1", "symbols": ["Statement$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "Statement$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "Statement", "symbols": ["Statement$subexpression$1", "Statement$ebnf$1"], "postprocess": ([d, ]) => { return d[0]; }}, {"name": "StmtHardSep", "symbols": ["__"]}, {"name": "StmtHardSep", "symbols": [(lexer.has("semi") ? {type: "semi"} : semi)]}, {"name": "StmtHardSep", "symbols": [(lexer.has("semi") ? {type: "semi"} : semi), "__"], "postprocess": function() {}}, {"name": "Assignment", "symbols": ["SingleAssign"], "postprocess": id}, {"name": "Assignment", "symbols": ["BatchAssign"], "postprocess": id}, {"name": "SingleAssign", "symbols": ["PostfixExpr", "AssignValue"], "postprocess": ([lhs, rhs]) => toNaslSingleAssign(lhs, rhs)}, {"name": "AssignValue", "symbols": [(lexer.has("eq") ? {type: "eq"} : eq), "_", "AnnExpression"], "postprocess": ([_0, _1, ae]) => ae}, {"name": "BatchAssign$macrocall$2$ebnf$1", "symbols": []}, {"name": "BatchAssign$macrocall$2$ebnf$1", "symbols": ["BatchAssign$macrocall$2$ebnf$1", "SingleAssignWithSemi"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "BatchAssign$macrocall$2", "symbols": ["BatchAssign$macrocall$2$ebnf$1"]}, {"name": "BatchAssign$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "BatchAssign$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "BatchAssign", "symbols": ["BatchAssign$macrocall$1"], "postprocess": ([ds]) => toNaslBatchAsgn(ds)}, {"name": "SingleAssignWithSemi$ebnf$1$subexpression$1", "symbols": [(lexer.has("semi") ? {type: "semi"} : semi), "_"]}, {"name": "SingleAssignWithSemi$ebnf$1", "symbols": ["SingleAssignWithSemi$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "SingleAssignWithSemi$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "SingleAssignWithSemi", "symbols": ["SingleAssign", "SingleAssignWithSemi$ebnf$1"], "postprocess": INJ(0)}, {"name": "If$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "If$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "If$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "If$macrocall$4", "symbols": ["Statements"]}, {"name": "If$macrocall$3", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "If$macrocall$4", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "If$ebnf$1", "symbols": []}, {"name": "If$ebnf$1", "symbols": ["If$ebnf$1", "ElseIf"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "If$ebnf$2", "symbols": ["FinalElse"], "postprocess": id}, {"name": "If$ebnf$2", "symbols": [], "postprocess": () => null}, {"name": "If", "symbols": [{"literal":"if"}, "_", "If$macrocall$1", "If$macrocall$3", "If$ebnf$1", "If$ebnf$2"], "postprocess": ([_0, _1, test, body, elseIfs, finalElse]) => toNaslIf(test, body, elseIfs, finalElse)}, {"name": "ElseIf$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "ElseIf$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "ElseIf$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ElseIf$macrocall$4", "symbols": ["Statements"]}, {"name": "ElseIf$macrocall$3", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "ElseIf$macrocall$4", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "ElseIf", "symbols": [{"literal":"elseif"}, "_", "ElseIf$macrocall$1", "ElseIf$macrocall$3"], "postprocess": ([_0, _1, test, stmts]) => toNaslElseIf(test, stmts)}, {"name": "FinalElse$macrocall$2", "symbols": ["Statements"]}, {"name": "FinalElse$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "FinalElse$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "FinalElse", "symbols": [{"literal":"else"}, "_", "FinalElse$macrocall$1"], "postprocess": INJ(2)}, {"name": "While$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "While$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "While$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "While$macrocall$4", "symbols": ["Statements"]}, {"name": "While$macrocall$3", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "While$macrocall$4", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "While", "symbols": [{"literal":"while"}, "_", "While$macrocall$1", "While$macrocall$3"], "postprocess": ([_0, _1, test, stmts]) => toNaslWhile(test, stmts)}, {"name": "Switch$macrocall$2", "symbols": ["SwitchCases"]}, {"name": "Switch$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "Switch$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "Switch", "symbols": [{"literal":"switch"}, "_", "Switch$macrocall$1"], "postprocess": ([_0, _1, cases]) => toNaslSwitch(cases)}, {"name": "SwitchCases$ebnf$1", "symbols": []}, {"name": "SwitchCases$ebnf$1", "symbols": ["SwitchCases$ebnf$1", "SwitchNormalCase"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "SwitchCases", "symbols": ["SwitchCases$ebnf$1", "SwitchDefaultCase"], "postprocess": ([norm, dft]) => AutoPackNaslAndCst( {norm: PackNaslAndCstSeq(norm.flat()), dft})}, {"name": "SwitchNormalCase$macrocall$2", "symbols": ["Statements"]}, {"name": "SwitchNormalCase$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "SwitchNormalCase$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "SwitchNormalCase", "symbols": ["AnnExpression", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "SwitchNormalCase$macrocall$1"], "postprocess": ([expr, _1, _2, stmts]) => toNaslSwitchCase(stmts, expr)}, {"name": "SwitchDefaultCase$macrocall$2", "symbols": ["Statements"]}, {"name": "SwitchDefaultCase$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "SwitchDefaultCase$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "SwitchDefaultCase", "symbols": [(lexer.has("wildcard") ? {type: "wildcard"} : wildcard), "_", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "SwitchDefaultCase$macrocall$1"], "postprocess": ([_0, _1, _2, _3, stmts]) => toNaslSwitchCase(stmts)}, {"name": "Foreach$macrocall$2", "symbols": ["LoopCond"]}, {"name": "Foreach$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "Foreach$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "Foreach$macrocall$4", "symbols": ["Statements"]}, {"name": "Foreach$macrocall$3", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "Foreach$macrocall$4", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "Foreach", "symbols": [{"literal":"for"}, "_", "Foreach$macrocall$1", "Foreach$macrocall$3"], "postprocess": ([_0, _1, cond, stmts]) => toNaslForeach(cond, stmts)}, {"name": "LoopCond$ebnf$1", "symbols": ["LoopIndexAndRange"], "postprocess": id}, {"name": "LoopCond$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "LoopCond", "symbols": ["SimpleIdentifier", {"literal":"in"}, "_", "AnnExpression", "LoopCond$ebnf$1"], "postprocess": ([item, _0, _1, colle, idxRange]) => PackNaslAndCst({item, colle: colle.nasl, idx: idxRange?.nasl.idx, start: idxRange?.nasl.start, end: idxRange?.nasl.end } , TYPE('LoopCond', {item, colle: colle.cst, idx: idxRange?.cst.idx, start: idxRange?.cst.start, end: idxRange?.cst.end })) }, {"name": "LoopIndexAndRange$ebnf$1", "symbols": ["LoopRange"], "postprocess": id}, {"name": "LoopIndexAndRange$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "LoopIndexAndRange", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "SimpleIdentifier", "LoopIndexAndRange$ebnf$1"], "postprocess": ([_0, _1, idx, range]) => PackNaslAndCst({ idx, start: range?.nasl.start, end: range?.nasl.end } ,{ idx, start: range?.cst.start, end: range?.cst.end}) }, {"name": "LoopRange$ebnf$1$subexpression$1", "symbols": [{"literal":"to"}, "_", "AnnExpression"]}, {"name": "LoopRange$ebnf$1", "symbols": ["LoopRange$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "LoopRange$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "LoopRange", "symbols": [{"literal":"in"}, "_", "AnnExpression", "LoopRange$ebnf$1"], "postprocess": ([_0, _1, start, end]) => AutoPackNaslAndCst({ start: start, end: end?.[2] }) }, {"name": "ExprStmt", "symbols": ["PostfixExpr", "PostfixSuffix"], "postprocess": toNaslPostfix}, {"name": "PageRedirection", "symbols": ["InAppRedirection"], "postprocess": id}, {"name": "PageRedirection", "symbols": ["ExtRedirection"], "postprocess": id}, {"name": "InAppRedirection", "symbols": [{"literal":"goto"}, "__", "PostfixExpr"], "postprocess": INJ(2)}, {"name": "ExtRedirection", "symbols": [{"literal":"goto"}, "__", "StringLit", "CallSuffix"], "postprocess": ([_0, _1, url, suffix]) => TYPE('ExtRedirection', { url, suffix })}, {"name": "Abort", "symbols": [{"literal":"abort"}, "_"], "postprocess": toNaslAbort}, {"name": "End", "symbols": [{"literal":"end"}, "_"], "postprocess": toNaslEnd}, {"name": "ValidationRuleCall", "symbols": [{"literal":"expect"}, "__", "PostfixExpr"], "postprocess": INJ(1)}, {"name": "MatchStmt$macrocall$2", "symbols": ["AnnExpression"]}, {"name": "MatchStmt$macrocall$1", "symbols": [(lexer.has("lparen") ? {type: "lparen"} : lparen), "_", "MatchStmt$macrocall$2", (lexer.has("rparen") ? {type: "rparen"} : rparen), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MatchStmt$macrocall$4", "symbols": ["MatchStmtCases"]}, {"name": "MatchStmt$macrocall$3", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "MatchStmt$macrocall$4", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MatchStmt", "symbols": [{"literal":"match"}, "__", "MatchStmt$macrocall$1", "MatchStmt$macrocall$3"], "postprocess": ([_0, _1, expr, cases]) => toNaslMatchStmt(expr, cases)}, {"name": "MatchStmtCases$ebnf$1", "symbols": []}, {"name": "MatchStmtCases$ebnf$1", "symbols": ["MatchStmtCases$ebnf$1", "MatchStmtNormalCase"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "MatchStmtCases", "symbols": ["MatchStmtCases$ebnf$1", "MatchStmtDefaultCase"], "postprocess": ([norm, dft]) => AutoPackNaslAndCst({ norm: PackNaslAndCstSeq(norm.flat()), dft })}, {"name": "MatchStmtNormalCase$macrocall$2", "symbols": ["Statements"]}, {"name": "MatchStmtNormalCase$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "MatchStmtNormalCase$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MatchStmtNormalCase", "symbols": ["MatchCasePats", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "MatchStmtNormalCase$macrocall$1"], "postprocess": ([pats, , , stmts]) => toNaslMatchCase(stmts, pats)}, {"name": "MatchStmtDefaultCase$macrocall$2", "symbols": ["Statements"]}, {"name": "MatchStmtDefaultCase$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "MatchStmtDefaultCase$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MatchStmtDefaultCase", "symbols": [(lexer.has("wildcard") ? {type: "wildcard"} : wildcard), "_", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "MatchStmtDefaultCase$macrocall$1"], "postprocess": ([, , , , stmts]) => toNaslMatchCase(stmts)}, {"name": "MatchCasePats$macrocall$2", "symbols": ["CasePat"]}, {"name": "MatchCasePats$macrocall$1$ebnf$1", "symbols": []}, {"name": "MatchCasePats$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("mid") ? {type: "mid"} : mid), "_", "MatchCasePats$macrocall$2"]}, {"name": "MatchCasePats$macrocall$1$ebnf$1", "symbols": ["MatchCasePats$macrocall$1$ebnf$1", "MatchCasePats$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "MatchCasePats$macrocall$1", "symbols": ["MatchCasePats$macrocall$2", "MatchCasePats$macrocall$1$ebnf$1"], "postprocess": MakeSeq}, {"name": "MatchCasePats$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "MatchCasePats", "symbols": ["MatchCasePats$macrocall$1"], "postprocess": id}, {"name": "CasePat", "symbols": ["TypePat"], "postprocess": id}, {"name": "CasePat", "symbols": ["ExprPat"], "postprocess": id}, {"name": "ExprPat", "symbols": ["AnnExpression"], "postprocess": id}, {"name": "TypePat", "symbols": ["FnType"], "postprocess": id}, {"name": "MatchExpr$macrocall$2", "symbols": ["MatchExprCases"]}, {"name": "MatchExpr$macrocall$1", "symbols": [(lexer.has("lbrace") ? {type: "lbrace"} : lbrace), "_", "MatchExpr$macrocall$2", (lexer.has("rbrace") ? {type: "rbrace"} : rbrace), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "MatchExpr", "symbols": [{"literal":"match"}, "__", "AnnExpression", "MatchExpr$macrocall$1"], "postprocess": ([_0, _1, expr, cases]) => toNaslMatchExpr(expr, cases)}, {"name": "MatchExprCases$ebnf$1", "symbols": []}, {"name": "MatchExprCases$ebnf$1", "symbols": ["MatchExprCases$ebnf$1", "MatchExprNormalCase"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "MatchExprCases", "symbols": ["__", "MatchExprCases$ebnf$1", "__", "MatchExprDefaultCase"], "postprocess": ([, norm, , def]) => AutoPackNaslAndCst({ norm: PackNaslAndCstSeq(norm.flat()), def })}, {"name": "MatchExprNormalCase", "symbols": ["MatchCasePats", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "AnnExpression"], "postprocess": ([pats, _1, _2, expr]) => toNaslMatchCase([expr], pats)}, {"name": "MatchExprDefaultCase", "symbols": [(lexer.has("wildcard") ? {type: "wildcard"} : wildcard), "_", (lexer.has("arrow") ? {type: "arrow"} : arrow), "_", "AnnExpression"], "postprocess": ([_0, _1, _2, _3, expr]) => toNaslMatchCase([expr])}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$2", "symbols": ["TypeVariable"]}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1", "symbols": []}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1$subexpression$1", "symbols": [(lexer.has("coma") ? {type: "coma"} : coma), "_", "TypeIntro$ebnf$1$macrocall$2$macrocall$2"]}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1", "symbols": ["TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1", "TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1$subexpression$1"], "postprocess": (d) => d[0].concat([d[1]])}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$1", "symbols": ["TypeIntro$ebnf$1$macrocall$2$macrocall$2", "TypeIntro$ebnf$1$macrocall$2$macrocall$1$ebnf$1"], "postprocess": MakeSeq}, {"name": "TypeIntro$ebnf$1$macrocall$2$macrocall$1", "symbols": [], "postprocess": EMPTY_LIST}, {"name": "TypeIntro$ebnf$1$macrocall$2", "symbols": ["TypeIntro$ebnf$1$macrocall$2$macrocall$1"]}, {"name": "TypeIntro$ebnf$1$macrocall$1", "symbols": [(lexer.has("langle") ? {type: "langle"} : langle), "_", "TypeIntro$ebnf$1$macrocall$2", (lexer.has("rangle") ? {type: "rangle"} : rangle), "_"], "postprocess": ([_0, _1, res, _3, _4]) => res[0]}, {"name": "TypeIntro$ebnf$1", "symbols": ["TypeIntro$ebnf$1$macrocall$1"], "postprocess": id}, {"name": "TypeIntro$ebnf$1", "symbols": [], "postprocess": () => null}, {"name": "TypeIntro", "symbols": ["SimpleIdentifier", "TypeIntro$ebnf$1"], "postprocess": ([tyCon, tyVars]) => TYPE('TypeIntro', { tyCon, tyVars: tyVars ?? [] })}, {"name": "TypeVariable", "symbols": ["SimpleIden