From 706af990ed5c777978d26bfd11d8b1b6cacf9abc Mon Sep 17 00:00:00 2001 From: "PETERSBURG\\Aleksandr_Sidoruk" Date: Tue, 21 Feb 2017 16:28:02 +0300 Subject: [PATCH 1/3] JavaScript support for a Hermes WDL grammar --- grammar.hgr | 79 +- javascript/.gitignore | 1 + javascript/README.md | 66 + javascript/hermes | 6 + javascript/sample.js | 20 + javascript/tests/cases/0/ast | 405 +++ javascript/tests/cases/0/wdl | 88 + javascript/tests/cases/1/ast | 186 ++ javascript/tests/cases/1/wdl | 39 + javascript/tests/cases/2/ast | 111 + javascript/tests/cases/2/wdl | 21 + javascript/tests/cases/3/ast | 186 ++ javascript/tests/cases/3/wdl | 43 + javascript/tests/cases/4/ast | 107 + javascript/tests/cases/4/wdl | 20 + javascript/tests/cases/5/ast | 446 ++++ javascript/tests/cases/5/wdl | 94 + javascript/tests/package.json | 8 + javascript/tests/parser-test.js | 41 + javascript/wdl_parser.js | 5548 +++++++++++++++++++++++++++++++++++++++ 20 files changed, 7504 insertions(+), 11 deletions(-) create mode 100644 javascript/.gitignore create mode 100644 javascript/README.md create mode 100644 javascript/hermes create mode 100644 javascript/sample.js create mode 100644 javascript/tests/cases/0/ast create mode 100644 javascript/tests/cases/0/wdl create mode 100644 javascript/tests/cases/1/ast create mode 100644 javascript/tests/cases/1/wdl create mode 100644 javascript/tests/cases/2/ast create mode 100644 javascript/tests/cases/2/wdl create mode 100644 javascript/tests/cases/3/ast create mode 100644 javascript/tests/cases/3/wdl create mode 100644 javascript/tests/cases/4/ast create mode 100644 javascript/tests/cases/4/wdl create mode 100644 javascript/tests/cases/5/ast create mode 100644 javascript/tests/cases/5/wdl create mode 100644 javascript/tests/package.json create mode 100644 javascript/tests/parser-test.js create mode 100644 javascript/wdl_parser.js diff --git a/grammar.hgr b/grammar.hgr index 063c06a..e4b1f88 100644 --- a/grammar.hgr +++ b/grammar.hgr @@ -41,11 +41,13 @@ grammar { enum { python: r'"([^\\\"\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*"' java: "\\\"(?>[^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\"" - } -> unescape(:string) + javascript: "\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\"" + } -> wdl_unescape(:string) enum { python: r'\'([^\\\'\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\'' java: "'(?>[^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" - } -> unescape(:string) + javascript: "'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" + } -> wdl_unescape(:string) r':' -> :colon r',' -> :comma @@ -74,6 +76,7 @@ grammar { enum { python: r'\?' java: "\\?" + javascript: "\\?" } -> :qmark r'-?[0-9]+\.[0-9]+' -> :float r'[0-9]+' -> :integer @@ -89,6 +92,7 @@ grammar { enum { python: r'{%_identifier%}(\.{%_identifier%})*' java: "{%_identifier%}(\\.{%_identifier%})*" + javascript: "{%_identifier%}(\\.{%_identifier%})*" } -> :fqn } mode { @@ -139,11 +143,13 @@ grammar { enum { python: r'"([^\\\"\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*"' java: "\\\"(?>[^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\"" - } -> unescape(:string) + javascript: "\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\"" + } -> wdl_unescape(:string) enum { python: r'\'([^\\\'\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\'' java: "'(?>[^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" - } -> unescape(:string) + javascript: "'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" + } -> wdl_unescape(:string) r'-?[0-9]+\.[0-9]+' -> :float r'[0-9]+' -> :integer } @@ -152,6 +158,7 @@ grammar { enum { python: r'{%_identifier%}(\.{%_identifier%})*' java: "{%_identifier%}(\\.{%_identifier%})*" + javascript: "{%_identifier%}(\\.{%_identifier%})*" } -> :fqn %pop } mode { @@ -172,7 +179,7 @@ grammar { python: r'(.*?)(?=\$\{|\})' (DOTALL) c: r'(.*?)(?=\$\{|\})' (PCRE_DOTALL) java: r'(.*?)(?=\$\{|\})' (DOTALL) - javascript: r'(.*?)(?=\$\{|\})' (m) + javascript: r'([\s\S]*?)(?=\$\{|\})' (m) } -> :cmd_part } mode { @@ -183,7 +190,7 @@ grammar { python: r'(.*?)(?=\$\{|>>>)' (DOTALL) c: r'(.*?)(?=\$\{|>>>)' (PCRE_DOTALL) java: r'(.*?)(?=\$\{|>>>)' (DOTALL) - javascript: r'(.*?)(?=\$\{|>>>)' (m) + javascript: r'([\s\S]*?)(?=\$\{|>>>)' (m) } -> :cmd_part } mode { @@ -195,9 +202,9 @@ grammar { r'\+' -> :plus r'\*' -> :asterisk r'[0-9]+' -> :integer - r'{%_identifier%}(?=\s*=)' -> :cmd_attr_hint[] :identifier r'(true|false)(?!{%_identifier_follow%})' -> :boolean r'{%_type%}(?!{%_identifier_follow%})' -> :type + r'{%_identifier%}(?=\s*=)' -> :cmd_attr_hint[] :identifier r'{%_identifier%}' -> :identifier # Expression tokens @@ -230,11 +237,13 @@ grammar { enum { python: r'"([^\\\"\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*"' java: "\\\"(?>[^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\"" - } -> unescape(:string) + javascript: "\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\"" + } -> wdl_unescape(:string) enum { python: r'\'([^\\\'\n]|\\[\\"\'nrbtfav\?]|\\[0-7]{1,3}|\\x[0-9a-fA-F]+|\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\'' java: "'(?>[^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" - } -> unescape(:string) + javascript: "'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'" + } -> wdl_unescape(:string) r'-?[0-9]+\.[0-9]+' -> :float r'[0-9]+' -> :integer } @@ -270,7 +279,7 @@ grammar { if ctx.user_context['context'] == 'workflow': ctx.stack.append('wf_output') default_action(ctx, terminal, source_string, line, col) - def unescape(ctx, terminal, source_string, line, col): + def wdl_unescape(ctx, terminal, source_string, line, col): for regex, c in ctx.user_context['replacements'].items(): source_string = regex.sub(chr(c), source_string) @@ -305,10 +314,57 @@ grammar { } default_action(ctx, terminal, source_string, line, col); } - public void unescape(LexerContext ctx, TerminalIdentifier terminal, String source_string, int line, int col) { + public void wdl_unescape(LexerContext ctx, TerminalIdentifier terminal, String source_string, int line, int col) { default_action(ctx, terminal, StringEscapeUtils.unescapeJava(source_string.substring(1, source_string.length() - 1)), line, col); } JAVA + + code << JAVASCRIPT + function init() { + return {wf_or_task: null}; + } + function workflow(ctx, terminal, source_string, line, col) { + ctx.user_context.wf_or_task = "workflow"; + default_action(ctx, terminal, source_string, line, col); + } + function task(ctx, terminal, source_string, line, col) { + ctx.user_context.wf_or_task = "task"; + default_action(ctx, terminal, source_string, line, col); + } + function output(ctx, terminal, source_string, line, col) { + const user_ctx = ctx.user_context; + if (user_ctx.wf_or_task != null && user_ctx.wf_or_task === "workflow") { + ctx.mode_stack.push("wf_output"); + } + default_action(ctx, terminal, source_string, line, col); + } + function wdl_unescape(ctx, terminal, source_string, line, col) { + var strip_slashes = function(str) { + return str + .replace(/\\(.?)/g, function (s, n1) { + var escapes = { + '\\': '\\', + '0' : '\u0000', + '' : '', + 'n' : '\n', + 'r' : '\r', + 'b' : '\b', + 't' : '\t', + 'f' : '\f', + 'a' : '\a', + 'v' : '\v'}; + + var symbol = escapes[n1]; + if (symbol !== undefined) { + return symbol; + } + return n1; + }); + } + var repl_str = strip_slashes(source_string.substring(1, source_string.length - 1)); + default_action(ctx, terminal, repl_str, line, col); + } + JAVASCRIPT } parser { # Document: https://github.com/broadinstitute/wdl/blob/wdl2/SPEC.md#document @@ -328,6 +384,7 @@ grammar { $cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr(key=$1, value=$3) $outputs = :output :lbrace list($output_kv) :rbrace -> Outputs(attributes=$2) $output_kv = $type_e :identifier :equal $e -> Output(type=$0, name=$1, expression=$3) + $runtime = :runtime $map -> Runtime(map=$1) $parameter_meta = :parameter_meta $map -> ParameterMeta(map=$1) $meta = :meta $map -> Meta(map=$1) diff --git a/javascript/.gitignore b/javascript/.gitignore new file mode 100644 index 0000000..23e3b21 --- /dev/null +++ b/javascript/.gitignore @@ -0,0 +1 @@ +tests/node_modules \ No newline at end of file diff --git a/javascript/README.md b/javascript/README.md new file mode 100644 index 0000000..25d004a --- /dev/null +++ b/javascript/README.md @@ -0,0 +1,66 @@ +# WDL Parser for JS + +`wdl_parser.js` is a JavaScript parser for WDL. + +Usage example is provided at `sample.js`, which consumes a WDL script and prints AST to console + +To run this example make sure that +* [Node.JS](https://nodejs.org/en/download/) and NPM are installed +* Current folder is `javascript` + +Run the following command: + +``` +#Replace with a WDL file location. Also test cases could be used e.g. ./tests/cases/0/wdl +node sample.js +``` + + +# How to generate a parser + +To run a generation command make sure that +* [Hermes Parser Generator](https://github.com/scottfrazer/hermes#installation) and all its dependencies are installed +* Current folder is `javascript` + +To generate WDL parser run the following command: + +``` +python hermes generate ../grammar.hgr --language=javascript --name=wdl --nodejs --header --directory . +``` + +`wdl_parser.js` will appear in a current folder + +# Runnings tests + +To tun the tests make sure that +* [Node.JS](https://nodejs.org/en/download/) and NPM are installed +* Current folder is `javascript/tests` + +Install dependencies + +``` +npm install +``` + +Run tests + +``` +npm run test +``` + +When tests are finished - results will be printed to the console, indicating state of test run for each folder in `javascript/tests/cases/` + +Below is an example of a successful test run: + +``` +JS-WDL Parser + √ should correctly generate ast for javascript/tests/cases/0 (53ms) + √ should correctly generate ast for javascript/tests/cases/1 + √ should correctly generate ast for javascript/tests/cases/2 + √ should correctly generate ast for javascript/tests/cases/3 + √ should correctly generate ast for javascript/tests/cases/4 + √ should correctly generate ast for javascript/tests/cases/5 + + + 6 passing (143ms) +``` \ No newline at end of file diff --git a/javascript/hermes b/javascript/hermes new file mode 100644 index 0000000..f3d4c88 --- /dev/null +++ b/javascript/hermes @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import sys +import hermes.main + +sys.exit(hermes.main.cli()) \ No newline at end of file diff --git a/javascript/sample.js b/javascript/sample.js new file mode 100644 index 0000000..15237ca --- /dev/null +++ b/javascript/sample.js @@ -0,0 +1,20 @@ +const fs = require('fs'); +const path = require('path'); +const parser = require('./wdl_parser.js'); + +if(process.argv.length < 3) { + console.error('node sample.js '); + return; +} + +try { + const wdlPath = process.argv[2]; + const wdl = fs.readFileSync(wdlPath).toString(); + const tokens = parser.lex(wdl); + const ast = parser.parse(tokens).to_ast(); + + console.log(parser.ast_string(ast, 2, true)); +} +catch(ex) { + console.error(ex.message); +} \ No newline at end of file diff --git a/javascript/tests/cases/0/ast b/javascript/tests/cases/0/ast new file mode 100644 index 0000000..351b7bb --- /dev/null +++ b/javascript/tests/cases/0/ast @@ -0,0 +1,405 @@ +(Namespace: + imports=[], + body=[ + (Task: + name=<{0}:1:6 identifier "aW5saW5l">, + declarations=[ + (Declaration: + type=<{0}:2:3 type "RmlsZQ==">, + name=<{0}:2:8 identifier "cGF0aA==">, + expression=None + ), + (Declaration: + type=<{0}:3:3 type "U3RyaW5n">, + name=<{0}:3:10 identifier "ZG9ja2Vy">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:4:13 cmd_part "CiAgICBweXRob24zIDw8Q09ERQogICAgd2l0aCBvcGVuKCc=">, + (CommandParameter: + attributes=[], + expr=<{0}:6:18 identifier "cGF0aA=="> + ), + <{0}:6:23 cmd_part "JykgYXMgZnA6CiAgICAgIGZvciBsaW5lIGluIGZwOgogICAgICAgIGlmIGxpbmUuc3RhcnRzd2l0aCgnem9vbG9naWMnKToKICAgICAgICAgIHByaW50KGxpbmUuc3RyaXAoKSkKICAgIENPREUKICA="> + ] + ), + (Runtime: + map=[ + (RuntimeAttribute: + key=<{0}:13:5 identifier "ZG9ja2Vy">, + value=<{0}:13:13 string "JHtkb2NrZXJ9"> + ) + ] + ) + ] + ), + (Task: + name=<{0}:17:6 identifier "dGFzazE=">, + declarations=[ + (Declaration: + type=<{0}:18:3 type "RmlsZQ==">, + name=<{0}:18:8 identifier "aW5maWxl">, + expression=None + ), + (Declaration: + type=<{0}:19:3 type "U3RyaW5n">, + name=<{0}:19:10 identifier "ZG9ja2Vy">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:20:12 cmd_part "CiAgICBncmVwICdeYWJlcnJhbicg">, + (CommandParameter: + attributes=[], + expr=<{0}:21:23 identifier "aW5maWxl"> + ), + <{0}:21:30 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:24:5 type "QXJyYXk=">, + subtype=[ + <{0}:24:11 type "U3RyaW5n"> + ] + ), + name=<{0}:24:19 identifier "d29yZHNfYQ==">, + expression=(FunctionCall: + name=<{0}:24:29 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:24:40 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ), + (Output: + type=<{0}:25:5 type "SW50">, + name=<{0}:25:9 identifier "Zm9v">, + expression=(Add: + lhs=<{0}:25:15 integer "MQ==">, + rhs=<{0}:25:17 integer "MQ=="> + ) + ) + ] + ), + (Runtime: + map=[ + (RuntimeAttribute: + key=<{0}:28:5 identifier "ZG9ja2Vy">, + value=<{0}:28:13 string "JHtkb2NrZXJ9"> + ) + ] + ) + ] + ), + (Task: + name=<{0}:32:6 identifier "dGFzazI=">, + declarations=[ + (Declaration: + type=<{0}:33:3 type "RmlsZQ==">, + name=<{0}:33:8 identifier "aW5maWxl">, + expression=None + ), + (Declaration: + type=<{0}:34:3 type "U3RyaW5n">, + name=<{0}:34:10 identifier "ZG9ja2Vy">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:35:12 cmd_part "CiAgICBncmVwICdeYmFja2JvbmUnIA==">, + (CommandParameter: + attributes=[], + expr=<{0}:36:24 identifier "aW5maWxl"> + ), + <{0}:36:31 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:39:5 type "QXJyYXk=">, + subtype=[ + <{0}:39:11 type "U3RyaW5n"> + ] + ), + name=<{0}:39:19 identifier "d29yZHNfYg==">, + expression=(FunctionCall: + name=<{0}:39:29 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:39:40 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ), + (Runtime: + map=[ + (RuntimeAttribute: + key=<{0}:42:5 identifier "ZG9ja2Vy">, + value=<{0}:42:13 string "JHtkb2NrZXJ9"> + ) + ] + ) + ] + ), + (Task: + name=<{0}:46:6 identifier "dGFzazM=">, + declarations=[ + (Declaration: + type=<{0}:47:3 type "RmlsZQ==">, + name=<{0}:47:8 identifier "aW5maWxl">, + expression=None + ), + (Declaration: + type=<{0}:48:3 type "U3RyaW5n">, + name=<{0}:48:10 identifier "ZG9ja2Vy">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:49:12 cmd_part "CiAgICBncmVwICdeeHlsJyA=">, + (CommandParameter: + attributes=[], + expr=<{0}:50:19 identifier "aW5maWxl"> + ), + <{0}:50:26 cmd_part "IHx8IGV4aXQgMAogIA=="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:53:5 type "QXJyYXk=">, + subtype=[ + <{0}:53:11 type "U3RyaW5n"> + ] + ), + name=<{0}:53:19 identifier "d29yZHNfeA==">, + expression=(FunctionCall: + name=<{0}:53:29 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:53:40 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ), + (Runtime: + map=[ + (RuntimeAttribute: + key=<{0}:56:5 identifier "ZG9ja2Vy">, + value=<{0}:56:13 string "JHtkb2NrZXJ9"> + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:60:10 identifier "c2ltcGxl">, + body=[ + (Declaration: + type=(Type: + name=<{0}:61:3 type "QXJyYXk=">, + subtype=[ + (Type: + name=<{0}:61:9 type "QXJyYXk=">, + subtype=[ + (Type: + name=<{0}:61:15 type "QXJyYXk=">, + subtype=[ + <{0}:61:21 type "RmlsZQ=="> + ] + ) + ] + ) + ] + ), + name=<{0}:61:29 identifier "c2NhdHRlcl9maWxlcw==">, + expression=None + ), + (Declaration: + type=<{0}:62:3 type "U3RyaW5n">, + name=<{0}:62:10 identifier "ZG9ja2Vy">, + expression=None + ), + (Declaration: + type=<{0}:63:3 type "U3RyaW5n">, + name=<{0}:63:10 identifier "d29yZHM=">, + expression=(Add: + lhs=(Add: + lhs=(Add: + lhs=(Add: + lhs=<{0}:63:18 string "dw==">, + rhs=<{0}:63:22 string "bw=="> + ), + rhs=<{0}:63:26 string "cg=="> + ), + rhs=<{0}:63:30 string "ZA=="> + ), + rhs=<{0}:63:34 string "cw=="> + ) + ), + (Declaration: + type=<{0}:64:3 type "RmlsZQ==">, + name=<{0}:64:8 identifier "ZGljdF9maWxl">, + expression=(Add: + lhs=<{0}:64:20 string "L3Vzci9zaGFyZS9kaWN0Lw==">, + rhs=<{0}:64:41 identifier "d29yZHM="> + ) + ), + (Declaration: + type=<{0}:65:3 type "Qm9vbGVhbg==">, + name=<{0}:65:11 identifier "Yg==">, + expression=<{0}:65:15 boolean "ZmFsc2U="> + ), + (Call: + task=<{0}:67:8 fqn "dGFzazE=">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:68:12 identifier "ZG9ja2Vy">, + value=<{0}:68:19 identifier "ZG9ja2Vy"> + ), + (IOMapping: + key=<{0}:68:27 identifier "aW5maWxl">, + value=<{0}:68:34 identifier "ZGljdF9maWxl"> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:70:8 fqn "dGFzazI=">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:71:12 identifier "aW5maWxl">, + value=<{0}:71:19 identifier "ZGljdF9maWxl"> + ), + (IOMapping: + key=<{0}:71:30 identifier "ZG9ja2Vy">, + value=<{0}:71:37 identifier "ZG9ja2Vy"> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:73:8 fqn "dGFzazM=">, + alias=<{0}:73:17 identifier "YWxpYXM=">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:74:12 identifier "aW5maWxl">, + value=(Add: + lhs=<{0}:74:19 string "L3Vzci9zaGFyZS9kaWN0Lw==">, + rhs=<{0}:74:40 identifier "d29yZHM="> + ) + ), + (IOMapping: + key=<{0}:74:47 identifier "ZG9ja2Vy">, + value=<{0}:74:54 identifier "ZG9ja2Vy"> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:76:8 fqn "aW5saW5l">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:77:12 identifier "cGF0aA==">, + value=<{0}:77:17 identifier "ZGljdF9maWxl"> + ), + (IOMapping: + key=<{0}:77:28 identifier "ZG9ja2Vy">, + value=<{0}:77:35 identifier "ZG9ja2Vy"> + ) + ] + ) + ] + ) + ), + (Scatter: + item=<{0}:79:11 identifier "eA==">, + collection=<{0}:79:16 identifier "c2NhdHRlcl9maWxlcw==">, + body=[ + (Scatter: + item=<{0}:80:13 identifier "eQ==">, + collection=<{0}:80:18 identifier "eA==">, + body=[ + (Scatter: + item=<{0}:81:15 identifier "eg==">, + collection=<{0}:81:20 identifier "eQ==">, + body=[ + (Call: + task=<{0}:82:14 fqn "dGFzazI=">, + alias=<{0}:82:23 identifier "YWxpYXMy">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:83:18 identifier "aW5maWxl">, + value=<{0}:83:25 identifier "eg=="> + ), + (IOMapping: + key=<{0}:83:28 identifier "ZG9ja2Vy">, + value=<{0}:83:35 identifier "ZG9ja2Vy"> + ) + ] + ) + ] + ) + ) + ] + ) + ] + ) + ] + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/0/wdl b/javascript/tests/cases/0/wdl new file mode 100644 index 0000000..ca9f4c8 --- /dev/null +++ b/javascript/tests/cases/0/wdl @@ -0,0 +1,88 @@ +task inline { + File path + String docker + command<<< + python3 <>> + runtime { + docker: "${docker}" + } +} + +task task1 { + File infile + String docker + command { + grep '^aberran' ${infile} + } + output { + Array[String] words_a = read_lines(stdout()) + Int foo = 1+1 + } + runtime { + docker: "${docker}" + } +} + +task task2 { + File infile + String docker + command { + grep '^backbone' ${infile} + } + output { + Array[String] words_b = read_lines(stdout()) + } + runtime { + docker: "${docker}" + } +} + +task task3 { + File infile + String docker + command { + grep '^xyl' ${infile} || exit 0 + } + output { + Array[String] words_x = read_lines(stdout()) + } + runtime { + docker: "${docker}" + } +} + +workflow simple { + Array[Array[Array[File]]] scatter_files + String docker + String words = "w"+"o"+"r"+"d"+"s" + File dict_file = "/usr/share/dict/" + words + Boolean b = false + + call task1 { + input: docker=docker, infile=dict_file + } + call task2 { + input: infile=dict_file, docker=docker + } + call task3 as alias { + input: infile="/usr/share/dict/" + words, docker=docker + } + call inline { + input: path=dict_file, docker=docker + } + scatter(x in scatter_files) { + scatter(y in x) { + scatter(z in y) { + call task2 as alias2 { + input: infile=z, docker=docker + } + } + } + } +} diff --git a/javascript/tests/cases/1/ast b/javascript/tests/cases/1/ast new file mode 100644 index 0000000..caf5f9a --- /dev/null +++ b/javascript/tests/cases/1/ast @@ -0,0 +1,186 @@ +(Namespace: + imports=[], + body=[ + (Task: + name=<{0}:1:6 identifier "Z3JlcA==">, + declarations=[ + (Declaration: + type=<{0}:2:3 type "U3RyaW5n">, + name=<{0}:2:10 identifier "cGF0dGVybg==">, + expression=None + ), + (Declaration: + type=(OptionalType: + innerType=<{0}:3:3 type "U3RyaW5n"> + ), + name=<{0}:3:11 identifier "ZmxhZ3M=">, + expression=None + ), + (Declaration: + type=<{0}:4:3 type "RmlsZQ==">, + name=<{0}:4:8 identifier "ZmlsZV9uYW1l">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:6:12 cmd_part "CiAgICBncmVwICc=">, + (CommandParameter: + attributes=[], + expr=<{0}:7:13 identifier "cGF0dGVybg=="> + ), + <{0}:7:21 cmd_part "JyA=">, + (CommandParameter: + attributes=[], + expr=<{0}:7:25 identifier "ZmxhZ3M="> + ), + <{0}:7:31 cmd_part "IA==">, + (CommandParameter: + attributes=[], + expr=<{0}:7:34 identifier "ZmlsZV9uYW1l"> + ), + <{0}:7:44 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:10:5 type "RmlsZQ==">, + name=<{0}:10:10 identifier "b3V0">, + expression=(FunctionCall: + name=<{0}:10:16 identifier "c3Rkb3V0">, + params=[] + ) + ) + ] + ), + (Runtime: + map=[ + (RuntimeAttribute: + key=<{0}:13:5 identifier "bWVtb3J5">, + value=<{0}:13:13 string "Mk1C"> + ), + (RuntimeAttribute: + key=<{0}:14:5 identifier "Y29yZXM=">, + value=<{0}:14:12 integer "MQ=="> + ), + (RuntimeAttribute: + key=<{0}:15:5 identifier "ZGlzaw==">, + value=<{0}:15:11 string "M01C"> + ) + ] + ) + ] + ), + (Task: + name=<{0}:19:6 identifier "d2M=">, + declarations=[ + (Declaration: + type=(NonEmptyType: + innerType=(Type: + name=<{0}:20:3 type "QXJyYXk=">, + subtype=[ + <{0}:20:9 type "RmlsZQ=="> + ] + ) + ), + name=<{0}:20:16 identifier "ZmlsZXM=">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:21:12 cmd_part "CiAgICB3YyAtbCA=">, + (CommandParameter: + attributes=[ + (CommandParameterAttr: + key=<{0}:22:13 identifier "c2Vw">, + value=<{0}:22:17 string "IA=="> + ) + ], + expr=<{0}:22:21 identifier "ZmlsZXM="> + ), + <{0}:22:27 cmd_part "IHwgdGFpbCAtMSB8IHRyIC1zICcgJyB8IGN1dCAtZCcgJyAtZiAyCiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:25:5 type "SW50">, + name=<{0}:25:9 identifier "Y291bnQ=">, + expression=(FunctionCall: + name=<{0}:25:17 identifier "cmVhZF9pbnQ=">, + params=[ + (FunctionCall: + name=<{0}:25:26 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:29:10 identifier "c2NhdHRlcl9nYXRoZXJfZ3JlcF93Yw==">, + body=[ + (Declaration: + type=(Type: + name=<{0}:30:3 type "QXJyYXk=">, + subtype=[ + <{0}:30:9 type "RmlsZQ=="> + ] + ), + name=<{0}:30:15 identifier "aW5wdXRfZmlsZXM=">, + expression=None + ), + (Scatter: + item=<{0}:31:11 identifier "Zg==">, + collection=<{0}:31:16 identifier "aW5wdXRfZmlsZXM=">, + body=[ + (Call: + task=<{0}:32:10 fqn "Z3JlcA==">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:33:14 identifier "ZmlsZV9uYW1l">, + value=<{0}:33:26 identifier "Zg=="> + ) + ] + ) + ] + ) + ) + ] + ), + (Call: + task=<{0}:36:8 fqn "d2M=">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:37:12 identifier "ZmlsZXM=">, + value=(MemberAccess: + lhs=<{0}:37:20 identifier "Z3JlcA==">, + rhs=<{0}:37:25 identifier "b3V0"> + ) + ) + ] + ) + ] + ) + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/1/wdl b/javascript/tests/cases/1/wdl new file mode 100644 index 0000000..8ce1499 --- /dev/null +++ b/javascript/tests/cases/1/wdl @@ -0,0 +1,39 @@ +task grep { + String pattern + String? flags + File file_name + + command { + grep '${pattern}' ${flags} ${file_name} + } + output { + File out = stdout() + } + runtime { + memory: "2MB" + cores: 1 + disk: "3MB" + } +} + +task wc { + Array[File]+ files + command { + wc -l ${sep=' ' files} | tail -1 | tr -s ' ' | cut -d' ' -f 2 + } + output { + Int count = read_int(stdout()) + } +} + +workflow scatter_gather_grep_wc { + Array[File] input_files + scatter(f in input_files) { + call grep { + input: file_name = f + } + } + call wc { + input: files = grep.out + } +} diff --git a/javascript/tests/cases/2/ast b/javascript/tests/cases/2/ast new file mode 100644 index 0000000..909358a --- /dev/null +++ b/javascript/tests/cases/2/ast @@ -0,0 +1,111 @@ +(Namespace: + imports=[], + body=[ + (Task: + name=<{0}:1:6 identifier "Z3JlcF93b3Jkcw==">, + declarations=[ + (Declaration: + type=<{0}:2:3 type "U3RyaW5n">, + name=<{0}:2:10 identifier "c3RhcnQ=">, + expression=None + ), + (Declaration: + type=<{0}:3:3 type "RmlsZQ==">, + name=<{0}:3:8 identifier "aW5maWxl">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:5:12 cmd_part "CiAgICBncmVwICde">, + (CommandParameter: + attributes=[], + expr=<{0}:6:14 identifier "c3RhcnQ="> + ), + <{0}:6:20 cmd_part "JyA=">, + (CommandParameter: + attributes=[], + expr=<{0}:6:24 identifier "aW5maWxl"> + ), + <{0}:6:31 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:9:5 type "QXJyYXk=">, + subtype=[ + <{0}:9:11 type "U3RyaW5n"> + ] + ), + name=<{0}:9:19 identifier "d29yZHM=">, + expression=(FunctionCall: + name=<{0}:9:27 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:9:38 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:12:10 identifier "d2Y=">, + body=[ + (Declaration: + type=<{0}:13:3 type "RmlsZQ==">, + name=<{0}:13:8 identifier "ZGljdGlvbmFyeQ==">, + expression=None + ), + (Call: + task=<{0}:15:8 fqn "Z3JlcF93b3Jkcw==">, + alias=<{0}:15:22 identifier "Z3JlcF9weXRob25pY193b3Jkcw==">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:16:12 identifier "c3RhcnQ=">, + value=<{0}:16:18 string "cHl0aG9uaWM="> + ), + (IOMapping: + key=<{0}:16:30 identifier "aW5maWxl">, + value=<{0}:16:37 identifier "ZGljdGlvbmFyeQ=="> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:18:8 fqn "Z3JlcF93b3Jkcw==">, + alias=<{0}:18:22 identifier "Z3JlcF93b3JrZl93b3Jkcw==">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:19:12 identifier "c3RhcnQ=">, + value=<{0}:19:18 string "d29ya2Y="> + ), + (IOMapping: + key=<{0}:19:27 identifier "aW5maWxl">, + value=<{0}:19:34 identifier "ZGljdGlvbmFyeQ=="> + ) + ] + ) + ] + ) + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/2/wdl b/javascript/tests/cases/2/wdl new file mode 100644 index 0000000..d62c636 --- /dev/null +++ b/javascript/tests/cases/2/wdl @@ -0,0 +1,21 @@ +task grep_words { + String start + File infile + + command { + grep '^${start}' ${infile} + } + output { + Array[String] words = read_lines(stdout()) + } +} +workflow wf { + File dictionary + + call grep_words as grep_pythonic_words { + input: start="pythonic", infile=dictionary + } + call grep_words as grep_workf_words { + input: start="workf", infile=dictionary + } +} diff --git a/javascript/tests/cases/3/ast b/javascript/tests/cases/3/ast new file mode 100644 index 0000000..57600af --- /dev/null +++ b/javascript/tests/cases/3/ast @@ -0,0 +1,186 @@ +(Namespace: + imports=[], + body=[ + (Task: + name=<{0}:1:6 identifier "c2NhdHRlcl90YXNr">, + declarations=[ + (Declaration: + type=<{0}:2:3 type "SW50">, + name=<{0}:2:7 identifier "Y291bnQ=">, + expression=None + ), + (Declaration: + type=<{0}:3:3 type "RmlsZQ==">, + name=<{0}:3:8 identifier "aW4=">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:5:14 cmd_part "CiAgICBlZ3JlcCBeLns=">, + (CommandParameter: + attributes=[], + expr=<{0}:6:16 identifier "Y291bnQ="> + ), + <{0}:6:22 cmd_part "fSQg">, + (CommandParameter: + attributes=[], + expr=<{0}:6:27 identifier "aW4="> + ), + <{0}:6:30 cmd_part "IHx8IGV4aXQgMAogIA=="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:9:5 type "QXJyYXk=">, + subtype=[ + <{0}:9:11 type "U3RyaW5n"> + ] + ), + name=<{0}:9:19 identifier "d29yZHM=">, + expression=(FunctionCall: + name=<{0}:9:27 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:9:38 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Task: + name=<{0}:13:6 identifier "Z2F0aGVyX3Rhc2s=">, + declarations=[ + (Declaration: + type=<{0}:14:3 type "SW50">, + name=<{0}:14:7 identifier "Y291bnQ=">, + expression=None + ), + (Declaration: + type=(Type: + name=<{0}:15:3 type "QXJyYXk=">, + subtype=[ + (Type: + name=<{0}:15:9 type "QXJyYXk=">, + subtype=[ + <{0}:15:15 type "U3RyaW5n"> + ] + ) + ] + ), + name=<{0}:15:24 identifier "d29yZF9saXN0cw==">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:17:12 cmd_part "CiAgICBweXRob24zIDw8Q09ERQogICAgaW1wb3J0IGpzb24KICAgIHdpdGggb3BlbignY291bnQnLCAndycpIGFzIGZwOgogICAgICBmcC53cml0ZShzdHIoaW50KA==">, + (CommandParameter: + attributes=[], + expr=<{0}:21:26 identifier "Y291bnQ="> + ), + <{0}:21:32 cmd_part "KSAtIDEpKQogICAgd2l0aCBvcGVuKCd3YycsICd3JykgYXMgZnA6CiAgICAgIGZwLndyaXRlKHN0cihzdW0oW2xlbih4KSBmb3IgeCBpbiBqc29uLmxvYWRzKG9wZW4oIg==">, + (CommandParameter: + attributes=[], + expr=<{0}:23:60 identifier "d29yZF9saXN0cw=="> + ), + <{0}:23:71 cmd_part "IikucmVhZCgpKV0pKSkKICAgIENPREUKICA="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:27:5 type "SW50">, + name=<{0}:27:9 identifier "Y291bnQ=">, + expression=(FunctionCall: + name=<{0}:27:17 identifier "cmVhZF9pbnQ=">, + params=[ + <{0}:27:26 string "Y291bnQ="> + ] + ) + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:31:10 identifier "d2Y=">, + body=[ + (Declaration: + type=(Type: + name=<{0}:32:3 type "QXJyYXk=">, + subtype=[ + <{0}:32:9 type "RmlsZQ=="> + ] + ), + name=<{0}:32:15 identifier "ZmlsZXM=">, + expression=None + ), + (Declaration: + type=<{0}:33:3 type "SW50">, + name=<{0}:33:7 identifier "Y291bnQ=">, + expression=None + ), + (Scatter: + item=<{0}:35:11 identifier "ZmlsZW5hbWU=">, + collection=<{0}:35:23 identifier "ZmlsZXM=">, + body=[ + (Call: + task=<{0}:36:10 fqn "c2NhdHRlcl90YXNr">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:37:14 identifier "aW4=">, + value=<{0}:37:17 identifier "ZmlsZW5hbWU="> + ), + (IOMapping: + key=<{0}:37:27 identifier "Y291bnQ=">, + value=<{0}:37:33 identifier "Y291bnQ="> + ) + ] + ) + ] + ) + ) + ] + ), + (Call: + task=<{0}:40:8 fqn "Z2F0aGVyX3Rhc2s=">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:41:12 identifier "Y291bnQ=">, + value=<{0}:41:18 identifier "Y291bnQ="> + ), + (IOMapping: + key=<{0}:41:25 identifier "d29yZF9saXN0cw==">, + value=(MemberAccess: + lhs=<{0}:41:36 identifier "c2NhdHRlcl90YXNr">, + rhs=<{0}:41:49 identifier "d29yZHM="> + ) + ) + ] + ) + ] + ) + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/3/wdl b/javascript/tests/cases/3/wdl new file mode 100644 index 0000000..47e595a --- /dev/null +++ b/javascript/tests/cases/3/wdl @@ -0,0 +1,43 @@ +task scatter_task { + Int count + File in + + command <<< + egrep ^.{${count}}$ ${in} || exit 0 + >>> + output { + Array[String] words = read_lines(stdout()) + } +} + +task gather_task { + Int count + Array[Array[String]] word_lists + + command { + python3 <, + name=<{0}:2:10 identifier "c3Ry">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:3:12 cmd_part "CiAgICBlY2hvICI=">, + (CommandParameter: + attributes=[], + expr=<{0}:4:13 identifier "c3Ry"> + ), + <{0}:4:17 cmd_part "IiB8IHdjIC1jCiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:7:5 type "SW50">, + name=<{0}:7:9 identifier "Y291bnQ=">, + expression=(Subtract: + lhs=(FunctionCall: + name=<{0}:7:17 identifier "cmVhZF9pbnQ=">, + params=[ + (FunctionCall: + name=<{0}:7:26 identifier "c3Rkb3V0">, + params=[] + ) + ] + ), + rhs=<{0}:7:38 integer "MQ=="> + ) + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:11:10 identifier "d2Y=">, + body=[ + (Declaration: + type=(Type: + name=<{0}:12:3 type "QXJyYXk=">, + subtype=[ + (Type: + name=<{0}:12:9 type "QXJyYXk=">, + subtype=[ + (Type: + name=<{0}:12:15 type "QXJyYXk=">, + subtype=[ + <{0}:12:21 type "U3RyaW5n"> + ] + ) + ] + ) + ] + ), + name=<{0}:12:31 identifier "dHJpcGxlX2FycmF5">, + expression=None + ), + (Scatter: + item=<{0}:13:11 identifier "ZG91YmxlX2FycmF5">, + collection=<{0}:13:27 identifier "dHJpcGxlX2FycmF5">, + body=[ + (Scatter: + item=<{0}:14:13 identifier "c2luZ2xlX2FycmF5">, + collection=<{0}:14:29 identifier "ZG91YmxlX2FycmF5">, + body=[ + (Scatter: + item=<{0}:15:15 identifier "aXRlbQ==">, + collection=<{0}:15:23 identifier "c2luZ2xlX2FycmF5">, + body=[ + (Call: + task=<{0}:16:14 fqn "d2M=">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:16:24 identifier "c3Ry">, + value=<{0}:16:28 identifier "aXRlbQ=="> + ) + ] + ) + ] + ) + ) + ] + ) + ] + ) + ] + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/4/wdl b/javascript/tests/cases/4/wdl new file mode 100644 index 0000000..3c7faf9 --- /dev/null +++ b/javascript/tests/cases/4/wdl @@ -0,0 +1,20 @@ +task wc { + String str + command { + echo "${str}" | wc -c + } + output { + Int count = read_int(stdout()) - 1 + } +} + +workflow wf { + Array[Array[Array[String]]] triple_array + scatter(double_array in triple_array) { + scatter(single_array in double_array) { + scatter(item in single_array) { + call wc{input: str=item} + } + } + } +} diff --git a/javascript/tests/cases/5/ast b/javascript/tests/cases/5/ast new file mode 100644 index 0000000..c485742 --- /dev/null +++ b/javascript/tests/cases/5/ast @@ -0,0 +1,446 @@ +(Namespace: + imports=[], + body=[ + (Task: + name=<{0}:1:6 identifier "cHM=">, + declarations=[ + (Declaration: + type=(OptionalType: + innerType=<{0}:2:3 type "U3RyaW5n"> + ), + name=<{0}:2:11 identifier "ZmxhZ3M=">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:3:12 cmd_part "CiAgICBwcyA=">, + (CommandParameter: + attributes=[], + expr=<{0}:4:10 identifier "ZmxhZ3M="> + ), + <{0}:4:16 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:7:5 type "RmlsZQ==">, + name=<{0}:7:10 identifier "cHJvY3M=">, + expression=(FunctionCall: + name=<{0}:7:18 identifier "c3Rkb3V0">, + params=[] + ) + ) + ] + ) + ] + ), + (Task: + name=<{0}:11:6 identifier "ZmluZF9maWxlcw==">, + declarations=[ + (Declaration: + type=<{0}:12:3 type "RmlsZQ==">, + name=<{0}:12:8 identifier "ZGly">, + expression=None + ), + (Declaration: + type=(OptionalType: + innerType=<{0}:13:3 type "SW50"> + ), + name=<{0}:13:8 identifier "bWF4X2RlcHRo">, + expression=None + ), + (Declaration: + type=<{0}:14:3 type "U3RyaW5n">, + name=<{0}:14:10 identifier "cGF0dGVybg==">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:16:12 cmd_part "CiAgICBmaW5kIA==">, + (CommandParameter: + attributes=[], + expr=<{0}:17:12 identifier "ZGly"> + ), + <{0}:17:16 cmd_part "IA==">, + (CommandParameter: + attributes=[], + expr=(Add: + lhs=<{0}:17:19 string "LW1heGRlcHRoIA==">, + rhs=<{0}:17:34 identifier "bWF4X2RlcHRo"> + ) + ), + <{0}:17:44 cmd_part "IHwgZ3JlcCAn">, + (CommandParameter: + attributes=[], + expr=<{0}:17:55 identifier "cGF0dGVybg=="> + ), + <{0}:17:63 cmd_part "JwogIA=="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=(Type: + name=<{0}:20:5 type "QXJyYXk=">, + subtype=[ + <{0}:20:11 type "RmlsZQ=="> + ] + ), + name=<{0}:20:17 identifier "ZmlsZXM=">, + expression=(FunctionCall: + name=<{0}:20:25 identifier "cmVhZF9saW5lcw==">, + params=[ + (FunctionCall: + name=<{0}:20:36 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Task: + name=<{0}:24:6 identifier "Y29uY2F0">, + declarations=[ + (Declaration: + type=(NonEmptyType: + innerType=(Type: + name=<{0}:25:3 type "QXJyYXk=">, + subtype=[ + <{0}:25:9 type "RmlsZQ=="> + ] + ) + ), + name=<{0}:25:16 identifier "ZmlsZXM=">, + expression=None + ), + (Declaration: + type=<{0}:26:3 type "U3RyaW5n">, + name=<{0}:26:10 identifier "b3V0ZmlsZQ==">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:28:12 cmd_part "CiAgICBjYXQg">, + (CommandParameter: + attributes=[ + (CommandParameterAttr: + key=<{0}:29:11 identifier "c2Vw">, + value=<{0}:29:15 string "IA=="> + ) + ], + expr=<{0}:29:19 identifier "ZmlsZXM="> + ), + <{0}:29:25 cmd_part "ID4g">, + (CommandParameter: + attributes=[], + expr=<{0}:29:30 identifier "b3V0ZmlsZQ=="> + ), + <{0}:29:38 cmd_part "CiAg"> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:32:5 type "RmlsZQ==">, + name=<{0}:32:10 identifier "Y29uY2F0ZW5hdGVk">, + expression=<{0}:32:25 identifier "b3V0ZmlsZQ=="> + ) + ] + ) + ] + ), + (Task: + name=<{0}:36:6 identifier "Ynl0ZWNvdW50">, + declarations=[ + (Declaration: + type=(NonEmptyType: + innerType=(Type: + name=<{0}:37:3 type "QXJyYXk=">, + subtype=[ + <{0}:37:9 type "RmlsZQ=="> + ] + ) + ), + name=<{0}:37:16 identifier "ZmlsZXM=">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:38:12 cmd_part "CiAgICBjYXQg">, + (CommandParameter: + attributes=[ + (CommandParameterAttr: + key=<{0}:39:11 identifier "c2Vw">, + value=<{0}:39:15 string "IA=="> + ) + ], + expr=<{0}:39:19 identifier "ZmlsZXM="> + ), + <{0}:39:25 cmd_part "IHwgd2MgLWMKICA="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:42:5 type "SW50">, + name=<{0}:42:9 identifier "Ynl0ZXM=">, + expression=(FunctionCall: + name=<{0}:42:17 identifier "cmVhZF9pbnQ=">, + params=[ + (FunctionCall: + name=<{0}:42:26 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Task: + name=<{0}:46:6 identifier "bGluZWNvdW50">, + declarations=[ + (Declaration: + type=(NonEmptyType: + innerType=(Type: + name=<{0}:47:3 type "QXJyYXk=">, + subtype=[ + <{0}:47:9 type "RmlsZQ=="> + ] + ) + ), + name=<{0}:47:16 identifier "ZmlsZXM=">, + expression=None + ) + ], + sections=[ + (RawCommand: + parts=[ + <{0}:48:12 cmd_part "CiAgICBjYXQg">, + (CommandParameter: + attributes=[ + (CommandParameterAttr: + key=<{0}:49:11 identifier "c2Vw">, + value=<{0}:49:15 string "IA=="> + ) + ], + expr=<{0}:49:19 identifier "ZmlsZXM="> + ), + <{0}:49:25 cmd_part "IHwgd2MgLWwKICA="> + ] + ), + (Outputs: + attributes=[ + (Output: + type=<{0}:52:5 type "SW50">, + name=<{0}:52:9 identifier "bGluZXM=">, + expression=(FunctionCall: + name=<{0}:52:17 identifier "cmVhZF9pbnQ=">, + params=[ + (FunctionCall: + name=<{0}:52:26 identifier "c3Rkb3V0">, + params=[] + ) + ] + ) + ) + ] + ) + ] + ), + (Workflow: + name=<{0}:56:10 identifier "c2xvYw==">, + body=[ + (Declaration: + type=(Type: + name=<{0}:57:3 type "QXJyYXk=">, + subtype=[ + <{0}:57:9 type "RmlsZQ=="> + ] + ), + name=<{0}:57:15 identifier "ZmlsZXM=">, + expression=None + ), + (Declaration: + type=<{0}:58:3 type "RmlsZQ==">, + name=<{0}:58:8 identifier "c291cmNlX2Rpcg==">, + expression=None + ), + (Call: + task=<{0}:61:8 fqn "cHM=">, + alias=None, + body=None + ), + (Call: + task=<{0}:62:8 fqn "cHM=">, + alias=<{0}:62:14 identifier "cHNfZmxhZ3M=">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:63:12 identifier "ZmxhZ3M=">, + value=<{0}:63:18 string "LWVm"> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:65:8 fqn "Ynl0ZWNvdW50">, + alias=<{0}:65:21 identifier "cHNfYnl0ZXM=">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:66:12 identifier "ZmlsZXM=">, + value=(MemberAccess: + lhs=<{0}:66:18 identifier "cHM=">, + rhs=<{0}:66:21 identifier "cHJvY3M="> + ) + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:68:8 fqn "Ynl0ZWNvdW50">, + alias=<{0}:68:21 identifier "cHNfZmxhZ3NfYnl0ZXM=">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:69:12 identifier "ZmlsZXM=">, + value=(MemberAccess: + lhs=<{0}:69:18 identifier "cHNfZmxhZ3M=">, + rhs=<{0}:69:27 identifier "cHJvY3M="> + ) + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:75:8 fqn "Y29uY2F0">, + alias=None, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:76:12 identifier "ZmlsZXM=">, + value=<{0}:76:18 identifier "ZmlsZXM="> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:78:8 fqn "Y29uY2F0">, + alias=<{0}:78:18 identifier "Y29uY2F0Mg==">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:79:11 identifier "ZmlsZXM=">, + value=<{0}:79:17 identifier "ZmlsZXM="> + ), + (IOMapping: + key=<{0}:79:24 identifier "b3V0ZmlsZQ==">, + value=<{0}:79:32 string "cmVkaXJlY3RlZA=="> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:84:8 fqn "ZmluZF9maWxlcw==">, + alias=<{0}:84:22 identifier "ZmluZF9weXRob25fZmlsZXM=">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:85:12 identifier "ZGly">, + value=<{0}:85:16 identifier "c291cmNlX2Rpcg=="> + ), + (IOMapping: + key=<{0}:85:28 identifier "cGF0dGVybg==">, + value=<{0}:85:36 string "XC5weSQ="> + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:87:8 fqn "Ynl0ZWNvdW50">, + alias=<{0}:87:21 identifier "cHl0aG9uX3NyY19ieXRlcw==">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:88:12 identifier "ZmlsZXM=">, + value=(MemberAccess: + lhs=<{0}:88:18 identifier "ZmluZF9weXRob25fZmlsZXM=">, + rhs=<{0}:88:36 identifier "ZmlsZXM="> + ) + ) + ] + ) + ] + ) + ), + (Call: + task=<{0}:90:8 fqn "bGluZWNvdW50">, + alias=<{0}:90:21 identifier "cHl0aG9uX3NyY19saW5lcw==">, + body=(CallBody: + declarations=[], + io=[ + (Inputs: + map=[ + (IOMapping: + key=<{0}:91:12 identifier "ZmlsZXM=">, + value=(MemberAccess: + lhs=<{0}:91:18 identifier "ZmluZF9weXRob25fZmlsZXM=">, + rhs=<{0}:91:36 identifier "ZmlsZXM="> + ) + ) + ] + ) + ] + ) + ) + ] + ) + ] +) \ No newline at end of file diff --git a/javascript/tests/cases/5/wdl b/javascript/tests/cases/5/wdl new file mode 100644 index 0000000..2d7edc1 --- /dev/null +++ b/javascript/tests/cases/5/wdl @@ -0,0 +1,94 @@ +task ps { + String? flags + command { + ps ${flags} + } + output { + File procs = stdout() + } +} + +task find_files { + File dir + Int? max_depth + String pattern + + command { + find ${dir} ${'-maxdepth ' + max_depth} | grep '${pattern}' + } + output { + Array[File] files = read_lines(stdout()) + } +} + +task concat { + Array[File]+ files + String outfile + + command { + cat ${sep=" " files} > ${outfile} + } + output { + File concatenated = outfile + } +} + +task bytecount { + Array[File]+ files + command { + cat ${sep=" " files} | wc -c + } + output { + Int bytes = read_int(stdout()) + } +} + +task linecount { + Array[File]+ files + command { + cat ${sep=" " files} | wc -l + } + output { + Int lines = read_int(stdout()) + } +} + +workflow sloc { + Array[File] files + File source_dir + + # Run 'ps', get the byte count of the output + call ps + call ps as ps_flags { + input: flags="-ef" + } + call bytecount as ps_bytes { + input: files=ps.procs + } + call bytecount as ps_flags_bytes { + input: files=ps_flags.procs + } + + # Test out default parameters. + # First 'concat' should output to file called "concatenated". + # Second 'concat' should output to a file called "redirected". + call concat { + input: files=files + } + call concat as concat2 { + input:files=files, outfile="redirected" + } + + # Find all Java and Scala files, count lines in each + # and then compute the total file size + call find_files as find_python_files { + input: dir=source_dir, pattern="\\.py$" + } + call bytecount as python_src_bytes { + input: files=find_python_files.files + } + call linecount as python_src_lines { + input: files=find_python_files.files + } +} + diff --git a/javascript/tests/package.json b/javascript/tests/package.json new file mode 100644 index 0000000..7fc55a0 --- /dev/null +++ b/javascript/tests/package.json @@ -0,0 +1,8 @@ +{ + "scripts": { + "test": "mocha ./*-test.js" + }, + "dependencies": { + "mocha": "^3.2.0" + } +} diff --git a/javascript/tests/parser-test.js b/javascript/tests/parser-test.js new file mode 100644 index 0000000..0397fa8 --- /dev/null +++ b/javascript/tests/parser-test.js @@ -0,0 +1,41 @@ +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const parser = require('../wdl_parser.js'); + +function getDirectories (srcpath) { + return fs.readdirSync(srcpath) + .filter(file => fs.statSync(path.join(srcpath, file)).isDirectory()) + .map(directory => path.join(srcpath, directory)); +} + +function removeLinebreaks(input) { + return input.replace(/[\r\n]/g, ''); +} + +describe('JS-WDL Parser', function () { + const cases = getDirectories(path.resolve('./cases')); + + cases.forEach(function(casePath) { + it('should correctly generate ast for ' + casePath, function () { + + //Read wdl test case to generate ast + const wdl = fs.readFileSync(path.resolve(casePath, "wdl")).toString(); + + //Parse wdl into ast + const tokens = parser.lex(wdl); + const astObj = parser.parse(tokens).to_ast(); + const astParsed = parser.ast_string(astObj, 2, true) + + //If no 'original' ast found in a test case directory - regenerate it + const astTestCasePath = path.resolve(casePath, "ast"); + if(!fs.existsSync(astTestCasePath)) { + fs.writeFileSync(astTestCasePath, astParsed); + } + const astTestCase = fs.readFileSync(astTestCasePath).toString(); + + //Line breaks are removed not to face Linux/Windows and Git settings line endings issues + assert(removeLinebreaks(astParsed) === removeLinebreaks(astTestCase), 'ASTs are not equal'); + }); + }); +}); \ No newline at end of file diff --git a/javascript/wdl_parser.js b/javascript/wdl_parser.js new file mode 100644 index 0000000..3462801 --- /dev/null +++ b/javascript/wdl_parser.js @@ -0,0 +1,5548 @@ + +/* + * This file was generated by Hermes Parser Generator on Wed Feb 15 14:28:13 2017 + * + * Hermes command: hermes generate ../grammar.hgr --language=javascript --name=wdl --nodejs --header --directory . + * Run from: . (relative to this file) + * Hermes version: hermes-parser 2.0rc6 + * + * !!! DO NOT CHANGE THIS FILE DIRECTLY !!! + * + * If you wish to change something in this file, either change the grammar and + * re-generate this file, or change the templates in Hermes and regenerate. + * See the Hermes repository: http://github.com/scottfrazer/hermes + */ +if (!String.prototype.format) { + String.prototype.format = function() { + var args = arguments; + return this.replace(/{(\d+)}/g, function(match, number) { + return typeof args[number] != 'undefined' ? args[number]: match; + }); + }; +} +String.prototype.lstrip = function() { + return this.replace(/^\s*/g, ""); +} +function parse_tree_string(parsetree, indent, b64_source) { + return _parse_tree_string(parsetree, indent, b64_source, 0); +} +function _parse_tree_string(parsetree, indent, b64_source, indent_level) { + if (typeof(indent) != 'number' || indent <= 0) { + indent = undefined + } + var indent_str = typeof(indent) !== 'undefined' ? Array(indent * indent_level + 1).join(' ') : '' + if (parsetree instanceof ParseTree) { + var children = [] + for (var i in parsetree.children) { + children.push(_parse_tree_string(parsetree.children[i], indent, b64_source, indent_level + 1)) + } + if (typeof(indent) == 'undefined' || children.length == 0) { + return '{0}({1}: {2})'.format(indent_str, parsetree.nonterminal.to_string(), children.join(', ')) + } else { + return '{0}({1}:\n{2}\n{3})'.format( + indent_str, + parsetree.nonterminal.to_string(), + children.join(',\n'), + indent_str + ) + } + } else if (parsetree instanceof Terminal) { + return indent_str + parsetree.to_string(b64_source) + } +} +function ast_string(ast, indent, b64_source) { + return _ast_string(ast, indent, b64_source, 0); +} +function _ast_string(ast, indent, b64_source, indent_level) { + if (typeof(indent) != 'number' || indent <= 0) { + indent = undefined + } + var indent_str = typeof(indent) !== 'undefined' ? Array(indent * indent_level + 1).join(' ') : '' + var next_indent_str = typeof(indent) !== 'undefined' ? Array(indent * (indent_level+1) + 1).join(' ') : '' + if (ast instanceof Ast) { + var children = {} + for (var key in ast.attributes) { + children[key] = _ast_string(ast.attributes[key], indent, b64_source, indent_level + 1) + } + if (typeof(indent) == 'undefined') { + var strs = [] + for (var key in children) { + strs.push('{0}={1}'.format(key, children[key])) + } + return '({0}: {1})'.format( + ast.name, + strs.join(', ') + ) + } else { + var strs = [] + for (var key in children) { + strs.push('{0}{1}={2}'.format(next_indent_str, key, children[key])) + } + return '({0}:\n{1}\n{2})'.format( + ast.name, + strs.join(',\n'), + indent_str + ) + } + } else if (ast instanceof AstList) { + var children = [] + for (var key in ast.list) { + children.push(_ast_string(ast.list[key], indent, b64_source, indent_level + 1)) + } + if (typeof(indent) == 'undefined' || children.length == 0) { + return '[{0}]'.format(children.join(', ')) + } else { + var strs = [] + for (var index in children) { + strs.push('{0}{1}'.format(next_indent_str, children[index])) + } + return '[\n{0}\n{1}]'.format( + strs.join(',\n'), + indent_str + ) + } + } else if (ast instanceof Terminal) { + return ast.to_string(b64_source) + } else { + return (ast == null) ? 'None' : ast.to_string() + } +} +function Terminal(id, str, source_string, resource, line, col) { + this.id = id; + this.str = str; + this.source_string = source_string; + this.resource = resource; + this.line = line; + this.col = col; + this.to_ast = function() { + return this; + }; + this.to_string = function(b64_source) { + return '<{0}:{1}:{2} {3} "{4}">'.format( + this.resource, + this.line, + this.col, + this.str, + b64_source ? Base64.encode(this.source_string) : this.source_string + ) + }; +} +function NonTerminal(id, str) { + this.id = id; + this.str = str; + this.to_string = function() { + return this.str; + }; +} +function AstTransformSubstitution(idx) { + this.idx = idx; + this.to_string = function() { + return '$' + this.idx; + }; +} +function AstTransformNodeCreator(name, parameters) { + this.name = name; + this.parameters = parameters; + this.to_string = function() { + var arr = []; + for ( key in this.parameters ) { + arr.push('{0}=${1}'.format(key, this.parameters[key])); + } + return '{0} ( {1} )'.format(this.name, arr.join(', ')); + }; +} +function AstList(list) { + this.list = list + this.push = function(element) { + this.list.push(element); + }; + this.to_ast = function() { + var arr = []; + for (item in this.list) { + arr.push(item.to_ast()); + } + return arr; + }; +} +function ParseTree(nonterminal) { + this.children = []; + this.nonterminal = nonterminal; + this.astTransform = null; + this.isExpr = false; + this.isNud = false; + this.isPrefix = false; + this.isInfix = false; + this.nudMorphemeCount = 0; + this.isExprNud = false; + this.listSeparator = null; + this.list = false; + this.add = function(tree) { + this.children.push(tree); + } + this.to_ast = function() { + if (this.list == true) { + if (this.children.length == 0) { + return new AstList([]); + } + var end = this.children.length - 1; + var list = []; + for (var i = 0; i < this.children.length; i++) { + if (this.children[i] instanceof Terminal && this.children[i].id == this.listSeparator) + continue; + list.push(this.children[i].to_ast()); + } + return new AstList(list); + } + else if (this.isExpr == true) { + if (this.astTransform instanceof AstTransformSubstitution) { + return this.children[this.astTransform.idx].to_ast(); + } + else if (this.astTransform instanceof AstTransformNodeCreator) { + var parameters = {} + for (name in this.astTransform.parameters) { + var idx = this.astTransform.parameters[name]; + var child = null; + if (idx == '$') { + child = this.children[0]; + } else if (this.children[0] instanceof ParseTree && this.children[0].isNud && !this.children[0].isPrefix && !this.isExprNud && !this.isInfix) { + if (idx < this.children[0].nudMorphemeCount) { + child = this.children[0].children[idx] + } else { + index = idx - this.children[0].nudMorphemeCount + 1 + child = this.children[index] + } + } else if (this.children.length == 1 && !(this.children[0] instanceof ParseTree) && !(this.children[0] instanceof Array)) { + return this.children[0]; + } else { + child = this.children[idx]; + } + parameters[name] = child.to_ast() + } + return new Ast(this.astTransform.name, parameters); + } + } + else { + if (this.astTransform instanceof AstTransformSubstitution) { + return this.children[this.astTransform.idx].to_ast() + } else if (this.astTransform instanceof AstTransformNodeCreator) { + var parameters = {}; + for (name in this.astTransform.parameters) { + parameters[name] = this.children[this.astTransform.parameters[name]].to_ast(); + } + return new Ast(this.astTransform.name, parameters); + return x; + } else if (this.children.length) { + return this.children[0].to_ast(); + } else { + return null; + } + } + } + this.to_string = function() { + var children = [] + for (i in this.children) { + var child = this.children[i]; + if (child instanceof Array) { + var stringify = child.map(function(x) {return x.to_string()}); + children.push('[' + stringify.join(', ') + ']'); + } else { + children.push(child.to_string()); + } + } + return '(' + this.nonterminal.to_string() + ': ' + children.join(', ') + ')' + } +} +function Ast(name, attributes) { + this.name = name; + this.attributes = attributes; + this.to_string = function() { + var arr = []; + for (var key in this.attributes) { + var value = this.attributes[key]; + if (value instanceof Array) { + var stringify = value.map(function(x) {return x.to_string()}); + value = '[{0}]'.format(stringify.join(', ')); + } else { + value = value.to_string(); + } + arr.push('{0}={1}'.format(key.to_string(), value)) + } + return '({0}: {1})'.format(this.name, arr.join(', ')); + } +} +function SyntaxError(message) { + this.message = message; + this.to_string = function() { + return this.message; + } +} +function TokenStream(list) { + this.list = list; + this.index = 0; + this.advance = function() { + this.index += 1; + return this.current(); + } + this.last = function() { + return this.list[this.list.length - 1]; + } + this.current = function() { + if (this.index < this.list.length) { + return this.list[this.index]; + } else { + return null; + } + } +} +function DefaultSyntaxErrorFormatter() { + this.unexpected_eof = function(nonterminal, expected_terminals, nonterminal_rules) { + return "Error: unexpected end of file"; + } + this.excess_tokens = function(nonterminal, terminal) { + return "Finished parsing without consuming all tokens."; + } + this.unexpected_symbol = function(nonterminal, actual_terminal, expected_terminals, rule) { + return "Unexpected symbol (line {0}, col {1}) when parsing parse_{2}. Expected {3}, got {4}.".format( + actual_terminal.line, + actual_terminal.col, + nonterminal, + expected_terminals.join(', '), + actual_terminal.to_string(true) + ); + } + this.no_more_tokens = function(nonterminal, expected_terminal, last_terminal) { + return "No more tokens. Expecting " + expected_terminal; + } + this.invalid_terminal = function(nonterminal, invalid_terminal) { + return "Invalid symbol ID: {0} ({1})".format(invalid_terminal.id, invalid_terminal.string); + } + this.missing_list_items = function(method, required, found, last) { + return "List for "+method+" requires "+required+" items but only "+found+" were found."; + } + this.missing_terminator = function(method, terminator, last) { + return "List for "+method+" is missing a terminator"; + } +} +function ParserContext(tokens, error_formatter) { + this.tokens = tokens; + this.error_formatter = error_formatter; + this.nonterminal_string = null; + this.rule_string = null; +} +function MultiRegExp(par) { + var regex; + if (par.source !== undefined){ + regex = par; + } else { + var exp = par; + var opts = ""; + if (par.substring(0, 1) == "/") { + var l = par.lastIndexOf("/"); + opts = par.substring(l + 1, par.length); + exp = par.substring(1, l); + } + regex = new RegExp(exp, opts); + } + var expandSource = function (braces, indexer) { + ret = ''; + for (var i = 0; i < braces.length; i++) { + if (braces[i].type == 'raw') { + ret += '(' + braces[i].text + ')'; + indexer.next(); + } else if (braces[i].type == 'brace' && braces[i].containsCapture) { + ret += braces[i].pre + expandSource(braces[i].children, indexer) + braces[i].post; + } else if (braces[i].type == 'brace' && !braces[i].isCapture) { + ret += '(' + braces[i].text.substring(braces[i].pre.length, braces[i].text.length - braces[i].post.length) + ')'; + indexer.next(); + } else if (braces[i].type == 'brace') { + ret += braces[i].text; + indexer.next(true); + } else { + ret += braces[i].text; + } + } + return ret; + } + var captureScan = function(braces, parent) { + var containsCapture = false; + for (var i = 0; i < braces.length; i++) { + captureScan(braces[i].children, braces[i]); + braces[i].isCapture = braces[i].text.indexOf('(?:') != 0; + if (braces[i].isCapture) { + containsCapture = true; + } + if (braces[i].isCapture && braces[i].containsCapture) { + throw "nested captures not permitted, use (?:...) where capture is not intended"; + } + } + if (parent) { + parent.containsCapture = containsCapture; + } + } + var fillGaps = function(braces, text) { + var pre = /^\((\?.)?/.exec(text); + pre = pre == null ? '' : pre[0]; + var post = /\)$/.exec(text); + post = post == null ? '' : post[0]; + var i = 0; + if (braces.length > 0) { + fillGaps(braces[0].children, braces[0].text); + } + if (braces.length > 0 && braces[0].pos > pre.length) { + braces.splice(0, 0, {type: 'raw', pos: pre.length, length: braces[0].pos, text: text.substring(pre.length, braces[0].pos)}); + i++; + } + for(i++ ;i < braces.length; i++) { + fillGaps(braces[i].children, braces[i].text); + if (braces[i].pos > braces[i-1].pos + braces[i-1].length) { + braces.splice(i, 0, {type:'raw', pos: braces[i-1].pos + braces[i-1].length, + length: braces[i].pos - (braces[i-1].pos + braces[i-1].length), + text: text.substring(braces[i-1].pos + braces[i-1].length, + braces[i].pos)}); + i++; + } + } + if (braces.length == 0) + { + braces.push({type:'raw', pos: pre.length, length: text.length - post.length - pre.length, text: text.substring(pre.length, text.length - post.length)}); + } else if (braces[braces.length - 1].pos + braces[braces.length - 1].length < text.length - post.length) { + var pos = braces[braces.length - 1].pos + braces[braces.length - 1].length; + var txt = text.substring(pos, text.length - post.length); + braces.push({type:'raw', pos: pos, length: txt.length, text: txt}); + } + } + var GetBraces = function(text) { + var ret = []; + var shift = 0; + do { + var brace = GetBrace(text); + if (brace == null) { + break; + } else { + text = text.substring(brace.pos + brace.length); + var del = brace.pos + brace.length; + brace.pos += shift; + shift += del; + ret.push(brace); + } + } while (brace != null); + return ret; + } + var GetBrace = function(text) { + var ret = {pos: -1, length: 0, text: '', children: [], type: 'brace'}; + var openExp = /^(?:\\.|[^\)\\\(])*\(\?./; + var pre = 3; + var post = 1; + var m = openExp.exec(text); + if (m == null) { + m = /^(?:\\.|[^\)\\\(])*\(/.exec(text); + pre = 1; + } + if (m != null) { + ret.pos = m[0].length - pre; + ret.children = GetBraces(text.substring(m[0].length)); + for (var i = 0; i < ret.children.length; i++) { + ret.children[i].pos += pre; + } + var closeExp = /^(?:\\.|[^\\\(\)])*\)/; + var closeExpAlt = /^(?:\\.|[^\\\(\)])*\)\?/; + var from = ret.children.length <= 0 ? ret.pos + pre : + ret.children[ret.children.length-1].pos + + ret.children[ret.children.length-1].length + + m[0].length - pre; + var m2 = closeExp.exec(text.substring(from)); + var m3 = closeExpAlt.exec(text.substring(from)); + if (m3 !== null && m3.length - 1 <= m2.length) { + m2 = m3; + post = 2; + } + if (m2 == null) { + return null; + } else { + ret.length = m2[0].length + from - ret.pos; + ret.text = text.substring(ret.pos, ret.pos + ret.length); + } + } + if (ret.text == '()' || /^\(\?.\)$/.test(ret.text)) { + throw 'empty braces not permitted'; + } + if (ret.pos != -1) { + ret.pre = ret.text.substring(0, pre); + ret.post = ret.text.substring(ret.text.length - post, ret.text.length); + } + return ret.pos == -1 ? null : ret; + } + var fixOrs = function (braces_W_raw) { + var orFind = /^(\\.|[^\\|])*\|/; + for (var i = 0; i < braces_W_raw.length; i++) { + if (braces_W_raw[i].type == 'raw') { + var fullText = braces_W_raw[i].text; + var m = orFind.exec(fullText); + if (m != null) { + var or = { type: 'or', pos: m[0].length - 1 + braces_W_raw[i].pos, length: 1, text: '|' }; + var raw = { type: 'raw', pos: m[0].length + braces_W_raw[i].pos, + length: fullText.length - m[0].length, + text: fullText.substring(m[0].length, fullText.length) + }; + braces_W_raw[i].text = fullText.substring(0, m[0].length - 1); + braces_W_raw[i].length = braces_W_raw[i].text.length; + braces_W_raw.splice(i + 1, 0, or, raw); + i += 1; + } + } else if (braces_W_raw[i].type == 'brace') { + fixOrs(braces_W_raw[i].children, braces_W_raw[i].text); + } + } + } + var source = regex.source; + var braces = GetBraces(source); + captureScan(braces); + fillGaps(braces, source); + fixOrs(braces); + var indexer = {i: 1, next: + function (realPoint) { + if (realPoint) { + this.points.push(this.i); + } + return this.i++; + }, points: []}; + source = expandSource(braces, indexer); + this.dataPoints = indexer.points; + var options = (regex.ignoreCase ? "i" : "") + (regex.global ? "g" : "") + (regex.multiline ? "m" : ""); + this.regex = new RegExp(source, options); + this.exec = function (text) { + var m = this.regex.exec(text); + if (m == null) { + return {}; + } + var ret = {}; + var ch = 0; + for (var i = 1; i < m.length; i++) { + if (m[i] !== null && m[i] !== undefined) { + var pos = this.dataPoints.indexOf(i); + if (pos != -1) { + ret[pos] = {index: ch, text: m[i]}; + } + ch += m[i].length; + } + } + for (var i = 0; i < this.dataPoints.length; i++) { + if (ret[i] === undefined) { + ret[i] = null; + } + } + return ret; + } +} +var Base64 = { + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + // public method for encoding + encode : function (input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + input = Base64._utf8_encode(input); + while (i < input.length) { + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + output = output + + Base64._keyStr.charAt(enc1) + Base64._keyStr.charAt(enc2) + + Base64._keyStr.charAt(enc3) + Base64._keyStr.charAt(enc4); + } + return output; + }, + // public method for decoding + decode : function (input) { + var output = ""; + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0; + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + while (i < input.length) { + enc1 = Base64._keyStr.indexOf(input.charAt(i++)); + enc2 = Base64._keyStr.indexOf(input.charAt(i++)); + enc3 = Base64._keyStr.indexOf(input.charAt(i++)); + enc4 = Base64._keyStr.indexOf(input.charAt(i++)); + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + output = output + String.fromCharCode(chr1); + if (enc3 != 64) { + output = output + String.fromCharCode(chr2); + } + if (enc4 != 64) { + output = output + String.fromCharCode(chr3); + } + } + output = Base64._utf8_decode(output); + return output; + }, + // private method for UTF-8 encoding + _utf8_encode : function (string) { + string = string.replace(/\r\n/g,"\n"); + var utftext = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + } + return utftext; + }, + // private method for UTF-8 decoding + _utf8_decode : function (utftext) { + var string = ""; + var i = 0; + var c = c1 = c2 = 0; + while ( i < utftext.length ) { + c = utftext.charCodeAt(i); + if (c < 128) { + string += String.fromCharCode(c); + i++; + } + else if((c > 191) && (c < 224)) { + c2 = utftext.charCodeAt(i+1); + string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); + i += 2; + } + else { + c2 = utftext.charCodeAt(i+1); + c3 = utftext.charCodeAt(i+2); + string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); + i += 3; + } + } + return string; + } +} +// Section: Parser +var terminals = { + 0: 'task', + 1: 'not', + 2: 'boolean', + 3: 'rbrace', + 4: 'input', + 5: 'parameter_meta', + 6: 'double_pipe', + 7: 'e', + 8: 'cmd_attr_hint', + 9: 'call', + 10: 'colon', + 11: 'double_ampersand', + 12: 'qmark', + 13: 'string', + 14: 'slash', + 15: 'import', + 16: 'lsquare', + 17: 'raw_cmd_end', + 18: 'lbrace', + 19: 'while', + 20: 'integer', + 21: 'type_e', + 22: 'double_equal', + 23: 'lteq', + 24: 'as', + 25: 'type', + 26: 'raw_command', + 27: 'meta', + 28: 'lt', + 29: 'object', + 30: 'fqn', + 31: 'workflow', + 32: 'dash', + 33: 'output', + 34: 'raw_cmd_start', + 35: 'rsquare', + 36: 'gteq', + 37: 'rparen', + 38: 'runtime', + 39: 'asterisk', + 40: 'float', + 41: 'plus', + 42: 'percent', + 43: 'comma', + 44: 'cmd_param_end', + 45: 'lparen', + 46: 'equal', + 47: 'identifier', + 48: 'in', + 49: 'if', + 50: 'dot', + 51: 'cmd_param_start', + 52: 'scatter', + 53: 'not_equal', + 54: 'gt', + 55: 'cmd_part', + 'task': 0, + 'not': 1, + 'boolean': 2, + 'rbrace': 3, + 'input': 4, + 'parameter_meta': 5, + 'double_pipe': 6, + 'e': 7, + 'cmd_attr_hint': 8, + 'call': 9, + 'colon': 10, + 'double_ampersand': 11, + 'qmark': 12, + 'string': 13, + 'slash': 14, + 'import': 15, + 'lsquare': 16, + 'raw_cmd_end': 17, + 'lbrace': 18, + 'while': 19, + 'integer': 20, + 'type_e': 21, + 'double_equal': 22, + 'lteq': 23, + 'as': 24, + 'type': 25, + 'raw_command': 26, + 'meta': 27, + 'lt': 28, + 'object': 29, + 'fqn': 30, + 'workflow': 31, + 'dash': 32, + 'output': 33, + 'raw_cmd_start': 34, + 'rsquare': 35, + 'gteq': 36, + 'rparen': 37, + 'runtime': 38, + 'asterisk': 39, + 'float': 40, + 'plus': 41, + 'percent': 42, + 'comma': 43, + 'cmd_param_end': 44, + 'lparen': 45, + 'equal': 46, + 'identifier': 47, + 'in': 48, + 'if': 49, + 'dot': 50, + 'cmd_param_start': 51, + 'scatter': 52, + 'not_equal': 53, + 'gt': 54, + 'cmd_part': 55, +} +// table[nonterminal][terminal] = rule +var table = [ + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, 66, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [35, -1, -1, 35, 35, 35, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, 35, -1, -1, -1, 35, 35, 35, -1, -1, -1, 35, -1, 35, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, 35, -1, -1, 35, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, 47, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, 42, -1, -1, -1, 42, -1, 48, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, 45, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, 17, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, 38, 38, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 38, -1, -1, 38, -1, 38, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, 38, 38, -1, -1, -1, 38, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, 52, -1, 52, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, -1, 52, -1, -1, -1, 52, -1, 52, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, 52, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, 50, -1, 50, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, 50, 50, -1, 50, -1, -1, 49, 50, -1, 50, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, 50, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 62, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 5, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, 20], + [12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, 2, -1, -1, -1, 2, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, 7, -1, -1, 6, 7, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], +] +var nonterminal_first = { + 56: [24], + 57: [50, -1], + 58: [5], + 59: [46, -1], + 60: [0, 21, -1, 25, 31], + 61: [5, 19, 21, 9, 25, 27, 49, 52, 33], + 62: [47], + 63: [47], + 64: [49], + 65: [24], + 66: [18], + 67: [38], + 68: [38, 26, 33, 27, 5], + 69: [25, 21], + 70: [38, 26, 27, 5, 33, -1], + 71: [51, 55, -1], + 72: [9], + 73: [33], + 74: [15], + 75: [2, 1, 18, 32, 45, 7, 47, 20, 29, 40, 13, 41, 16], + 76: [25, 21], + 77: [25, 21, -1], + 78: [4], + 79: [25, 30, 21, -1], + 80: [47], + 81: [15, -1], + 82: [47, -1], + 83: [26], + 84: [25, 21, -1], + 85: [47, -1], + 86: [25, 21], + 87: [25, 21, -1], + 88: [18, -1], + 89: [2, 1, 7, -1, 40, 13, 41, 16, 18, 45, 20, 47, 29, 32], + 90: [2, 1, 7, -1, 40, 13, 41, 16, 18, 45, 20, 47, 29, 32], + 91: [24, -1], + 92: [46], + 93: [8, -1], + 94: [25, 21, 30], + 95: [0, 31, 21, 25], + 96: [47, -1], + 97: [27], + 98: [8], + 99: [18], + 100: [19], + 101: [5], + 102: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 103: [31], + 104: [25, 21], + 105: [30], + 106: [4, -1], + 107: [33], + 108: [52], + 109: [27], + 110: [51], + 111: [50], + 112: [51, 55], + 113: [0], + 114: [0, 25, 31, 21, 15, -1], + 115: [5, 19, 21, -1, 9, 25, 27, 49, 52, 33], + 116: [24, -1], +} +var nonterminal_follow = { + 56: [0, 25, -1, 31, 21, 15], + 57: [25, 3, 30, 21], + 58: [3, 5, 38, 26, 27, 33], + 59: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], + 60: [-1], + 61: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 62: [43, 3], + 63: [3, 47], + 64: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 65: [18, 3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 66: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 67: [3, 5, 38, 26, 27, 33], + 68: [3, 5, 38, 26, 27, 33], + 69: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], + 70: [3], + 71: [17], + 72: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 73: [3, 5, 38, 26, 27, 33], + 74: [0, 25, -1, 31, 21, 15], + 75: [43, 3], + 76: [43, 35, 47], + 77: [38, 26, 27, 4, 5, 33], + 78: [3, 4], + 79: [3], + 80: [43, 3, 4], + 81: [0, 25, 21, -1, 31], + 82: [3], + 83: [3, 5, 38, 26, 27, 33], + 84: [3], + 85: [3, 4], + 86: [25, 3, 30, 21], + 87: [35], + 88: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 89: [37, 35], + 90: [3], + 91: [18, 3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 92: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], + 93: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 94: [25, 3, 30, 21], + 95: [0, 21, -1, 25, 31], + 96: [3], + 97: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 98: [2, 1, 18, 16, 45, 7, 47, 20, 8, 29, 40, 13, 32, 41], + 99: [3, 5, 19, 21, 9, 38, 26, 27, 25, 49, 52, 33], + 100: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 101: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 102: [2, 1, 0, 3, 4, 5, 7, 8, 9, 10, -1, 11, 13, 14, 16, 18, 19, 20, 21, 22, 23, 25, 27, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 49, 52, 53, 54, 6], + 103: [0, 21, -1, 25, 31], + 104: [25, 21, 3], + 105: [25, 3, 30, 21], + 106: [3], + 107: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 108: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], + 109: [3, 5, 38, 26, 27, 33], + 110: [51, 55, 17], + 111: [25, 3, 30, 21], + 112: [51, 55, 17], + 113: [0, 21, -1, 25, 31], + 114: [-1], + 115: [3], + 116: [0, 25, -1, 31, 21, 15], +} +var rule_first = { + 0: [15, -1], + 1: [0, 31, 21, 25, -1], + 2: [0, 21, -1, 25, 31, 15], + 3: [31], + 4: [0], + 5: [25, 21], + 6: [24], + 7: [-1], + 8: [15], + 9: [24], + 10: [25, 21, -1], + 11: [5, -1, 38, 26, 27, 33], + 12: [0], + 13: [26], + 14: [33], + 15: [38], + 16: [5], + 17: [27], + 18: [51, 55, -1], + 19: [26], + 20: [55], + 21: [51], + 22: [8, -1], + 23: [51], + 24: [8], + 25: [25, 21, -1], + 26: [33], + 27: [25, 21], + 28: [38], + 29: [5], + 30: [27], + 31: [47, -1], + 32: [18], + 33: [47], + 34: [46], + 35: [-1], + 36: [25, 21], + 37: [46], + 38: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 39: [5, 19, 21, -1, 9, 25, 27, 49, 52, 33], + 40: [31], + 41: [9], + 42: [25, 21], + 43: [19], + 44: [49], + 45: [52], + 46: [33], + 47: [5], + 48: [27], + 49: [24], + 50: [-1], + 51: [18], + 52: [-1], + 53: [9], + 54: [4, -1], + 55: [18], + 56: [47, -1], + 57: [4], + 58: [47], + 59: [24], + 60: [25, 21, 30, -1], + 61: [33], + 62: [25, 21], + 63: [30], + 64: [25, 21], + 65: [50], + 66: [-1], + 67: [30], + 68: [50], + 69: [5], + 70: [27], + 71: [19], + 72: [49], + 73: [52], + 74: [47], + 75: [25, 21, -1], + 76: [25], + 77: [25], + 78: [25], + 79: [25], + 80: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 81: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 82: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 83: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 84: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 85: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 86: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 87: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 88: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 89: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 90: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 91: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 92: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], + 93: [1], + 94: [41], + 95: [32], + 96: [2, 1, 18, 45, 7, 47, 20, -1, 41, 29, 40, 13, 32, 16], + 97: [47], + 98: [47], + 99: [47], + 100: [47, -1], + 101: [29], + 102: [16], + 103: [2, 1, 18, 32, 45, 7, 47, 20, -1, 29, 40, 13, 41, 16], + 104: [18], + 105: [45], + 106: [13], + 107: [47], + 108: [2], + 109: [20], + 110: [40], +} +var nonterminal_rules = { + 56: [ + "$import_namespace = :as :identifier -> $1", + ], + 57: [ + "$_gen16 = $wf_output_wildcard", + "$_gen16 = :_empty", + ], + 58: [ + "$parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + ], + 59: [ + "$_gen9 = $setter", + "$_gen9 = :_empty", + ], + 60: [ + "$_gen1 = list($workflow_or_task_or_decl)", + ], + 61: [ + "$wf_body_element = $call", + "$wf_body_element = $declaration", + "$wf_body_element = $while_loop", + "$wf_body_element = $if_stmt", + "$wf_body_element = $scatter", + "$wf_body_element = $wf_outputs", + "$wf_body_element = $wf_parameter_meta", + "$wf_body_element = $wf_meta", + ], + 62: [ + "$object_kv = :identifier :colon $e -> ObjectKV( key=$0, value=$2 )", + ], + 63: [ + "$kv = :identifier :colon $e -> RuntimeAttribute( key=$0, value=$2 )", + ], + 64: [ + "$if_stmt = :if :lparen $e :rparen :lbrace $_gen10 :rbrace -> If( expression=$2, body=$5 )", + ], + 65: [ + "$alias = :as :identifier -> $1", + ], + 66: [ + "$call_body = :lbrace $_gen3 $_gen13 :rbrace -> CallBody( declarations=$1, io=$2 )", + ], + 67: [ + "$runtime = :runtime $map -> Runtime( map=$1 )", + ], + 68: [ + "$sections = $command", + "$sections = $outputs", + "$sections = $runtime", + "$sections = $parameter_meta", + "$sections = $meta", + ], + 69: [ + "$declaration = $type_e :identifier $_gen9 -> Declaration( type=$0, name=$1, expression=$2 )", + ], + 70: [ + "$_gen4 = list($sections)", + ], + 71: [ + "$_gen5 = list($command_part)", + ], + 72: [ + "$call = :call :fqn $_gen11 $_gen12 -> Call( task=$1, alias=$2, body=$3 )", + ], + 73: [ + "$outputs = :output :lbrace $_gen7 :rbrace -> Outputs( attributes=$2 )", + ], + 74: [ + "$import = :import :string $_gen2 -> Import( uri=$1, namespace=$2 )", + ], + 75: [ + "$map_kv = $e :colon $e -> MapLiteralKv( key=$0, value=$2 )", + ], + 76: [ + "$type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 )", + "$type_e = :type <=> :qmark -> OptionalType( innerType=$0 )", + "$type_e = :type <=> :plus -> NonEmptyType( innerType=$0 )", + "$type_e = :type", + ], + 77: [ + "$_gen3 = list($declaration)", + ], + 78: [ + "$call_input = :input :colon $_gen14 -> Inputs( map=$2 )", + ], + 79: [ + "$_gen15 = list($wf_output)", + ], + 80: [ + "$mapping = :identifier :equal $e -> IOMapping( key=$0, value=$2 )", + ], + 81: [ + "$_gen0 = list($import)", + ], + 82: [ + "$_gen8 = list($kv)", + ], + 83: [ + "$command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 )", + ], + 84: [ + "$_gen7 = list($output_kv)", + ], + 85: [ + "$_gen14 = list($mapping, :comma)", + ], + 86: [ + "$wf_output_declaration_syntax = $type_e :identifier :equal $e -> WorkflowOutputDeclaration( type=$0, name=$1, expression=$3 )", + ], + 87: [ + "$_gen17 = list($type_e, :comma)", + ], + 88: [ + "$_gen12 = $call_body", + "$_gen12 = :_empty", + ], + 89: [ + "$_gen18 = list($e, :comma)", + ], + 90: [ + "$_gen20 = list($map_kv, :comma)", + ], + 91: [ + "$_gen11 = $alias", + "$_gen11 = :_empty", + ], + 92: [ + "$setter = :equal $e -> $1", + ], + 93: [ + "$_gen6 = list($cmd_param_kv)", + ], + 94: [ + "$wf_output = $wf_output_declaration_syntax", + "$wf_output = $wf_output_wildcard_syntax", + ], + 95: [ + "$workflow_or_task_or_decl = $workflow", + "$workflow_or_task_or_decl = $task", + "$workflow_or_task_or_decl = $declaration", + ], + 96: [ + "$_gen19 = list($object_kv, :comma)", + ], + 97: [ + "$wf_meta = :meta $map -> Meta( map=$1 )", + ], + 98: [ + "$cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr( key=$1, value=$3 )", + ], + 99: [ + "$map = :lbrace $_gen8 :rbrace -> $1", + ], + 100: [ + "$while_loop = :while :lparen $e :rparen :lbrace $_gen10 :rbrace -> WhileLoop( expression=$2, body=$5 )", + ], + 101: [ + "$wf_parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + ], + 102: [ + "$e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 )", + "$e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 )", + "$e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 )", + "$e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 )", + "$e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 )", + "$e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 )", + "$e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 )", + "$e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 )", + "$e = $e :plus $e -> Add( lhs=$0, rhs=$2 )", + "$e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 )", + "$e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 )", + "$e = $e :slash $e -> Divide( lhs=$0, rhs=$2 )", + "$e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 )", + "$e = :not $e -> LogicalNot( expression=$1 )", + "$e = :plus $e -> UnaryPlus( expression=$1 )", + "$e = :dash $e -> UnaryNegation( expression=$1 )", + "$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )", + "$e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 )", + "$e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 )", + "$e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 )", + "$e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 )", + "$e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 )", + "$e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 )", + "$e = :string", + "$e = :identifier", + "$e = :boolean", + "$e = :integer", + "$e = :float", + ], + 103: [ + "$workflow = :workflow :identifier :lbrace $_gen10 :rbrace -> Workflow( name=$1, body=$3 )", + ], + 104: [ + "$output_kv = $type_e :identifier :equal $e -> Output( type=$0, name=$1, expression=$3 )", + ], + 105: [ + "$wf_output_wildcard_syntax = :fqn $_gen16 -> WorkflowOutputWildcard( fqn=$0, wildcard=$1 )", + ], + 106: [ + "$_gen13 = list($call_input)", + ], + 107: [ + "$wf_outputs = :output :lbrace $_gen15 :rbrace -> WorkflowOutputs( outputs=$2 )", + ], + 108: [ + "$scatter = :scatter :lparen :identifier :in $e :rparen :lbrace $_gen10 :rbrace -> Scatter( item=$2, collection=$4, body=$7 )", + ], + 109: [ + "$meta = :meta $map -> Meta( map=$1 )", + ], + 110: [ + "$cmd_param = :cmd_param_start $_gen6 $e :cmd_param_end -> CommandParameter( attributes=$1, expr=$2 )", + ], + 111: [ + "$wf_output_wildcard = :dot :asterisk -> $1", + ], + 112: [ + "$command_part = :cmd_part", + "$command_part = $cmd_param", + ], + 113: [ + "$task = :task :identifier :lbrace $_gen3 $_gen4 :rbrace -> Task( name=$1, declarations=$3, sections=$4 )", + ], + 114: [ + "$document = $_gen0 $_gen1 -> Namespace( imports=$0, body=$1 )", + ], + 115: [ + "$_gen10 = list($wf_body_element)", + ], + 116: [ + "$_gen2 = $import_namespace", + "$_gen2 = :_empty", + ], +} +var rules = { + 0: "$_gen0 = list($import)", + 1: "$_gen1 = list($workflow_or_task_or_decl)", + 2: "$document = $_gen0 $_gen1 -> Namespace( imports=$0, body=$1 )", + 3: "$workflow_or_task_or_decl = $workflow", + 4: "$workflow_or_task_or_decl = $task", + 5: "$workflow_or_task_or_decl = $declaration", + 6: "$_gen2 = $import_namespace", + 7: "$_gen2 = :_empty", + 8: "$import = :import :string $_gen2 -> Import( uri=$1, namespace=$2 )", + 9: "$import_namespace = :as :identifier -> $1", + 10: "$_gen3 = list($declaration)", + 11: "$_gen4 = list($sections)", + 12: "$task = :task :identifier :lbrace $_gen3 $_gen4 :rbrace -> Task( name=$1, declarations=$3, sections=$4 )", + 13: "$sections = $command", + 14: "$sections = $outputs", + 15: "$sections = $runtime", + 16: "$sections = $parameter_meta", + 17: "$sections = $meta", + 18: "$_gen5 = list($command_part)", + 19: "$command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 )", + 20: "$command_part = :cmd_part", + 21: "$command_part = $cmd_param", + 22: "$_gen6 = list($cmd_param_kv)", + 23: "$cmd_param = :cmd_param_start $_gen6 $e :cmd_param_end -> CommandParameter( attributes=$1, expr=$2 )", + 24: "$cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr( key=$1, value=$3 )", + 25: "$_gen7 = list($output_kv)", + 26: "$outputs = :output :lbrace $_gen7 :rbrace -> Outputs( attributes=$2 )", + 27: "$output_kv = $type_e :identifier :equal $e -> Output( type=$0, name=$1, expression=$3 )", + 28: "$runtime = :runtime $map -> Runtime( map=$1 )", + 29: "$parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + 30: "$meta = :meta $map -> Meta( map=$1 )", + 31: "$_gen8 = list($kv)", + 32: "$map = :lbrace $_gen8 :rbrace -> $1", + 33: "$kv = :identifier :colon $e -> RuntimeAttribute( key=$0, value=$2 )", + 34: "$_gen9 = $setter", + 35: "$_gen9 = :_empty", + 36: "$declaration = $type_e :identifier $_gen9 -> Declaration( type=$0, name=$1, expression=$2 )", + 37: "$setter = :equal $e -> $1", + 38: "$map_kv = $e :colon $e -> MapLiteralKv( key=$0, value=$2 )", + 39: "$_gen10 = list($wf_body_element)", + 40: "$workflow = :workflow :identifier :lbrace $_gen10 :rbrace -> Workflow( name=$1, body=$3 )", + 41: "$wf_body_element = $call", + 42: "$wf_body_element = $declaration", + 43: "$wf_body_element = $while_loop", + 44: "$wf_body_element = $if_stmt", + 45: "$wf_body_element = $scatter", + 46: "$wf_body_element = $wf_outputs", + 47: "$wf_body_element = $wf_parameter_meta", + 48: "$wf_body_element = $wf_meta", + 49: "$_gen11 = $alias", + 50: "$_gen11 = :_empty", + 51: "$_gen12 = $call_body", + 52: "$_gen12 = :_empty", + 53: "$call = :call :fqn $_gen11 $_gen12 -> Call( task=$1, alias=$2, body=$3 )", + 54: "$_gen13 = list($call_input)", + 55: "$call_body = :lbrace $_gen3 $_gen13 :rbrace -> CallBody( declarations=$1, io=$2 )", + 56: "$_gen14 = list($mapping, :comma)", + 57: "$call_input = :input :colon $_gen14 -> Inputs( map=$2 )", + 58: "$mapping = :identifier :equal $e -> IOMapping( key=$0, value=$2 )", + 59: "$alias = :as :identifier -> $1", + 60: "$_gen15 = list($wf_output)", + 61: "$wf_outputs = :output :lbrace $_gen15 :rbrace -> WorkflowOutputs( outputs=$2 )", + 62: "$wf_output = $wf_output_declaration_syntax", + 63: "$wf_output = $wf_output_wildcard_syntax", + 64: "$wf_output_declaration_syntax = $type_e :identifier :equal $e -> WorkflowOutputDeclaration( type=$0, name=$1, expression=$3 )", + 65: "$_gen16 = $wf_output_wildcard", + 66: "$_gen16 = :_empty", + 67: "$wf_output_wildcard_syntax = :fqn $_gen16 -> WorkflowOutputWildcard( fqn=$0, wildcard=$1 )", + 68: "$wf_output_wildcard = :dot :asterisk -> $1", + 69: "$wf_parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + 70: "$wf_meta = :meta $map -> Meta( map=$1 )", + 71: "$while_loop = :while :lparen $e :rparen :lbrace $_gen10 :rbrace -> WhileLoop( expression=$2, body=$5 )", + 72: "$if_stmt = :if :lparen $e :rparen :lbrace $_gen10 :rbrace -> If( expression=$2, body=$5 )", + 73: "$scatter = :scatter :lparen :identifier :in $e :rparen :lbrace $_gen10 :rbrace -> Scatter( item=$2, collection=$4, body=$7 )", + 74: "$object_kv = :identifier :colon $e -> ObjectKV( key=$0, value=$2 )", + 75: "$_gen17 = list($type_e, :comma)", + 76: "$type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 )", + 77: "$type_e = :type <=> :qmark -> OptionalType( innerType=$0 )", + 78: "$type_e = :type <=> :plus -> NonEmptyType( innerType=$0 )", + 79: "$type_e = :type", + 80: "$e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 )", + 81: "$e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 )", + 82: "$e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 )", + 83: "$e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 )", + 84: "$e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 )", + 85: "$e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 )", + 86: "$e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 )", + 87: "$e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 )", + 88: "$e = $e :plus $e -> Add( lhs=$0, rhs=$2 )", + 89: "$e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 )", + 90: "$e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 )", + 91: "$e = $e :slash $e -> Divide( lhs=$0, rhs=$2 )", + 92: "$e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 )", + 93: "$e = :not $e -> LogicalNot( expression=$1 )", + 94: "$e = :plus $e -> UnaryPlus( expression=$1 )", + 95: "$e = :dash $e -> UnaryNegation( expression=$1 )", + 96: "$_gen18 = list($e, :comma)", + 97: "$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )", + 98: "$e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 )", + 99: "$e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 )", + 100: "$_gen19 = list($object_kv, :comma)", + 101: "$e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 )", + 102: "$e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 )", + 103: "$_gen20 = list($map_kv, :comma)", + 104: "$e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 )", + 105: "$e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 )", + 106: "$e = :string", + 107: "$e = :identifier", + 108: "$e = :boolean", + 109: "$e = :integer", + 110: "$e = :float", +} +function is_terminal(id){ + return 0 <= id && id <= 55; +} +function parse(tokens, error_formatter, start) { + if (error_formatter === undefined) { + error_formatter = new DefaultSyntaxErrorFormatter(); + } + var ctx = new ParserContext(tokens, error_formatter); + var tree = parse_document(ctx); + if (tokens.current() != null) { + throw new SyntaxError('Finished parsing without consuming all tokens.'); + } + return tree; +} +function expect(ctx, terminal_id) { + var current = ctx.tokens.current(); + if (current == null) { + throw new SyntaxError(ctx.error_formatter.no_more_tokens(ctx.nonterminal, terminals[terminal_id], ctx.tokens.last())); + } + if (current.id != terminal_id) { + throw new SyntaxError(ctx.error_formatter.unexpected_symbol(ctx.nonterminal, current, [terminals[terminal_id]], ctx.rule)); + } + var next = ctx.tokens.advance(); + if (next && !is_terminal(next.id)) { + throw new SyntaxError(ctx.error_formatter.invalid_terminal(ctx.nonterminal, next)); + } + return current; +} +// START definitions for expression parser `e` +var infix_binding_power_e = { + 6: 4000, // $e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 ) + 11: 5000, // $e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 ) + 22: 6000, // $e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 ) + 53: 6000, // $e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 ) + 28: 7000, // $e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 ) + 23: 7000, // $e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 ) + 54: 7000, // $e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 ) + 36: 7000, // $e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 ) + 41: 8000, // $e = $e :plus $e -> Add( lhs=$0, rhs=$2 ) + 32: 8000, // $e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 ) + 39: 9000, // $e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 ) + 14: 9000, // $e = $e :slash $e -> Divide( lhs=$0, rhs=$2 ) + 42: 9000, // $e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 ) + 45: 11000, // $e = :identifier <=> :lparen list($e, :comma) :rparen -> FunctionCall( name=$0, params=$2 ) + 16: 12000, // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) + 50: 13000, // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) +} +var prefix_binding_power_e = { + 1: 10000, // $e = :not $e -> LogicalNot( expression=$1 ) + 41: 10000, // $e = :plus $e -> UnaryPlus( expression=$1 ) + 32: 10000, // $e = :dash $e -> UnaryNegation( expression=$1 ) +} +function get_infix_binding_power_e(terminal_id) { + if (terminal_id in infix_binding_power_e) { + return infix_binding_power_e[terminal_id]; + } else { + return 0; + } +} +function get_prefix_binding_power_e(terminal_id) { + if (terminal_id in prefix_binding_power_e) { + return prefix_binding_power_e[terminal_id]; + } else { + return 0; + } +} +function parse_e(ctx) { + return parse_e_internal(ctx, 0); +} +function parse_e_internal(ctx, rbp) { + left = nud_e(ctx); + if (left instanceof ParseTree) { + left.isExpr = true; + left.isNud = true; + } + while (ctx.tokens.current() && rbp < get_infix_binding_power_e(ctx.tokens.current().id)) { + left = led_e(left, ctx); + } + if (left) { + left.isExpr = true; + } + return left; +} +function nud_e(ctx) { + var tree = new ParseTree(new NonTerminal(102, 'e')); + var current = ctx.tokens.current(); + ctx.nonterminal = "e"; + if (!current) { + return tree; + } + else if (rule_first[93].indexOf(current.id) != -1) { + // $e = :not $e -> LogicalNot( expression=$1 ) + ctx.rule = rules[93]; + ast_parameters = { + 'expression': 1, + } + tree.astTransform = new AstTransformNodeCreator('LogicalNot', ast_parameters); + tree.nudMorphemeCount = 2; + tree.add(expect(ctx, 1)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(1))); + tree.isPrefix = true; + } + else if (rule_first[94].indexOf(current.id) != -1) { + // $e = :plus $e -> UnaryPlus( expression=$1 ) + ctx.rule = rules[94]; + ast_parameters = { + 'expression': 1, + } + tree.astTransform = new AstTransformNodeCreator('UnaryPlus', ast_parameters); + tree.nudMorphemeCount = 2; + tree.add(expect(ctx, 41)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(41))); + tree.isPrefix = true; + } + else if (rule_first[95].indexOf(current.id) != -1) { + // $e = :dash $e -> UnaryNegation( expression=$1 ) + ctx.rule = rules[95]; + ast_parameters = { + 'expression': 1, + } + tree.astTransform = new AstTransformNodeCreator('UnaryNegation', ast_parameters); + tree.nudMorphemeCount = 2; + tree.add(expect(ctx, 32)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(32))); + tree.isPrefix = true; + } + else if (rule_first[97].indexOf(current.id) != -1) { + // $e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 ) + ctx.rule = rules[97]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 47)); + } + else if (rule_first[98].indexOf(current.id) != -1) { + // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) + ctx.rule = rules[98]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 47)); + } + else if (rule_first[99].indexOf(current.id) != -1) { + // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) + ctx.rule = rules[99]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 47)); + } + else if (rule_first[101].indexOf(current.id) != -1) { + // $e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 ) + ctx.rule = rules[101]; + ast_parameters = { + 'map': 2, + } + tree.astTransform = new AstTransformNodeCreator('ObjectLiteral', ast_parameters); + tree.nudMorphemeCount = 4; + tree.add(expect(ctx, 29)); + tree.add(expect(ctx, 18)); + tree.add(parse__gen19(ctx)); + tree.add(expect(ctx, 3)); + } + else if (rule_first[102].indexOf(current.id) != -1) { + // $e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 ) + ctx.rule = rules[102]; + ast_parameters = { + 'values': 1, + } + tree.astTransform = new AstTransformNodeCreator('ArrayLiteral', ast_parameters); + tree.nudMorphemeCount = 3; + tree.add(expect(ctx, 16)); + tree.add(parse__gen18(ctx)); + tree.add(expect(ctx, 35)); + } + else if (rule_first[104].indexOf(current.id) != -1) { + // $e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 ) + ctx.rule = rules[104]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('MapLiteral', ast_parameters); + tree.nudMorphemeCount = 3; + tree.add(expect(ctx, 18)); + tree.add(parse__gen20(ctx)); + tree.add(expect(ctx, 3)); + } + else if (rule_first[105].indexOf(current.id) != -1) { + // $e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 ) + ctx.rule = rules[105]; + ast_parameters = { + 'values': 1, + } + tree.astTransform = new AstTransformNodeCreator('TupleLiteral', ast_parameters); + tree.nudMorphemeCount = 3; + tree.add(expect(ctx, 45)); + tree.add(parse__gen18(ctx)); + tree.add(expect(ctx, 37)); + } + else if (rule_first[106].indexOf(current.id) != -1) { + // $e = :string + ctx.rule = rules[106]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 13)); + } + else if (rule_first[107].indexOf(current.id) != -1) { + // $e = :identifier + ctx.rule = rules[107]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 47)); + } + else if (rule_first[108].indexOf(current.id) != -1) { + // $e = :boolean + ctx.rule = rules[108]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 2)); + } + else if (rule_first[109].indexOf(current.id) != -1) { + // $e = :integer + ctx.rule = rules[109]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 20)); + } + else if (rule_first[110].indexOf(current.id) != -1) { + // $e = :float + ctx.rule = rules[110]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 40)); + } + return tree; +} +function led_e(left, ctx) { + var tree = new ParseTree(new NonTerminal(102, 'e')) + var current = ctx.tokens.current() + ctx.nonterminal = "e"; + if (current.id == 6) { // :double_pipe + // $e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 ) + ctx.rule = rules[80]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('LogicalOr', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 6)); // :double_pipe + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(6) - modifier)); + } + if (current.id == 11) { // :double_ampersand + // $e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 ) + ctx.rule = rules[81]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('LogicalAnd', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 11)); // :double_ampersand + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(11) - modifier)); + } + if (current.id == 22) { // :double_equal + // $e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 ) + ctx.rule = rules[82]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Equals', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 22)); // :double_equal + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(22) - modifier)); + } + if (current.id == 53) { // :not_equal + // $e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 ) + ctx.rule = rules[83]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('NotEquals', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 53)); // :not_equal + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(53) - modifier)); + } + if (current.id == 28) { // :lt + // $e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 ) + ctx.rule = rules[84]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('LessThan', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 28)); // :lt + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(28) - modifier)); + } + if (current.id == 23) { // :lteq + // $e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 ) + ctx.rule = rules[85]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('LessThanOrEqual', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 23)); // :lteq + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(23) - modifier)); + } + if (current.id == 54) { // :gt + // $e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 ) + ctx.rule = rules[86]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('GreaterThan', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 54)); // :gt + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(54) - modifier)); + } + if (current.id == 36) { // :gteq + // $e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 ) + ctx.rule = rules[87]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('GreaterThanOrEqual', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 36)); // :gteq + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(36) - modifier)); + } + if (current.id == 41) { // :plus + // $e = $e :plus $e -> Add( lhs=$0, rhs=$2 ) + ctx.rule = rules[88]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Add', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 41)); // :plus + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(41) - modifier)); + } + if (current.id == 32) { // :dash + // $e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 ) + ctx.rule = rules[89]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Subtract', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 32)); // :dash + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(32) - modifier)); + } + if (current.id == 39) { // :asterisk + // $e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 ) + ctx.rule = rules[90]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Multiply', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 39)); // :asterisk + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(39) - modifier)); + } + if (current.id == 14) { // :slash + // $e = $e :slash $e -> Divide( lhs=$0, rhs=$2 ) + ctx.rule = rules[91]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Divide', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 14)); // :slash + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(14) - modifier)); + } + if (current.id == 42) { // :percent + // $e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 ) + ctx.rule = rules[92]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('Remainder', ast_parameters); + tree.isExprNud = true; + tree.add(left); + tree.add(expect(ctx, 42)); // :percent + modifier = 0; + tree.isInfix = true; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(42) - modifier)); + } + if (current.id == 45) { // :lparen + // $e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 ) + ctx.rule = rules[97]; + ast_parameters = { + 'name': 0, + 'params': 2, + } + tree.astTransform = new AstTransformNodeCreator('FunctionCall', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 45)); // :lparen + tree.add(parse__gen18(ctx)); + tree.add(expect(ctx, 37)); // :rparen + } + if (current.id == 16) { // :lsquare + // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) + ctx.rule = rules[98]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('ArrayOrMapLookup', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 16)); // :lsquare + modifier = 0; + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(16) - modifier)); + tree.add(expect(ctx, 35)); // :rsquare + } + if (current.id == 50) { // :dot + // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) + ctx.rule = rules[99]; + ast_parameters = { + 'lhs': 0, + 'rhs': 2, + } + tree.astTransform = new AstTransformNodeCreator('MemberAccess', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 50)); // :dot + tree.add(expect(ctx, 47)); // :identifier + } + return tree; +} +// END definitions for expression parser `e` +// START definitions for expression parser `type_e` +var infix_binding_power_type_e = { + 16: 1000, // $type_e = :type <=> :lsquare list($type_e, :comma) :rsquare -> Type( name=$0, subtype=$2 ) + 12: 2000, // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) + 41: 3000, // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) +} +var prefix_binding_power_type_e = { +} +function get_infix_binding_power_type_e(terminal_id) { + if (terminal_id in infix_binding_power_type_e) { + return infix_binding_power_type_e[terminal_id]; + } else { + return 0; + } +} +function get_prefix_binding_power_type_e(terminal_id) { + if (terminal_id in prefix_binding_power_type_e) { + return prefix_binding_power_type_e[terminal_id]; + } else { + return 0; + } +} +function parse_type_e(ctx) { + return parse_type_e_internal(ctx, 0); +} +function parse_type_e_internal(ctx, rbp) { + left = nud_type_e(ctx); + if (left instanceof ParseTree) { + left.isExpr = true; + left.isNud = true; + } + while (ctx.tokens.current() && rbp < get_infix_binding_power_type_e(ctx.tokens.current().id)) { + left = led_type_e(left, ctx); + } + if (left) { + left.isExpr = true; + } + return left; +} +function nud_type_e(ctx) { + var tree = new ParseTree(new NonTerminal(76, 'type_e')); + var current = ctx.tokens.current(); + ctx.nonterminal = "type_e"; + if (!current) { + return tree; + } + if (rule_first[76].indexOf(current.id) != -1) { + // $type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 ) + ctx.rule = rules[76]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 25)); + } + else if (rule_first[77].indexOf(current.id) != -1) { + // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) + ctx.rule = rules[77]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 25)); + } + else if (rule_first[78].indexOf(current.id) != -1) { + // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) + ctx.rule = rules[78]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 25)); + } + else if (rule_first[79].indexOf(current.id) != -1) { + // $type_e = :type + ctx.rule = rules[79]; + tree.astTransform = new AstTransformSubstitution(0); + tree.nudMorphemeCount = 1; + tree.add(expect(ctx, 25)); + } + return tree; +} +function led_type_e(left, ctx) { + var tree = new ParseTree(new NonTerminal(76, 'type_e')) + var current = ctx.tokens.current() + ctx.nonterminal = "type_e"; + if (current.id == 16) { // :lsquare + // $type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 ) + ctx.rule = rules[76]; + ast_parameters = { + 'name': 0, + 'subtype': 2, + } + tree.astTransform = new AstTransformNodeCreator('Type', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 16)); // :lsquare + tree.add(parse__gen17(ctx)); + tree.add(expect(ctx, 35)); // :rsquare + } + if (current.id == 12) { // :qmark + // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) + ctx.rule = rules[77]; + ast_parameters = { + 'innerType': 0, + } + tree.astTransform = new AstTransformNodeCreator('OptionalType', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 12)); // :qmark + } + if (current.id == 41) { // :plus + // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) + ctx.rule = rules[78]; + ast_parameters = { + 'innerType': 0, + } + tree.astTransform = new AstTransformNodeCreator('NonEmptyType', ast_parameters); + tree.add(left); + tree.add(expect(ctx, 41)); // :plus + } + return tree; +} +// END definitions for expression parser `type_e` +function parse__gen0(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[25][current.id] : -1; + var tree = new ParseTree(new NonTerminal(81, '_gen0')); + ctx.nonterminal = "_gen0"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[81].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[81].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[81].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_import(ctx)); + ctx.nonterminal = "_gen0"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen1(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[4][current.id] : -1; + var tree = new ParseTree(new NonTerminal(60, '_gen1')); + ctx.nonterminal = "_gen1"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[60].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[60].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[60].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_workflow_or_task_or_decl(ctx)); + ctx.nonterminal = "_gen1"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen10(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[59][current.id] : -1; + var tree = new ParseTree(new NonTerminal(115, '_gen10')); + ctx.nonterminal = "_gen10"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[115].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[115].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[115].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_wf_body_element(ctx)); + ctx.nonterminal = "_gen10"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen13(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[50][current.id] : -1; + var tree = new ParseTree(new NonTerminal(106, '_gen13')); + ctx.nonterminal = "_gen13"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[106].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[106].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[106].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_call_input(ctx)); + ctx.nonterminal = "_gen13"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen14(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[29][current.id] : -1; + var tree = new ParseTree(new NonTerminal(85, '_gen14')); + ctx.nonterminal = "_gen14"; + tree.list = true; + tree.listSeparator = 43; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[85].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[85].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[85].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_mapping(ctx)); + ctx.nonterminal = "_gen14"; + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { + tree.add(expect(ctx, 43)); + } else { + if (minimum > 1) { + throw new SyntaxError(ctx.error_formatter.missing_list_items( + "_gen14", + 0, + 0 - minimum + 1, + null + )); + } + break; + } + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen15(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[23][current.id] : -1; + var tree = new ParseTree(new NonTerminal(79, '_gen15')); + ctx.nonterminal = "_gen15"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[79].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[79].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[79].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_wf_output(ctx)); + ctx.nonterminal = "_gen15"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen17(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[31][current.id] : -1; + var tree = new ParseTree(new NonTerminal(87, '_gen17')); + ctx.nonterminal = "_gen17"; + tree.list = true; + tree.listSeparator = 43; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[87].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[87].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[87].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_type_e(ctx)); + ctx.nonterminal = "_gen17"; + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { + tree.add(expect(ctx, 43)); + } else { + if (minimum > 1) { + throw new SyntaxError(ctx.error_formatter.missing_list_items( + "_gen17", + 0, + 0 - minimum + 1, + null + )); + } + break; + } + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen18(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[33][current.id] : -1; + var tree = new ParseTree(new NonTerminal(89, '_gen18')); + ctx.nonterminal = "_gen18"; + tree.list = true; + tree.listSeparator = 43; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[89].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[89].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[89].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_e(ctx)); + ctx.nonterminal = "_gen18"; + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { + tree.add(expect(ctx, 43)); + } else { + if (minimum > 1) { + throw new SyntaxError(ctx.error_formatter.missing_list_items( + "_gen18", + 0, + 0 - minimum + 1, + null + )); + } + break; + } + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen19(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[40][current.id] : -1; + var tree = new ParseTree(new NonTerminal(96, '_gen19')); + ctx.nonterminal = "_gen19"; + tree.list = true; + tree.listSeparator = 43; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[96].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[96].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[96].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_object_kv(ctx)); + ctx.nonterminal = "_gen19"; + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { + tree.add(expect(ctx, 43)); + } else { + if (minimum > 1) { + throw new SyntaxError(ctx.error_formatter.missing_list_items( + "_gen19", + 0, + 0 - minimum + 1, + null + )); + } + break; + } + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen20(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[34][current.id] : -1; + var tree = new ParseTree(new NonTerminal(90, '_gen20')); + ctx.nonterminal = "_gen20"; + tree.list = true; + tree.listSeparator = 43; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[90].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[90].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[90].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_map_kv(ctx)); + ctx.nonterminal = "_gen20"; + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { + tree.add(expect(ctx, 43)); + } else { + if (minimum > 1) { + throw new SyntaxError(ctx.error_formatter.missing_list_items( + "_gen20", + 0, + 0 - minimum + 1, + null + )); + } + break; + } + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen3(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[21][current.id] : -1; + var tree = new ParseTree(new NonTerminal(77, '_gen3')); + ctx.nonterminal = "_gen3"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[77].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[77].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[77].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_declaration(ctx)); + ctx.nonterminal = "_gen3"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen4(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[14][current.id] : -1; + var tree = new ParseTree(new NonTerminal(70, '_gen4')); + ctx.nonterminal = "_gen4"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[70].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[70].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[70].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_sections(ctx)); + ctx.nonterminal = "_gen4"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen5(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[15][current.id] : -1; + var tree = new ParseTree(new NonTerminal(71, '_gen5')); + ctx.nonterminal = "_gen5"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[71].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[71].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[71].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_command_part(ctx)); + ctx.nonterminal = "_gen5"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen6(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[37][current.id] : -1; + var tree = new ParseTree(new NonTerminal(93, '_gen6')); + ctx.nonterminal = "_gen6"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[93].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[93].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[93].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_cmd_param_kv(ctx)); + ctx.nonterminal = "_gen6"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen7(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[28][current.id] : -1; + var tree = new ParseTree(new NonTerminal(84, '_gen7')); + ctx.nonterminal = "_gen7"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[84].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[84].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[84].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_output_kv(ctx)); + ctx.nonterminal = "_gen7"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen8(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[26][current.id] : -1; + var tree = new ParseTree(new NonTerminal(82, '_gen8')); + ctx.nonterminal = "_gen8"; + tree.list = true; + tree.listSeparator = -1; + tree.astTransform = new AstTransformSubstitution(0); + if ( ctx.tokens.current() != null && + nonterminal_follow[82].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[82].indexOf(ctx.tokens.current().id) == -1 ) { + return tree; + } + if ( ctx.tokens.current() == null) { + return tree; + } + var minimum = 0; + while ( minimum > 0 || + (ctx.tokens.current() != null && + nonterminal_first[82].indexOf(ctx.tokens.current().id) != -1)) { + tree.add(parse_kv(ctx)); + ctx.nonterminal = "_gen8"; + minimum = Math.max(minimum - 1, 0); + } + return tree; +} +function parse__gen11(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[35][current.id] : -1; + var tree = new ParseTree(new NonTerminal(91, '_gen11')); + ctx.nonterminal = "_gen11"; + if (current != null && nonterminal_follow[91].indexOf(current.id) != -1 && nonterminal_first[91].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 49) { // $_gen11 = $alias + ctx.rule = rules[49]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_alias(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse__gen12(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[32][current.id] : -1; + var tree = new ParseTree(new NonTerminal(88, '_gen12')); + ctx.nonterminal = "_gen12"; + if (current != null && nonterminal_follow[88].indexOf(current.id) != -1 && nonterminal_first[88].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 51) { // $_gen12 = $call_body + ctx.rule = rules[51]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_call_body(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse__gen16(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[1][current.id] : -1; + var tree = new ParseTree(new NonTerminal(57, '_gen16')); + ctx.nonterminal = "_gen16"; + if (current != null && nonterminal_follow[57].indexOf(current.id) != -1 && nonterminal_first[57].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 65) { // $_gen16 = $wf_output_wildcard + ctx.rule = rules[65]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_output_wildcard(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse__gen2(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[60][current.id] : -1; + var tree = new ParseTree(new NonTerminal(116, '_gen2')); + ctx.nonterminal = "_gen2"; + if (current != null && nonterminal_follow[116].indexOf(current.id) != -1 && nonterminal_first[116].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 6) { // $_gen2 = $import_namespace + ctx.rule = rules[6]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_import_namespace(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse__gen9(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[3][current.id] : -1; + var tree = new ParseTree(new NonTerminal(59, '_gen9')); + ctx.nonterminal = "_gen9"; + if (current != null && nonterminal_follow[59].indexOf(current.id) != -1 && nonterminal_first[59].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 34) { // $_gen9 = $setter + ctx.rule = rules[34]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_setter(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse_alias(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[9][current.id] : -1; + var tree = new ParseTree(new NonTerminal(65, 'alias')); + ctx.nonterminal = "alias"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 59) { // $alias = :as :identifier -> $1 + ctx.rule = rules[59]; + tree.astTransform = new AstTransformSubstitution(1); + t = expect(ctx, 24); // :as + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[65], + rules[59] + )); +} +function parse_call(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[16][current.id] : -1; + var tree = new ParseTree(new NonTerminal(72, 'call')); + ctx.nonterminal = "call"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 53) { // $call = :call :fqn $_gen11 $_gen12 -> Call( task=$1, alias=$2, body=$3 ) + ctx.rule = rules[53]; + ast_parameters = { + 'task': 1, + 'alias': 2, + 'body': 3, + } + tree.astTransform = new AstTransformNodeCreator('Call', ast_parameters); + t = expect(ctx, 9); // :call + tree.add(t); + t = expect(ctx, 30); // :fqn + tree.add(t); + subtree = parse__gen11(ctx); + tree.add(subtree); + subtree = parse__gen12(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[72], + rules[53] + )); +} +function parse_call_body(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[10][current.id] : -1; + var tree = new ParseTree(new NonTerminal(66, 'call_body')); + ctx.nonterminal = "call_body"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 55) { // $call_body = :lbrace $_gen3 $_gen13 :rbrace -> CallBody( declarations=$1, io=$2 ) + ctx.rule = rules[55]; + ast_parameters = { + 'declarations': 1, + 'io': 2, + } + tree.astTransform = new AstTransformNodeCreator('CallBody', ast_parameters); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen3(ctx); + tree.add(subtree); + subtree = parse__gen13(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[66], + rules[55] + )); +} +function parse_call_input(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[22][current.id] : -1; + var tree = new ParseTree(new NonTerminal(78, 'call_input')); + ctx.nonterminal = "call_input"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 57) { // $call_input = :input :colon $_gen14 -> Inputs( map=$2 ) + ctx.rule = rules[57]; + ast_parameters = { + 'map': 2, + } + tree.astTransform = new AstTransformNodeCreator('Inputs', ast_parameters); + t = expect(ctx, 4); // :input + tree.add(t); + t = expect(ctx, 10); // :colon + tree.add(t); + subtree = parse__gen14(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[78], + rules[57] + )); +} +function parse_cmd_param(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[54][current.id] : -1; + var tree = new ParseTree(new NonTerminal(110, 'cmd_param')); + ctx.nonterminal = "cmd_param"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 23) { // $cmd_param = :cmd_param_start $_gen6 $e :cmd_param_end -> CommandParameter( attributes=$1, expr=$2 ) + ctx.rule = rules[23]; + ast_parameters = { + 'attributes': 1, + 'expr': 2, + } + tree.astTransform = new AstTransformNodeCreator('CommandParameter', ast_parameters); + t = expect(ctx, 51); // :cmd_param_start + tree.add(t); + subtree = parse__gen6(ctx); + tree.add(subtree); + subtree = parse_e(ctx); + tree.add(subtree); + t = expect(ctx, 44); // :cmd_param_end + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[110], + rules[23] + )); +} +function parse_cmd_param_kv(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[42][current.id] : -1; + var tree = new ParseTree(new NonTerminal(98, 'cmd_param_kv')); + ctx.nonterminal = "cmd_param_kv"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 24) { // $cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr( key=$1, value=$3 ) + ctx.rule = rules[24]; + ast_parameters = { + 'key': 1, + 'value': 3, + } + tree.astTransform = new AstTransformNodeCreator('CommandParameterAttr', ast_parameters); + t = expect(ctx, 8); // :cmd_attr_hint + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 46); // :equal + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[98], + rules[24] + )); +} +function parse_command(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[27][current.id] : -1; + var tree = new ParseTree(new NonTerminal(83, 'command')); + ctx.nonterminal = "command"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 19) { // $command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 ) + ctx.rule = rules[19]; + ast_parameters = { + 'parts': 2, + } + tree.astTransform = new AstTransformNodeCreator('RawCommand', ast_parameters); + t = expect(ctx, 26); // :raw_command + tree.add(t); + t = expect(ctx, 34); // :raw_cmd_start + tree.add(t); + subtree = parse__gen5(ctx); + tree.add(subtree); + t = expect(ctx, 17); // :raw_cmd_end + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[83], + rules[19] + )); +} +function parse_command_part(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[56][current.id] : -1; + var tree = new ParseTree(new NonTerminal(112, 'command_part')); + ctx.nonterminal = "command_part"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 20) { // $command_part = :cmd_part + ctx.rule = rules[20]; + tree.astTransform = new AstTransformSubstitution(0); + t = expect(ctx, 55); // :cmd_part + tree.add(t); + return tree; + } + else if (rule == 21) { // $command_part = $cmd_param + ctx.rule = rules[21]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_cmd_param(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[112], + rules[21] + )); +} +function parse_declaration(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[13][current.id] : -1; + var tree = new ParseTree(new NonTerminal(69, 'declaration')); + ctx.nonterminal = "declaration"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 36) { // $declaration = $type_e :identifier $_gen9 -> Declaration( type=$0, name=$1, expression=$2 ) + ctx.rule = rules[36]; + ast_parameters = { + 'type': 0, + 'name': 1, + 'expression': 2, + } + tree.astTransform = new AstTransformNodeCreator('Declaration', ast_parameters); + subtree = parse_type_e(ctx); + tree.add(subtree); + t = expect(ctx, 47); // :identifier + tree.add(t); + subtree = parse__gen9(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[69], + rules[36] + )); +} +function parse_document(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[58][current.id] : -1; + var tree = new ParseTree(new NonTerminal(114, 'document')); + ctx.nonterminal = "document"; + if (current != null && nonterminal_follow[114].indexOf(current.id) != -1 && nonterminal_first[114].indexOf(current.id) == -1) { + return tree; + } + if (current == null) { + return tree; + } + if (rule == 2) { // $document = $_gen0 $_gen1 -> Namespace( imports=$0, body=$1 ) + ctx.rule = rules[2]; + ast_parameters = { + 'imports': 0, + 'body': 1, + } + tree.astTransform = new AstTransformNodeCreator('Namespace', ast_parameters); + subtree = parse__gen0(ctx); + tree.add(subtree); + subtree = parse__gen1(ctx); + tree.add(subtree); + return tree; + } + return tree; +} +function parse_if_stmt(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[8][current.id] : -1; + var tree = new ParseTree(new NonTerminal(64, 'if_stmt')); + ctx.nonterminal = "if_stmt"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 72) { // $if_stmt = :if :lparen $e :rparen :lbrace $_gen10 :rbrace -> If( expression=$2, body=$5 ) + ctx.rule = rules[72]; + ast_parameters = { + 'expression': 2, + 'body': 5, + } + tree.astTransform = new AstTransformNodeCreator('If', ast_parameters); + t = expect(ctx, 49); // :if + tree.add(t); + t = expect(ctx, 45); // :lparen + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + t = expect(ctx, 37); // :rparen + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen10(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[64], + rules[72] + )); +} +function parse_import(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[18][current.id] : -1; + var tree = new ParseTree(new NonTerminal(74, 'import')); + ctx.nonterminal = "import"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 8) { // $import = :import :string $_gen2 -> Import( uri=$1, namespace=$2 ) + ctx.rule = rules[8]; + ast_parameters = { + 'uri': 1, + 'namespace': 2, + } + tree.astTransform = new AstTransformNodeCreator('Import', ast_parameters); + t = expect(ctx, 15); // :import + tree.add(t); + t = expect(ctx, 13); // :string + tree.add(t); + subtree = parse__gen2(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[74], + rules[8] + )); +} +function parse_import_namespace(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[0][current.id] : -1; + var tree = new ParseTree(new NonTerminal(56, 'import_namespace')); + ctx.nonterminal = "import_namespace"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 9) { // $import_namespace = :as :identifier -> $1 + ctx.rule = rules[9]; + tree.astTransform = new AstTransformSubstitution(1); + t = expect(ctx, 24); // :as + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[56], + rules[9] + )); +} +function parse_kv(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[7][current.id] : -1; + var tree = new ParseTree(new NonTerminal(63, 'kv')); + ctx.nonterminal = "kv"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 33) { // $kv = :identifier :colon $e -> RuntimeAttribute( key=$0, value=$2 ) + ctx.rule = rules[33]; + ast_parameters = { + 'key': 0, + 'value': 2, + } + tree.astTransform = new AstTransformNodeCreator('RuntimeAttribute', ast_parameters); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 10); // :colon + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[63], + rules[33] + )); +} +function parse_map(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[43][current.id] : -1; + var tree = new ParseTree(new NonTerminal(99, 'map')); + ctx.nonterminal = "map"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 32) { // $map = :lbrace $_gen8 :rbrace -> $1 + ctx.rule = rules[32]; + tree.astTransform = new AstTransformSubstitution(1); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen8(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[99], + rules[32] + )); +} +function parse_map_kv(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[19][current.id] : -1; + var tree = new ParseTree(new NonTerminal(75, 'map_kv')); + ctx.nonterminal = "map_kv"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 38) { // $map_kv = $e :colon $e -> MapLiteralKv( key=$0, value=$2 ) + ctx.rule = rules[38]; + ast_parameters = { + 'key': 0, + 'value': 2, + } + tree.astTransform = new AstTransformNodeCreator('MapLiteralKv', ast_parameters); + subtree = parse_e(ctx); + tree.add(subtree); + t = expect(ctx, 10); // :colon + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[75], + rules[38] + )); +} +function parse_mapping(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[24][current.id] : -1; + var tree = new ParseTree(new NonTerminal(80, 'mapping')); + ctx.nonterminal = "mapping"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 58) { // $mapping = :identifier :equal $e -> IOMapping( key=$0, value=$2 ) + ctx.rule = rules[58]; + ast_parameters = { + 'key': 0, + 'value': 2, + } + tree.astTransform = new AstTransformNodeCreator('IOMapping', ast_parameters); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 46); // :equal + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[80], + rules[58] + )); +} +function parse_meta(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[53][current.id] : -1; + var tree = new ParseTree(new NonTerminal(109, 'meta')); + ctx.nonterminal = "meta"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 30) { // $meta = :meta $map -> Meta( map=$1 ) + ctx.rule = rules[30]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('Meta', ast_parameters); + t = expect(ctx, 27); // :meta + tree.add(t); + subtree = parse_map(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[109], + rules[30] + )); +} +function parse_object_kv(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[6][current.id] : -1; + var tree = new ParseTree(new NonTerminal(62, 'object_kv')); + ctx.nonterminal = "object_kv"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 74) { // $object_kv = :identifier :colon $e -> ObjectKV( key=$0, value=$2 ) + ctx.rule = rules[74]; + ast_parameters = { + 'key': 0, + 'value': 2, + } + tree.astTransform = new AstTransformNodeCreator('ObjectKV', ast_parameters); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 10); // :colon + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[62], + rules[74] + )); +} +function parse_output_kv(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[48][current.id] : -1; + var tree = new ParseTree(new NonTerminal(104, 'output_kv')); + ctx.nonterminal = "output_kv"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 27) { // $output_kv = $type_e :identifier :equal $e -> Output( type=$0, name=$1, expression=$3 ) + ctx.rule = rules[27]; + ast_parameters = { + 'type': 0, + 'name': 1, + 'expression': 3, + } + tree.astTransform = new AstTransformNodeCreator('Output', ast_parameters); + subtree = parse_type_e(ctx); + tree.add(subtree); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 46); // :equal + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[104], + rules[27] + )); +} +function parse_outputs(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[17][current.id] : -1; + var tree = new ParseTree(new NonTerminal(73, 'outputs')); + ctx.nonterminal = "outputs"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 26) { // $outputs = :output :lbrace $_gen7 :rbrace -> Outputs( attributes=$2 ) + ctx.rule = rules[26]; + ast_parameters = { + 'attributes': 2, + } + tree.astTransform = new AstTransformNodeCreator('Outputs', ast_parameters); + t = expect(ctx, 33); // :output + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen7(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[73], + rules[26] + )); +} +function parse_parameter_meta(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[2][current.id] : -1; + var tree = new ParseTree(new NonTerminal(58, 'parameter_meta')); + ctx.nonterminal = "parameter_meta"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 29) { // $parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 ) + ctx.rule = rules[29]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('ParameterMeta', ast_parameters); + t = expect(ctx, 5); // :parameter_meta + tree.add(t); + subtree = parse_map(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[58], + rules[29] + )); +} +function parse_runtime(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[11][current.id] : -1; + var tree = new ParseTree(new NonTerminal(67, 'runtime')); + ctx.nonterminal = "runtime"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 28) { // $runtime = :runtime $map -> Runtime( map=$1 ) + ctx.rule = rules[28]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('Runtime', ast_parameters); + t = expect(ctx, 38); // :runtime + tree.add(t); + subtree = parse_map(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[67], + rules[28] + )); +} +function parse_scatter(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[52][current.id] : -1; + var tree = new ParseTree(new NonTerminal(108, 'scatter')); + ctx.nonterminal = "scatter"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 73) { // $scatter = :scatter :lparen :identifier :in $e :rparen :lbrace $_gen10 :rbrace -> Scatter( item=$2, collection=$4, body=$7 ) + ctx.rule = rules[73]; + ast_parameters = { + 'item': 2, + 'collection': 4, + 'body': 7, + } + tree.astTransform = new AstTransformNodeCreator('Scatter', ast_parameters); + t = expect(ctx, 52); // :scatter + tree.add(t); + t = expect(ctx, 45); // :lparen + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 48); // :in + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + t = expect(ctx, 37); // :rparen + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen10(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[108], + rules[73] + )); +} +function parse_sections(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[12][current.id] : -1; + var tree = new ParseTree(new NonTerminal(68, 'sections')); + ctx.nonterminal = "sections"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 13) { // $sections = $command + ctx.rule = rules[13]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_command(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 14) { // $sections = $outputs + ctx.rule = rules[14]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_outputs(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 15) { // $sections = $runtime + ctx.rule = rules[15]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_runtime(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 16) { // $sections = $parameter_meta + ctx.rule = rules[16]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_parameter_meta(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 17) { // $sections = $meta + ctx.rule = rules[17]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_meta(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[68], + rules[17] + )); +} +function parse_setter(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[36][current.id] : -1; + var tree = new ParseTree(new NonTerminal(92, 'setter')); + ctx.nonterminal = "setter"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 37) { // $setter = :equal $e -> $1 + ctx.rule = rules[37]; + tree.astTransform = new AstTransformSubstitution(1); + t = expect(ctx, 46); // :equal + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[92], + rules[37] + )); +} +function parse_task(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[57][current.id] : -1; + var tree = new ParseTree(new NonTerminal(113, 'task')); + ctx.nonterminal = "task"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 12) { // $task = :task :identifier :lbrace $_gen3 $_gen4 :rbrace -> Task( name=$1, declarations=$3, sections=$4 ) + ctx.rule = rules[12]; + ast_parameters = { + 'name': 1, + 'declarations': 3, + 'sections': 4, + } + tree.astTransform = new AstTransformNodeCreator('Task', ast_parameters); + t = expect(ctx, 0); // :task + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen3(ctx); + tree.add(subtree); + subtree = parse__gen4(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[113], + rules[12] + )); +} +function parse_wf_body_element(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[5][current.id] : -1; + var tree = new ParseTree(new NonTerminal(61, 'wf_body_element')); + ctx.nonterminal = "wf_body_element"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 41) { // $wf_body_element = $call + ctx.rule = rules[41]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_call(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 42) { // $wf_body_element = $declaration + ctx.rule = rules[42]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_declaration(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 43) { // $wf_body_element = $while_loop + ctx.rule = rules[43]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_while_loop(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 44) { // $wf_body_element = $if_stmt + ctx.rule = rules[44]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_if_stmt(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 45) { // $wf_body_element = $scatter + ctx.rule = rules[45]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_scatter(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 46) { // $wf_body_element = $wf_outputs + ctx.rule = rules[46]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_outputs(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 47) { // $wf_body_element = $wf_parameter_meta + ctx.rule = rules[47]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_parameter_meta(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 48) { // $wf_body_element = $wf_meta + ctx.rule = rules[48]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_meta(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[61], + rules[48] + )); +} +function parse_wf_meta(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[41][current.id] : -1; + var tree = new ParseTree(new NonTerminal(97, 'wf_meta')); + ctx.nonterminal = "wf_meta"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 70) { // $wf_meta = :meta $map -> Meta( map=$1 ) + ctx.rule = rules[70]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('Meta', ast_parameters); + t = expect(ctx, 27); // :meta + tree.add(t); + subtree = parse_map(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[97], + rules[70] + )); +} +function parse_wf_output(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[38][current.id] : -1; + var tree = new ParseTree(new NonTerminal(94, 'wf_output')); + ctx.nonterminal = "wf_output"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 62) { // $wf_output = $wf_output_declaration_syntax + ctx.rule = rules[62]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_output_declaration_syntax(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 63) { // $wf_output = $wf_output_wildcard_syntax + ctx.rule = rules[63]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_wf_output_wildcard_syntax(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[94], + rules[63] + )); +} +function parse_wf_output_declaration_syntax(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[30][current.id] : -1; + var tree = new ParseTree(new NonTerminal(86, 'wf_output_declaration_syntax')); + ctx.nonterminal = "wf_output_declaration_syntax"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 64) { // $wf_output_declaration_syntax = $type_e :identifier :equal $e -> WorkflowOutputDeclaration( type=$0, name=$1, expression=$3 ) + ctx.rule = rules[64]; + ast_parameters = { + 'type': 0, + 'name': 1, + 'expression': 3, + } + tree.astTransform = new AstTransformNodeCreator('WorkflowOutputDeclaration', ast_parameters); + subtree = parse_type_e(ctx); + tree.add(subtree); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 46); // :equal + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[86], + rules[64] + )); +} +function parse_wf_output_wildcard(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[55][current.id] : -1; + var tree = new ParseTree(new NonTerminal(111, 'wf_output_wildcard')); + ctx.nonterminal = "wf_output_wildcard"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 68) { // $wf_output_wildcard = :dot :asterisk -> $1 + ctx.rule = rules[68]; + tree.astTransform = new AstTransformSubstitution(1); + t = expect(ctx, 50); // :dot + tree.add(t); + t = expect(ctx, 39); // :asterisk + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[111], + rules[68] + )); +} +function parse_wf_output_wildcard_syntax(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[49][current.id] : -1; + var tree = new ParseTree(new NonTerminal(105, 'wf_output_wildcard_syntax')); + ctx.nonterminal = "wf_output_wildcard_syntax"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 67) { // $wf_output_wildcard_syntax = :fqn $_gen16 -> WorkflowOutputWildcard( fqn=$0, wildcard=$1 ) + ctx.rule = rules[67]; + ast_parameters = { + 'fqn': 0, + 'wildcard': 1, + } + tree.astTransform = new AstTransformNodeCreator('WorkflowOutputWildcard', ast_parameters); + t = expect(ctx, 30); // :fqn + tree.add(t); + subtree = parse__gen16(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[105], + rules[67] + )); +} +function parse_wf_outputs(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[51][current.id] : -1; + var tree = new ParseTree(new NonTerminal(107, 'wf_outputs')); + ctx.nonterminal = "wf_outputs"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 61) { // $wf_outputs = :output :lbrace $_gen15 :rbrace -> WorkflowOutputs( outputs=$2 ) + ctx.rule = rules[61]; + ast_parameters = { + 'outputs': 2, + } + tree.astTransform = new AstTransformNodeCreator('WorkflowOutputs', ast_parameters); + t = expect(ctx, 33); // :output + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen15(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[107], + rules[61] + )); +} +function parse_wf_parameter_meta(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[45][current.id] : -1; + var tree = new ParseTree(new NonTerminal(101, 'wf_parameter_meta')); + ctx.nonterminal = "wf_parameter_meta"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 69) { // $wf_parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 ) + ctx.rule = rules[69]; + ast_parameters = { + 'map': 1, + } + tree.astTransform = new AstTransformNodeCreator('ParameterMeta', ast_parameters); + t = expect(ctx, 5); // :parameter_meta + tree.add(t); + subtree = parse_map(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[101], + rules[69] + )); +} +function parse_while_loop(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[44][current.id] : -1; + var tree = new ParseTree(new NonTerminal(100, 'while_loop')); + ctx.nonterminal = "while_loop"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 71) { // $while_loop = :while :lparen $e :rparen :lbrace $_gen10 :rbrace -> WhileLoop( expression=$2, body=$5 ) + ctx.rule = rules[71]; + ast_parameters = { + 'expression': 2, + 'body': 5, + } + tree.astTransform = new AstTransformNodeCreator('WhileLoop', ast_parameters); + t = expect(ctx, 19); // :while + tree.add(t); + t = expect(ctx, 45); // :lparen + tree.add(t); + subtree = parse_e(ctx); + tree.add(subtree); + t = expect(ctx, 37); // :rparen + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen10(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[100], + rules[71] + )); +} +function parse_workflow(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[47][current.id] : -1; + var tree = new ParseTree(new NonTerminal(103, 'workflow')); + ctx.nonterminal = "workflow"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 40) { // $workflow = :workflow :identifier :lbrace $_gen10 :rbrace -> Workflow( name=$1, body=$3 ) + ctx.rule = rules[40]; + ast_parameters = { + 'name': 1, + 'body': 3, + } + tree.astTransform = new AstTransformNodeCreator('Workflow', ast_parameters); + t = expect(ctx, 31); // :workflow + tree.add(t); + t = expect(ctx, 47); // :identifier + tree.add(t); + t = expect(ctx, 18); // :lbrace + tree.add(t); + subtree = parse__gen10(ctx); + tree.add(subtree); + t = expect(ctx, 3); // :rbrace + tree.add(t); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[103], + rules[40] + )); +} +function parse_workflow_or_task_or_decl(ctx) { + var current = ctx.tokens.current(); + var rule = current != null ? table[39][current.id] : -1; + var tree = new ParseTree(new NonTerminal(95, 'workflow_or_task_or_decl')); + ctx.nonterminal = "workflow_or_task_or_decl"; + if (current == null) { + throw new SyntaxError('Error: unexpected end of file'); + } + if (rule == 3) { // $workflow_or_task_or_decl = $workflow + ctx.rule = rules[3]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_workflow(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 4) { // $workflow_or_task_or_decl = $task + ctx.rule = rules[4]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_task(ctx); + tree.add(subtree); + return tree; + } + else if (rule == 5) { // $workflow_or_task_or_decl = $declaration + ctx.rule = rules[5]; + tree.astTransform = new AstTransformSubstitution(0); + subtree = parse_declaration(ctx); + tree.add(subtree); + return tree; + } + throw new SyntaxError(ctx.error_formatter.unexpected_symbol( + ctx.nonterminal, + ctx.tokens.current(), + nonterminal_first[95], + rules[5] + )); +} +// Section: Lexer +// START USER CODE +function init() { + return {wf_or_task: null}; +} +function workflow(ctx, terminal, source_string, line, col) { + ctx.user_context.wf_or_task = "workflow"; + default_action(ctx, terminal, source_string, line, col); +} +function task(ctx, terminal, source_string, line, col) { + ctx.user_context.wf_or_task = "task"; + default_action(ctx, terminal, source_string, line, col); +} +function output(ctx, terminal, source_string, line, col) { + const user_ctx = ctx.user_context; + if (user_ctx.wf_or_task != null && user_ctx.wf_or_task === "workflow") { + ctx.mode_stack.push("wf_output"); + } + default_action(ctx, terminal, source_string, line, col); +} +function wdl_unescape(ctx, terminal, source_string, line, col) { + var strip_slashes = function(str) { + return str + .replace(/\\(.?)/g, function (s, n1) { + var escapes = { + '\\': '\\', + '0' : '\u0000', + '' : '', + 'n' : '\n', + 'r' : '\r', + 'b' : '\b', + 't' : '\t', + 'f' : '\f', + 'a' : '\a', + 'v' : '\v'}; + var symbol = escapes[n1]; + if (symbol !== undefined) { + return symbol; + } + return n1; + }); + } + var repl_str = strip_slashes(source_string.substring(1, source_string.length - 1)); + default_action(ctx, terminal, repl_str, line, col); +} +// END USER CODE +function emit(ctx, terminal, source_string, line, col) { + ctx.tokens.push(new Terminal(terminals[terminal], terminal, source_string, ctx.resource, line, col)) +} +function default_action(ctx, terminal, source_string, line, col) { + emit(ctx, terminal, source_string, line, col) +} +function post_filter(tokens) { + return tokens +} +function destroy(context) { + return 0; +} +var regex = { + 'default': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("/\\*(.*?)\\*/", "m"), + outputs: [ + ] + }, + { + regex: new RegExp("#.*"), + outputs: [ + ] + }, + { + regex: new RegExp("task(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'task', + group: 0, + function: task, + }, + ] + }, + { + regex: new RegExp("(call)\\s+"), + outputs: [ + { + terminal: 'call', + group: 1, + function: null, + }, + { + stack_push: 'task_fqn', + }, + ] + }, + { + regex: new RegExp("workflow(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'workflow', + group: 0, + function: workflow, + }, + ] + }, + { + regex: new RegExp("import(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'import', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("input(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'input', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("output(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'output', + group: 0, + function: output, + }, + ] + }, + { + regex: new RegExp("as(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'as', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("if(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'if', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("while(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'while', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("runtime(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'runtime', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("scatter(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'scatter', + group: 0, + function: null, + }, + { + stack_push: 'scatter', + }, + ] + }, + { + regex: new RegExp("command\\s*(?=<<<)"), + outputs: [ + { + terminal: 'raw_command', + group: 0, + function: null, + }, + { + stack_push: 'raw_command2', + }, + ] + }, + { + regex: new RegExp("command\\s*(?=\\{)"), + outputs: [ + { + terminal: 'raw_command', + group: 0, + function: null, + }, + { + stack_push: 'raw_command', + }, + ] + }, + { + regex: new RegExp("parameter_meta(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'parameter_meta', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("meta(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'meta', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(true|false)(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'boolean', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(object)\\s*(\\{)"), + outputs: [ + { + terminal: 'object', + group: 0, + function: null, + }, + { + terminal: 'lbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'type', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*"), + outputs: [ + { + terminal: 'identifier', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\""), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp("'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'"), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp(":"), + outputs: [ + { + terminal: 'colon', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(","), + outputs: [ + { + terminal: 'comma', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("=="), + outputs: [ + { + terminal: 'double_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\|\\|"), + outputs: [ + { + terminal: 'double_pipe', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\&\\&"), + outputs: [ + { + terminal: 'double_ampersand', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!="), + outputs: [ + { + terminal: 'not_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("="), + outputs: [ + { + terminal: 'equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\{"), + outputs: [ + { + terminal: 'lbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\}"), + outputs: [ + { + terminal: 'rbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\("), + outputs: [ + { + terminal: 'lparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\)"), + outputs: [ + { + terminal: 'rparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\+"), + outputs: [ + { + terminal: 'plus', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("-"), + outputs: [ + { + terminal: 'dash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("/"), + outputs: [ + { + terminal: 'slash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("%"), + outputs: [ + { + terminal: 'percent', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<="), + outputs: [ + { + terminal: 'lteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<"), + outputs: [ + { + terminal: 'lt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">="), + outputs: [ + { + terminal: 'gteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">"), + outputs: [ + { + terminal: 'gt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!"), + outputs: [ + { + terminal: 'not', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\?"), + outputs: [ + { + terminal: 'qmark', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("-?[0-9]+\\.[0-9]+"), + outputs: [ + { + terminal: 'float', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[0-9]+"), + outputs: [ + { + terminal: 'integer', + group: 0, + function: null, + }, + ] + }, + ], + 'wf_output': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("#.*"), + outputs: [ + ] + }, + { + regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'type', + group: 0, + function: null, + }, + { + action: 'pop', + }, + { + stack_push: 'wf_output_declaration', + }, + ] + }, + { + regex: new RegExp("\\{"), + outputs: [ + { + terminal: 'lbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\}"), + outputs: [ + { + terminal: 'rbrace', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp(","), + outputs: [ + { + terminal: 'comma', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*(\\.[a-zA-Z]([a-zA-Z0-9_])*)*"), + outputs: [ + { + terminal: 'fqn', + group: 0, + function: null, + }, + ] + }, + ], + 'wf_output_declaration': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("#.*"), + outputs: [ + ] + }, + { + regex: new RegExp("\\}"), + outputs: [ + { + terminal: 'rbrace', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("="), + outputs: [ + { + terminal: 'equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\+"), + outputs: [ + { + terminal: 'plus', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[0-9]+"), + outputs: [ + { + terminal: 'integer', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(true|false)(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'boolean', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'type', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*"), + outputs: [ + { + terminal: 'identifier', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(":"), + outputs: [ + { + terminal: 'colon', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(","), + outputs: [ + { + terminal: 'comma', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("=="), + outputs: [ + { + terminal: 'double_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\|\\|"), + outputs: [ + { + terminal: 'double_pipe', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\&\\&"), + outputs: [ + { + terminal: 'double_ampersand', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!="), + outputs: [ + { + terminal: 'not_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("="), + outputs: [ + { + terminal: 'equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\{"), + outputs: [ + { + terminal: 'lbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\("), + outputs: [ + { + terminal: 'lparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\)"), + outputs: [ + { + terminal: 'rparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\+"), + outputs: [ + { + terminal: 'plus', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("-"), + outputs: [ + { + terminal: 'dash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("/"), + outputs: [ + { + terminal: 'slash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("%"), + outputs: [ + { + terminal: 'percent', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<="), + outputs: [ + { + terminal: 'lteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<"), + outputs: [ + { + terminal: 'lt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">="), + outputs: [ + { + terminal: 'gteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">"), + outputs: [ + { + terminal: 'gt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!"), + outputs: [ + { + terminal: 'not', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\""), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp("'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'"), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp("-?[0-9]+\\.[0-9]+"), + outputs: [ + { + terminal: 'float', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[0-9]+"), + outputs: [ + { + terminal: 'integer', + group: 0, + function: null, + }, + ] + }, + ], + 'task_fqn': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*(\\.[a-zA-Z]([a-zA-Z0-9_])*)*"), + outputs: [ + { + terminal: 'fqn', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + ], + 'scatter': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("\\)"), + outputs: [ + { + terminal: 'rparen', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp("\\("), + outputs: [ + { + terminal: 'lparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("in(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'in', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*"), + outputs: [ + { + terminal: 'identifier', + group: 0, + function: null, + }, + ] + }, + ], + 'raw_command': [ + { + regex: new RegExp("\\{"), + outputs: [ + { + terminal: 'raw_cmd_start', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\}"), + outputs: [ + { + terminal: 'raw_cmd_end', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp("\\$\\{"), + outputs: [ + { + terminal: 'cmd_param_start', + group: 0, + function: null, + }, + { + stack_push: 'cmd_param', + }, + ] + }, + { + regex: new RegExp("([\\s\\S]*?)(?=\\$\\{|\\})", "m"), + outputs: [ + { + terminal: 'cmd_part', + group: 0, + function: null, + }, + ] + }, + ], + 'raw_command2': [ + { + regex: new RegExp("<<<"), + outputs: [ + { + terminal: 'raw_cmd_start', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">>>"), + outputs: [ + { + terminal: 'raw_cmd_end', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp("\\$\\{"), + outputs: [ + { + terminal: 'cmd_param_start', + group: 0, + function: null, + }, + { + stack_push: 'cmd_param', + }, + ] + }, + { + regex: new RegExp("([\\s\\S]*?)(?=\\$\\{|>>>)", "m"), + outputs: [ + { + terminal: 'cmd_part', + group: 0, + function: null, + }, + ] + }, + ], + 'cmd_param': [ + { + regex: new RegExp("\\s+"), + outputs: [ + ] + }, + { + regex: new RegExp("\\}"), + outputs: [ + { + terminal: 'cmd_param_end', + group: 0, + function: null, + }, + { + action: 'pop', + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("="), + outputs: [ + { + terminal: 'equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\+"), + outputs: [ + { + terminal: 'plus', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[0-9]+"), + outputs: [ + { + terminal: 'integer', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(true|false)(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'boolean', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), + outputs: [ + { + terminal: 'type', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*(?=\\s*=)"), + outputs: [ + { + terminal: 'cmd_attr_hint', + group: null, + function: null, + }, + { + terminal: 'identifier', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*"), + outputs: [ + { + terminal: 'identifier', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(":"), + outputs: [ + { + terminal: 'colon', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(","), + outputs: [ + { + terminal: 'comma', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("=="), + outputs: [ + { + terminal: 'double_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\|\\|"), + outputs: [ + { + terminal: 'double_pipe', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\&\\&"), + outputs: [ + { + terminal: 'double_ampersand', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!="), + outputs: [ + { + terminal: 'not_equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("="), + outputs: [ + { + terminal: 'equal', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\."), + outputs: [ + { + terminal: 'dot', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\{"), + outputs: [ + { + terminal: 'lbrace', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\("), + outputs: [ + { + terminal: 'lparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\)"), + outputs: [ + { + terminal: 'rparen', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\["), + outputs: [ + { + terminal: 'lsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\]"), + outputs: [ + { + terminal: 'rsquare', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\+"), + outputs: [ + { + terminal: 'plus', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\*"), + outputs: [ + { + terminal: 'asterisk', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("-"), + outputs: [ + { + terminal: 'dash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("/"), + outputs: [ + { + terminal: 'slash', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("%"), + outputs: [ + { + terminal: 'percent', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<="), + outputs: [ + { + terminal: 'lteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("<"), + outputs: [ + { + terminal: 'lt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">="), + outputs: [ + { + terminal: 'gteq', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp(">"), + outputs: [ + { + terminal: 'gt', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("!"), + outputs: [ + { + terminal: 'not', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\""), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp("'([^\\\\\\'\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*'"), + outputs: [ + { + terminal: 'string', + group: 0, + function: wdl_unescape, + }, + ] + }, + { + regex: new RegExp("-?[0-9]+\\.[0-9]+"), + outputs: [ + { + terminal: 'float', + group: 0, + function: null, + }, + ] + }, + { + regex: new RegExp("[0-9]+"), + outputs: [ + { + terminal: 'integer', + group: 0, + function: null, + }, + ] + }, + ], +} +function advance_line_col(string, length, line, col) { + for (var i = 0; i < length; i++) { + if (string[i] == '\n') { + line += 1; + col = 1; + } else { + col += 1; + } + } + return {line: line, col: col} +} +function advance_string(ctx, string) { + lc = advance_line_col(string, string.length, ctx.line, ctx.col) + ctx.line = lc.line + ctx.col = lc.col + ctx.string = ctx.string.substring(string.length) +} +function _unrecognized_token(string, line, col) { + var lines = string.split('\n') + var bad_line = lines[line-1] + var message = 'Unrecognized token on line {0}, column {1}:\n\n{2}\n{3}'.format( + line, col, bad_line, Array(col).join(' ') + '^' + ) + throw new SyntaxError(message) +} +function _next(ctx) { + var tokens = [] + var mode = ctx.mode_stack[ctx.mode_stack.length - 1] + for (var i = 0; i < regex[mode].length; i++) { + match = regex[mode][i].regex.exec(ctx.string); + if (match != null && match.index == 0) { + for (var j = 0; j < regex[mode][i].outputs.length; j++) { + var terminal = regex[mode][i].outputs[j].terminal; + var group = regex[mode][i].outputs[j].group; + var func = regex[mode][i].outputs[j].function; + var stack_push = regex[mode][i].outputs[j].stack_push; + var action = regex[mode][i].outputs[j].action; + if (stack_push !== undefined) { + ctx.mode_stack.push(stack_push) + } else if (action !== undefined) { + if (action == 'pop') { + ctx.mode_stack.pop() + } + } else { + func = (func == null) ? default_action : func; + var source_string = group != null ? match[group] : "" + // Ugh! JavaScript why you no have regex group indexes?! + var group_line = ctx.line + var group_col = ctx.col + try { + var mult_regex = new MultiRegExp(regex[mode][i].regex.source); + var mult_groups = mult_regex.exec(ctx.string) + if (group != null && group > 0) { + var lc = advance_line_col(match[0], mult_groups[group-1].index, ctx.line, ctx.col) + group_line = lc.line + group_col = lc.col + } + } catch(err) {} + // ^ Literally the worst thing ever + func(ctx, terminal, source_string, group_line, group_col) + } + } + advance_string(ctx, match[0]) + return true + } + } + return false +} +function lex(string, resource) { + ctx = { + string: string, + resource: resource, + user_context: init(), + mode_stack: ['default'], + tokens: [], + line: 1, + col: 1 + } + string_copy = string + parsed_tokens = [] + while (ctx.string.length) { + matched = _next(ctx) + if (matched == false) { + _unrecognized_token(string_copy, ctx.line, ctx.col) + } + } + destroy(ctx.user_context) + filtered = post_filter(ctx.tokens) + return new TokenStream(filtered) +} +// Section: Main +// Section: Exports +module.exports = { + lex: lex, + parse: parse, + terminals: terminals, + parse_tree_string: parse_tree_string, + ast_string: ast_string +} From 2b0f369c16ff7ecea553086a0b718cae6e470ccb Mon Sep 17 00:00:00 2001 From: "PETERSBURG\\Aleksandr_Sidoruk" Date: Wed, 22 Feb 2017 17:06:30 +0300 Subject: [PATCH 2/3] Added new lines to the JS files --- javascript/.gitignore | 2 +- javascript/README.md | 2 +- javascript/hermes | 2 +- javascript/sample.js | 2 +- javascript/tests/cases/5/wdl | 1 - javascript/tests/parser-test.js | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/javascript/.gitignore b/javascript/.gitignore index 23e3b21..dad685d 100644 --- a/javascript/.gitignore +++ b/javascript/.gitignore @@ -1 +1 @@ -tests/node_modules \ No newline at end of file +tests/node_modules diff --git a/javascript/README.md b/javascript/README.md index 25d004a..66ce0bc 100644 --- a/javascript/README.md +++ b/javascript/README.md @@ -63,4 +63,4 @@ JS-WDL Parser 6 passing (143ms) -``` \ No newline at end of file +``` diff --git a/javascript/hermes b/javascript/hermes index f3d4c88..e3348c1 100644 --- a/javascript/hermes +++ b/javascript/hermes @@ -3,4 +3,4 @@ import sys import hermes.main -sys.exit(hermes.main.cli()) \ No newline at end of file +sys.exit(hermes.main.cli()) diff --git a/javascript/sample.js b/javascript/sample.js index 15237ca..633cbbe 100644 --- a/javascript/sample.js +++ b/javascript/sample.js @@ -17,4 +17,4 @@ try { } catch(ex) { console.error(ex.message); -} \ No newline at end of file +} diff --git a/javascript/tests/cases/5/wdl b/javascript/tests/cases/5/wdl index 2d7edc1..3d79372 100644 --- a/javascript/tests/cases/5/wdl +++ b/javascript/tests/cases/5/wdl @@ -91,4 +91,3 @@ workflow sloc { input: files=find_python_files.files } } - diff --git a/javascript/tests/parser-test.js b/javascript/tests/parser-test.js index 0397fa8..94eba28 100644 --- a/javascript/tests/parser-test.js +++ b/javascript/tests/parser-test.js @@ -38,4 +38,4 @@ describe('JS-WDL Parser', function () { assert(removeLinebreaks(astParsed) === removeLinebreaks(astTestCase), 'ASTs are not equal'); }); }); -}); \ No newline at end of file +}); From 34c45502fd0598f7d5090eb6d6f13f9f34f3d0bf Mon Sep 17 00:00:00 2001 From: Aleksandr Sidoruk Date: Thu, 23 Feb 2017 00:55:57 +0300 Subject: [PATCH 3/3] Fix grammar to pass wdl4s tests --- grammar.hgr | 3 +- javascript/wdl_parser.js | 1810 +++++++++++++++++++++++----------------------- 2 files changed, 911 insertions(+), 902 deletions(-) diff --git a/grammar.hgr b/grammar.hgr index e4b1f88..6163c49 100644 --- a/grammar.hgr +++ b/grammar.hgr @@ -202,9 +202,9 @@ grammar { r'\+' -> :plus r'\*' -> :asterisk r'[0-9]+' -> :integer + r'{%_identifier%}(?=\s*=)' -> :cmd_attr_hint[] :identifier r'(true|false)(?!{%_identifier_follow%})' -> :boolean r'{%_type%}(?!{%_identifier_follow%})' -> :type - r'{%_identifier%}(?=\s*=)' -> :cmd_attr_hint[] :identifier r'{%_identifier%}' -> :identifier # Expression tokens @@ -384,7 +384,6 @@ grammar { $cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr(key=$1, value=$3) $outputs = :output :lbrace list($output_kv) :rbrace -> Outputs(attributes=$2) $output_kv = $type_e :identifier :equal $e -> Output(type=$0, name=$1, expression=$3) - $runtime = :runtime $map -> Runtime(map=$1) $parameter_meta = :parameter_meta $map -> ParameterMeta(map=$1) $meta = :meta $map -> Meta(map=$1) diff --git a/javascript/wdl_parser.js b/javascript/wdl_parser.js index 3462801..7c5f3be 100644 --- a/javascript/wdl_parser.js +++ b/javascript/wdl_parser.js @@ -1,6 +1,6 @@ /* - * This file was generated by Hermes Parser Generator on Wed Feb 15 14:28:13 2017 + * This file was generated by Hermes Parser Generator on Thu Feb 23 00:52:28 2017 * * Hermes command: hermes generate ../grammar.hgr --language=javascript --name=wdl --nodejs --header --directory . * Run from: . (relative to this file) @@ -637,655 +637,655 @@ var Base64 = { } // Section: Parser var terminals = { - 0: 'task', - 1: 'not', - 2: 'boolean', - 3: 'rbrace', - 4: 'input', - 5: 'parameter_meta', - 6: 'double_pipe', - 7: 'e', - 8: 'cmd_attr_hint', - 9: 'call', - 10: 'colon', - 11: 'double_ampersand', - 12: 'qmark', - 13: 'string', - 14: 'slash', - 15: 'import', - 16: 'lsquare', - 17: 'raw_cmd_end', - 18: 'lbrace', - 19: 'while', - 20: 'integer', - 21: 'type_e', - 22: 'double_equal', - 23: 'lteq', + 0: 'raw_cmd_start', + 1: 'float', + 2: 'slash', + 3: 'colon', + 4: 'percent', + 5: 'double_ampersand', + 6: 'rbrace', + 7: 'cmd_attr_hint', + 8: 'comma', + 9: 'object', + 10: 'double_pipe', + 11: 'boolean', + 12: 'type', + 13: 'cmd_part', + 14: 'identifier', + 15: 'type_e', + 16: 'cmd_param_start', + 17: 'lt', + 18: 'dot', + 19: 'meta', + 20: 'lbrace', + 21: 'runtime', + 22: 'lparen', + 23: 'qmark', 24: 'as', - 25: 'type', - 26: 'raw_command', - 27: 'meta', - 28: 'lt', - 29: 'object', - 30: 'fqn', - 31: 'workflow', - 32: 'dash', - 33: 'output', - 34: 'raw_cmd_start', - 35: 'rsquare', - 36: 'gteq', - 37: 'rparen', - 38: 'runtime', - 39: 'asterisk', - 40: 'float', - 41: 'plus', - 42: 'percent', - 43: 'comma', - 44: 'cmd_param_end', - 45: 'lparen', - 46: 'equal', - 47: 'identifier', - 48: 'in', - 49: 'if', - 50: 'dot', - 51: 'cmd_param_start', + 25: 'equal', + 26: 'cmd_param_end', + 27: 'plus', + 28: 'double_equal', + 29: 'integer', + 30: 'call', + 31: 'in', + 32: 'import', + 33: 'raw_command', + 34: 'input', + 35: 'gt', + 36: 'workflow', + 37: 'string', + 38: 'raw_cmd_end', + 39: 'gteq', + 40: 'not_equal', + 41: 'rsquare', + 42: 'if', + 43: 'asterisk', + 44: 'dash', + 45: 'not', + 46: 'output', + 47: 'parameter_meta', + 48: 'while', + 49: 'rparen', + 50: 'fqn', + 51: 'task', 52: 'scatter', - 53: 'not_equal', - 54: 'gt', - 55: 'cmd_part', - 'task': 0, - 'not': 1, - 'boolean': 2, - 'rbrace': 3, - 'input': 4, - 'parameter_meta': 5, - 'double_pipe': 6, - 'e': 7, - 'cmd_attr_hint': 8, - 'call': 9, - 'colon': 10, - 'double_ampersand': 11, - 'qmark': 12, - 'string': 13, - 'slash': 14, - 'import': 15, - 'lsquare': 16, - 'raw_cmd_end': 17, - 'lbrace': 18, - 'while': 19, - 'integer': 20, - 'type_e': 21, - 'double_equal': 22, - 'lteq': 23, + 53: 'lteq', + 54: 'lsquare', + 55: 'e', + 'raw_cmd_start': 0, + 'float': 1, + 'slash': 2, + 'colon': 3, + 'percent': 4, + 'double_ampersand': 5, + 'rbrace': 6, + 'cmd_attr_hint': 7, + 'comma': 8, + 'object': 9, + 'double_pipe': 10, + 'boolean': 11, + 'type': 12, + 'cmd_part': 13, + 'identifier': 14, + 'type_e': 15, + 'cmd_param_start': 16, + 'lt': 17, + 'dot': 18, + 'meta': 19, + 'lbrace': 20, + 'runtime': 21, + 'lparen': 22, + 'qmark': 23, 'as': 24, - 'type': 25, - 'raw_command': 26, - 'meta': 27, - 'lt': 28, - 'object': 29, - 'fqn': 30, - 'workflow': 31, - 'dash': 32, - 'output': 33, - 'raw_cmd_start': 34, - 'rsquare': 35, - 'gteq': 36, - 'rparen': 37, - 'runtime': 38, - 'asterisk': 39, - 'float': 40, - 'plus': 41, - 'percent': 42, - 'comma': 43, - 'cmd_param_end': 44, - 'lparen': 45, - 'equal': 46, - 'identifier': 47, - 'in': 48, - 'if': 49, - 'dot': 50, - 'cmd_param_start': 51, + 'equal': 25, + 'cmd_param_end': 26, + 'plus': 27, + 'double_equal': 28, + 'integer': 29, + 'call': 30, + 'in': 31, + 'import': 32, + 'raw_command': 33, + 'input': 34, + 'gt': 35, + 'workflow': 36, + 'string': 37, + 'raw_cmd_end': 38, + 'gteq': 39, + 'not_equal': 40, + 'rsquare': 41, + 'if': 42, + 'asterisk': 43, + 'dash': 44, + 'not': 45, + 'output': 46, + 'parameter_meta': 47, + 'while': 48, + 'rparen': 49, + 'fqn': 50, + 'task': 51, 'scatter': 52, - 'not_equal': 53, - 'gt': 54, - 'cmd_part': 55, + 'lteq': 53, + 'lsquare': 54, + 'e': 55, } // table[nonterminal][terminal] = rule var table = [ + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, 66, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [35, -1, -1, 35, 35, 35, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, 35, -1, -1, -1, 35, 35, 35, -1, -1, -1, 35, -1, 35, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, 35, -1, -1, 35, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, 47, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, 42, -1, -1, -1, 42, -1, 48, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, 45, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, 17, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, 38, 38, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 38, -1, -1, 38, -1, 38, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, 38, -1, -1, -1, -1, -1, -1, -1, 38, 38, -1, -1, -1, 38, -1, 38, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, 35, -1, -1, 35, -1, -1, -1, 35, -1, 35, -1, -1, -1, 34, -1, -1, -1, -1, 35, -1, -1, 35, 35, -1, 35, -1, -1, -1, -1, -1, 35, -1, -1, -1, 35, 35, 35, -1, -1, 35, 35, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, 42, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, 46, 47, 43, -1, -1, -1, 45, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, 16, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, 52, -1, 52, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, 51, 52, -1, 52, -1, -1, -1, 52, -1, 52, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, 52, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, 50, -1, -1, 50, -1, -1, -1, 50, 50, -1, -1, -1, 49, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, 50, 50, 50, -1, -1, -1, 50, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, 50, -1, 50, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, 50, 50, -1, 50, -1, -1, 49, 50, -1, 50, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, 50, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, 52, -1, -1, 52, -1, -1, -1, 52, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, 52, 52, 52, -1, -1, -1, 52, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, 38, -1, -1, -1, -1, -1, -1, -1, 38, -1, 38, -1, -1, 38, -1, -1, -1, -1, -1, 38, -1, 38, -1, -1, -1, -1, 38, -1, 38, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, 38, 38, -1, -1, -1, -1, -1, -1, -1, -1, 38, 38], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 62, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 5, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, 66, -1, -1, 66, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1], - [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, 20], - [12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, 2, -1, -1, -1, 2, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], + [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], - [7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, 7, -1, -1, 6, 7, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], ] var nonterminal_first = { - 56: [24], - 57: [50, -1], - 58: [5], - 59: [46, -1], - 60: [0, 21, -1, 25, 31], - 61: [5, 19, 21, 9, 25, 27, 49, 52, 33], - 62: [47], - 63: [47], - 64: [49], - 65: [24], - 66: [18], - 67: [38], - 68: [38, 26, 33, 27, 5], - 69: [25, 21], - 70: [38, 26, 27, 5, 33, -1], - 71: [51, 55, -1], - 72: [9], - 73: [33], - 74: [15], - 75: [2, 1, 18, 32, 45, 7, 47, 20, 29, 40, 13, 41, 16], - 76: [25, 21], - 77: [25, 21, -1], - 78: [4], - 79: [25, 30, 21, -1], - 80: [47], - 81: [15, -1], - 82: [47, -1], - 83: [26], - 84: [25, 21, -1], - 85: [47, -1], - 86: [25, 21], - 87: [25, 21, -1], - 88: [18, -1], - 89: [2, 1, 7, -1, 40, 13, 41, 16, 18, 45, 20, 47, 29, 32], - 90: [2, 1, 7, -1, 40, 13, 41, 16, 18, 45, 20, 47, 29, 32], - 91: [24, -1], - 92: [46], - 93: [8, -1], - 94: [25, 21, 30], - 95: [0, 31, 21, 25], - 96: [47, -1], - 97: [27], - 98: [8], - 99: [18], - 100: [19], - 101: [5], - 102: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 103: [31], - 104: [25, 21], - 105: [30], - 106: [4, -1], - 107: [33], - 108: [52], - 109: [27], - 110: [51], - 111: [50], - 112: [51, 55], - 113: [0], - 114: [0, 25, 31, 21, 15, -1], - 115: [5, 19, 21, -1, 9, 25, 27, 49, 52, 33], - 116: [24, -1], + 56: [32], + 57: [30], + 58: [52], + 59: [33], + 60: [34], + 61: [47], + 62: [19], + 63: [24], + 64: [1, 9, 14, 20, 22, -1, 27, 29, 37, 44, 45, 11, 54, 55], + 65: [-1, 44, 45, 1, 27, 29, 20, 9, 22, 37, 11, 54, 14, 55], + 66: [36], + 67: [18], + 68: [14], + 69: [19], + 70: [36, 51, 12, 15], + 71: [51], + 72: [12, 15], + 73: [-1, 30, 12, 15, 42, 46, 48, 47, 19, 52], + 74: [48], + 75: [-1, 25], + 76: [-1, 12, 15], + 77: [21], + 78: [-1, 14], + 79: [30, 12, 15, 42, 46, 48, 47, 19, 52], + 80: [-1, 14], + 81: [12, 15], + 82: [-1, 12, 15], + 83: [-1, 12, 15], + 84: [42], + 85: [-1, 14], + 86: [46, 47, 19, 21, 33], + 87: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 88: [-1, 16, 13], + 89: [-1, 7], + 90: [12, 15], + 91: [47], + 92: [24], + 93: [-1, 24], + 94: [-1, 46, 47, 19, 21, 33], + 95: [46], + 96: [-1, 32, 36, 51, 12, 15], + 97: [14], + 98: [-1, 20], + 99: [46], + 100: [16], + 101: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 102: [14], + 103: [34, -1], + 104: [18, -1], + 105: [7], + 106: [50], + 107: [12, 15], + 108: [13, 16], + 109: [-1, 24], + 110: [25], + 111: [20], + 112: [-1, 36, 12, 15, 51], + 113: [12, 50, 15], + 114: [-1, 50, 12, 15], + 115: [20], + 116: [-1, 32], } var nonterminal_follow = { - 56: [0, 25, -1, 31, 21, 15], - 57: [25, 3, 30, 21], - 58: [3, 5, 38, 26, 27, 33], - 59: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], - 60: [-1], - 61: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 62: [43, 3], - 63: [3, 47], - 64: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 65: [18, 3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 66: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 67: [3, 5, 38, 26, 27, 33], - 68: [3, 5, 38, 26, 27, 33], - 69: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], - 70: [3], - 71: [17], - 72: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 73: [3, 5, 38, 26, 27, 33], - 74: [0, 25, -1, 31, 21, 15], - 75: [43, 3], - 76: [43, 35, 47], - 77: [38, 26, 27, 4, 5, 33], - 78: [3, 4], - 79: [3], - 80: [43, 3, 4], - 81: [0, 25, 21, -1, 31], - 82: [3], - 83: [3, 5, 38, 26, 27, 33], - 84: [3], - 85: [3, 4], - 86: [25, 3, 30, 21], - 87: [35], - 88: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 89: [37, 35], - 90: [3], - 91: [18, 3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 92: [0, 3, 4, 5, 9, -1, 38, 19, 21, 25, 27, 26, 49, 31, 52, 33], - 93: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 94: [25, 3, 30, 21], - 95: [0, 21, -1, 25, 31], - 96: [3], - 97: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 98: [2, 1, 18, 16, 45, 7, 47, 20, 8, 29, 40, 13, 32, 41], - 99: [3, 5, 19, 21, 9, 38, 26, 27, 25, 49, 52, 33], - 100: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 101: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 102: [2, 1, 0, 3, 4, 5, 7, 8, 9, 10, -1, 11, 13, 14, 16, 18, 19, 20, 21, 22, 23, 25, 27, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 49, 52, 53, 54, 6], - 103: [0, 21, -1, 25, 31], - 104: [25, 21, 3], - 105: [25, 3, 30, 21], - 106: [3], - 107: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 108: [3, 5, 19, 21, 9, 25, 27, 49, 52, 33], - 109: [3, 5, 38, 26, 27, 33], - 110: [51, 55, 17], - 111: [25, 3, 30, 21], - 112: [51, 55, 17], - 113: [0, 21, -1, 25, 31], - 114: [-1], - 115: [3], - 116: [0, 25, -1, 31, 21, 15], + 56: [-1, 32, 36, 51, 12, 15], + 57: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 58: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 59: [46, 47, 19, 6, 21, 33], + 60: [34, 6], + 61: [46, 47, 19, 6, 21, 33], + 62: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 63: [-1, 32, 36, 51, 12, 15], + 64: [6], + 65: [41, 49], + 66: [36, 12, 15, -1, 51], + 67: [6, 50, 12, 15], + 68: [6, 8], + 69: [46, 47, 19, 6, 21, 33], + 70: [36, 12, 15, -1, 51], + 71: [36, 12, 15, -1, 51], + 72: [30, 6, 33, 34, 36, 12, 15, 42, 46, 48, 47, 19, -1, 21, 51, 52], + 73: [6], + 74: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 75: [30, 6, 33, 34, 36, 12, 15, 42, 46, 48, 47, 19, -1, 21, 51, 52], + 76: [41], + 77: [46, 47, 19, 6, 21, 33], + 78: [6], + 79: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 80: [34, 6], + 81: [6, 50, 12, 15], + 82: [6], + 83: [46, 47, 19, 21, 33, 34], + 84: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 85: [6], + 86: [46, 47, 19, 6, 21, 33], + 87: [3, 4, 7, 8, 12, 14, 19, -1, 22, 27, 29, 36, 41, 42, 43, 44, 45, 48, 49, 51, 52, 11, 55, 1, 2, 5, 6, 9, 10, 15, 17, 20, 21, 26, 28, 30, 33, 39, 35, 34, 37, 40, 46, 47, 50, 53, 54], + 88: [38], + 89: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 90: [6, 12, 15], + 91: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 92: [30, 6, 12, 15, 42, 46, 48, 47, 19, 20, 52], + 93: [30, 6, 12, 15, 42, 46, 48, 47, 19, 20, 52], + 94: [6], + 95: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 96: [-1], + 97: [8, 6, 34], + 98: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 99: [46, 47, 19, 6, 21, 33], + 100: [16, 38, 13], + 101: [6, 8], + 102: [6, 14], + 103: [6], + 104: [6, 50, 12, 15], + 105: [1, 27, 29, 7, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 106: [6, 50, 12, 15], + 107: [41, 8, 14], + 108: [16, 38, 13], + 109: [-1, 32, 36, 51, 12, 15], + 110: [30, 6, 33, 34, 36, 12, 15, 42, 46, 48, 47, 19, -1, 21, 51, 52], + 111: [30, 6, 12, 15, 42, 46, 48, 47, 19, 52], + 112: [-1], + 113: [6, 50, 12, 15], + 114: [6], + 115: [30, 6, 33, 12, 15, 42, 46, 47, 48, 19, 21, 52], + 116: [-1, 36, 51, 12, 15], } var rule_first = { - 0: [15, -1], - 1: [0, 31, 21, 25, -1], - 2: [0, 21, -1, 25, 31, 15], - 3: [31], - 4: [0], - 5: [25, 21], + 0: [-1, 32], + 1: [-1, 36, 51, 12, 15], + 2: [-1, 32, 36, 51, 12, 15], + 3: [36], + 4: [51], + 5: [12, 15], 6: [24], 7: [-1], - 8: [15], + 8: [32], 9: [24], - 10: [25, 21, -1], - 11: [5, -1, 38, 26, 27, 33], - 12: [0], - 13: [26], - 14: [33], - 15: [38], - 16: [5], - 17: [27], - 18: [51, 55, -1], - 19: [26], - 20: [55], - 21: [51], - 22: [8, -1], - 23: [51], - 24: [8], - 25: [25, 21, -1], - 26: [33], - 27: [25, 21], - 28: [38], - 29: [5], - 30: [27], - 31: [47, -1], - 32: [18], - 33: [47], - 34: [46], + 10: [-1, 12, 15], + 11: [-1, 46, 47, 19, 21, 33], + 12: [51], + 13: [33], + 14: [46], + 15: [21], + 16: [47], + 17: [19], + 18: [-1, 13, 16], + 19: [33], + 20: [13], + 21: [16], + 22: [-1, 7], + 23: [16], + 24: [7], + 25: [-1, 12, 15], + 26: [46], + 27: [12, 15], + 28: [21], + 29: [47], + 30: [19], + 31: [-1, 14], + 32: [20], + 33: [14], + 34: [25], 35: [-1], - 36: [25, 21], - 37: [46], - 38: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 39: [5, 19, 21, -1, 9, 25, 27, 49, 52, 33], - 40: [31], - 41: [9], - 42: [25, 21], - 43: [19], - 44: [49], + 36: [12, 15], + 37: [25], + 38: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 39: [-1, 30, 12, 15, 42, 46, 48, 47, 19, 52], + 40: [36], + 41: [30], + 42: [12, 15], + 43: [48], + 44: [42], 45: [52], - 46: [33], - 47: [5], - 48: [27], + 46: [46], + 47: [47], + 48: [19], 49: [24], 50: [-1], - 51: [18], + 51: [20], 52: [-1], - 53: [9], - 54: [4, -1], - 55: [18], - 56: [47, -1], - 57: [4], - 58: [47], + 53: [30], + 54: [34, -1], + 55: [20], + 56: [-1, 14], + 57: [34], + 58: [14], 59: [24], - 60: [25, 21, 30, -1], - 61: [33], - 62: [25, 21], - 63: [30], - 64: [25, 21], - 65: [50], + 60: [-1, 12, 50, 15], + 61: [46], + 62: [12, 15], + 63: [50], + 64: [12, 15], + 65: [18], 66: [-1], - 67: [30], - 68: [50], - 69: [5], - 70: [27], - 71: [19], - 72: [49], + 67: [50], + 68: [18], + 69: [47], + 70: [19], + 71: [48], + 72: [42], 73: [52], - 74: [47], - 75: [25, 21, -1], - 76: [25], - 77: [25], - 78: [25], - 79: [25], - 80: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 81: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 82: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 83: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 84: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 85: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 86: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 87: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 88: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 89: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 90: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 91: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 92: [2, 1, 18, 45, 7, 47, 20, 41, 29, 40, 13, 32, 16], - 93: [1], - 94: [41], - 95: [32], - 96: [2, 1, 18, 45, 7, 47, 20, -1, 41, 29, 40, 13, 32, 16], - 97: [47], - 98: [47], - 99: [47], - 100: [47, -1], - 101: [29], - 102: [16], - 103: [2, 1, 18, 32, 45, 7, 47, 20, -1, 29, 40, 13, 41, 16], - 104: [18], - 105: [45], - 106: [13], - 107: [47], - 108: [2], - 109: [20], - 110: [40], + 74: [14], + 75: [-1, 12, 15], + 76: [12], + 77: [12], + 78: [12], + 79: [12], + 80: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 81: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 82: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 83: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 84: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 85: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 86: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 87: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 88: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 89: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 90: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 91: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 92: [1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 93: [45], + 94: [27], + 95: [44], + 96: [1, -1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 97: [14], + 98: [14], + 99: [14], + 100: [-1, 14], + 101: [9], + 102: [54], + 103: [1, -1, 27, 29, 9, 37, 14, 44, 45, 20, 22, 11, 54, 55], + 104: [20], + 105: [22], + 106: [37], + 107: [14], + 108: [11], + 109: [29], + 110: [1], } var nonterminal_rules = { 56: [ - "$import_namespace = :as :identifier -> $1", + "$import = :import :string $_gen2 -> Import( uri=$1, namespace=$2 )", ], 57: [ - "$_gen16 = $wf_output_wildcard", - "$_gen16 = :_empty", + "$call = :call :fqn $_gen11 $_gen12 -> Call( task=$1, alias=$2, body=$3 )", ], 58: [ - "$parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + "$scatter = :scatter :lparen :identifier :in $e :rparen :lbrace $_gen10 :rbrace -> Scatter( item=$2, collection=$4, body=$7 )", ], 59: [ - "$_gen9 = $setter", - "$_gen9 = :_empty", + "$command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 )", ], 60: [ - "$_gen1 = list($workflow_or_task_or_decl)", + "$call_input = :input :colon $_gen14 -> Inputs( map=$2 )", ], 61: [ - "$wf_body_element = $call", - "$wf_body_element = $declaration", - "$wf_body_element = $while_loop", - "$wf_body_element = $if_stmt", - "$wf_body_element = $scatter", - "$wf_body_element = $wf_outputs", - "$wf_body_element = $wf_parameter_meta", - "$wf_body_element = $wf_meta", + "$parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", ], 62: [ - "$object_kv = :identifier :colon $e -> ObjectKV( key=$0, value=$2 )", + "$wf_meta = :meta $map -> Meta( map=$1 )", ], 63: [ - "$kv = :identifier :colon $e -> RuntimeAttribute( key=$0, value=$2 )", + "$import_namespace = :as :identifier -> $1", ], 64: [ - "$if_stmt = :if :lparen $e :rparen :lbrace $_gen10 :rbrace -> If( expression=$2, body=$5 )", + "$_gen20 = list($map_kv, :comma)", ], 65: [ - "$alias = :as :identifier -> $1", + "$_gen18 = list($e, :comma)", ], 66: [ - "$call_body = :lbrace $_gen3 $_gen13 :rbrace -> CallBody( declarations=$1, io=$2 )", + "$workflow = :workflow :identifier :lbrace $_gen10 :rbrace -> Workflow( name=$1, body=$3 )", ], 67: [ - "$runtime = :runtime $map -> Runtime( map=$1 )", + "$wf_output_wildcard = :dot :asterisk -> $1", ], 68: [ - "$sections = $command", - "$sections = $outputs", - "$sections = $runtime", - "$sections = $parameter_meta", - "$sections = $meta", + "$object_kv = :identifier :colon $e -> ObjectKV( key=$0, value=$2 )", ], 69: [ - "$declaration = $type_e :identifier $_gen9 -> Declaration( type=$0, name=$1, expression=$2 )", + "$meta = :meta $map -> Meta( map=$1 )", ], 70: [ - "$_gen4 = list($sections)", + "$workflow_or_task_or_decl = $workflow", + "$workflow_or_task_or_decl = $task", + "$workflow_or_task_or_decl = $declaration", ], 71: [ - "$_gen5 = list($command_part)", + "$task = :task :identifier :lbrace $_gen3 $_gen4 :rbrace -> Task( name=$1, declarations=$3, sections=$4 )", ], 72: [ - "$call = :call :fqn $_gen11 $_gen12 -> Call( task=$1, alias=$2, body=$3 )", + "$declaration = $type_e :identifier $_gen9 -> Declaration( type=$0, name=$1, expression=$2 )", ], 73: [ - "$outputs = :output :lbrace $_gen7 :rbrace -> Outputs( attributes=$2 )", + "$_gen10 = list($wf_body_element)", ], 74: [ - "$import = :import :string $_gen2 -> Import( uri=$1, namespace=$2 )", + "$while_loop = :while :lparen $e :rparen :lbrace $_gen10 :rbrace -> WhileLoop( expression=$2, body=$5 )", ], 75: [ - "$map_kv = $e :colon $e -> MapLiteralKv( key=$0, value=$2 )", + "$_gen9 = $setter", + "$_gen9 = :_empty", ], 76: [ - "$type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 )", - "$type_e = :type <=> :qmark -> OptionalType( innerType=$0 )", - "$type_e = :type <=> :plus -> NonEmptyType( innerType=$0 )", - "$type_e = :type", + "$_gen17 = list($type_e, :comma)", ], 77: [ - "$_gen3 = list($declaration)", + "$runtime = :runtime $map -> Runtime( map=$1 )", ], 78: [ - "$call_input = :input :colon $_gen14 -> Inputs( map=$2 )", + "$_gen8 = list($kv)", ], 79: [ - "$_gen15 = list($wf_output)", + "$wf_body_element = $call", + "$wf_body_element = $declaration", + "$wf_body_element = $while_loop", + "$wf_body_element = $if_stmt", + "$wf_body_element = $scatter", + "$wf_body_element = $wf_outputs", + "$wf_body_element = $wf_parameter_meta", + "$wf_body_element = $wf_meta", ], 80: [ - "$mapping = :identifier :equal $e -> IOMapping( key=$0, value=$2 )", + "$_gen14 = list($mapping, :comma)", ], 81: [ - "$_gen0 = list($import)", + "$wf_output_declaration_syntax = $type_e :identifier :equal $e -> WorkflowOutputDeclaration( type=$0, name=$1, expression=$3 )", ], 82: [ - "$_gen8 = list($kv)", + "$_gen7 = list($output_kv)", ], 83: [ - "$command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 )", + "$_gen3 = list($declaration)", ], 84: [ - "$_gen7 = list($output_kv)", + "$if_stmt = :if :lparen $e :rparen :lbrace $_gen10 :rbrace -> If( expression=$2, body=$5 )", ], 85: [ - "$_gen14 = list($mapping, :comma)", + "$_gen19 = list($object_kv, :comma)", ], 86: [ - "$wf_output_declaration_syntax = $type_e :identifier :equal $e -> WorkflowOutputDeclaration( type=$0, name=$1, expression=$3 )", + "$sections = $command", + "$sections = $outputs", + "$sections = $runtime", + "$sections = $parameter_meta", + "$sections = $meta", ], 87: [ - "$_gen17 = list($type_e, :comma)", + "$e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 )", + "$e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 )", + "$e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 )", + "$e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 )", + "$e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 )", + "$e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 )", + "$e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 )", + "$e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 )", + "$e = $e :plus $e -> Add( lhs=$0, rhs=$2 )", + "$e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 )", + "$e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 )", + "$e = $e :slash $e -> Divide( lhs=$0, rhs=$2 )", + "$e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 )", + "$e = :not $e -> LogicalNot( expression=$1 )", + "$e = :plus $e -> UnaryPlus( expression=$1 )", + "$e = :dash $e -> UnaryNegation( expression=$1 )", + "$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )", + "$e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 )", + "$e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 )", + "$e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 )", + "$e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 )", + "$e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 )", + "$e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 )", + "$e = :string", + "$e = :identifier", + "$e = :boolean", + "$e = :integer", + "$e = :float", ], 88: [ - "$_gen12 = $call_body", - "$_gen12 = :_empty", + "$_gen5 = list($command_part)", ], 89: [ - "$_gen18 = list($e, :comma)", + "$_gen6 = list($cmd_param_kv)", ], 90: [ - "$_gen20 = list($map_kv, :comma)", + "$output_kv = $type_e :identifier :equal $e -> Output( type=$0, name=$1, expression=$3 )", ], 91: [ - "$_gen11 = $alias", - "$_gen11 = :_empty", + "$wf_parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", ], 92: [ - "$setter = :equal $e -> $1", + "$alias = :as :identifier -> $1", ], 93: [ - "$_gen6 = list($cmd_param_kv)", + "$_gen11 = $alias", + "$_gen11 = :_empty", ], 94: [ - "$wf_output = $wf_output_declaration_syntax", - "$wf_output = $wf_output_wildcard_syntax", + "$_gen4 = list($sections)", ], 95: [ - "$workflow_or_task_or_decl = $workflow", - "$workflow_or_task_or_decl = $task", - "$workflow_or_task_or_decl = $declaration", + "$wf_outputs = :output :lbrace $_gen15 :rbrace -> WorkflowOutputs( outputs=$2 )", ], 96: [ - "$_gen19 = list($object_kv, :comma)", + "$document = $_gen0 $_gen1 -> Namespace( imports=$0, body=$1 )", ], 97: [ - "$wf_meta = :meta $map -> Meta( map=$1 )", + "$mapping = :identifier :equal $e -> IOMapping( key=$0, value=$2 )", ], 98: [ - "$cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr( key=$1, value=$3 )", + "$_gen12 = $call_body", + "$_gen12 = :_empty", ], 99: [ - "$map = :lbrace $_gen8 :rbrace -> $1", + "$outputs = :output :lbrace $_gen7 :rbrace -> Outputs( attributes=$2 )", ], 100: [ - "$while_loop = :while :lparen $e :rparen :lbrace $_gen10 :rbrace -> WhileLoop( expression=$2, body=$5 )", + "$cmd_param = :cmd_param_start $_gen6 $e :cmd_param_end -> CommandParameter( attributes=$1, expr=$2 )", ], 101: [ - "$wf_parameter_meta = :parameter_meta $map -> ParameterMeta( map=$1 )", + "$map_kv = $e :colon $e -> MapLiteralKv( key=$0, value=$2 )", ], 102: [ - "$e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 )", - "$e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 )", - "$e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 )", - "$e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 )", - "$e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 )", - "$e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 )", - "$e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 )", - "$e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 )", - "$e = $e :plus $e -> Add( lhs=$0, rhs=$2 )", - "$e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 )", - "$e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 )", - "$e = $e :slash $e -> Divide( lhs=$0, rhs=$2 )", - "$e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 )", - "$e = :not $e -> LogicalNot( expression=$1 )", - "$e = :plus $e -> UnaryPlus( expression=$1 )", - "$e = :dash $e -> UnaryNegation( expression=$1 )", - "$e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 )", - "$e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 )", - "$e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 )", - "$e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 )", - "$e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 )", - "$e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 )", - "$e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 )", - "$e = :string", - "$e = :identifier", - "$e = :boolean", - "$e = :integer", - "$e = :float", + "$kv = :identifier :colon $e -> RuntimeAttribute( key=$0, value=$2 )", ], 103: [ - "$workflow = :workflow :identifier :lbrace $_gen10 :rbrace -> Workflow( name=$1, body=$3 )", + "$_gen13 = list($call_input)", ], 104: [ - "$output_kv = $type_e :identifier :equal $e -> Output( type=$0, name=$1, expression=$3 )", + "$_gen16 = $wf_output_wildcard", + "$_gen16 = :_empty", ], 105: [ - "$wf_output_wildcard_syntax = :fqn $_gen16 -> WorkflowOutputWildcard( fqn=$0, wildcard=$1 )", + "$cmd_param_kv = :cmd_attr_hint :identifier :equal $e -> CommandParameterAttr( key=$1, value=$3 )", ], 106: [ - "$_gen13 = list($call_input)", + "$wf_output_wildcard_syntax = :fqn $_gen16 -> WorkflowOutputWildcard( fqn=$0, wildcard=$1 )", ], 107: [ - "$wf_outputs = :output :lbrace $_gen15 :rbrace -> WorkflowOutputs( outputs=$2 )", + "$type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 )", + "$type_e = :type <=> :qmark -> OptionalType( innerType=$0 )", + "$type_e = :type <=> :plus -> NonEmptyType( innerType=$0 )", + "$type_e = :type", ], 108: [ - "$scatter = :scatter :lparen :identifier :in $e :rparen :lbrace $_gen10 :rbrace -> Scatter( item=$2, collection=$4, body=$7 )", + "$command_part = :cmd_part", + "$command_part = $cmd_param", ], 109: [ - "$meta = :meta $map -> Meta( map=$1 )", + "$_gen2 = $import_namespace", + "$_gen2 = :_empty", ], 110: [ - "$cmd_param = :cmd_param_start $_gen6 $e :cmd_param_end -> CommandParameter( attributes=$1, expr=$2 )", + "$setter = :equal $e -> $1", ], 111: [ - "$wf_output_wildcard = :dot :asterisk -> $1", + "$call_body = :lbrace $_gen3 $_gen13 :rbrace -> CallBody( declarations=$1, io=$2 )", ], 112: [ - "$command_part = :cmd_part", - "$command_part = $cmd_param", + "$_gen1 = list($workflow_or_task_or_decl)", ], 113: [ - "$task = :task :identifier :lbrace $_gen3 $_gen4 :rbrace -> Task( name=$1, declarations=$3, sections=$4 )", + "$wf_output = $wf_output_declaration_syntax", + "$wf_output = $wf_output_wildcard_syntax", ], 114: [ - "$document = $_gen0 $_gen1 -> Namespace( imports=$0, body=$1 )", + "$_gen15 = list($wf_output)", ], 115: [ - "$_gen10 = list($wf_body_element)", + "$map = :lbrace $_gen8 :rbrace -> $1", ], 116: [ - "$_gen2 = $import_namespace", - "$_gen2 = :_empty", + "$_gen0 = list($import)", ], } var rules = { @@ -1431,27 +1431,27 @@ function expect(ctx, terminal_id) { } // START definitions for expression parser `e` var infix_binding_power_e = { - 6: 4000, // $e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 ) - 11: 5000, // $e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 ) - 22: 6000, // $e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 ) - 53: 6000, // $e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 ) - 28: 7000, // $e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 ) - 23: 7000, // $e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 ) - 54: 7000, // $e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 ) - 36: 7000, // $e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 ) - 41: 8000, // $e = $e :plus $e -> Add( lhs=$0, rhs=$2 ) - 32: 8000, // $e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 ) - 39: 9000, // $e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 ) - 14: 9000, // $e = $e :slash $e -> Divide( lhs=$0, rhs=$2 ) - 42: 9000, // $e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 ) - 45: 11000, // $e = :identifier <=> :lparen list($e, :comma) :rparen -> FunctionCall( name=$0, params=$2 ) - 16: 12000, // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) - 50: 13000, // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) + 10: 4000, // $e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 ) + 5: 5000, // $e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 ) + 28: 6000, // $e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 ) + 40: 6000, // $e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 ) + 17: 7000, // $e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 ) + 53: 7000, // $e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 ) + 35: 7000, // $e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 ) + 39: 7000, // $e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 ) + 27: 8000, // $e = $e :plus $e -> Add( lhs=$0, rhs=$2 ) + 44: 8000, // $e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 ) + 43: 9000, // $e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 ) + 2: 9000, // $e = $e :slash $e -> Divide( lhs=$0, rhs=$2 ) + 4: 9000, // $e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 ) + 22: 11000, // $e = :identifier <=> :lparen list($e, :comma) :rparen -> FunctionCall( name=$0, params=$2 ) + 54: 12000, // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) + 18: 13000, // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) } var prefix_binding_power_e = { - 1: 10000, // $e = :not $e -> LogicalNot( expression=$1 ) - 41: 10000, // $e = :plus $e -> UnaryPlus( expression=$1 ) - 32: 10000, // $e = :dash $e -> UnaryNegation( expression=$1 ) + 45: 10000, // $e = :not $e -> LogicalNot( expression=$1 ) + 27: 10000, // $e = :plus $e -> UnaryPlus( expression=$1 ) + 44: 10000, // $e = :dash $e -> UnaryNegation( expression=$1 ) } function get_infix_binding_power_e(terminal_id) { if (terminal_id in infix_binding_power_e) { @@ -1485,7 +1485,7 @@ function parse_e_internal(ctx, rbp) { return left; } function nud_e(ctx) { - var tree = new ParseTree(new NonTerminal(102, 'e')); + var tree = new ParseTree(new NonTerminal(87, 'e')); var current = ctx.tokens.current(); ctx.nonterminal = "e"; if (!current) { @@ -1499,8 +1499,8 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('LogicalNot', ast_parameters); tree.nudMorphemeCount = 2; - tree.add(expect(ctx, 1)); - tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(1))); + tree.add(expect(ctx, 45)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(45))); tree.isPrefix = true; } else if (rule_first[94].indexOf(current.id) != -1) { @@ -1511,8 +1511,8 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('UnaryPlus', ast_parameters); tree.nudMorphemeCount = 2; - tree.add(expect(ctx, 41)); - tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(41))); + tree.add(expect(ctx, 27)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(27))); tree.isPrefix = true; } else if (rule_first[95].indexOf(current.id) != -1) { @@ -1523,8 +1523,8 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('UnaryNegation', ast_parameters); tree.nudMorphemeCount = 2; - tree.add(expect(ctx, 32)); - tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(32))); + tree.add(expect(ctx, 44)); + tree.add(parse_e_internal(ctx, get_prefix_binding_power_e(44))); tree.isPrefix = true; } else if (rule_first[97].indexOf(current.id) != -1) { @@ -1532,21 +1532,21 @@ function nud_e(ctx) { ctx.rule = rules[97]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 47)); + tree.add(expect(ctx, 14)); } else if (rule_first[98].indexOf(current.id) != -1) { // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) ctx.rule = rules[98]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 47)); + tree.add(expect(ctx, 14)); } else if (rule_first[99].indexOf(current.id) != -1) { // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) ctx.rule = rules[99]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 47)); + tree.add(expect(ctx, 14)); } else if (rule_first[101].indexOf(current.id) != -1) { // $e = :object :lbrace $_gen19 :rbrace -> ObjectLiteral( map=$2 ) @@ -1556,10 +1556,10 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('ObjectLiteral', ast_parameters); tree.nudMorphemeCount = 4; - tree.add(expect(ctx, 29)); - tree.add(expect(ctx, 18)); + tree.add(expect(ctx, 9)); + tree.add(expect(ctx, 20)); tree.add(parse__gen19(ctx)); - tree.add(expect(ctx, 3)); + tree.add(expect(ctx, 6)); } else if (rule_first[102].indexOf(current.id) != -1) { // $e = :lsquare $_gen18 :rsquare -> ArrayLiteral( values=$1 ) @@ -1569,9 +1569,9 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('ArrayLiteral', ast_parameters); tree.nudMorphemeCount = 3; - tree.add(expect(ctx, 16)); + tree.add(expect(ctx, 54)); tree.add(parse__gen18(ctx)); - tree.add(expect(ctx, 35)); + tree.add(expect(ctx, 41)); } else if (rule_first[104].indexOf(current.id) != -1) { // $e = :lbrace $_gen20 :rbrace -> MapLiteral( map=$1 ) @@ -1581,9 +1581,9 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('MapLiteral', ast_parameters); tree.nudMorphemeCount = 3; - tree.add(expect(ctx, 18)); + tree.add(expect(ctx, 20)); tree.add(parse__gen20(ctx)); - tree.add(expect(ctx, 3)); + tree.add(expect(ctx, 6)); } else if (rule_first[105].indexOf(current.id) != -1) { // $e = :lparen $_gen18 :rparen -> TupleLiteral( values=$1 ) @@ -1593,52 +1593,52 @@ function nud_e(ctx) { } tree.astTransform = new AstTransformNodeCreator('TupleLiteral', ast_parameters); tree.nudMorphemeCount = 3; - tree.add(expect(ctx, 45)); + tree.add(expect(ctx, 22)); tree.add(parse__gen18(ctx)); - tree.add(expect(ctx, 37)); + tree.add(expect(ctx, 49)); } else if (rule_first[106].indexOf(current.id) != -1) { // $e = :string ctx.rule = rules[106]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 13)); + tree.add(expect(ctx, 37)); } else if (rule_first[107].indexOf(current.id) != -1) { // $e = :identifier ctx.rule = rules[107]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 47)); + tree.add(expect(ctx, 14)); } else if (rule_first[108].indexOf(current.id) != -1) { // $e = :boolean ctx.rule = rules[108]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 2)); + tree.add(expect(ctx, 11)); } else if (rule_first[109].indexOf(current.id) != -1) { // $e = :integer ctx.rule = rules[109]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 20)); + tree.add(expect(ctx, 29)); } else if (rule_first[110].indexOf(current.id) != -1) { // $e = :float ctx.rule = rules[110]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 40)); + tree.add(expect(ctx, 1)); } return tree; } function led_e(left, ctx) { - var tree = new ParseTree(new NonTerminal(102, 'e')) + var tree = new ParseTree(new NonTerminal(87, 'e')) var current = ctx.tokens.current() ctx.nonterminal = "e"; - if (current.id == 6) { // :double_pipe + if (current.id == 10) { // :double_pipe // $e = $e :double_pipe $e -> LogicalOr( lhs=$0, rhs=$2 ) ctx.rule = rules[80]; ast_parameters = { @@ -1648,12 +1648,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('LogicalOr', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 6)); // :double_pipe + tree.add(expect(ctx, 10)); // :double_pipe modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(6) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(10) - modifier)); } - if (current.id == 11) { // :double_ampersand + if (current.id == 5) { // :double_ampersand // $e = $e :double_ampersand $e -> LogicalAnd( lhs=$0, rhs=$2 ) ctx.rule = rules[81]; ast_parameters = { @@ -1663,12 +1663,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('LogicalAnd', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 11)); // :double_ampersand + tree.add(expect(ctx, 5)); // :double_ampersand modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(11) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(5) - modifier)); } - if (current.id == 22) { // :double_equal + if (current.id == 28) { // :double_equal // $e = $e :double_equal $e -> Equals( lhs=$0, rhs=$2 ) ctx.rule = rules[82]; ast_parameters = { @@ -1678,12 +1678,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Equals', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 22)); // :double_equal + tree.add(expect(ctx, 28)); // :double_equal modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(22) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(28) - modifier)); } - if (current.id == 53) { // :not_equal + if (current.id == 40) { // :not_equal // $e = $e :not_equal $e -> NotEquals( lhs=$0, rhs=$2 ) ctx.rule = rules[83]; ast_parameters = { @@ -1693,12 +1693,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('NotEquals', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 53)); // :not_equal + tree.add(expect(ctx, 40)); // :not_equal modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(53) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(40) - modifier)); } - if (current.id == 28) { // :lt + if (current.id == 17) { // :lt // $e = $e :lt $e -> LessThan( lhs=$0, rhs=$2 ) ctx.rule = rules[84]; ast_parameters = { @@ -1708,12 +1708,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('LessThan', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 28)); // :lt + tree.add(expect(ctx, 17)); // :lt modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(28) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(17) - modifier)); } - if (current.id == 23) { // :lteq + if (current.id == 53) { // :lteq // $e = $e :lteq $e -> LessThanOrEqual( lhs=$0, rhs=$2 ) ctx.rule = rules[85]; ast_parameters = { @@ -1723,12 +1723,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('LessThanOrEqual', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 23)); // :lteq + tree.add(expect(ctx, 53)); // :lteq modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(23) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(53) - modifier)); } - if (current.id == 54) { // :gt + if (current.id == 35) { // :gt // $e = $e :gt $e -> GreaterThan( lhs=$0, rhs=$2 ) ctx.rule = rules[86]; ast_parameters = { @@ -1738,12 +1738,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('GreaterThan', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 54)); // :gt + tree.add(expect(ctx, 35)); // :gt modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(54) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(35) - modifier)); } - if (current.id == 36) { // :gteq + if (current.id == 39) { // :gteq // $e = $e :gteq $e -> GreaterThanOrEqual( lhs=$0, rhs=$2 ) ctx.rule = rules[87]; ast_parameters = { @@ -1753,12 +1753,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('GreaterThanOrEqual', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 36)); // :gteq + tree.add(expect(ctx, 39)); // :gteq modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(36) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(39) - modifier)); } - if (current.id == 41) { // :plus + if (current.id == 27) { // :plus // $e = $e :plus $e -> Add( lhs=$0, rhs=$2 ) ctx.rule = rules[88]; ast_parameters = { @@ -1768,12 +1768,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Add', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 41)); // :plus + tree.add(expect(ctx, 27)); // :plus modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(41) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(27) - modifier)); } - if (current.id == 32) { // :dash + if (current.id == 44) { // :dash // $e = $e :dash $e -> Subtract( lhs=$0, rhs=$2 ) ctx.rule = rules[89]; ast_parameters = { @@ -1783,12 +1783,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Subtract', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 32)); // :dash + tree.add(expect(ctx, 44)); // :dash modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(32) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(44) - modifier)); } - if (current.id == 39) { // :asterisk + if (current.id == 43) { // :asterisk // $e = $e :asterisk $e -> Multiply( lhs=$0, rhs=$2 ) ctx.rule = rules[90]; ast_parameters = { @@ -1798,12 +1798,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Multiply', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 39)); // :asterisk + tree.add(expect(ctx, 43)); // :asterisk modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(39) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(43) - modifier)); } - if (current.id == 14) { // :slash + if (current.id == 2) { // :slash // $e = $e :slash $e -> Divide( lhs=$0, rhs=$2 ) ctx.rule = rules[91]; ast_parameters = { @@ -1813,12 +1813,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Divide', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 14)); // :slash + tree.add(expect(ctx, 2)); // :slash modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(14) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(2) - modifier)); } - if (current.id == 42) { // :percent + if (current.id == 4) { // :percent // $e = $e :percent $e -> Remainder( lhs=$0, rhs=$2 ) ctx.rule = rules[92]; ast_parameters = { @@ -1828,12 +1828,12 @@ function led_e(left, ctx) { tree.astTransform = new AstTransformNodeCreator('Remainder', ast_parameters); tree.isExprNud = true; tree.add(left); - tree.add(expect(ctx, 42)); // :percent + tree.add(expect(ctx, 4)); // :percent modifier = 0; tree.isInfix = true; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(42) - modifier)); + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(4) - modifier)); } - if (current.id == 45) { // :lparen + if (current.id == 22) { // :lparen // $e = :identifier <=> :lparen $_gen18 :rparen -> FunctionCall( name=$0, params=$2 ) ctx.rule = rules[97]; ast_parameters = { @@ -1842,11 +1842,11 @@ function led_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('FunctionCall', ast_parameters); tree.add(left); - tree.add(expect(ctx, 45)); // :lparen + tree.add(expect(ctx, 22)); // :lparen tree.add(parse__gen18(ctx)); - tree.add(expect(ctx, 37)); // :rparen + tree.add(expect(ctx, 49)); // :rparen } - if (current.id == 16) { // :lsquare + if (current.id == 54) { // :lsquare // $e = :identifier <=> :lsquare $e :rsquare -> ArrayOrMapLookup( lhs=$0, rhs=$2 ) ctx.rule = rules[98]; ast_parameters = { @@ -1855,12 +1855,12 @@ function led_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('ArrayOrMapLookup', ast_parameters); tree.add(left); - tree.add(expect(ctx, 16)); // :lsquare + tree.add(expect(ctx, 54)); // :lsquare modifier = 0; - tree.add(parse_e_internal(ctx, get_infix_binding_power_e(16) - modifier)); - tree.add(expect(ctx, 35)); // :rsquare + tree.add(parse_e_internal(ctx, get_infix_binding_power_e(54) - modifier)); + tree.add(expect(ctx, 41)); // :rsquare } - if (current.id == 50) { // :dot + if (current.id == 18) { // :dot // $e = :identifier <=> :dot :identifier -> MemberAccess( lhs=$0, rhs=$2 ) ctx.rule = rules[99]; ast_parameters = { @@ -1869,17 +1869,17 @@ function led_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('MemberAccess', ast_parameters); tree.add(left); - tree.add(expect(ctx, 50)); // :dot - tree.add(expect(ctx, 47)); // :identifier + tree.add(expect(ctx, 18)); // :dot + tree.add(expect(ctx, 14)); // :identifier } return tree; } // END definitions for expression parser `e` // START definitions for expression parser `type_e` var infix_binding_power_type_e = { - 16: 1000, // $type_e = :type <=> :lsquare list($type_e, :comma) :rsquare -> Type( name=$0, subtype=$2 ) - 12: 2000, // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) - 41: 3000, // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) + 54: 1000, // $type_e = :type <=> :lsquare list($type_e, :comma) :rsquare -> Type( name=$0, subtype=$2 ) + 23: 2000, // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) + 27: 3000, // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) } var prefix_binding_power_type_e = { } @@ -1915,7 +1915,7 @@ function parse_type_e_internal(ctx, rbp) { return left; } function nud_type_e(ctx) { - var tree = new ParseTree(new NonTerminal(76, 'type_e')); + var tree = new ParseTree(new NonTerminal(107, 'type_e')); var current = ctx.tokens.current(); ctx.nonterminal = "type_e"; if (!current) { @@ -1926,36 +1926,36 @@ function nud_type_e(ctx) { ctx.rule = rules[76]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 25)); + tree.add(expect(ctx, 12)); } else if (rule_first[77].indexOf(current.id) != -1) { // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) ctx.rule = rules[77]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 25)); + tree.add(expect(ctx, 12)); } else if (rule_first[78].indexOf(current.id) != -1) { // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) ctx.rule = rules[78]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 25)); + tree.add(expect(ctx, 12)); } else if (rule_first[79].indexOf(current.id) != -1) { // $type_e = :type ctx.rule = rules[79]; tree.astTransform = new AstTransformSubstitution(0); tree.nudMorphemeCount = 1; - tree.add(expect(ctx, 25)); + tree.add(expect(ctx, 12)); } return tree; } function led_type_e(left, ctx) { - var tree = new ParseTree(new NonTerminal(76, 'type_e')) + var tree = new ParseTree(new NonTerminal(107, 'type_e')) var current = ctx.tokens.current() ctx.nonterminal = "type_e"; - if (current.id == 16) { // :lsquare + if (current.id == 54) { // :lsquare // $type_e = :type <=> :lsquare $_gen17 :rsquare -> Type( name=$0, subtype=$2 ) ctx.rule = rules[76]; ast_parameters = { @@ -1964,11 +1964,11 @@ function led_type_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('Type', ast_parameters); tree.add(left); - tree.add(expect(ctx, 16)); // :lsquare + tree.add(expect(ctx, 54)); // :lsquare tree.add(parse__gen17(ctx)); - tree.add(expect(ctx, 35)); // :rsquare + tree.add(expect(ctx, 41)); // :rsquare } - if (current.id == 12) { // :qmark + if (current.id == 23) { // :qmark // $type_e = :type <=> :qmark -> OptionalType( innerType=$0 ) ctx.rule = rules[77]; ast_parameters = { @@ -1976,9 +1976,9 @@ function led_type_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('OptionalType', ast_parameters); tree.add(left); - tree.add(expect(ctx, 12)); // :qmark + tree.add(expect(ctx, 23)); // :qmark } - if (current.id == 41) { // :plus + if (current.id == 27) { // :plus // $type_e = :type <=> :plus -> NonEmptyType( innerType=$0 ) ctx.rule = rules[78]; ast_parameters = { @@ -1986,22 +1986,22 @@ function led_type_e(left, ctx) { } tree.astTransform = new AstTransformNodeCreator('NonEmptyType', ast_parameters); tree.add(left); - tree.add(expect(ctx, 41)); // :plus + tree.add(expect(ctx, 27)); // :plus } return tree; } // END definitions for expression parser `type_e` function parse__gen0(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[25][current.id] : -1; - var tree = new ParseTree(new NonTerminal(81, '_gen0')); + var rule = current != null ? table[60][current.id] : -1; + var tree = new ParseTree(new NonTerminal(116, '_gen0')); ctx.nonterminal = "_gen0"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[81].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[81].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[116].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[116].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2010,7 +2010,7 @@ function parse__gen0(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[81].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[116].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_import(ctx)); ctx.nonterminal = "_gen0"; minimum = Math.max(minimum - 1, 0); @@ -2019,15 +2019,15 @@ function parse__gen0(ctx) { } function parse__gen1(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[4][current.id] : -1; - var tree = new ParseTree(new NonTerminal(60, '_gen1')); + var rule = current != null ? table[56][current.id] : -1; + var tree = new ParseTree(new NonTerminal(112, '_gen1')); ctx.nonterminal = "_gen1"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[60].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[60].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[112].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[112].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2036,7 +2036,7 @@ function parse__gen1(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[60].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[112].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_workflow_or_task_or_decl(ctx)); ctx.nonterminal = "_gen1"; minimum = Math.max(minimum - 1, 0); @@ -2045,15 +2045,15 @@ function parse__gen1(ctx) { } function parse__gen10(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[59][current.id] : -1; - var tree = new ParseTree(new NonTerminal(115, '_gen10')); + var rule = current != null ? table[17][current.id] : -1; + var tree = new ParseTree(new NonTerminal(73, '_gen10')); ctx.nonterminal = "_gen10"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[115].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[115].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[73].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[73].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2062,7 +2062,7 @@ function parse__gen10(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[115].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[73].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_wf_body_element(ctx)); ctx.nonterminal = "_gen10"; minimum = Math.max(minimum - 1, 0); @@ -2071,15 +2071,15 @@ function parse__gen10(ctx) { } function parse__gen13(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[50][current.id] : -1; - var tree = new ParseTree(new NonTerminal(106, '_gen13')); + var rule = current != null ? table[47][current.id] : -1; + var tree = new ParseTree(new NonTerminal(103, '_gen13')); ctx.nonterminal = "_gen13"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[106].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[106].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[103].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[103].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2088,7 +2088,7 @@ function parse__gen13(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[106].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[103].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_call_input(ctx)); ctx.nonterminal = "_gen13"; minimum = Math.max(minimum - 1, 0); @@ -2097,15 +2097,15 @@ function parse__gen13(ctx) { } function parse__gen14(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[29][current.id] : -1; - var tree = new ParseTree(new NonTerminal(85, '_gen14')); + var rule = current != null ? table[24][current.id] : -1; + var tree = new ParseTree(new NonTerminal(80, '_gen14')); ctx.nonterminal = "_gen14"; tree.list = true; - tree.listSeparator = 43; + tree.listSeparator = 8; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[85].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[85].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[80].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[80].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2114,11 +2114,11 @@ function parse__gen14(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[85].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[80].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_mapping(ctx)); ctx.nonterminal = "_gen14"; - if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { - tree.add(expect(ctx, 43)); + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 8) { + tree.add(expect(ctx, 8)); } else { if (minimum > 1) { throw new SyntaxError(ctx.error_formatter.missing_list_items( @@ -2136,15 +2136,15 @@ function parse__gen14(ctx) { } function parse__gen15(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[23][current.id] : -1; - var tree = new ParseTree(new NonTerminal(79, '_gen15')); + var rule = current != null ? table[58][current.id] : -1; + var tree = new ParseTree(new NonTerminal(114, '_gen15')); ctx.nonterminal = "_gen15"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[79].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[79].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[114].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[114].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2153,7 +2153,7 @@ function parse__gen15(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[79].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[114].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_wf_output(ctx)); ctx.nonterminal = "_gen15"; minimum = Math.max(minimum - 1, 0); @@ -2162,15 +2162,15 @@ function parse__gen15(ctx) { } function parse__gen17(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[31][current.id] : -1; - var tree = new ParseTree(new NonTerminal(87, '_gen17')); + var rule = current != null ? table[20][current.id] : -1; + var tree = new ParseTree(new NonTerminal(76, '_gen17')); ctx.nonterminal = "_gen17"; tree.list = true; - tree.listSeparator = 43; + tree.listSeparator = 8; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[87].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[87].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[76].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[76].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2179,11 +2179,11 @@ function parse__gen17(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[87].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[76].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_type_e(ctx)); ctx.nonterminal = "_gen17"; - if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { - tree.add(expect(ctx, 43)); + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 8) { + tree.add(expect(ctx, 8)); } else { if (minimum > 1) { throw new SyntaxError(ctx.error_formatter.missing_list_items( @@ -2201,15 +2201,15 @@ function parse__gen17(ctx) { } function parse__gen18(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[33][current.id] : -1; - var tree = new ParseTree(new NonTerminal(89, '_gen18')); + var rule = current != null ? table[9][current.id] : -1; + var tree = new ParseTree(new NonTerminal(65, '_gen18')); ctx.nonterminal = "_gen18"; tree.list = true; - tree.listSeparator = 43; + tree.listSeparator = 8; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[89].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[89].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[65].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[65].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2218,11 +2218,11 @@ function parse__gen18(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[89].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[65].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_e(ctx)); ctx.nonterminal = "_gen18"; - if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { - tree.add(expect(ctx, 43)); + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 8) { + tree.add(expect(ctx, 8)); } else { if (minimum > 1) { throw new SyntaxError(ctx.error_formatter.missing_list_items( @@ -2240,15 +2240,15 @@ function parse__gen18(ctx) { } function parse__gen19(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[40][current.id] : -1; - var tree = new ParseTree(new NonTerminal(96, '_gen19')); + var rule = current != null ? table[29][current.id] : -1; + var tree = new ParseTree(new NonTerminal(85, '_gen19')); ctx.nonterminal = "_gen19"; tree.list = true; - tree.listSeparator = 43; + tree.listSeparator = 8; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[96].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[96].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[85].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[85].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2257,11 +2257,11 @@ function parse__gen19(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[96].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[85].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_object_kv(ctx)); ctx.nonterminal = "_gen19"; - if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { - tree.add(expect(ctx, 43)); + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 8) { + tree.add(expect(ctx, 8)); } else { if (minimum > 1) { throw new SyntaxError(ctx.error_formatter.missing_list_items( @@ -2279,15 +2279,15 @@ function parse__gen19(ctx) { } function parse__gen20(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[34][current.id] : -1; - var tree = new ParseTree(new NonTerminal(90, '_gen20')); + var rule = current != null ? table[8][current.id] : -1; + var tree = new ParseTree(new NonTerminal(64, '_gen20')); ctx.nonterminal = "_gen20"; tree.list = true; - tree.listSeparator = 43; + tree.listSeparator = 8; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[90].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[90].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[64].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[64].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2296,11 +2296,11 @@ function parse__gen20(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[90].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[64].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_map_kv(ctx)); ctx.nonterminal = "_gen20"; - if ( ctx.tokens.current() != null && ctx.tokens.current().id == 43) { - tree.add(expect(ctx, 43)); + if ( ctx.tokens.current() != null && ctx.tokens.current().id == 8) { + tree.add(expect(ctx, 8)); } else { if (minimum > 1) { throw new SyntaxError(ctx.error_formatter.missing_list_items( @@ -2318,15 +2318,15 @@ function parse__gen20(ctx) { } function parse__gen3(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[21][current.id] : -1; - var tree = new ParseTree(new NonTerminal(77, '_gen3')); + var rule = current != null ? table[27][current.id] : -1; + var tree = new ParseTree(new NonTerminal(83, '_gen3')); ctx.nonterminal = "_gen3"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[77].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[77].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[83].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[83].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2335,7 +2335,7 @@ function parse__gen3(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[77].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[83].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_declaration(ctx)); ctx.nonterminal = "_gen3"; minimum = Math.max(minimum - 1, 0); @@ -2344,15 +2344,15 @@ function parse__gen3(ctx) { } function parse__gen4(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[14][current.id] : -1; - var tree = new ParseTree(new NonTerminal(70, '_gen4')); + var rule = current != null ? table[38][current.id] : -1; + var tree = new ParseTree(new NonTerminal(94, '_gen4')); ctx.nonterminal = "_gen4"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[70].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[70].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[94].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[94].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2361,7 +2361,7 @@ function parse__gen4(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[70].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[94].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_sections(ctx)); ctx.nonterminal = "_gen4"; minimum = Math.max(minimum - 1, 0); @@ -2370,15 +2370,15 @@ function parse__gen4(ctx) { } function parse__gen5(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[15][current.id] : -1; - var tree = new ParseTree(new NonTerminal(71, '_gen5')); + var rule = current != null ? table[32][current.id] : -1; + var tree = new ParseTree(new NonTerminal(88, '_gen5')); ctx.nonterminal = "_gen5"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[71].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[71].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[88].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[88].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2387,7 +2387,7 @@ function parse__gen5(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[71].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[88].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_command_part(ctx)); ctx.nonterminal = "_gen5"; minimum = Math.max(minimum - 1, 0); @@ -2396,15 +2396,15 @@ function parse__gen5(ctx) { } function parse__gen6(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[37][current.id] : -1; - var tree = new ParseTree(new NonTerminal(93, '_gen6')); + var rule = current != null ? table[33][current.id] : -1; + var tree = new ParseTree(new NonTerminal(89, '_gen6')); ctx.nonterminal = "_gen6"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[93].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[93].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[89].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[89].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2413,7 +2413,7 @@ function parse__gen6(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[93].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[89].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_cmd_param_kv(ctx)); ctx.nonterminal = "_gen6"; minimum = Math.max(minimum - 1, 0); @@ -2422,15 +2422,15 @@ function parse__gen6(ctx) { } function parse__gen7(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[28][current.id] : -1; - var tree = new ParseTree(new NonTerminal(84, '_gen7')); + var rule = current != null ? table[26][current.id] : -1; + var tree = new ParseTree(new NonTerminal(82, '_gen7')); ctx.nonterminal = "_gen7"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[84].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[84].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[82].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[82].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2439,7 +2439,7 @@ function parse__gen7(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[84].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[82].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_output_kv(ctx)); ctx.nonterminal = "_gen7"; minimum = Math.max(minimum - 1, 0); @@ -2448,15 +2448,15 @@ function parse__gen7(ctx) { } function parse__gen8(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[26][current.id] : -1; - var tree = new ParseTree(new NonTerminal(82, '_gen8')); + var rule = current != null ? table[22][current.id] : -1; + var tree = new ParseTree(new NonTerminal(78, '_gen8')); ctx.nonterminal = "_gen8"; tree.list = true; tree.listSeparator = -1; tree.astTransform = new AstTransformSubstitution(0); if ( ctx.tokens.current() != null && - nonterminal_follow[82].indexOf(ctx.tokens.current().id) != -1 && - nonterminal_first[82].indexOf(ctx.tokens.current().id) == -1 ) { + nonterminal_follow[78].indexOf(ctx.tokens.current().id) != -1 && + nonterminal_first[78].indexOf(ctx.tokens.current().id) == -1 ) { return tree; } if ( ctx.tokens.current() == null) { @@ -2465,7 +2465,7 @@ function parse__gen8(ctx) { var minimum = 0; while ( minimum > 0 || (ctx.tokens.current() != null && - nonterminal_first[82].indexOf(ctx.tokens.current().id) != -1)) { + nonterminal_first[78].indexOf(ctx.tokens.current().id) != -1)) { tree.add(parse_kv(ctx)); ctx.nonterminal = "_gen8"; minimum = Math.max(minimum - 1, 0); @@ -2474,10 +2474,10 @@ function parse__gen8(ctx) { } function parse__gen11(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[35][current.id] : -1; - var tree = new ParseTree(new NonTerminal(91, '_gen11')); + var rule = current != null ? table[37][current.id] : -1; + var tree = new ParseTree(new NonTerminal(93, '_gen11')); ctx.nonterminal = "_gen11"; - if (current != null && nonterminal_follow[91].indexOf(current.id) != -1 && nonterminal_first[91].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[93].indexOf(current.id) != -1 && nonterminal_first[93].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2494,10 +2494,10 @@ function parse__gen11(ctx) { } function parse__gen12(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[32][current.id] : -1; - var tree = new ParseTree(new NonTerminal(88, '_gen12')); + var rule = current != null ? table[42][current.id] : -1; + var tree = new ParseTree(new NonTerminal(98, '_gen12')); ctx.nonterminal = "_gen12"; - if (current != null && nonterminal_follow[88].indexOf(current.id) != -1 && nonterminal_first[88].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[98].indexOf(current.id) != -1 && nonterminal_first[98].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2514,10 +2514,10 @@ function parse__gen12(ctx) { } function parse__gen16(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[1][current.id] : -1; - var tree = new ParseTree(new NonTerminal(57, '_gen16')); + var rule = current != null ? table[48][current.id] : -1; + var tree = new ParseTree(new NonTerminal(104, '_gen16')); ctx.nonterminal = "_gen16"; - if (current != null && nonterminal_follow[57].indexOf(current.id) != -1 && nonterminal_first[57].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[104].indexOf(current.id) != -1 && nonterminal_first[104].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2534,10 +2534,10 @@ function parse__gen16(ctx) { } function parse__gen2(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[60][current.id] : -1; - var tree = new ParseTree(new NonTerminal(116, '_gen2')); + var rule = current != null ? table[53][current.id] : -1; + var tree = new ParseTree(new NonTerminal(109, '_gen2')); ctx.nonterminal = "_gen2"; - if (current != null && nonterminal_follow[116].indexOf(current.id) != -1 && nonterminal_first[116].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[109].indexOf(current.id) != -1 && nonterminal_first[109].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2554,10 +2554,10 @@ function parse__gen2(ctx) { } function parse__gen9(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[3][current.id] : -1; - var tree = new ParseTree(new NonTerminal(59, '_gen9')); + var rule = current != null ? table[19][current.id] : -1; + var tree = new ParseTree(new NonTerminal(75, '_gen9')); ctx.nonterminal = "_gen9"; - if (current != null && nonterminal_follow[59].indexOf(current.id) != -1 && nonterminal_first[59].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[75].indexOf(current.id) != -1 && nonterminal_first[75].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2574,8 +2574,8 @@ function parse__gen9(ctx) { } function parse_alias(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[9][current.id] : -1; - var tree = new ParseTree(new NonTerminal(65, 'alias')); + var rule = current != null ? table[36][current.id] : -1; + var tree = new ParseTree(new NonTerminal(92, 'alias')); ctx.nonterminal = "alias"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2585,21 +2585,21 @@ function parse_alias(ctx) { tree.astTransform = new AstTransformSubstitution(1); t = expect(ctx, 24); // :as tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[65], + nonterminal_first[92], rules[59] )); } function parse_call(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[16][current.id] : -1; - var tree = new ParseTree(new NonTerminal(72, 'call')); + var rule = current != null ? table[1][current.id] : -1; + var tree = new ParseTree(new NonTerminal(57, 'call')); ctx.nonterminal = "call"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2612,9 +2612,9 @@ function parse_call(ctx) { 'body': 3, } tree.astTransform = new AstTransformNodeCreator('Call', ast_parameters); - t = expect(ctx, 9); // :call + t = expect(ctx, 30); // :call tree.add(t); - t = expect(ctx, 30); // :fqn + t = expect(ctx, 50); // :fqn tree.add(t); subtree = parse__gen11(ctx); tree.add(subtree); @@ -2625,14 +2625,14 @@ function parse_call(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[72], + nonterminal_first[57], rules[53] )); } function parse_call_body(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[10][current.id] : -1; - var tree = new ParseTree(new NonTerminal(66, 'call_body')); + var rule = current != null ? table[55][current.id] : -1; + var tree = new ParseTree(new NonTerminal(111, 'call_body')); ctx.nonterminal = "call_body"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2644,27 +2644,27 @@ function parse_call_body(ctx) { 'io': 2, } tree.astTransform = new AstTransformNodeCreator('CallBody', ast_parameters); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen3(ctx); tree.add(subtree); subtree = parse__gen13(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[66], + nonterminal_first[111], rules[55] )); } function parse_call_input(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[22][current.id] : -1; - var tree = new ParseTree(new NonTerminal(78, 'call_input')); + var rule = current != null ? table[4][current.id] : -1; + var tree = new ParseTree(new NonTerminal(60, 'call_input')); ctx.nonterminal = "call_input"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2675,9 +2675,9 @@ function parse_call_input(ctx) { 'map': 2, } tree.astTransform = new AstTransformNodeCreator('Inputs', ast_parameters); - t = expect(ctx, 4); // :input + t = expect(ctx, 34); // :input tree.add(t); - t = expect(ctx, 10); // :colon + t = expect(ctx, 3); // :colon tree.add(t); subtree = parse__gen14(ctx); tree.add(subtree); @@ -2686,14 +2686,14 @@ function parse_call_input(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[78], + nonterminal_first[60], rules[57] )); } function parse_cmd_param(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[54][current.id] : -1; - var tree = new ParseTree(new NonTerminal(110, 'cmd_param')); + var rule = current != null ? table[44][current.id] : -1; + var tree = new ParseTree(new NonTerminal(100, 'cmd_param')); ctx.nonterminal = "cmd_param"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2705,27 +2705,27 @@ function parse_cmd_param(ctx) { 'expr': 2, } tree.astTransform = new AstTransformNodeCreator('CommandParameter', ast_parameters); - t = expect(ctx, 51); // :cmd_param_start + t = expect(ctx, 16); // :cmd_param_start tree.add(t); subtree = parse__gen6(ctx); tree.add(subtree); subtree = parse_e(ctx); tree.add(subtree); - t = expect(ctx, 44); // :cmd_param_end + t = expect(ctx, 26); // :cmd_param_end tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[110], + nonterminal_first[100], rules[23] )); } function parse_cmd_param_kv(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[42][current.id] : -1; - var tree = new ParseTree(new NonTerminal(98, 'cmd_param_kv')); + var rule = current != null ? table[49][current.id] : -1; + var tree = new ParseTree(new NonTerminal(105, 'cmd_param_kv')); ctx.nonterminal = "cmd_param_kv"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2737,11 +2737,11 @@ function parse_cmd_param_kv(ctx) { 'value': 3, } tree.astTransform = new AstTransformNodeCreator('CommandParameterAttr', ast_parameters); - t = expect(ctx, 8); // :cmd_attr_hint + t = expect(ctx, 7); // :cmd_attr_hint tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 46); // :equal + t = expect(ctx, 25); // :equal tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -2750,14 +2750,14 @@ function parse_cmd_param_kv(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[98], + nonterminal_first[105], rules[24] )); } function parse_command(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[27][current.id] : -1; - var tree = new ParseTree(new NonTerminal(83, 'command')); + var rule = current != null ? table[3][current.id] : -1; + var tree = new ParseTree(new NonTerminal(59, 'command')); ctx.nonterminal = "command"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2768,27 +2768,27 @@ function parse_command(ctx) { 'parts': 2, } tree.astTransform = new AstTransformNodeCreator('RawCommand', ast_parameters); - t = expect(ctx, 26); // :raw_command + t = expect(ctx, 33); // :raw_command tree.add(t); - t = expect(ctx, 34); // :raw_cmd_start + t = expect(ctx, 0); // :raw_cmd_start tree.add(t); subtree = parse__gen5(ctx); tree.add(subtree); - t = expect(ctx, 17); // :raw_cmd_end + t = expect(ctx, 38); // :raw_cmd_end tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[83], + nonterminal_first[59], rules[19] )); } function parse_command_part(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[56][current.id] : -1; - var tree = new ParseTree(new NonTerminal(112, 'command_part')); + var rule = current != null ? table[52][current.id] : -1; + var tree = new ParseTree(new NonTerminal(108, 'command_part')); ctx.nonterminal = "command_part"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2796,7 +2796,7 @@ function parse_command_part(ctx) { if (rule == 20) { // $command_part = :cmd_part ctx.rule = rules[20]; tree.astTransform = new AstTransformSubstitution(0); - t = expect(ctx, 55); // :cmd_part + t = expect(ctx, 13); // :cmd_part tree.add(t); return tree; } @@ -2810,14 +2810,14 @@ function parse_command_part(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[112], + nonterminal_first[108], rules[21] )); } function parse_declaration(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[13][current.id] : -1; - var tree = new ParseTree(new NonTerminal(69, 'declaration')); + var rule = current != null ? table[16][current.id] : -1; + var tree = new ParseTree(new NonTerminal(72, 'declaration')); ctx.nonterminal = "declaration"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2832,7 +2832,7 @@ function parse_declaration(ctx) { tree.astTransform = new AstTransformNodeCreator('Declaration', ast_parameters); subtree = parse_type_e(ctx); tree.add(subtree); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); subtree = parse__gen9(ctx); tree.add(subtree); @@ -2841,16 +2841,16 @@ function parse_declaration(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[69], + nonterminal_first[72], rules[36] )); } function parse_document(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[58][current.id] : -1; - var tree = new ParseTree(new NonTerminal(114, 'document')); + var rule = current != null ? table[40][current.id] : -1; + var tree = new ParseTree(new NonTerminal(96, 'document')); ctx.nonterminal = "document"; - if (current != null && nonterminal_follow[114].indexOf(current.id) != -1 && nonterminal_first[114].indexOf(current.id) == -1) { + if (current != null && nonterminal_follow[96].indexOf(current.id) != -1 && nonterminal_first[96].indexOf(current.id) == -1) { return tree; } if (current == null) { @@ -2873,8 +2873,8 @@ function parse_document(ctx) { } function parse_if_stmt(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[8][current.id] : -1; - var tree = new ParseTree(new NonTerminal(64, 'if_stmt')); + var rule = current != null ? table[28][current.id] : -1; + var tree = new ParseTree(new NonTerminal(84, 'if_stmt')); ctx.nonterminal = "if_stmt"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2886,33 +2886,33 @@ function parse_if_stmt(ctx) { 'body': 5, } tree.astTransform = new AstTransformNodeCreator('If', ast_parameters); - t = expect(ctx, 49); // :if + t = expect(ctx, 42); // :if tree.add(t); - t = expect(ctx, 45); // :lparen + t = expect(ctx, 22); // :lparen tree.add(t); subtree = parse_e(ctx); tree.add(subtree); - t = expect(ctx, 37); // :rparen + t = expect(ctx, 49); // :rparen tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen10(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[64], + nonterminal_first[84], rules[72] )); } function parse_import(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[18][current.id] : -1; - var tree = new ParseTree(new NonTerminal(74, 'import')); + var rule = current != null ? table[0][current.id] : -1; + var tree = new ParseTree(new NonTerminal(56, 'import')); ctx.nonterminal = "import"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2924,9 +2924,9 @@ function parse_import(ctx) { 'namespace': 2, } tree.astTransform = new AstTransformNodeCreator('Import', ast_parameters); - t = expect(ctx, 15); // :import + t = expect(ctx, 32); // :import tree.add(t); - t = expect(ctx, 13); // :string + t = expect(ctx, 37); // :string tree.add(t); subtree = parse__gen2(ctx); tree.add(subtree); @@ -2935,14 +2935,14 @@ function parse_import(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[74], + nonterminal_first[56], rules[8] )); } function parse_import_namespace(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[0][current.id] : -1; - var tree = new ParseTree(new NonTerminal(56, 'import_namespace')); + var rule = current != null ? table[7][current.id] : -1; + var tree = new ParseTree(new NonTerminal(63, 'import_namespace')); ctx.nonterminal = "import_namespace"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2952,21 +2952,21 @@ function parse_import_namespace(ctx) { tree.astTransform = new AstTransformSubstitution(1); t = expect(ctx, 24); // :as tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[56], + nonterminal_first[63], rules[9] )); } function parse_kv(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[7][current.id] : -1; - var tree = new ParseTree(new NonTerminal(63, 'kv')); + var rule = current != null ? table[46][current.id] : -1; + var tree = new ParseTree(new NonTerminal(102, 'kv')); ctx.nonterminal = "kv"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -2978,9 +2978,9 @@ function parse_kv(ctx) { 'value': 2, } tree.astTransform = new AstTransformNodeCreator('RuntimeAttribute', ast_parameters); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 10); // :colon + t = expect(ctx, 3); // :colon tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -2989,14 +2989,14 @@ function parse_kv(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[63], + nonterminal_first[102], rules[33] )); } function parse_map(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[43][current.id] : -1; - var tree = new ParseTree(new NonTerminal(99, 'map')); + var rule = current != null ? table[59][current.id] : -1; + var tree = new ParseTree(new NonTerminal(115, 'map')); ctx.nonterminal = "map"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3004,25 +3004,25 @@ function parse_map(ctx) { if (rule == 32) { // $map = :lbrace $_gen8 :rbrace -> $1 ctx.rule = rules[32]; tree.astTransform = new AstTransformSubstitution(1); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen8(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[99], + nonterminal_first[115], rules[32] )); } function parse_map_kv(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[19][current.id] : -1; - var tree = new ParseTree(new NonTerminal(75, 'map_kv')); + var rule = current != null ? table[45][current.id] : -1; + var tree = new ParseTree(new NonTerminal(101, 'map_kv')); ctx.nonterminal = "map_kv"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3036,7 +3036,7 @@ function parse_map_kv(ctx) { tree.astTransform = new AstTransformNodeCreator('MapLiteralKv', ast_parameters); subtree = parse_e(ctx); tree.add(subtree); - t = expect(ctx, 10); // :colon + t = expect(ctx, 3); // :colon tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3045,14 +3045,14 @@ function parse_map_kv(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[75], + nonterminal_first[101], rules[38] )); } function parse_mapping(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[24][current.id] : -1; - var tree = new ParseTree(new NonTerminal(80, 'mapping')); + var rule = current != null ? table[41][current.id] : -1; + var tree = new ParseTree(new NonTerminal(97, 'mapping')); ctx.nonterminal = "mapping"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3064,9 +3064,9 @@ function parse_mapping(ctx) { 'value': 2, } tree.astTransform = new AstTransformNodeCreator('IOMapping', ast_parameters); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 46); // :equal + t = expect(ctx, 25); // :equal tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3075,14 +3075,14 @@ function parse_mapping(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[80], + nonterminal_first[97], rules[58] )); } function parse_meta(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[53][current.id] : -1; - var tree = new ParseTree(new NonTerminal(109, 'meta')); + var rule = current != null ? table[13][current.id] : -1; + var tree = new ParseTree(new NonTerminal(69, 'meta')); ctx.nonterminal = "meta"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3093,7 +3093,7 @@ function parse_meta(ctx) { 'map': 1, } tree.astTransform = new AstTransformNodeCreator('Meta', ast_parameters); - t = expect(ctx, 27); // :meta + t = expect(ctx, 19); // :meta tree.add(t); subtree = parse_map(ctx); tree.add(subtree); @@ -3102,14 +3102,14 @@ function parse_meta(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[109], + nonterminal_first[69], rules[30] )); } function parse_object_kv(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[6][current.id] : -1; - var tree = new ParseTree(new NonTerminal(62, 'object_kv')); + var rule = current != null ? table[12][current.id] : -1; + var tree = new ParseTree(new NonTerminal(68, 'object_kv')); ctx.nonterminal = "object_kv"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3121,9 +3121,9 @@ function parse_object_kv(ctx) { 'value': 2, } tree.astTransform = new AstTransformNodeCreator('ObjectKV', ast_parameters); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 10); // :colon + t = expect(ctx, 3); // :colon tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3132,14 +3132,14 @@ function parse_object_kv(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[62], + nonterminal_first[68], rules[74] )); } function parse_output_kv(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[48][current.id] : -1; - var tree = new ParseTree(new NonTerminal(104, 'output_kv')); + var rule = current != null ? table[34][current.id] : -1; + var tree = new ParseTree(new NonTerminal(90, 'output_kv')); ctx.nonterminal = "output_kv"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3154,9 +3154,9 @@ function parse_output_kv(ctx) { tree.astTransform = new AstTransformNodeCreator('Output', ast_parameters); subtree = parse_type_e(ctx); tree.add(subtree); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 46); // :equal + t = expect(ctx, 25); // :equal tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3165,14 +3165,14 @@ function parse_output_kv(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[104], + nonterminal_first[90], rules[27] )); } function parse_outputs(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[17][current.id] : -1; - var tree = new ParseTree(new NonTerminal(73, 'outputs')); + var rule = current != null ? table[43][current.id] : -1; + var tree = new ParseTree(new NonTerminal(99, 'outputs')); ctx.nonterminal = "outputs"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3183,27 +3183,27 @@ function parse_outputs(ctx) { 'attributes': 2, } tree.astTransform = new AstTransformNodeCreator('Outputs', ast_parameters); - t = expect(ctx, 33); // :output + t = expect(ctx, 46); // :output tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen7(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[73], + nonterminal_first[99], rules[26] )); } function parse_parameter_meta(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[2][current.id] : -1; - var tree = new ParseTree(new NonTerminal(58, 'parameter_meta')); + var rule = current != null ? table[5][current.id] : -1; + var tree = new ParseTree(new NonTerminal(61, 'parameter_meta')); ctx.nonterminal = "parameter_meta"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3214,7 +3214,7 @@ function parse_parameter_meta(ctx) { 'map': 1, } tree.astTransform = new AstTransformNodeCreator('ParameterMeta', ast_parameters); - t = expect(ctx, 5); // :parameter_meta + t = expect(ctx, 47); // :parameter_meta tree.add(t); subtree = parse_map(ctx); tree.add(subtree); @@ -3223,14 +3223,14 @@ function parse_parameter_meta(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[58], + nonterminal_first[61], rules[29] )); } function parse_runtime(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[11][current.id] : -1; - var tree = new ParseTree(new NonTerminal(67, 'runtime')); + var rule = current != null ? table[21][current.id] : -1; + var tree = new ParseTree(new NonTerminal(77, 'runtime')); ctx.nonterminal = "runtime"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3241,7 +3241,7 @@ function parse_runtime(ctx) { 'map': 1, } tree.astTransform = new AstTransformNodeCreator('Runtime', ast_parameters); - t = expect(ctx, 38); // :runtime + t = expect(ctx, 21); // :runtime tree.add(t); subtree = parse_map(ctx); tree.add(subtree); @@ -3250,14 +3250,14 @@ function parse_runtime(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[67], + nonterminal_first[77], rules[28] )); } function parse_scatter(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[52][current.id] : -1; - var tree = new ParseTree(new NonTerminal(108, 'scatter')); + var rule = current != null ? table[2][current.id] : -1; + var tree = new ParseTree(new NonTerminal(58, 'scatter')); ctx.nonterminal = "scatter"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3272,35 +3272,35 @@ function parse_scatter(ctx) { tree.astTransform = new AstTransformNodeCreator('Scatter', ast_parameters); t = expect(ctx, 52); // :scatter tree.add(t); - t = expect(ctx, 45); // :lparen + t = expect(ctx, 22); // :lparen tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 48); // :in + t = expect(ctx, 31); // :in tree.add(t); subtree = parse_e(ctx); tree.add(subtree); - t = expect(ctx, 37); // :rparen + t = expect(ctx, 49); // :rparen tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen10(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[108], + nonterminal_first[58], rules[73] )); } function parse_sections(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[12][current.id] : -1; - var tree = new ParseTree(new NonTerminal(68, 'sections')); + var rule = current != null ? table[30][current.id] : -1; + var tree = new ParseTree(new NonTerminal(86, 'sections')); ctx.nonterminal = "sections"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3343,14 +3343,14 @@ function parse_sections(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[68], + nonterminal_first[86], rules[17] )); } function parse_setter(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[36][current.id] : -1; - var tree = new ParseTree(new NonTerminal(92, 'setter')); + var rule = current != null ? table[54][current.id] : -1; + var tree = new ParseTree(new NonTerminal(110, 'setter')); ctx.nonterminal = "setter"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3358,7 +3358,7 @@ function parse_setter(ctx) { if (rule == 37) { // $setter = :equal $e -> $1 ctx.rule = rules[37]; tree.astTransform = new AstTransformSubstitution(1); - t = expect(ctx, 46); // :equal + t = expect(ctx, 25); // :equal tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3367,14 +3367,14 @@ function parse_setter(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[92], + nonterminal_first[110], rules[37] )); } function parse_task(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[57][current.id] : -1; - var tree = new ParseTree(new NonTerminal(113, 'task')); + var rule = current != null ? table[15][current.id] : -1; + var tree = new ParseTree(new NonTerminal(71, 'task')); ctx.nonterminal = "task"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3387,31 +3387,31 @@ function parse_task(ctx) { 'sections': 4, } tree.astTransform = new AstTransformNodeCreator('Task', ast_parameters); - t = expect(ctx, 0); // :task + t = expect(ctx, 51); // :task tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen3(ctx); tree.add(subtree); subtree = parse__gen4(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[113], + nonterminal_first[71], rules[12] )); } function parse_wf_body_element(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[5][current.id] : -1; - var tree = new ParseTree(new NonTerminal(61, 'wf_body_element')); + var rule = current != null ? table[23][current.id] : -1; + var tree = new ParseTree(new NonTerminal(79, 'wf_body_element')); ctx.nonterminal = "wf_body_element"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3475,14 +3475,14 @@ function parse_wf_body_element(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[61], + nonterminal_first[79], rules[48] )); } function parse_wf_meta(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[41][current.id] : -1; - var tree = new ParseTree(new NonTerminal(97, 'wf_meta')); + var rule = current != null ? table[6][current.id] : -1; + var tree = new ParseTree(new NonTerminal(62, 'wf_meta')); ctx.nonterminal = "wf_meta"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3493,7 +3493,7 @@ function parse_wf_meta(ctx) { 'map': 1, } tree.astTransform = new AstTransformNodeCreator('Meta', ast_parameters); - t = expect(ctx, 27); // :meta + t = expect(ctx, 19); // :meta tree.add(t); subtree = parse_map(ctx); tree.add(subtree); @@ -3502,14 +3502,14 @@ function parse_wf_meta(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[97], + nonterminal_first[62], rules[70] )); } function parse_wf_output(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[38][current.id] : -1; - var tree = new ParseTree(new NonTerminal(94, 'wf_output')); + var rule = current != null ? table[57][current.id] : -1; + var tree = new ParseTree(new NonTerminal(113, 'wf_output')); ctx.nonterminal = "wf_output"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3531,14 +3531,14 @@ function parse_wf_output(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[94], + nonterminal_first[113], rules[63] )); } function parse_wf_output_declaration_syntax(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[30][current.id] : -1; - var tree = new ParseTree(new NonTerminal(86, 'wf_output_declaration_syntax')); + var rule = current != null ? table[25][current.id] : -1; + var tree = new ParseTree(new NonTerminal(81, 'wf_output_declaration_syntax')); ctx.nonterminal = "wf_output_declaration_syntax"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3553,9 +3553,9 @@ function parse_wf_output_declaration_syntax(ctx) { tree.astTransform = new AstTransformNodeCreator('WorkflowOutputDeclaration', ast_parameters); subtree = parse_type_e(ctx); tree.add(subtree); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 46); // :equal + t = expect(ctx, 25); // :equal tree.add(t); subtree = parse_e(ctx); tree.add(subtree); @@ -3564,14 +3564,14 @@ function parse_wf_output_declaration_syntax(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[86], + nonterminal_first[81], rules[64] )); } function parse_wf_output_wildcard(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[55][current.id] : -1; - var tree = new ParseTree(new NonTerminal(111, 'wf_output_wildcard')); + var rule = current != null ? table[11][current.id] : -1; + var tree = new ParseTree(new NonTerminal(67, 'wf_output_wildcard')); ctx.nonterminal = "wf_output_wildcard"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3579,23 +3579,23 @@ function parse_wf_output_wildcard(ctx) { if (rule == 68) { // $wf_output_wildcard = :dot :asterisk -> $1 ctx.rule = rules[68]; tree.astTransform = new AstTransformSubstitution(1); - t = expect(ctx, 50); // :dot + t = expect(ctx, 18); // :dot tree.add(t); - t = expect(ctx, 39); // :asterisk + t = expect(ctx, 43); // :asterisk tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[111], + nonterminal_first[67], rules[68] )); } function parse_wf_output_wildcard_syntax(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[49][current.id] : -1; - var tree = new ParseTree(new NonTerminal(105, 'wf_output_wildcard_syntax')); + var rule = current != null ? table[50][current.id] : -1; + var tree = new ParseTree(new NonTerminal(106, 'wf_output_wildcard_syntax')); ctx.nonterminal = "wf_output_wildcard_syntax"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3607,7 +3607,7 @@ function parse_wf_output_wildcard_syntax(ctx) { 'wildcard': 1, } tree.astTransform = new AstTransformNodeCreator('WorkflowOutputWildcard', ast_parameters); - t = expect(ctx, 30); // :fqn + t = expect(ctx, 50); // :fqn tree.add(t); subtree = parse__gen16(ctx); tree.add(subtree); @@ -3616,14 +3616,14 @@ function parse_wf_output_wildcard_syntax(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[105], + nonterminal_first[106], rules[67] )); } function parse_wf_outputs(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[51][current.id] : -1; - var tree = new ParseTree(new NonTerminal(107, 'wf_outputs')); + var rule = current != null ? table[39][current.id] : -1; + var tree = new ParseTree(new NonTerminal(95, 'wf_outputs')); ctx.nonterminal = "wf_outputs"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3634,27 +3634,27 @@ function parse_wf_outputs(ctx) { 'outputs': 2, } tree.astTransform = new AstTransformNodeCreator('WorkflowOutputs', ast_parameters); - t = expect(ctx, 33); // :output + t = expect(ctx, 46); // :output tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen15(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[107], + nonterminal_first[95], rules[61] )); } function parse_wf_parameter_meta(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[45][current.id] : -1; - var tree = new ParseTree(new NonTerminal(101, 'wf_parameter_meta')); + var rule = current != null ? table[35][current.id] : -1; + var tree = new ParseTree(new NonTerminal(91, 'wf_parameter_meta')); ctx.nonterminal = "wf_parameter_meta"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3665,7 +3665,7 @@ function parse_wf_parameter_meta(ctx) { 'map': 1, } tree.astTransform = new AstTransformNodeCreator('ParameterMeta', ast_parameters); - t = expect(ctx, 5); // :parameter_meta + t = expect(ctx, 47); // :parameter_meta tree.add(t); subtree = parse_map(ctx); tree.add(subtree); @@ -3674,14 +3674,14 @@ function parse_wf_parameter_meta(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[101], + nonterminal_first[91], rules[69] )); } function parse_while_loop(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[44][current.id] : -1; - var tree = new ParseTree(new NonTerminal(100, 'while_loop')); + var rule = current != null ? table[18][current.id] : -1; + var tree = new ParseTree(new NonTerminal(74, 'while_loop')); ctx.nonterminal = "while_loop"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3693,33 +3693,33 @@ function parse_while_loop(ctx) { 'body': 5, } tree.astTransform = new AstTransformNodeCreator('WhileLoop', ast_parameters); - t = expect(ctx, 19); // :while + t = expect(ctx, 48); // :while tree.add(t); - t = expect(ctx, 45); // :lparen + t = expect(ctx, 22); // :lparen tree.add(t); subtree = parse_e(ctx); tree.add(subtree); - t = expect(ctx, 37); // :rparen + t = expect(ctx, 49); // :rparen tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen10(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[100], + nonterminal_first[74], rules[71] )); } function parse_workflow(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[47][current.id] : -1; - var tree = new ParseTree(new NonTerminal(103, 'workflow')); + var rule = current != null ? table[10][current.id] : -1; + var tree = new ParseTree(new NonTerminal(66, 'workflow')); ctx.nonterminal = "workflow"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3731,29 +3731,29 @@ function parse_workflow(ctx) { 'body': 3, } tree.astTransform = new AstTransformNodeCreator('Workflow', ast_parameters); - t = expect(ctx, 31); // :workflow + t = expect(ctx, 36); // :workflow tree.add(t); - t = expect(ctx, 47); // :identifier + t = expect(ctx, 14); // :identifier tree.add(t); - t = expect(ctx, 18); // :lbrace + t = expect(ctx, 20); // :lbrace tree.add(t); subtree = parse__gen10(ctx); tree.add(subtree); - t = expect(ctx, 3); // :rbrace + t = expect(ctx, 6); // :rbrace tree.add(t); return tree; } throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[103], + nonterminal_first[66], rules[40] )); } function parse_workflow_or_task_or_decl(ctx) { var current = ctx.tokens.current(); - var rule = current != null ? table[39][current.id] : -1; - var tree = new ParseTree(new NonTerminal(95, 'workflow_or_task_or_decl')); + var rule = current != null ? table[14][current.id] : -1; + var tree = new ParseTree(new NonTerminal(70, 'workflow_or_task_or_decl')); ctx.nonterminal = "workflow_or_task_or_decl"; if (current == null) { throw new SyntaxError('Error: unexpected end of file'); @@ -3782,7 +3782,7 @@ function parse_workflow_or_task_or_decl(ctx) { throw new SyntaxError(ctx.error_formatter.unexpected_symbol( ctx.nonterminal, ctx.tokens.current(), - nonterminal_first[95], + nonterminal_first[70], rules[5] )); } @@ -4805,6 +4805,16 @@ var regex = { ] }, { + regex: new RegExp("\\?"), + outputs: [ + { + terminal: 'qmark', + group: 0, + function: null, + }, + ] + }, + { regex: new RegExp("\\\"([^\\\\\\\"\\n]|\\\\[\\\"\\'nrbtfav\\\\?]|\\\\[0-7]{1,3}|\\\\x[0-9a-fA-F]+|\\\\[uU]([0-9a-fA-F]{4})([0-9a-fA-F]{4})?)*\\\\?\""), outputs: [ { @@ -5121,35 +5131,35 @@ var regex = { ] }, { - regex: new RegExp("(true|false)(?![a-zA-Z0-9_])"), + regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*(?=\\s*=)"), outputs: [ { - terminal: 'boolean', + terminal: 'cmd_attr_hint', + group: null, + function: null, + }, + { + terminal: 'identifier', group: 0, function: null, }, ] }, { - regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), + regex: new RegExp("(true|false)(?![a-zA-Z0-9_])"), outputs: [ { - terminal: 'type', + terminal: 'boolean', group: 0, function: null, }, ] }, { - regex: new RegExp("[a-zA-Z]([a-zA-Z0-9_])*(?=\\s*=)"), + regex: new RegExp("(Array|Map|Object|Pair|Boolean|Int|Float|Uri|File|String)(?![a-zA-Z0-9_])(?![a-zA-Z0-9_])"), outputs: [ { - terminal: 'cmd_attr_hint', - group: null, - function: null, - }, - { - terminal: 'identifier', + terminal: 'type', group: 0, function: null, },