From 335ca3dbe2247085b7d3c5094fda1b04f1cfed11 Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Tue, 13 May 2025 09:17:30 +0200 Subject: [PATCH 1/6] [] --- .../stepfunctions/asl/antlr/DSLLexer.g4 | 68 ++++++++++++++++++ .../stepfunctions/asl/antlr/DSLParser.g4 | 69 +++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 new file mode 100644 index 0000000000000..35822e46d52b1 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 @@ -0,0 +1,68 @@ +// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false +// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine +// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true + +lexer grammar DSLLexer; + +// Comments: +LINECOMMENT: '#' ~[\r\n\f]* -> skip; + +JSONATA: 'jsonata(' ~[)]* ')'; + +// Symbols. +ARROW: '->'; +EQUALS: '='; +COMMA: ','; +COLON: ':'; +LPAREN: '('; +RPAREN: ')'; +LBRACK: '['; +RBRACK: ']'; +LBRACE: '{'; +RBRACE: '}'; + +// Literals. +TRUE: 'true'; +FALSE: 'false'; +NULL: 'null'; + +// Keywords. +WITH: 'with'; +AS: 'as'; +FAIL: 'fail'; +ERROR: 'error'; +CAUSE: 'cause'; +LAMBDA: 'lambda'; +PARAMETERS: 'parameters'; +CATCH: 'catch'; + + +STRINGPATH: '"$"' | '"$' ('.' | '[') (ESC | SAFECODEPOINT)* '"'; + +VAR: '$' [a-zA-Z_] (ESC | SAFECODEPOINT)*; + +STRING: '"' (ESC | SAFECODEPOINT)* '"'; + +fragment ESC: '\\' (["\\/bfnrt] | UNICODE); + +fragment UNICODE: 'u' HEX HEX HEX HEX; + +fragment HEX: [0-9a-fA-F]; + +fragment SAFECODEPOINT: ~ ["\\\u0000-\u001F]; + + +// Numbers. +INT: '0' | [1-9] [0-9]*; + +NUMBER: '-'? INT ('.' [0-9]+)? EXP?; + +fragment EXP: [Ee] [+\-]? INT; + +IDEN: [a-zA-Z_0-9-]+; + + +// Whitespace. +WS: [ \t\n\r]+ -> skip; + +TOK: .; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 new file mode 100644 index 0000000000000..f6db1d65683b1 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 @@ -0,0 +1,69 @@ +// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false +// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine +// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true + +parser grammar DSLParser; + +options { + tokenVocab = DSLLexer; +} + +workflow: state_declaration* state_call+ EOF; + +state_declaration: + IDEN (LPAREN IDEN (COMMA IDEN)* RPAREN)? EQUALS state +; + +state: + task_state + | fail_state +; + +task_state: + service_name COLON IDEN task_state_with; + +service_name: LAMBDA; + +task_state_with: + WITH parameters? catch_? +; + +parameters: PARAMETERS json_value; +catch_: CATCH LBRACE catch_case (catch_case)* RBRACE; +catch_case: + STRING ARROW state #catch_case_state + | STRING ARROW state_call #catch_case_call +; + +state_call: + IDEN LPAREN (argument_assignment (COMMA argument_assignment)*)? RPAREN + | IDEN AS state; + +argument_assignment: + IDEN EQUALS json_value +; + + +fail_state: FAIL WITH error cause?; +error: ERROR STRING; +cause: CAUSE STRING; + + +json_object: LBRACE json_binding (COMMA json_binding)* RBRACE | LBRACE RBRACE; + +json_binding: + | STRING COLON json_value +; + +json_arr: LBRACK json_value (COMMA json_value)* RBRACK | LBRACK RBRACK; + +json_value: json_object | json_arr | json_value_lit; + +json_value_lit: + NUMBER # json_value_float + | INT # json_value_int + | (TRUE | FALSE) # json_value_bool + | NULL # json_value_null + | STRING # json_value_str + | JSONATA # json_value_jsonata +; From 322ac22e767a9d625d1754a84826a3269b810fa2 Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Wed, 14 May 2025 15:03:09 +0200 Subject: [PATCH 2/6] base functionality --- .../stepfunctions/asl/antlr/DSLParser.g4 | 69 - .../asl/antlr/{DSLLexer.g4 => LSLLexer.g4} | 28 +- .../stepfunctions/asl/antlr/LSLParser.g4 | 93 + .../asl/antlr/runtime/LSLLexer.py | 366 +++ .../asl/antlr/runtime/LSLParser.py | 2357 +++++++++++++++++ .../asl/antlr/runtime/LSLParserListener.py | 336 +++ .../asl/antlr/runtime/LSLParserVisitor.py | 193 ++ .../stepfunctions/asl/parse/lsl/__init__.py | 0 .../stepfunctions/asl/parse/lsl/transpiler.py | 287 ++ .../stepfunctions/asl/parse/lsl_parser.py | 21 + .../v2/localstack_states_language.py | 353 +++ 11 files changed, 4028 insertions(+), 75 deletions(-) delete mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 rename localstack-core/localstack/services/stepfunctions/asl/antlr/{DSLLexer.g4 => LSLLexer.g4} (55%) create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/parse/lsl/__init__.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py create mode 100644 localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py create mode 100644 tests/aws/services/stepfunctions/v2/localstack_states_language.py diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 deleted file mode 100644 index f6db1d65683b1..0000000000000 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLParser.g4 +++ /dev/null @@ -1,69 +0,0 @@ -// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false -// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine -// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true - -parser grammar DSLParser; - -options { - tokenVocab = DSLLexer; -} - -workflow: state_declaration* state_call+ EOF; - -state_declaration: - IDEN (LPAREN IDEN (COMMA IDEN)* RPAREN)? EQUALS state -; - -state: - task_state - | fail_state -; - -task_state: - service_name COLON IDEN task_state_with; - -service_name: LAMBDA; - -task_state_with: - WITH parameters? catch_? -; - -parameters: PARAMETERS json_value; -catch_: CATCH LBRACE catch_case (catch_case)* RBRACE; -catch_case: - STRING ARROW state #catch_case_state - | STRING ARROW state_call #catch_case_call -; - -state_call: - IDEN LPAREN (argument_assignment (COMMA argument_assignment)*)? RPAREN - | IDEN AS state; - -argument_assignment: - IDEN EQUALS json_value -; - - -fail_state: FAIL WITH error cause?; -error: ERROR STRING; -cause: CAUSE STRING; - - -json_object: LBRACE json_binding (COMMA json_binding)* RBRACE | LBRACE RBRACE; - -json_binding: - | STRING COLON json_value -; - -json_arr: LBRACK json_value (COMMA json_value)* RBRACK | LBRACK RBRACK; - -json_value: json_object | json_arr | json_value_lit; - -json_value_lit: - NUMBER # json_value_float - | INT # json_value_int - | (TRUE | FALSE) # json_value_bool - | NULL # json_value_null - | STRING # json_value_str - | JSONATA # json_value_jsonata -; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 similarity index 55% rename from localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 rename to localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 index 35822e46d52b1..be4986b4ddebe 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/DSLLexer.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 @@ -2,13 +2,30 @@ // $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine // $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true -lexer grammar DSLLexer; +lexer grammar LSLLexer; // Comments: LINECOMMENT: '#' ~[\r\n\f]* -> skip; JSONATA: 'jsonata(' ~[)]* ')'; +// ErrorNames +ERRORNAMEStatesALL: 'States.ALL'; +ERRORNAMEStatesDataLimitExceeded: 'States.DataLimitExceeded'; +ERRORNAMEStatesHeartbeatTimeout: 'States.HeartbeatTimeout'; +ERRORNAMEStatesTimeout: 'States.Timeout'; +ERRORNAMEStatesTaskFailed: 'States.TaskFailed'; +ERRORNAMEStatesPermissions: 'States.Permissions'; +ERRORNAMEStatesResultPathMatchFailure: 'States.ResultPathMatchFailure'; +ERRORNAMEStatesParameterPathFailure: 'States.ParameterPathFailure'; +ERRORNAMEStatesBranchFailed: 'States.BranchFailed'; +ERRORNAMEStatesNoChoiceMatched: 'States.NoChoiceMatched'; +ERRORNAMEStatesIntrinsicFailure: 'States.IntrinsicFailure'; +ERRORNAMEStatesExceedToleratedFailureThreshold: 'States.ExceedToleratedFailureThreshold'; +ERRORNAMEStatesItemReaderFailed: 'States.ItemReaderFailed'; +ERRORNAMEStatesResultWriterFailed: 'States.ResultWriterFailed'; +ERRORNAMEStatesQueryEvaluationError: 'States.QueryEvaluationError'; + // Symbols. ARROW: '->'; EQUALS: '='; @@ -27,16 +44,17 @@ FALSE: 'false'; NULL: 'null'; // Keywords. -WITH: 'with'; +WHERE: 'where'; AS: 'as'; FAIL: 'fail'; +OUTPUT: 'output'; +SUCCEED: 'succeed'; ERROR: 'error'; CAUSE: 'cause'; LAMBDA: 'lambda'; -PARAMETERS: 'parameters'; +ARGUMENTS: 'arguments'; CATCH: 'catch'; - STRINGPATH: '"$"' | '"$' ('.' | '[') (ESC | SAFECODEPOINT)* '"'; VAR: '$' [a-zA-Z_] (ESC | SAFECODEPOINT)*; @@ -51,7 +69,6 @@ fragment HEX: [0-9a-fA-F]; fragment SAFECODEPOINT: ~ ["\\\u0000-\u001F]; - // Numbers. INT: '0' | [1-9] [0-9]*; @@ -61,7 +78,6 @@ fragment EXP: [Ee] [+\-]? INT; IDEN: [a-zA-Z_0-9-]+; - // Whitespace. WS: [ \t\n\r]+ -> skip; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 new file mode 100644 index 0000000000000..fd6900a0cc766 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 @@ -0,0 +1,93 @@ +// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false +// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine +// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true + +parser grammar LSLParser; + +options { + tokenVocab = LSLLexer; +} + +state_machine: (state_declaration | var_assign | state_call)+ EOF; + +state_declaration: + IDEN parameter_list EQUALS state +; + +state_call: + IDEN args_assign_list # state_call_template + | IDEN AS state # state_call_named + | state # state_call_anonymous + ; + +state: + service_name COLON IDEN task_where # state_task + | FAIL fail_where # state_fail + | SUCCEED succeed_where # state_succeed +; + +service_name: LAMBDA; + +task_where: WHERE arguments? catch_block?; +fail_where: WHERE error cause?; +succeed_where: WHERE output_block; + +arguments: ARGUMENTS json_value; +catch_block: CATCH LBRACE catch_case (catch_case)* RBRACE; +catch_case: error_name ARROW state_call; + +parameter_list: + LPAREN IDEN? (COMMA IDEN)* RPAREN +; + +args_assign_list: + LPAREN args_assign (COMMA args_assign)* RPAREN +; +args_assign: IDEN EQUALS json_value; + +error: ERROR string_or_jsonata; +cause: CAUSE string_or_jsonata; + +output_block: OUTPUT json_value; + +var_assign: + IDEN EQUALS state_call # var_assign_state_call + | IDEN EQUALS json_value # var_assign_json_value +; + +json_value: json_object | json_arr | json_value_lit; +json_object: LBRACE json_binding (COMMA json_binding)* RBRACE | LBRACE RBRACE; +json_binding: (STRING | IDEN) COLON json_value; +json_arr: LBRACK json_value (COMMA json_value)* RBRACK | LBRACK RBRACK; +json_value_lit: + NUMBER # json_value_float + | INT # json_value_int + | (TRUE | FALSE) # json_value_bool + | NULL # json_value_null + | STRING # json_value_str + | JSONATA # json_value_jsonata +; + +string_or_jsonata: + STRING # string_or_jsonata_string + | JSONATA # string_or_jsonata_jsonata +; + +error_name: + ERRORNAMEStatesALL + | ERRORNAMEStatesDataLimitExceeded + | ERRORNAMEStatesHeartbeatTimeout + | ERRORNAMEStatesTimeout + | ERRORNAMEStatesTaskFailed + | ERRORNAMEStatesPermissions + | ERRORNAMEStatesResultPathMatchFailure + | ERRORNAMEStatesParameterPathFailure + | ERRORNAMEStatesBranchFailed + | ERRORNAMEStatesNoChoiceMatched + | ERRORNAMEStatesIntrinsicFailure + | ERRORNAMEStatesExceedToleratedFailureThreshold + | ERRORNAMEStatesItemReaderFailed + | ERRORNAMEStatesResultWriterFailed + | ERRORNAMEStatesQueryEvaluationError + | STRING +; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py new file mode 100644 index 0000000000000..2632b0b0de0db --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py @@ -0,0 +1,366 @@ +# Generated from LSLLexer.g4 by ANTLR 4.13.2 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,48,684,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, + 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, + 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, + 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7, + 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, + 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, + 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, + 52,7,52,1,0,1,0,5,0,110,8,0,10,0,12,0,113,9,0,1,0,1,0,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,127,8,1,10,1,12,1,130,9,1,1,1, + 1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, + 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7, + 1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7, + 1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, + 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,9, + 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9, + 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10, + 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, + 1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, + 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13, + 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, + 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, + 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14, + 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14, + 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15, + 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15, + 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16, + 1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16, + 1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17, + 1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23, + 1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,28,1,28, + 1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30, + 1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33, + 1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35, + 1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37, + 1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38, + 1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40, + 1,40,1,40,1,40,1,40,5,40,598,8,40,10,40,12,40,601,9,40,1,40,3,40, + 604,8,40,1,41,1,41,1,41,1,41,5,41,610,8,41,10,41,12,41,613,9,41, + 1,42,1,42,1,42,5,42,618,8,42,10,42,12,42,621,9,42,1,42,1,42,1,43, + 1,43,1,43,3,43,628,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45, + 1,46,1,46,1,47,1,47,1,47,5,47,643,8,47,10,47,12,47,646,9,47,3,47, + 648,8,47,1,48,3,48,651,8,48,1,48,1,48,1,48,4,48,656,8,48,11,48,12, + 48,657,3,48,660,8,48,1,48,3,48,663,8,48,1,49,1,49,3,49,667,8,49, + 1,49,1,49,1,50,4,50,672,8,50,11,50,12,50,673,1,51,4,51,677,8,51, + 11,51,12,51,678,1,51,1,51,1,52,1,52,0,0,53,1,1,3,2,5,3,7,4,9,5,11, + 6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17, + 35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28, + 57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39, + 79,40,81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,44,97,45,99,0,101, + 46,103,47,105,48,1,0,13,2,0,10,10,12,13,1,0,41,41,2,0,46,46,91,91, + 3,0,65,90,95,95,97,122,8,0,34,34,47,47,92,92,98,98,102,102,110,110, + 114,114,116,116,3,0,48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0, + 49,57,1,0,48,57,2,0,69,69,101,101,2,0,43,43,45,45,5,0,45,45,48,57, + 65,90,95,95,97,122,3,0,9,10,13,13,32,32,697,0,1,1,0,0,0,0,3,1,0, + 0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0, + 0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0, + 0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0, + 0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0, + 0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0, + 0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0, + 0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0, + 0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0, + 0,0,85,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,101,1,0,0,0,0,103,1,0, + 0,0,0,105,1,0,0,0,1,107,1,0,0,0,3,116,1,0,0,0,5,133,1,0,0,0,7,144, + 1,0,0,0,9,169,1,0,0,0,11,193,1,0,0,0,13,208,1,0,0,0,15,226,1,0,0, + 0,17,245,1,0,0,0,19,275,1,0,0,0,21,303,1,0,0,0,23,323,1,0,0,0,25, + 346,1,0,0,0,27,370,1,0,0,0,29,409,1,0,0,0,31,433,1,0,0,0,33,459, + 1,0,0,0,35,487,1,0,0,0,37,490,1,0,0,0,39,492,1,0,0,0,41,494,1,0, + 0,0,43,496,1,0,0,0,45,498,1,0,0,0,47,500,1,0,0,0,49,502,1,0,0,0, + 51,504,1,0,0,0,53,506,1,0,0,0,55,508,1,0,0,0,57,513,1,0,0,0,59,519, + 1,0,0,0,61,524,1,0,0,0,63,530,1,0,0,0,65,533,1,0,0,0,67,538,1,0, + 0,0,69,545,1,0,0,0,71,553,1,0,0,0,73,559,1,0,0,0,75,565,1,0,0,0, + 77,572,1,0,0,0,79,582,1,0,0,0,81,603,1,0,0,0,83,605,1,0,0,0,85,614, + 1,0,0,0,87,624,1,0,0,0,89,629,1,0,0,0,91,635,1,0,0,0,93,637,1,0, + 0,0,95,647,1,0,0,0,97,650,1,0,0,0,99,664,1,0,0,0,101,671,1,0,0,0, + 103,676,1,0,0,0,105,682,1,0,0,0,107,111,5,35,0,0,108,110,8,0,0,0, + 109,108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0, + 112,114,1,0,0,0,113,111,1,0,0,0,114,115,6,0,0,0,115,2,1,0,0,0,116, + 117,5,106,0,0,117,118,5,115,0,0,118,119,5,111,0,0,119,120,5,110, + 0,0,120,121,5,97,0,0,121,122,5,116,0,0,122,123,5,97,0,0,123,124, + 5,40,0,0,124,128,1,0,0,0,125,127,8,1,0,0,126,125,1,0,0,0,127,130, + 1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128, + 1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,83,0,0,134,135, + 5,116,0,0,135,136,5,97,0,0,136,137,5,116,0,0,137,138,5,101,0,0,138, + 139,5,115,0,0,139,140,5,46,0,0,140,141,5,65,0,0,141,142,5,76,0,0, + 142,143,5,76,0,0,143,6,1,0,0,0,144,145,5,83,0,0,145,146,5,116,0, + 0,146,147,5,97,0,0,147,148,5,116,0,0,148,149,5,101,0,0,149,150,5, + 115,0,0,150,151,5,46,0,0,151,152,5,68,0,0,152,153,5,97,0,0,153,154, + 5,116,0,0,154,155,5,97,0,0,155,156,5,76,0,0,156,157,5,105,0,0,157, + 158,5,109,0,0,158,159,5,105,0,0,159,160,5,116,0,0,160,161,5,69,0, + 0,161,162,5,120,0,0,162,163,5,99,0,0,163,164,5,101,0,0,164,165,5, + 101,0,0,165,166,5,100,0,0,166,167,5,101,0,0,167,168,5,100,0,0,168, + 8,1,0,0,0,169,170,5,83,0,0,170,171,5,116,0,0,171,172,5,97,0,0,172, + 173,5,116,0,0,173,174,5,101,0,0,174,175,5,115,0,0,175,176,5,46,0, + 0,176,177,5,72,0,0,177,178,5,101,0,0,178,179,5,97,0,0,179,180,5, + 114,0,0,180,181,5,116,0,0,181,182,5,98,0,0,182,183,5,101,0,0,183, + 184,5,97,0,0,184,185,5,116,0,0,185,186,5,84,0,0,186,187,5,105,0, + 0,187,188,5,109,0,0,188,189,5,101,0,0,189,190,5,111,0,0,190,191, + 5,117,0,0,191,192,5,116,0,0,192,10,1,0,0,0,193,194,5,83,0,0,194, + 195,5,116,0,0,195,196,5,97,0,0,196,197,5,116,0,0,197,198,5,101,0, + 0,198,199,5,115,0,0,199,200,5,46,0,0,200,201,5,84,0,0,201,202,5, + 105,0,0,202,203,5,109,0,0,203,204,5,101,0,0,204,205,5,111,0,0,205, + 206,5,117,0,0,206,207,5,116,0,0,207,12,1,0,0,0,208,209,5,83,0,0, + 209,210,5,116,0,0,210,211,5,97,0,0,211,212,5,116,0,0,212,213,5,101, + 0,0,213,214,5,115,0,0,214,215,5,46,0,0,215,216,5,84,0,0,216,217, + 5,97,0,0,217,218,5,115,0,0,218,219,5,107,0,0,219,220,5,70,0,0,220, + 221,5,97,0,0,221,222,5,105,0,0,222,223,5,108,0,0,223,224,5,101,0, + 0,224,225,5,100,0,0,225,14,1,0,0,0,226,227,5,83,0,0,227,228,5,116, + 0,0,228,229,5,97,0,0,229,230,5,116,0,0,230,231,5,101,0,0,231,232, + 5,115,0,0,232,233,5,46,0,0,233,234,5,80,0,0,234,235,5,101,0,0,235, + 236,5,114,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,115, + 0,0,239,240,5,115,0,0,240,241,5,105,0,0,241,242,5,111,0,0,242,243, + 5,110,0,0,243,244,5,115,0,0,244,16,1,0,0,0,245,246,5,83,0,0,246, + 247,5,116,0,0,247,248,5,97,0,0,248,249,5,116,0,0,249,250,5,101,0, + 0,250,251,5,115,0,0,251,252,5,46,0,0,252,253,5,82,0,0,253,254,5, + 101,0,0,254,255,5,115,0,0,255,256,5,117,0,0,256,257,5,108,0,0,257, + 258,5,116,0,0,258,259,5,80,0,0,259,260,5,97,0,0,260,261,5,116,0, + 0,261,262,5,104,0,0,262,263,5,77,0,0,263,264,5,97,0,0,264,265,5, + 116,0,0,265,266,5,99,0,0,266,267,5,104,0,0,267,268,5,70,0,0,268, + 269,5,97,0,0,269,270,5,105,0,0,270,271,5,108,0,0,271,272,5,117,0, + 0,272,273,5,114,0,0,273,274,5,101,0,0,274,18,1,0,0,0,275,276,5,83, + 0,0,276,277,5,116,0,0,277,278,5,97,0,0,278,279,5,116,0,0,279,280, + 5,101,0,0,280,281,5,115,0,0,281,282,5,46,0,0,282,283,5,80,0,0,283, + 284,5,97,0,0,284,285,5,114,0,0,285,286,5,97,0,0,286,287,5,109,0, + 0,287,288,5,101,0,0,288,289,5,116,0,0,289,290,5,101,0,0,290,291, + 5,114,0,0,291,292,5,80,0,0,292,293,5,97,0,0,293,294,5,116,0,0,294, + 295,5,104,0,0,295,296,5,70,0,0,296,297,5,97,0,0,297,298,5,105,0, + 0,298,299,5,108,0,0,299,300,5,117,0,0,300,301,5,114,0,0,301,302, + 5,101,0,0,302,20,1,0,0,0,303,304,5,83,0,0,304,305,5,116,0,0,305, + 306,5,97,0,0,306,307,5,116,0,0,307,308,5,101,0,0,308,309,5,115,0, + 0,309,310,5,46,0,0,310,311,5,66,0,0,311,312,5,114,0,0,312,313,5, + 97,0,0,313,314,5,110,0,0,314,315,5,99,0,0,315,316,5,104,0,0,316, + 317,5,70,0,0,317,318,5,97,0,0,318,319,5,105,0,0,319,320,5,108,0, + 0,320,321,5,101,0,0,321,322,5,100,0,0,322,22,1,0,0,0,323,324,5,83, + 0,0,324,325,5,116,0,0,325,326,5,97,0,0,326,327,5,116,0,0,327,328, + 5,101,0,0,328,329,5,115,0,0,329,330,5,46,0,0,330,331,5,78,0,0,331, + 332,5,111,0,0,332,333,5,67,0,0,333,334,5,104,0,0,334,335,5,111,0, + 0,335,336,5,105,0,0,336,337,5,99,0,0,337,338,5,101,0,0,338,339,5, + 77,0,0,339,340,5,97,0,0,340,341,5,116,0,0,341,342,5,99,0,0,342,343, + 5,104,0,0,343,344,5,101,0,0,344,345,5,100,0,0,345,24,1,0,0,0,346, + 347,5,83,0,0,347,348,5,116,0,0,348,349,5,97,0,0,349,350,5,116,0, + 0,350,351,5,101,0,0,351,352,5,115,0,0,352,353,5,46,0,0,353,354,5, + 73,0,0,354,355,5,110,0,0,355,356,5,116,0,0,356,357,5,114,0,0,357, + 358,5,105,0,0,358,359,5,110,0,0,359,360,5,115,0,0,360,361,5,105, + 0,0,361,362,5,99,0,0,362,363,5,70,0,0,363,364,5,97,0,0,364,365,5, + 105,0,0,365,366,5,108,0,0,366,367,5,117,0,0,367,368,5,114,0,0,368, + 369,5,101,0,0,369,26,1,0,0,0,370,371,5,83,0,0,371,372,5,116,0,0, + 372,373,5,97,0,0,373,374,5,116,0,0,374,375,5,101,0,0,375,376,5,115, + 0,0,376,377,5,46,0,0,377,378,5,69,0,0,378,379,5,120,0,0,379,380, + 5,99,0,0,380,381,5,101,0,0,381,382,5,101,0,0,382,383,5,100,0,0,383, + 384,5,84,0,0,384,385,5,111,0,0,385,386,5,108,0,0,386,387,5,101,0, + 0,387,388,5,114,0,0,388,389,5,97,0,0,389,390,5,116,0,0,390,391,5, + 101,0,0,391,392,5,100,0,0,392,393,5,70,0,0,393,394,5,97,0,0,394, + 395,5,105,0,0,395,396,5,108,0,0,396,397,5,117,0,0,397,398,5,114, + 0,0,398,399,5,101,0,0,399,400,5,84,0,0,400,401,5,104,0,0,401,402, + 5,114,0,0,402,403,5,101,0,0,403,404,5,115,0,0,404,405,5,104,0,0, + 405,406,5,111,0,0,406,407,5,108,0,0,407,408,5,100,0,0,408,28,1,0, + 0,0,409,410,5,83,0,0,410,411,5,116,0,0,411,412,5,97,0,0,412,413, + 5,116,0,0,413,414,5,101,0,0,414,415,5,115,0,0,415,416,5,46,0,0,416, + 417,5,73,0,0,417,418,5,116,0,0,418,419,5,101,0,0,419,420,5,109,0, + 0,420,421,5,82,0,0,421,422,5,101,0,0,422,423,5,97,0,0,423,424,5, + 100,0,0,424,425,5,101,0,0,425,426,5,114,0,0,426,427,5,70,0,0,427, + 428,5,97,0,0,428,429,5,105,0,0,429,430,5,108,0,0,430,431,5,101,0, + 0,431,432,5,100,0,0,432,30,1,0,0,0,433,434,5,83,0,0,434,435,5,116, + 0,0,435,436,5,97,0,0,436,437,5,116,0,0,437,438,5,101,0,0,438,439, + 5,115,0,0,439,440,5,46,0,0,440,441,5,82,0,0,441,442,5,101,0,0,442, + 443,5,115,0,0,443,444,5,117,0,0,444,445,5,108,0,0,445,446,5,116, + 0,0,446,447,5,87,0,0,447,448,5,114,0,0,448,449,5,105,0,0,449,450, + 5,116,0,0,450,451,5,101,0,0,451,452,5,114,0,0,452,453,5,70,0,0,453, + 454,5,97,0,0,454,455,5,105,0,0,455,456,5,108,0,0,456,457,5,101,0, + 0,457,458,5,100,0,0,458,32,1,0,0,0,459,460,5,83,0,0,460,461,5,116, + 0,0,461,462,5,97,0,0,462,463,5,116,0,0,463,464,5,101,0,0,464,465, + 5,115,0,0,465,466,5,46,0,0,466,467,5,81,0,0,467,468,5,117,0,0,468, + 469,5,101,0,0,469,470,5,114,0,0,470,471,5,121,0,0,471,472,5,69,0, + 0,472,473,5,118,0,0,473,474,5,97,0,0,474,475,5,108,0,0,475,476,5, + 117,0,0,476,477,5,97,0,0,477,478,5,116,0,0,478,479,5,105,0,0,479, + 480,5,111,0,0,480,481,5,110,0,0,481,482,5,69,0,0,482,483,5,114,0, + 0,483,484,5,114,0,0,484,485,5,111,0,0,485,486,5,114,0,0,486,34,1, + 0,0,0,487,488,5,45,0,0,488,489,5,62,0,0,489,36,1,0,0,0,490,491,5, + 61,0,0,491,38,1,0,0,0,492,493,5,44,0,0,493,40,1,0,0,0,494,495,5, + 58,0,0,495,42,1,0,0,0,496,497,5,40,0,0,497,44,1,0,0,0,498,499,5, + 41,0,0,499,46,1,0,0,0,500,501,5,91,0,0,501,48,1,0,0,0,502,503,5, + 93,0,0,503,50,1,0,0,0,504,505,5,123,0,0,505,52,1,0,0,0,506,507,5, + 125,0,0,507,54,1,0,0,0,508,509,5,116,0,0,509,510,5,114,0,0,510,511, + 5,117,0,0,511,512,5,101,0,0,512,56,1,0,0,0,513,514,5,102,0,0,514, + 515,5,97,0,0,515,516,5,108,0,0,516,517,5,115,0,0,517,518,5,101,0, + 0,518,58,1,0,0,0,519,520,5,110,0,0,520,521,5,117,0,0,521,522,5,108, + 0,0,522,523,5,108,0,0,523,60,1,0,0,0,524,525,5,119,0,0,525,526,5, + 104,0,0,526,527,5,101,0,0,527,528,5,114,0,0,528,529,5,101,0,0,529, + 62,1,0,0,0,530,531,5,97,0,0,531,532,5,115,0,0,532,64,1,0,0,0,533, + 534,5,102,0,0,534,535,5,97,0,0,535,536,5,105,0,0,536,537,5,108,0, + 0,537,66,1,0,0,0,538,539,5,111,0,0,539,540,5,117,0,0,540,541,5,116, + 0,0,541,542,5,112,0,0,542,543,5,117,0,0,543,544,5,116,0,0,544,68, + 1,0,0,0,545,546,5,115,0,0,546,547,5,117,0,0,547,548,5,99,0,0,548, + 549,5,99,0,0,549,550,5,101,0,0,550,551,5,101,0,0,551,552,5,100,0, + 0,552,70,1,0,0,0,553,554,5,101,0,0,554,555,5,114,0,0,555,556,5,114, + 0,0,556,557,5,111,0,0,557,558,5,114,0,0,558,72,1,0,0,0,559,560,5, + 99,0,0,560,561,5,97,0,0,561,562,5,117,0,0,562,563,5,115,0,0,563, + 564,5,101,0,0,564,74,1,0,0,0,565,566,5,108,0,0,566,567,5,97,0,0, + 567,568,5,109,0,0,568,569,5,98,0,0,569,570,5,100,0,0,570,571,5,97, + 0,0,571,76,1,0,0,0,572,573,5,97,0,0,573,574,5,114,0,0,574,575,5, + 103,0,0,575,576,5,117,0,0,576,577,5,109,0,0,577,578,5,101,0,0,578, + 579,5,110,0,0,579,580,5,116,0,0,580,581,5,115,0,0,581,78,1,0,0,0, + 582,583,5,99,0,0,583,584,5,97,0,0,584,585,5,116,0,0,585,586,5,99, + 0,0,586,587,5,104,0,0,587,80,1,0,0,0,588,589,5,34,0,0,589,590,5, + 36,0,0,590,604,5,34,0,0,591,592,5,34,0,0,592,593,5,36,0,0,593,594, + 1,0,0,0,594,599,7,2,0,0,595,598,3,87,43,0,596,598,3,93,46,0,597, + 595,1,0,0,0,597,596,1,0,0,0,598,601,1,0,0,0,599,597,1,0,0,0,599, + 600,1,0,0,0,600,602,1,0,0,0,601,599,1,0,0,0,602,604,5,34,0,0,603, + 588,1,0,0,0,603,591,1,0,0,0,604,82,1,0,0,0,605,606,5,36,0,0,606, + 611,7,3,0,0,607,610,3,87,43,0,608,610,3,93,46,0,609,607,1,0,0,0, + 609,608,1,0,0,0,610,613,1,0,0,0,611,609,1,0,0,0,611,612,1,0,0,0, + 612,84,1,0,0,0,613,611,1,0,0,0,614,619,5,34,0,0,615,618,3,87,43, + 0,616,618,3,93,46,0,617,615,1,0,0,0,617,616,1,0,0,0,618,621,1,0, + 0,0,619,617,1,0,0,0,619,620,1,0,0,0,620,622,1,0,0,0,621,619,1,0, + 0,0,622,623,5,34,0,0,623,86,1,0,0,0,624,627,5,92,0,0,625,628,7,4, + 0,0,626,628,3,89,44,0,627,625,1,0,0,0,627,626,1,0,0,0,628,88,1,0, + 0,0,629,630,5,117,0,0,630,631,3,91,45,0,631,632,3,91,45,0,632,633, + 3,91,45,0,633,634,3,91,45,0,634,90,1,0,0,0,635,636,7,5,0,0,636,92, + 1,0,0,0,637,638,8,6,0,0,638,94,1,0,0,0,639,648,5,48,0,0,640,644, + 7,7,0,0,641,643,7,8,0,0,642,641,1,0,0,0,643,646,1,0,0,0,644,642, + 1,0,0,0,644,645,1,0,0,0,645,648,1,0,0,0,646,644,1,0,0,0,647,639, + 1,0,0,0,647,640,1,0,0,0,648,96,1,0,0,0,649,651,5,45,0,0,650,649, + 1,0,0,0,650,651,1,0,0,0,651,652,1,0,0,0,652,659,3,95,47,0,653,655, + 5,46,0,0,654,656,7,8,0,0,655,654,1,0,0,0,656,657,1,0,0,0,657,655, + 1,0,0,0,657,658,1,0,0,0,658,660,1,0,0,0,659,653,1,0,0,0,659,660, + 1,0,0,0,660,662,1,0,0,0,661,663,3,99,49,0,662,661,1,0,0,0,662,663, + 1,0,0,0,663,98,1,0,0,0,664,666,7,9,0,0,665,667,7,10,0,0,666,665, + 1,0,0,0,666,667,1,0,0,0,667,668,1,0,0,0,668,669,3,95,47,0,669,100, + 1,0,0,0,670,672,7,11,0,0,671,670,1,0,0,0,672,673,1,0,0,0,673,671, + 1,0,0,0,673,674,1,0,0,0,674,102,1,0,0,0,675,677,7,12,0,0,676,675, + 1,0,0,0,677,678,1,0,0,0,678,676,1,0,0,0,678,679,1,0,0,0,679,680, + 1,0,0,0,680,681,6,51,0,0,681,104,1,0,0,0,682,683,9,0,0,0,683,106, + 1,0,0,0,20,0,111,128,597,599,603,609,611,617,619,627,644,647,650, + 657,659,662,666,673,678,1,6,0,0 + ] + +class LSLLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + LINECOMMENT = 1 + JSONATA = 2 + ERRORNAMEStatesALL = 3 + ERRORNAMEStatesDataLimitExceeded = 4 + ERRORNAMEStatesHeartbeatTimeout = 5 + ERRORNAMEStatesTimeout = 6 + ERRORNAMEStatesTaskFailed = 7 + ERRORNAMEStatesPermissions = 8 + ERRORNAMEStatesResultPathMatchFailure = 9 + ERRORNAMEStatesParameterPathFailure = 10 + ERRORNAMEStatesBranchFailed = 11 + ERRORNAMEStatesNoChoiceMatched = 12 + ERRORNAMEStatesIntrinsicFailure = 13 + ERRORNAMEStatesExceedToleratedFailureThreshold = 14 + ERRORNAMEStatesItemReaderFailed = 15 + ERRORNAMEStatesResultWriterFailed = 16 + ERRORNAMEStatesQueryEvaluationError = 17 + ARROW = 18 + EQUALS = 19 + COMMA = 20 + COLON = 21 + LPAREN = 22 + RPAREN = 23 + LBRACK = 24 + RBRACK = 25 + LBRACE = 26 + RBRACE = 27 + TRUE = 28 + FALSE = 29 + NULL = 30 + WHERE = 31 + AS = 32 + FAIL = 33 + OUTPUT = 34 + SUCCEED = 35 + ERROR = 36 + CAUSE = 37 + LAMBDA = 38 + ARGUMENTS = 39 + CATCH = 40 + STRINGPATH = 41 + VAR = 42 + STRING = 43 + INT = 44 + NUMBER = 45 + IDEN = 46 + WS = 47 + TOK = 48 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "'States.ALL'", "'States.DataLimitExceeded'", "'States.HeartbeatTimeout'", + "'States.Timeout'", "'States.TaskFailed'", "'States.Permissions'", + "'States.ResultPathMatchFailure'", "'States.ParameterPathFailure'", + "'States.BranchFailed'", "'States.NoChoiceMatched'", "'States.IntrinsicFailure'", + "'States.ExceedToleratedFailureThreshold'", "'States.ItemReaderFailed'", + "'States.ResultWriterFailed'", "'States.QueryEvaluationError'", + "'->'", "'='", "','", "':'", "'('", "')'", "'['", "']'", "'{'", + "'}'", "'true'", "'false'", "'null'", "'where'", "'as'", "'fail'", + "'output'", "'succeed'", "'error'", "'cause'", "'lambda'", "'arguments'", + "'catch'" ] + + symbolicNames = [ "", + "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", "ERRORNAMEStatesDataLimitExceeded", + "ERRORNAMEStatesHeartbeatTimeout", "ERRORNAMEStatesTimeout", + "ERRORNAMEStatesTaskFailed", "ERRORNAMEStatesPermissions", "ERRORNAMEStatesResultPathMatchFailure", + "ERRORNAMEStatesParameterPathFailure", "ERRORNAMEStatesBranchFailed", + "ERRORNAMEStatesNoChoiceMatched", "ERRORNAMEStatesIntrinsicFailure", + "ERRORNAMEStatesExceedToleratedFailureThreshold", "ERRORNAMEStatesItemReaderFailed", + "ERRORNAMEStatesResultWriterFailed", "ERRORNAMEStatesQueryEvaluationError", + "ARROW", "EQUALS", "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", + "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", + "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", "LAMBDA", + "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "INT", + "NUMBER", "IDEN", "WS", "TOK" ] + + ruleNames = [ "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", "ERRORNAMEStatesDataLimitExceeded", + "ERRORNAMEStatesHeartbeatTimeout", "ERRORNAMEStatesTimeout", + "ERRORNAMEStatesTaskFailed", "ERRORNAMEStatesPermissions", + "ERRORNAMEStatesResultPathMatchFailure", "ERRORNAMEStatesParameterPathFailure", + "ERRORNAMEStatesBranchFailed", "ERRORNAMEStatesNoChoiceMatched", + "ERRORNAMEStatesIntrinsicFailure", "ERRORNAMEStatesExceedToleratedFailureThreshold", + "ERRORNAMEStatesItemReaderFailed", "ERRORNAMEStatesResultWriterFailed", + "ERRORNAMEStatesQueryEvaluationError", "ARROW", "EQUALS", + "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", + "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", + "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", "LAMBDA", + "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "ESC", + "UNICODE", "HEX", "SAFECODEPOINT", "INT", "NUMBER", "EXP", + "IDEN", "WS", "TOK" ] + + grammarFileName = "LSLLexer.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.2") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py new file mode 100644 index 0000000000000..1ecb08e87e59d --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py @@ -0,0 +1,2357 @@ +# Generated from LSLParser.g4 by ANTLR 4.13.2 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,48,217,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, + 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,1,0,1,0,1,0,4,0,54, + 8,0,11,0,12,0,55,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2, + 1,2,3,2,71,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,82,8,3,1, + 4,1,4,1,5,1,5,3,5,88,8,5,1,5,3,5,91,8,5,1,6,1,6,1,6,3,6,96,8,6,1, + 7,1,7,1,7,1,8,1,8,1,8,1,9,1,9,1,9,1,9,5,9,108,8,9,10,9,12,9,111, + 9,9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,3,11,121,8,11,1,11,1,11, + 5,11,125,8,11,10,11,12,11,128,9,11,1,11,1,11,1,12,1,12,1,12,1,12, + 5,12,136,8,12,10,12,12,12,139,9,12,1,12,1,12,1,13,1,13,1,13,1,13, + 1,14,1,14,1,14,1,15,1,15,1,15,1,16,1,16,1,16,1,17,1,17,1,17,1,17, + 1,17,1,17,3,17,162,8,17,1,18,1,18,1,18,3,18,167,8,18,1,19,1,19,1, + 19,1,19,5,19,173,8,19,10,19,12,19,176,9,19,1,19,1,19,1,19,1,19,3, + 19,182,8,19,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1,21,5,21,192,8,21, + 10,21,12,21,195,9,21,1,21,1,21,1,21,1,21,3,21,201,8,21,1,22,1,22, + 1,22,1,22,1,22,1,22,3,22,209,8,22,1,23,1,23,3,23,213,8,23,1,24,1, + 24,1,24,0,0,25,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34, + 36,38,40,42,44,46,48,0,3,2,0,43,43,46,46,1,0,28,29,2,0,3,17,43,43, + 218,0,53,1,0,0,0,2,59,1,0,0,0,4,70,1,0,0,0,6,81,1,0,0,0,8,83,1,0, + 0,0,10,85,1,0,0,0,12,92,1,0,0,0,14,97,1,0,0,0,16,100,1,0,0,0,18, + 103,1,0,0,0,20,114,1,0,0,0,22,118,1,0,0,0,24,131,1,0,0,0,26,142, + 1,0,0,0,28,146,1,0,0,0,30,149,1,0,0,0,32,152,1,0,0,0,34,161,1,0, + 0,0,36,166,1,0,0,0,38,181,1,0,0,0,40,183,1,0,0,0,42,200,1,0,0,0, + 44,208,1,0,0,0,46,212,1,0,0,0,48,214,1,0,0,0,50,54,3,2,1,0,51,54, + 3,34,17,0,52,54,3,4,2,0,53,50,1,0,0,0,53,51,1,0,0,0,53,52,1,0,0, + 0,54,55,1,0,0,0,55,53,1,0,0,0,55,56,1,0,0,0,56,57,1,0,0,0,57,58, + 5,0,0,1,58,1,1,0,0,0,59,60,5,46,0,0,60,61,3,22,11,0,61,62,5,19,0, + 0,62,63,3,6,3,0,63,3,1,0,0,0,64,65,5,46,0,0,65,71,3,24,12,0,66,67, + 5,46,0,0,67,68,5,32,0,0,68,71,3,6,3,0,69,71,3,6,3,0,70,64,1,0,0, + 0,70,66,1,0,0,0,70,69,1,0,0,0,71,5,1,0,0,0,72,73,3,8,4,0,73,74,5, + 21,0,0,74,75,5,46,0,0,75,76,3,10,5,0,76,82,1,0,0,0,77,78,5,33,0, + 0,78,82,3,12,6,0,79,80,5,35,0,0,80,82,3,14,7,0,81,72,1,0,0,0,81, + 77,1,0,0,0,81,79,1,0,0,0,82,7,1,0,0,0,83,84,5,38,0,0,84,9,1,0,0, + 0,85,87,5,31,0,0,86,88,3,16,8,0,87,86,1,0,0,0,87,88,1,0,0,0,88,90, + 1,0,0,0,89,91,3,18,9,0,90,89,1,0,0,0,90,91,1,0,0,0,91,11,1,0,0,0, + 92,93,5,31,0,0,93,95,3,28,14,0,94,96,3,30,15,0,95,94,1,0,0,0,95, + 96,1,0,0,0,96,13,1,0,0,0,97,98,5,31,0,0,98,99,3,32,16,0,99,15,1, + 0,0,0,100,101,5,39,0,0,101,102,3,36,18,0,102,17,1,0,0,0,103,104, + 5,40,0,0,104,105,5,26,0,0,105,109,3,20,10,0,106,108,3,20,10,0,107, + 106,1,0,0,0,108,111,1,0,0,0,109,107,1,0,0,0,109,110,1,0,0,0,110, + 112,1,0,0,0,111,109,1,0,0,0,112,113,5,27,0,0,113,19,1,0,0,0,114, + 115,3,48,24,0,115,116,5,18,0,0,116,117,3,4,2,0,117,21,1,0,0,0,118, + 120,5,22,0,0,119,121,5,46,0,0,120,119,1,0,0,0,120,121,1,0,0,0,121, + 126,1,0,0,0,122,123,5,20,0,0,123,125,5,46,0,0,124,122,1,0,0,0,125, + 128,1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0,127,129,1,0,0,0,128, + 126,1,0,0,0,129,130,5,23,0,0,130,23,1,0,0,0,131,132,5,22,0,0,132, + 137,3,26,13,0,133,134,5,20,0,0,134,136,3,26,13,0,135,133,1,0,0,0, + 136,139,1,0,0,0,137,135,1,0,0,0,137,138,1,0,0,0,138,140,1,0,0,0, + 139,137,1,0,0,0,140,141,5,23,0,0,141,25,1,0,0,0,142,143,5,46,0,0, + 143,144,5,19,0,0,144,145,3,36,18,0,145,27,1,0,0,0,146,147,5,36,0, + 0,147,148,3,46,23,0,148,29,1,0,0,0,149,150,5,37,0,0,150,151,3,46, + 23,0,151,31,1,0,0,0,152,153,5,34,0,0,153,154,3,36,18,0,154,33,1, + 0,0,0,155,156,5,46,0,0,156,157,5,19,0,0,157,162,3,4,2,0,158,159, + 5,46,0,0,159,160,5,19,0,0,160,162,3,36,18,0,161,155,1,0,0,0,161, + 158,1,0,0,0,162,35,1,0,0,0,163,167,3,38,19,0,164,167,3,42,21,0,165, + 167,3,44,22,0,166,163,1,0,0,0,166,164,1,0,0,0,166,165,1,0,0,0,167, + 37,1,0,0,0,168,169,5,26,0,0,169,174,3,40,20,0,170,171,5,20,0,0,171, + 173,3,40,20,0,172,170,1,0,0,0,173,176,1,0,0,0,174,172,1,0,0,0,174, + 175,1,0,0,0,175,177,1,0,0,0,176,174,1,0,0,0,177,178,5,27,0,0,178, + 182,1,0,0,0,179,180,5,26,0,0,180,182,5,27,0,0,181,168,1,0,0,0,181, + 179,1,0,0,0,182,39,1,0,0,0,183,184,7,0,0,0,184,185,5,21,0,0,185, + 186,3,36,18,0,186,41,1,0,0,0,187,188,5,24,0,0,188,193,3,36,18,0, + 189,190,5,20,0,0,190,192,3,36,18,0,191,189,1,0,0,0,192,195,1,0,0, + 0,193,191,1,0,0,0,193,194,1,0,0,0,194,196,1,0,0,0,195,193,1,0,0, + 0,196,197,5,25,0,0,197,201,1,0,0,0,198,199,5,24,0,0,199,201,5,25, + 0,0,200,187,1,0,0,0,200,198,1,0,0,0,201,43,1,0,0,0,202,209,5,45, + 0,0,203,209,5,44,0,0,204,209,7,1,0,0,205,209,5,30,0,0,206,209,5, + 43,0,0,207,209,5,2,0,0,208,202,1,0,0,0,208,203,1,0,0,0,208,204,1, + 0,0,0,208,205,1,0,0,0,208,206,1,0,0,0,208,207,1,0,0,0,209,45,1,0, + 0,0,210,213,5,43,0,0,211,213,5,2,0,0,212,210,1,0,0,0,212,211,1,0, + 0,0,213,47,1,0,0,0,214,215,7,2,0,0,215,49,1,0,0,0,19,53,55,70,81, + 87,90,95,109,120,126,137,161,166,174,181,193,200,208,212 + ] + +class LSLParser ( Parser ): + + grammarFileName = "LSLParser.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "", "", "'States.ALL'", + "'States.DataLimitExceeded'", "'States.HeartbeatTimeout'", + "'States.Timeout'", "'States.TaskFailed'", "'States.Permissions'", + "'States.ResultPathMatchFailure'", "'States.ParameterPathFailure'", + "'States.BranchFailed'", "'States.NoChoiceMatched'", + "'States.IntrinsicFailure'", "'States.ExceedToleratedFailureThreshold'", + "'States.ItemReaderFailed'", "'States.ResultWriterFailed'", + "'States.QueryEvaluationError'", "'->'", "'='", "','", + "':'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'true'", + "'false'", "'null'", "'where'", "'as'", "'fail'", "'output'", + "'succeed'", "'error'", "'cause'", "'lambda'", "'arguments'", + "'catch'" ] + + symbolicNames = [ "", "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", + "ERRORNAMEStatesDataLimitExceeded", "ERRORNAMEStatesHeartbeatTimeout", + "ERRORNAMEStatesTimeout", "ERRORNAMEStatesTaskFailed", + "ERRORNAMEStatesPermissions", "ERRORNAMEStatesResultPathMatchFailure", + "ERRORNAMEStatesParameterPathFailure", "ERRORNAMEStatesBranchFailed", + "ERRORNAMEStatesNoChoiceMatched", "ERRORNAMEStatesIntrinsicFailure", + "ERRORNAMEStatesExceedToleratedFailureThreshold", + "ERRORNAMEStatesItemReaderFailed", "ERRORNAMEStatesResultWriterFailed", + "ERRORNAMEStatesQueryEvaluationError", "ARROW", "EQUALS", + "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", + "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", + "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", + "LAMBDA", "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", + "STRING", "INT", "NUMBER", "IDEN", "WS", "TOK" ] + + RULE_state_machine = 0 + RULE_state_declaration = 1 + RULE_state_call = 2 + RULE_state = 3 + RULE_service_name = 4 + RULE_task_where = 5 + RULE_fail_where = 6 + RULE_succeed_where = 7 + RULE_arguments = 8 + RULE_catch_block = 9 + RULE_catch_case = 10 + RULE_parameter_list = 11 + RULE_args_assign_list = 12 + RULE_args_assign = 13 + RULE_error = 14 + RULE_cause = 15 + RULE_output_block = 16 + RULE_var_assign = 17 + RULE_json_value = 18 + RULE_json_object = 19 + RULE_json_binding = 20 + RULE_json_arr = 21 + RULE_json_value_lit = 22 + RULE_string_or_jsonata = 23 + RULE_error_name = 24 + + ruleNames = [ "state_machine", "state_declaration", "state_call", "state", + "service_name", "task_where", "fail_where", "succeed_where", + "arguments", "catch_block", "catch_case", "parameter_list", + "args_assign_list", "args_assign", "error", "cause", + "output_block", "var_assign", "json_value", "json_object", + "json_binding", "json_arr", "json_value_lit", "string_or_jsonata", + "error_name" ] + + EOF = Token.EOF + LINECOMMENT=1 + JSONATA=2 + ERRORNAMEStatesALL=3 + ERRORNAMEStatesDataLimitExceeded=4 + ERRORNAMEStatesHeartbeatTimeout=5 + ERRORNAMEStatesTimeout=6 + ERRORNAMEStatesTaskFailed=7 + ERRORNAMEStatesPermissions=8 + ERRORNAMEStatesResultPathMatchFailure=9 + ERRORNAMEStatesParameterPathFailure=10 + ERRORNAMEStatesBranchFailed=11 + ERRORNAMEStatesNoChoiceMatched=12 + ERRORNAMEStatesIntrinsicFailure=13 + ERRORNAMEStatesExceedToleratedFailureThreshold=14 + ERRORNAMEStatesItemReaderFailed=15 + ERRORNAMEStatesResultWriterFailed=16 + ERRORNAMEStatesQueryEvaluationError=17 + ARROW=18 + EQUALS=19 + COMMA=20 + COLON=21 + LPAREN=22 + RPAREN=23 + LBRACK=24 + RBRACK=25 + LBRACE=26 + RBRACE=27 + TRUE=28 + FALSE=29 + NULL=30 + WHERE=31 + AS=32 + FAIL=33 + OUTPUT=34 + SUCCEED=35 + ERROR=36 + CAUSE=37 + LAMBDA=38 + ARGUMENTS=39 + CATCH=40 + STRINGPATH=41 + VAR=42 + STRING=43 + INT=44 + NUMBER=45 + IDEN=46 + WS=47 + TOK=48 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.2") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class State_machineContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def EOF(self): + return self.getToken(LSLParser.EOF, 0) + + def state_declaration(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.State_declarationContext) + else: + return self.getTypedRuleContext(LSLParser.State_declarationContext,i) + + + def var_assign(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Var_assignContext) + else: + return self.getTypedRuleContext(LSLParser.Var_assignContext,i) + + + def state_call(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.State_callContext) + else: + return self.getTypedRuleContext(LSLParser.State_callContext,i) + + + def getRuleIndex(self): + return LSLParser.RULE_state_machine + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_machine" ): + listener.enterState_machine(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_machine" ): + listener.exitState_machine(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_machine" ): + return visitor.visitState_machine(self) + else: + return visitor.visitChildren(self) + + + + + def state_machine(self): + + localctx = LSLParser.State_machineContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_state_machine) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 53 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 53 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,0,self._ctx) + if la_ == 1: + self.state = 50 + self.state_declaration() + pass + + elif la_ == 2: + self.state = 51 + self.var_assign() + pass + + elif la_ == 3: + self.state = 52 + self.state_call() + pass + + + self.state = 55 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 70686571757568) != 0)): + break + + self.state = 57 + self.match(LSLParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class State_declarationContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + + def parameter_list(self): + return self.getTypedRuleContext(LSLParser.Parameter_listContext,0) + + + def EQUALS(self): + return self.getToken(LSLParser.EQUALS, 0) + + def state_(self): + return self.getTypedRuleContext(LSLParser.StateContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_state_declaration + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_declaration" ): + listener.enterState_declaration(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_declaration" ): + listener.exitState_declaration(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_declaration" ): + return visitor.visitState_declaration(self) + else: + return visitor.visitChildren(self) + + + + + def state_declaration(self): + + localctx = LSLParser.State_declarationContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_state_declaration) + try: + self.enterOuterAlt(localctx, 1) + self.state = 59 + self.match(LSLParser.IDEN) + self.state = 60 + self.parameter_list() + self.state = 61 + self.match(LSLParser.EQUALS) + self.state = 62 + self.state_() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class State_callContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return LSLParser.RULE_state_call + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class State_call_templateContext(State_callContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.State_callContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def args_assign_list(self): + return self.getTypedRuleContext(LSLParser.Args_assign_listContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_call_template" ): + listener.enterState_call_template(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_call_template" ): + listener.exitState_call_template(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_call_template" ): + return visitor.visitState_call_template(self) + else: + return visitor.visitChildren(self) + + + class State_call_anonymousContext(State_callContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.State_callContext + super().__init__(parser) + self.copyFrom(ctx) + + def state_(self): + return self.getTypedRuleContext(LSLParser.StateContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_call_anonymous" ): + listener.enterState_call_anonymous(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_call_anonymous" ): + listener.exitState_call_anonymous(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_call_anonymous" ): + return visitor.visitState_call_anonymous(self) + else: + return visitor.visitChildren(self) + + + class State_call_namedContext(State_callContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.State_callContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def AS(self): + return self.getToken(LSLParser.AS, 0) + def state_(self): + return self.getTypedRuleContext(LSLParser.StateContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_call_named" ): + listener.enterState_call_named(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_call_named" ): + listener.exitState_call_named(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_call_named" ): + return visitor.visitState_call_named(self) + else: + return visitor.visitChildren(self) + + + + def state_call(self): + + localctx = LSLParser.State_callContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_state_call) + try: + self.state = 70 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,2,self._ctx) + if la_ == 1: + localctx = LSLParser.State_call_templateContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 64 + self.match(LSLParser.IDEN) + self.state = 65 + self.args_assign_list() + pass + + elif la_ == 2: + localctx = LSLParser.State_call_namedContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 66 + self.match(LSLParser.IDEN) + self.state = 67 + self.match(LSLParser.AS) + self.state = 68 + self.state_() + pass + + elif la_ == 3: + localctx = LSLParser.State_call_anonymousContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 69 + self.state_() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class StateContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return LSLParser.RULE_state + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class State_failContext(StateContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext + super().__init__(parser) + self.copyFrom(ctx) + + def FAIL(self): + return self.getToken(LSLParser.FAIL, 0) + def fail_where(self): + return self.getTypedRuleContext(LSLParser.Fail_whereContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_fail" ): + listener.enterState_fail(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_fail" ): + listener.exitState_fail(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_fail" ): + return visitor.visitState_fail(self) + else: + return visitor.visitChildren(self) + + + class State_succeedContext(StateContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext + super().__init__(parser) + self.copyFrom(ctx) + + def SUCCEED(self): + return self.getToken(LSLParser.SUCCEED, 0) + def succeed_where(self): + return self.getTypedRuleContext(LSLParser.Succeed_whereContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_succeed" ): + listener.enterState_succeed(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_succeed" ): + listener.exitState_succeed(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_succeed" ): + return visitor.visitState_succeed(self) + else: + return visitor.visitChildren(self) + + + class State_taskContext(StateContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext + super().__init__(parser) + self.copyFrom(ctx) + + def service_name(self): + return self.getTypedRuleContext(LSLParser.Service_nameContext,0) + + def COLON(self): + return self.getToken(LSLParser.COLON, 0) + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def task_where(self): + return self.getTypedRuleContext(LSLParser.Task_whereContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_task" ): + listener.enterState_task(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_task" ): + listener.exitState_task(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_task" ): + return visitor.visitState_task(self) + else: + return visitor.visitChildren(self) + + + + def state_(self): + + localctx = LSLParser.StateContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_state) + try: + self.state = 81 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [38]: + localctx = LSLParser.State_taskContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 72 + self.service_name() + self.state = 73 + self.match(LSLParser.COLON) + self.state = 74 + self.match(LSLParser.IDEN) + self.state = 75 + self.task_where() + pass + elif token in [33]: + localctx = LSLParser.State_failContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 77 + self.match(LSLParser.FAIL) + self.state = 78 + self.fail_where() + pass + elif token in [35]: + localctx = LSLParser.State_succeedContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 79 + self.match(LSLParser.SUCCEED) + self.state = 80 + self.succeed_where() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Service_nameContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LAMBDA(self): + return self.getToken(LSLParser.LAMBDA, 0) + + def getRuleIndex(self): + return LSLParser.RULE_service_name + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterService_name" ): + listener.enterService_name(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitService_name" ): + listener.exitService_name(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitService_name" ): + return visitor.visitService_name(self) + else: + return visitor.visitChildren(self) + + + + + def service_name(self): + + localctx = LSLParser.Service_nameContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_service_name) + try: + self.enterOuterAlt(localctx, 1) + self.state = 83 + self.match(LSLParser.LAMBDA) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Task_whereContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def WHERE(self): + return self.getToken(LSLParser.WHERE, 0) + + def arguments(self): + return self.getTypedRuleContext(LSLParser.ArgumentsContext,0) + + + def catch_block(self): + return self.getTypedRuleContext(LSLParser.Catch_blockContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_task_where + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTask_where" ): + listener.enterTask_where(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTask_where" ): + listener.exitTask_where(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTask_where" ): + return visitor.visitTask_where(self) + else: + return visitor.visitChildren(self) + + + + + def task_where(self): + + localctx = LSLParser.Task_whereContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_task_where) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 85 + self.match(LSLParser.WHERE) + self.state = 87 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==39: + self.state = 86 + self.arguments() + + + self.state = 90 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==40: + self.state = 89 + self.catch_block() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Fail_whereContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def WHERE(self): + return self.getToken(LSLParser.WHERE, 0) + + def error(self): + return self.getTypedRuleContext(LSLParser.ErrorContext,0) + + + def cause(self): + return self.getTypedRuleContext(LSLParser.CauseContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_fail_where + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterFail_where" ): + listener.enterFail_where(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitFail_where" ): + listener.exitFail_where(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitFail_where" ): + return visitor.visitFail_where(self) + else: + return visitor.visitChildren(self) + + + + + def fail_where(self): + + localctx = LSLParser.Fail_whereContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_fail_where) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 92 + self.match(LSLParser.WHERE) + self.state = 93 + self.error() + self.state = 95 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==37: + self.state = 94 + self.cause() + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Succeed_whereContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def WHERE(self): + return self.getToken(LSLParser.WHERE, 0) + + def output_block(self): + return self.getTypedRuleContext(LSLParser.Output_blockContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_succeed_where + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSucceed_where" ): + listener.enterSucceed_where(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSucceed_where" ): + listener.exitSucceed_where(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSucceed_where" ): + return visitor.visitSucceed_where(self) + else: + return visitor.visitChildren(self) + + + + + def succeed_where(self): + + localctx = LSLParser.Succeed_whereContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_succeed_where) + try: + self.enterOuterAlt(localctx, 1) + self.state = 97 + self.match(LSLParser.WHERE) + self.state = 98 + self.output_block() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ArgumentsContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ARGUMENTS(self): + return self.getToken(LSLParser.ARGUMENTS, 0) + + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_arguments + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArguments" ): + listener.enterArguments(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArguments" ): + listener.exitArguments(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArguments" ): + return visitor.visitArguments(self) + else: + return visitor.visitChildren(self) + + + + + def arguments(self): + + localctx = LSLParser.ArgumentsContext(self, self._ctx, self.state) + self.enterRule(localctx, 16, self.RULE_arguments) + try: + self.enterOuterAlt(localctx, 1) + self.state = 100 + self.match(LSLParser.ARGUMENTS) + self.state = 101 + self.json_value() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Catch_blockContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def CATCH(self): + return self.getToken(LSLParser.CATCH, 0) + + def LBRACE(self): + return self.getToken(LSLParser.LBRACE, 0) + + def catch_case(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Catch_caseContext) + else: + return self.getTypedRuleContext(LSLParser.Catch_caseContext,i) + + + def RBRACE(self): + return self.getToken(LSLParser.RBRACE, 0) + + def getRuleIndex(self): + return LSLParser.RULE_catch_block + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCatch_block" ): + listener.enterCatch_block(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCatch_block" ): + listener.exitCatch_block(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCatch_block" ): + return visitor.visitCatch_block(self) + else: + return visitor.visitChildren(self) + + + + + def catch_block(self): + + localctx = LSLParser.Catch_blockContext(self, self._ctx, self.state) + self.enterRule(localctx, 18, self.RULE_catch_block) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 103 + self.match(LSLParser.CATCH) + self.state = 104 + self.match(LSLParser.LBRACE) + self.state = 105 + self.catch_case() + self.state = 109 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0): + self.state = 106 + self.catch_case() + self.state = 111 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 112 + self.match(LSLParser.RBRACE) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Catch_caseContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def error_name(self): + return self.getTypedRuleContext(LSLParser.Error_nameContext,0) + + + def ARROW(self): + return self.getToken(LSLParser.ARROW, 0) + + def state_call(self): + return self.getTypedRuleContext(LSLParser.State_callContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_catch_case + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCatch_case" ): + listener.enterCatch_case(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCatch_case" ): + listener.exitCatch_case(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCatch_case" ): + return visitor.visitCatch_case(self) + else: + return visitor.visitChildren(self) + + + + + def catch_case(self): + + localctx = LSLParser.Catch_caseContext(self, self._ctx, self.state) + self.enterRule(localctx, 20, self.RULE_catch_case) + try: + self.enterOuterAlt(localctx, 1) + self.state = 114 + self.error_name() + self.state = 115 + self.match(LSLParser.ARROW) + self.state = 116 + self.state_call() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Parameter_listContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LPAREN(self): + return self.getToken(LSLParser.LPAREN, 0) + + def RPAREN(self): + return self.getToken(LSLParser.RPAREN, 0) + + def IDEN(self, i:int=None): + if i is None: + return self.getTokens(LSLParser.IDEN) + else: + return self.getToken(LSLParser.IDEN, i) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(LSLParser.COMMA) + else: + return self.getToken(LSLParser.COMMA, i) + + def getRuleIndex(self): + return LSLParser.RULE_parameter_list + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterParameter_list" ): + listener.enterParameter_list(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitParameter_list" ): + listener.exitParameter_list(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitParameter_list" ): + return visitor.visitParameter_list(self) + else: + return visitor.visitChildren(self) + + + + + def parameter_list(self): + + localctx = LSLParser.Parameter_listContext(self, self._ctx, self.state) + self.enterRule(localctx, 22, self.RULE_parameter_list) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 118 + self.match(LSLParser.LPAREN) + self.state = 120 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==46: + self.state = 119 + self.match(LSLParser.IDEN) + + + self.state = 126 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==20: + self.state = 122 + self.match(LSLParser.COMMA) + self.state = 123 + self.match(LSLParser.IDEN) + self.state = 128 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 129 + self.match(LSLParser.RPAREN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Args_assign_listContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LPAREN(self): + return self.getToken(LSLParser.LPAREN, 0) + + def args_assign(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Args_assignContext) + else: + return self.getTypedRuleContext(LSLParser.Args_assignContext,i) + + + def RPAREN(self): + return self.getToken(LSLParser.RPAREN, 0) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(LSLParser.COMMA) + else: + return self.getToken(LSLParser.COMMA, i) + + def getRuleIndex(self): + return LSLParser.RULE_args_assign_list + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArgs_assign_list" ): + listener.enterArgs_assign_list(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArgs_assign_list" ): + listener.exitArgs_assign_list(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArgs_assign_list" ): + return visitor.visitArgs_assign_list(self) + else: + return visitor.visitChildren(self) + + + + + def args_assign_list(self): + + localctx = LSLParser.Args_assign_listContext(self, self._ctx, self.state) + self.enterRule(localctx, 24, self.RULE_args_assign_list) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 131 + self.match(LSLParser.LPAREN) + self.state = 132 + self.args_assign() + self.state = 137 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==20: + self.state = 133 + self.match(LSLParser.COMMA) + self.state = 134 + self.args_assign() + self.state = 139 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 140 + self.match(LSLParser.RPAREN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Args_assignContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + + def EQUALS(self): + return self.getToken(LSLParser.EQUALS, 0) + + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_args_assign + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterArgs_assign" ): + listener.enterArgs_assign(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitArgs_assign" ): + listener.exitArgs_assign(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitArgs_assign" ): + return visitor.visitArgs_assign(self) + else: + return visitor.visitChildren(self) + + + + + def args_assign(self): + + localctx = LSLParser.Args_assignContext(self, self._ctx, self.state) + self.enterRule(localctx, 26, self.RULE_args_assign) + try: + self.enterOuterAlt(localctx, 1) + self.state = 142 + self.match(LSLParser.IDEN) + self.state = 143 + self.match(LSLParser.EQUALS) + self.state = 144 + self.json_value() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ErrorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ERROR(self): + return self.getToken(LSLParser.ERROR, 0) + + def string_or_jsonata(self): + return self.getTypedRuleContext(LSLParser.String_or_jsonataContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_error + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterError" ): + listener.enterError(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitError" ): + listener.exitError(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitError" ): + return visitor.visitError(self) + else: + return visitor.visitChildren(self) + + + + + def error(self): + + localctx = LSLParser.ErrorContext(self, self._ctx, self.state) + self.enterRule(localctx, 28, self.RULE_error) + try: + self.enterOuterAlt(localctx, 1) + self.state = 146 + self.match(LSLParser.ERROR) + self.state = 147 + self.string_or_jsonata() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class CauseContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def CAUSE(self): + return self.getToken(LSLParser.CAUSE, 0) + + def string_or_jsonata(self): + return self.getTypedRuleContext(LSLParser.String_or_jsonataContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_cause + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCause" ): + listener.enterCause(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCause" ): + listener.exitCause(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCause" ): + return visitor.visitCause(self) + else: + return visitor.visitChildren(self) + + + + + def cause(self): + + localctx = LSLParser.CauseContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_cause) + try: + self.enterOuterAlt(localctx, 1) + self.state = 149 + self.match(LSLParser.CAUSE) + self.state = 150 + self.string_or_jsonata() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Output_blockContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def OUTPUT(self): + return self.getToken(LSLParser.OUTPUT, 0) + + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_output_block + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterOutput_block" ): + listener.enterOutput_block(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitOutput_block" ): + listener.exitOutput_block(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitOutput_block" ): + return visitor.visitOutput_block(self) + else: + return visitor.visitChildren(self) + + + + + def output_block(self): + + localctx = LSLParser.Output_blockContext(self, self._ctx, self.state) + self.enterRule(localctx, 32, self.RULE_output_block) + try: + self.enterOuterAlt(localctx, 1) + self.state = 152 + self.match(LSLParser.OUTPUT) + self.state = 153 + self.json_value() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Var_assignContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return LSLParser.RULE_var_assign + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Var_assign_state_callContext(Var_assignContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Var_assignContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def EQUALS(self): + return self.getToken(LSLParser.EQUALS, 0) + def state_call(self): + return self.getTypedRuleContext(LSLParser.State_callContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterVar_assign_state_call" ): + listener.enterVar_assign_state_call(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitVar_assign_state_call" ): + listener.exitVar_assign_state_call(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitVar_assign_state_call" ): + return visitor.visitVar_assign_state_call(self) + else: + return visitor.visitChildren(self) + + + class Var_assign_json_valueContext(Var_assignContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Var_assignContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def EQUALS(self): + return self.getToken(LSLParser.EQUALS, 0) + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterVar_assign_json_value" ): + listener.enterVar_assign_json_value(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitVar_assign_json_value" ): + listener.exitVar_assign_json_value(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitVar_assign_json_value" ): + return visitor.visitVar_assign_json_value(self) + else: + return visitor.visitChildren(self) + + + + def var_assign(self): + + localctx = LSLParser.Var_assignContext(self, self._ctx, self.state) + self.enterRule(localctx, 34, self.RULE_var_assign) + try: + self.state = 161 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,11,self._ctx) + if la_ == 1: + localctx = LSLParser.Var_assign_state_callContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 155 + self.match(LSLParser.IDEN) + self.state = 156 + self.match(LSLParser.EQUALS) + self.state = 157 + self.state_call() + pass + + elif la_ == 2: + localctx = LSLParser.Var_assign_json_valueContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 158 + self.match(LSLParser.IDEN) + self.state = 159 + self.match(LSLParser.EQUALS) + self.state = 160 + self.json_value() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Json_valueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def json_object(self): + return self.getTypedRuleContext(LSLParser.Json_objectContext,0) + + + def json_arr(self): + return self.getTypedRuleContext(LSLParser.Json_arrContext,0) + + + def json_value_lit(self): + return self.getTypedRuleContext(LSLParser.Json_value_litContext,0) + + + def getRuleIndex(self): + return LSLParser.RULE_json_value + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value" ): + listener.enterJson_value(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value" ): + listener.exitJson_value(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value" ): + return visitor.visitJson_value(self) + else: + return visitor.visitChildren(self) + + + + + def json_value(self): + + localctx = LSLParser.Json_valueContext(self, self._ctx, self.state) + self.enterRule(localctx, 36, self.RULE_json_value) + try: + self.state = 166 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [26]: + self.enterOuterAlt(localctx, 1) + self.state = 163 + self.json_object() + pass + elif token in [24]: + self.enterOuterAlt(localctx, 2) + self.state = 164 + self.json_arr() + pass + elif token in [2, 28, 29, 30, 43, 44, 45]: + self.enterOuterAlt(localctx, 3) + self.state = 165 + self.json_value_lit() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Json_objectContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LBRACE(self): + return self.getToken(LSLParser.LBRACE, 0) + + def json_binding(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Json_bindingContext) + else: + return self.getTypedRuleContext(LSLParser.Json_bindingContext,i) + + + def RBRACE(self): + return self.getToken(LSLParser.RBRACE, 0) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(LSLParser.COMMA) + else: + return self.getToken(LSLParser.COMMA, i) + + def getRuleIndex(self): + return LSLParser.RULE_json_object + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_object" ): + listener.enterJson_object(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_object" ): + listener.exitJson_object(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_object" ): + return visitor.visitJson_object(self) + else: + return visitor.visitChildren(self) + + + + + def json_object(self): + + localctx = LSLParser.Json_objectContext(self, self._ctx, self.state) + self.enterRule(localctx, 38, self.RULE_json_object) + self._la = 0 # Token type + try: + self.state = 181 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,14,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 168 + self.match(LSLParser.LBRACE) + self.state = 169 + self.json_binding() + self.state = 174 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==20: + self.state = 170 + self.match(LSLParser.COMMA) + self.state = 171 + self.json_binding() + self.state = 176 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 177 + self.match(LSLParser.RBRACE) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 179 + self.match(LSLParser.LBRACE) + self.state = 180 + self.match(LSLParser.RBRACE) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Json_bindingContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def COLON(self): + return self.getToken(LSLParser.COLON, 0) + + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + + def STRING(self): + return self.getToken(LSLParser.STRING, 0) + + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + + def getRuleIndex(self): + return LSLParser.RULE_json_binding + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_binding" ): + listener.enterJson_binding(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_binding" ): + listener.exitJson_binding(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_binding" ): + return visitor.visitJson_binding(self) + else: + return visitor.visitChildren(self) + + + + + def json_binding(self): + + localctx = LSLParser.Json_bindingContext(self, self._ctx, self.state) + self.enterRule(localctx, 40, self.RULE_json_binding) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 183 + _la = self._input.LA(1) + if not(_la==43 or _la==46): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 184 + self.match(LSLParser.COLON) + self.state = 185 + self.json_value() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Json_arrContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LBRACK(self): + return self.getToken(LSLParser.LBRACK, 0) + + def json_value(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Json_valueContext) + else: + return self.getTypedRuleContext(LSLParser.Json_valueContext,i) + + + def RBRACK(self): + return self.getToken(LSLParser.RBRACK, 0) + + def COMMA(self, i:int=None): + if i is None: + return self.getTokens(LSLParser.COMMA) + else: + return self.getToken(LSLParser.COMMA, i) + + def getRuleIndex(self): + return LSLParser.RULE_json_arr + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_arr" ): + listener.enterJson_arr(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_arr" ): + listener.exitJson_arr(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_arr" ): + return visitor.visitJson_arr(self) + else: + return visitor.visitChildren(self) + + + + + def json_arr(self): + + localctx = LSLParser.Json_arrContext(self, self._ctx, self.state) + self.enterRule(localctx, 42, self.RULE_json_arr) + self._la = 0 # Token type + try: + self.state = 200 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,16,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 187 + self.match(LSLParser.LBRACK) + self.state = 188 + self.json_value() + self.state = 193 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==20: + self.state = 189 + self.match(LSLParser.COMMA) + self.state = 190 + self.json_value() + self.state = 195 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 196 + self.match(LSLParser.RBRACK) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 198 + self.match(LSLParser.LBRACK) + self.state = 199 + self.match(LSLParser.RBRACK) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Json_value_litContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return LSLParser.RULE_json_value_lit + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class Json_value_strContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def STRING(self): + return self.getToken(LSLParser.STRING, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_str" ): + listener.enterJson_value_str(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_str" ): + listener.exitJson_value_str(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_str" ): + return visitor.visitJson_value_str(self) + else: + return visitor.visitChildren(self) + + + class Json_value_floatContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def NUMBER(self): + return self.getToken(LSLParser.NUMBER, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_float" ): + listener.enterJson_value_float(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_float" ): + listener.exitJson_value_float(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_float" ): + return visitor.visitJson_value_float(self) + else: + return visitor.visitChildren(self) + + + class Json_value_intContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def INT(self): + return self.getToken(LSLParser.INT, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_int" ): + listener.enterJson_value_int(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_int" ): + listener.exitJson_value_int(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_int" ): + return visitor.visitJson_value_int(self) + else: + return visitor.visitChildren(self) + + + class Json_value_nullContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def NULL(self): + return self.getToken(LSLParser.NULL, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_null" ): + listener.enterJson_value_null(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_null" ): + listener.exitJson_value_null(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_null" ): + return visitor.visitJson_value_null(self) + else: + return visitor.visitChildren(self) + + + class Json_value_jsonataContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def JSONATA(self): + return self.getToken(LSLParser.JSONATA, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_jsonata" ): + listener.enterJson_value_jsonata(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_jsonata" ): + listener.exitJson_value_jsonata(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_jsonata" ): + return visitor.visitJson_value_jsonata(self) + else: + return visitor.visitChildren(self) + + + class Json_value_boolContext(Json_value_litContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.Json_value_litContext + super().__init__(parser) + self.copyFrom(ctx) + + def TRUE(self): + return self.getToken(LSLParser.TRUE, 0) + def FALSE(self): + return self.getToken(LSLParser.FALSE, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJson_value_bool" ): + listener.enterJson_value_bool(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJson_value_bool" ): + listener.exitJson_value_bool(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitJson_value_bool" ): + return visitor.visitJson_value_bool(self) + else: + return visitor.visitChildren(self) + + + + def json_value_lit(self): + + localctx = LSLParser.Json_value_litContext(self, self._ctx, self.state) + self.enterRule(localctx, 44, self.RULE_json_value_lit) + self._la = 0 # Token type + try: + self.state = 208 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [45]: + localctx = LSLParser.Json_value_floatContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 202 + self.match(LSLParser.NUMBER) + pass + elif token in [44]: + localctx = LSLParser.Json_value_intContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 203 + self.match(LSLParser.INT) + pass + elif token in [28, 29]: + localctx = LSLParser.Json_value_boolContext(self, localctx) + self.enterOuterAlt(localctx, 3) + self.state = 204 + _la = self._input.LA(1) + if not(_la==28 or _la==29): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + pass + elif token in [30]: + localctx = LSLParser.Json_value_nullContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 205 + self.match(LSLParser.NULL) + pass + elif token in [43]: + localctx = LSLParser.Json_value_strContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 206 + self.match(LSLParser.STRING) + pass + elif token in [2]: + localctx = LSLParser.Json_value_jsonataContext(self, localctx) + self.enterOuterAlt(localctx, 6) + self.state = 207 + self.match(LSLParser.JSONATA) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class String_or_jsonataContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + + def getRuleIndex(self): + return LSLParser.RULE_string_or_jsonata + + + def copyFrom(self, ctx:ParserRuleContext): + super().copyFrom(ctx) + + + + class String_or_jsonata_jsonataContext(String_or_jsonataContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.String_or_jsonataContext + super().__init__(parser) + self.copyFrom(ctx) + + def JSONATA(self): + return self.getToken(LSLParser.JSONATA, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString_or_jsonata_jsonata" ): + listener.enterString_or_jsonata_jsonata(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString_or_jsonata_jsonata" ): + listener.exitString_or_jsonata_jsonata(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString_or_jsonata_jsonata" ): + return visitor.visitString_or_jsonata_jsonata(self) + else: + return visitor.visitChildren(self) + + + class String_or_jsonata_stringContext(String_or_jsonataContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.String_or_jsonataContext + super().__init__(parser) + self.copyFrom(ctx) + + def STRING(self): + return self.getToken(LSLParser.STRING, 0) + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterString_or_jsonata_string" ): + listener.enterString_or_jsonata_string(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitString_or_jsonata_string" ): + listener.exitString_or_jsonata_string(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitString_or_jsonata_string" ): + return visitor.visitString_or_jsonata_string(self) + else: + return visitor.visitChildren(self) + + + + def string_or_jsonata(self): + + localctx = LSLParser.String_or_jsonataContext(self, self._ctx, self.state) + self.enterRule(localctx, 46, self.RULE_string_or_jsonata) + try: + self.state = 212 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [43]: + localctx = LSLParser.String_or_jsonata_stringContext(self, localctx) + self.enterOuterAlt(localctx, 1) + self.state = 210 + self.match(LSLParser.STRING) + pass + elif token in [2]: + localctx = LSLParser.String_or_jsonata_jsonataContext(self, localctx) + self.enterOuterAlt(localctx, 2) + self.state = 211 + self.match(LSLParser.JSONATA) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Error_nameContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ERRORNAMEStatesALL(self): + return self.getToken(LSLParser.ERRORNAMEStatesALL, 0) + + def ERRORNAMEStatesDataLimitExceeded(self): + return self.getToken(LSLParser.ERRORNAMEStatesDataLimitExceeded, 0) + + def ERRORNAMEStatesHeartbeatTimeout(self): + return self.getToken(LSLParser.ERRORNAMEStatesHeartbeatTimeout, 0) + + def ERRORNAMEStatesTimeout(self): + return self.getToken(LSLParser.ERRORNAMEStatesTimeout, 0) + + def ERRORNAMEStatesTaskFailed(self): + return self.getToken(LSLParser.ERRORNAMEStatesTaskFailed, 0) + + def ERRORNAMEStatesPermissions(self): + return self.getToken(LSLParser.ERRORNAMEStatesPermissions, 0) + + def ERRORNAMEStatesResultPathMatchFailure(self): + return self.getToken(LSLParser.ERRORNAMEStatesResultPathMatchFailure, 0) + + def ERRORNAMEStatesParameterPathFailure(self): + return self.getToken(LSLParser.ERRORNAMEStatesParameterPathFailure, 0) + + def ERRORNAMEStatesBranchFailed(self): + return self.getToken(LSLParser.ERRORNAMEStatesBranchFailed, 0) + + def ERRORNAMEStatesNoChoiceMatched(self): + return self.getToken(LSLParser.ERRORNAMEStatesNoChoiceMatched, 0) + + def ERRORNAMEStatesIntrinsicFailure(self): + return self.getToken(LSLParser.ERRORNAMEStatesIntrinsicFailure, 0) + + def ERRORNAMEStatesExceedToleratedFailureThreshold(self): + return self.getToken(LSLParser.ERRORNAMEStatesExceedToleratedFailureThreshold, 0) + + def ERRORNAMEStatesItemReaderFailed(self): + return self.getToken(LSLParser.ERRORNAMEStatesItemReaderFailed, 0) + + def ERRORNAMEStatesResultWriterFailed(self): + return self.getToken(LSLParser.ERRORNAMEStatesResultWriterFailed, 0) + + def ERRORNAMEStatesQueryEvaluationError(self): + return self.getToken(LSLParser.ERRORNAMEStatesQueryEvaluationError, 0) + + def STRING(self): + return self.getToken(LSLParser.STRING, 0) + + def getRuleIndex(self): + return LSLParser.RULE_error_name + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterError_name" ): + listener.enterError_name(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitError_name" ): + listener.exitError_name(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitError_name" ): + return visitor.visitError_name(self) + else: + return visitor.visitChildren(self) + + + + + def error_name(self): + + localctx = LSLParser.Error_nameContext(self, self._ctx, self.state) + self.enterRule(localctx, 48, self.RULE_error_name) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 214 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + + diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py new file mode 100644 index 0000000000000..5a894e10029b6 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py @@ -0,0 +1,336 @@ +# Generated from LSLParser.g4 by ANTLR 4.13.2 +from antlr4 import * +if "." in __name__: + from .LSLParser import LSLParser +else: + from LSLParser import LSLParser + +# This class defines a complete listener for a parse tree produced by LSLParser. +class LSLParserListener(ParseTreeListener): + + # Enter a parse tree produced by LSLParser#state_machine. + def enterState_machine(self, ctx:LSLParser.State_machineContext): + pass + + # Exit a parse tree produced by LSLParser#state_machine. + def exitState_machine(self, ctx:LSLParser.State_machineContext): + pass + + + # Enter a parse tree produced by LSLParser#state_declaration. + def enterState_declaration(self, ctx:LSLParser.State_declarationContext): + pass + + # Exit a parse tree produced by LSLParser#state_declaration. + def exitState_declaration(self, ctx:LSLParser.State_declarationContext): + pass + + + # Enter a parse tree produced by LSLParser#state_call_template. + def enterState_call_template(self, ctx:LSLParser.State_call_templateContext): + pass + + # Exit a parse tree produced by LSLParser#state_call_template. + def exitState_call_template(self, ctx:LSLParser.State_call_templateContext): + pass + + + # Enter a parse tree produced by LSLParser#state_call_named. + def enterState_call_named(self, ctx:LSLParser.State_call_namedContext): + pass + + # Exit a parse tree produced by LSLParser#state_call_named. + def exitState_call_named(self, ctx:LSLParser.State_call_namedContext): + pass + + + # Enter a parse tree produced by LSLParser#state_call_anonymous. + def enterState_call_anonymous(self, ctx:LSLParser.State_call_anonymousContext): + pass + + # Exit a parse tree produced by LSLParser#state_call_anonymous. + def exitState_call_anonymous(self, ctx:LSLParser.State_call_anonymousContext): + pass + + + # Enter a parse tree produced by LSLParser#state_task. + def enterState_task(self, ctx:LSLParser.State_taskContext): + pass + + # Exit a parse tree produced by LSLParser#state_task. + def exitState_task(self, ctx:LSLParser.State_taskContext): + pass + + + # Enter a parse tree produced by LSLParser#state_fail. + def enterState_fail(self, ctx:LSLParser.State_failContext): + pass + + # Exit a parse tree produced by LSLParser#state_fail. + def exitState_fail(self, ctx:LSLParser.State_failContext): + pass + + + # Enter a parse tree produced by LSLParser#state_succeed. + def enterState_succeed(self, ctx:LSLParser.State_succeedContext): + pass + + # Exit a parse tree produced by LSLParser#state_succeed. + def exitState_succeed(self, ctx:LSLParser.State_succeedContext): + pass + + + # Enter a parse tree produced by LSLParser#service_name. + def enterService_name(self, ctx:LSLParser.Service_nameContext): + pass + + # Exit a parse tree produced by LSLParser#service_name. + def exitService_name(self, ctx:LSLParser.Service_nameContext): + pass + + + # Enter a parse tree produced by LSLParser#task_where. + def enterTask_where(self, ctx:LSLParser.Task_whereContext): + pass + + # Exit a parse tree produced by LSLParser#task_where. + def exitTask_where(self, ctx:LSLParser.Task_whereContext): + pass + + + # Enter a parse tree produced by LSLParser#fail_where. + def enterFail_where(self, ctx:LSLParser.Fail_whereContext): + pass + + # Exit a parse tree produced by LSLParser#fail_where. + def exitFail_where(self, ctx:LSLParser.Fail_whereContext): + pass + + + # Enter a parse tree produced by LSLParser#succeed_where. + def enterSucceed_where(self, ctx:LSLParser.Succeed_whereContext): + pass + + # Exit a parse tree produced by LSLParser#succeed_where. + def exitSucceed_where(self, ctx:LSLParser.Succeed_whereContext): + pass + + + # Enter a parse tree produced by LSLParser#arguments. + def enterArguments(self, ctx:LSLParser.ArgumentsContext): + pass + + # Exit a parse tree produced by LSLParser#arguments. + def exitArguments(self, ctx:LSLParser.ArgumentsContext): + pass + + + # Enter a parse tree produced by LSLParser#catch_block. + def enterCatch_block(self, ctx:LSLParser.Catch_blockContext): + pass + + # Exit a parse tree produced by LSLParser#catch_block. + def exitCatch_block(self, ctx:LSLParser.Catch_blockContext): + pass + + + # Enter a parse tree produced by LSLParser#catch_case. + def enterCatch_case(self, ctx:LSLParser.Catch_caseContext): + pass + + # Exit a parse tree produced by LSLParser#catch_case. + def exitCatch_case(self, ctx:LSLParser.Catch_caseContext): + pass + + + # Enter a parse tree produced by LSLParser#parameter_list. + def enterParameter_list(self, ctx:LSLParser.Parameter_listContext): + pass + + # Exit a parse tree produced by LSLParser#parameter_list. + def exitParameter_list(self, ctx:LSLParser.Parameter_listContext): + pass + + + # Enter a parse tree produced by LSLParser#args_assign_list. + def enterArgs_assign_list(self, ctx:LSLParser.Args_assign_listContext): + pass + + # Exit a parse tree produced by LSLParser#args_assign_list. + def exitArgs_assign_list(self, ctx:LSLParser.Args_assign_listContext): + pass + + + # Enter a parse tree produced by LSLParser#args_assign. + def enterArgs_assign(self, ctx:LSLParser.Args_assignContext): + pass + + # Exit a parse tree produced by LSLParser#args_assign. + def exitArgs_assign(self, ctx:LSLParser.Args_assignContext): + pass + + + # Enter a parse tree produced by LSLParser#error. + def enterError(self, ctx:LSLParser.ErrorContext): + pass + + # Exit a parse tree produced by LSLParser#error. + def exitError(self, ctx:LSLParser.ErrorContext): + pass + + + # Enter a parse tree produced by LSLParser#cause. + def enterCause(self, ctx:LSLParser.CauseContext): + pass + + # Exit a parse tree produced by LSLParser#cause. + def exitCause(self, ctx:LSLParser.CauseContext): + pass + + + # Enter a parse tree produced by LSLParser#output_block. + def enterOutput_block(self, ctx:LSLParser.Output_blockContext): + pass + + # Exit a parse tree produced by LSLParser#output_block. + def exitOutput_block(self, ctx:LSLParser.Output_blockContext): + pass + + + # Enter a parse tree produced by LSLParser#var_assign_state_call. + def enterVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): + pass + + # Exit a parse tree produced by LSLParser#var_assign_state_call. + def exitVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): + pass + + + # Enter a parse tree produced by LSLParser#var_assign_json_value. + def enterVar_assign_json_value(self, ctx:LSLParser.Var_assign_json_valueContext): + pass + + # Exit a parse tree produced by LSLParser#var_assign_json_value. + def exitVar_assign_json_value(self, ctx:LSLParser.Var_assign_json_valueContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value. + def enterJson_value(self, ctx:LSLParser.Json_valueContext): + pass + + # Exit a parse tree produced by LSLParser#json_value. + def exitJson_value(self, ctx:LSLParser.Json_valueContext): + pass + + + # Enter a parse tree produced by LSLParser#json_object. + def enterJson_object(self, ctx:LSLParser.Json_objectContext): + pass + + # Exit a parse tree produced by LSLParser#json_object. + def exitJson_object(self, ctx:LSLParser.Json_objectContext): + pass + + + # Enter a parse tree produced by LSLParser#json_binding. + def enterJson_binding(self, ctx:LSLParser.Json_bindingContext): + pass + + # Exit a parse tree produced by LSLParser#json_binding. + def exitJson_binding(self, ctx:LSLParser.Json_bindingContext): + pass + + + # Enter a parse tree produced by LSLParser#json_arr. + def enterJson_arr(self, ctx:LSLParser.Json_arrContext): + pass + + # Exit a parse tree produced by LSLParser#json_arr. + def exitJson_arr(self, ctx:LSLParser.Json_arrContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_float. + def enterJson_value_float(self, ctx:LSLParser.Json_value_floatContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_float. + def exitJson_value_float(self, ctx:LSLParser.Json_value_floatContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_int. + def enterJson_value_int(self, ctx:LSLParser.Json_value_intContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_int. + def exitJson_value_int(self, ctx:LSLParser.Json_value_intContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_bool. + def enterJson_value_bool(self, ctx:LSLParser.Json_value_boolContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_bool. + def exitJson_value_bool(self, ctx:LSLParser.Json_value_boolContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_null. + def enterJson_value_null(self, ctx:LSLParser.Json_value_nullContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_null. + def exitJson_value_null(self, ctx:LSLParser.Json_value_nullContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_str. + def enterJson_value_str(self, ctx:LSLParser.Json_value_strContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_str. + def exitJson_value_str(self, ctx:LSLParser.Json_value_strContext): + pass + + + # Enter a parse tree produced by LSLParser#json_value_jsonata. + def enterJson_value_jsonata(self, ctx:LSLParser.Json_value_jsonataContext): + pass + + # Exit a parse tree produced by LSLParser#json_value_jsonata. + def exitJson_value_jsonata(self, ctx:LSLParser.Json_value_jsonataContext): + pass + + + # Enter a parse tree produced by LSLParser#string_or_jsonata_string. + def enterString_or_jsonata_string(self, ctx:LSLParser.String_or_jsonata_stringContext): + pass + + # Exit a parse tree produced by LSLParser#string_or_jsonata_string. + def exitString_or_jsonata_string(self, ctx:LSLParser.String_or_jsonata_stringContext): + pass + + + # Enter a parse tree produced by LSLParser#string_or_jsonata_jsonata. + def enterString_or_jsonata_jsonata(self, ctx:LSLParser.String_or_jsonata_jsonataContext): + pass + + # Exit a parse tree produced by LSLParser#string_or_jsonata_jsonata. + def exitString_or_jsonata_jsonata(self, ctx:LSLParser.String_or_jsonata_jsonataContext): + pass + + + # Enter a parse tree produced by LSLParser#error_name. + def enterError_name(self, ctx:LSLParser.Error_nameContext): + pass + + # Exit a parse tree produced by LSLParser#error_name. + def exitError_name(self, ctx:LSLParser.Error_nameContext): + pass + + + +del LSLParser \ No newline at end of file diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py new file mode 100644 index 0000000000000..d649b989376b5 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py @@ -0,0 +1,193 @@ +# Generated from LSLParser.g4 by ANTLR 4.13.2 +from antlr4 import * +if "." in __name__: + from .LSLParser import LSLParser +else: + from LSLParser import LSLParser + +# This class defines a complete generic visitor for a parse tree produced by LSLParser. + +class LSLParserVisitor(ParseTreeVisitor): + + # Visit a parse tree produced by LSLParser#state_machine. + def visitState_machine(self, ctx:LSLParser.State_machineContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_declaration. + def visitState_declaration(self, ctx:LSLParser.State_declarationContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_call_template. + def visitState_call_template(self, ctx:LSLParser.State_call_templateContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_call_named. + def visitState_call_named(self, ctx:LSLParser.State_call_namedContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_call_anonymous. + def visitState_call_anonymous(self, ctx:LSLParser.State_call_anonymousContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_task. + def visitState_task(self, ctx:LSLParser.State_taskContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_fail. + def visitState_fail(self, ctx:LSLParser.State_failContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_succeed. + def visitState_succeed(self, ctx:LSLParser.State_succeedContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#service_name. + def visitService_name(self, ctx:LSLParser.Service_nameContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#task_where. + def visitTask_where(self, ctx:LSLParser.Task_whereContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#fail_where. + def visitFail_where(self, ctx:LSLParser.Fail_whereContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#succeed_where. + def visitSucceed_where(self, ctx:LSLParser.Succeed_whereContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#arguments. + def visitArguments(self, ctx:LSLParser.ArgumentsContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#catch_block. + def visitCatch_block(self, ctx:LSLParser.Catch_blockContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#catch_case. + def visitCatch_case(self, ctx:LSLParser.Catch_caseContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#parameter_list. + def visitParameter_list(self, ctx:LSLParser.Parameter_listContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#args_assign_list. + def visitArgs_assign_list(self, ctx:LSLParser.Args_assign_listContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#args_assign. + def visitArgs_assign(self, ctx:LSLParser.Args_assignContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#error. + def visitError(self, ctx:LSLParser.ErrorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#cause. + def visitCause(self, ctx:LSLParser.CauseContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#output_block. + def visitOutput_block(self, ctx:LSLParser.Output_blockContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#var_assign_state_call. + def visitVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#var_assign_json_value. + def visitVar_assign_json_value(self, ctx:LSLParser.Var_assign_json_valueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value. + def visitJson_value(self, ctx:LSLParser.Json_valueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_object. + def visitJson_object(self, ctx:LSLParser.Json_objectContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_binding. + def visitJson_binding(self, ctx:LSLParser.Json_bindingContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_arr. + def visitJson_arr(self, ctx:LSLParser.Json_arrContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_float. + def visitJson_value_float(self, ctx:LSLParser.Json_value_floatContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_int. + def visitJson_value_int(self, ctx:LSLParser.Json_value_intContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_bool. + def visitJson_value_bool(self, ctx:LSLParser.Json_value_boolContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_null. + def visitJson_value_null(self, ctx:LSLParser.Json_value_nullContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_str. + def visitJson_value_str(self, ctx:LSLParser.Json_value_strContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#json_value_jsonata. + def visitJson_value_jsonata(self, ctx:LSLParser.Json_value_jsonataContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#string_or_jsonata_string. + def visitString_or_jsonata_string(self, ctx:LSLParser.String_or_jsonata_stringContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#string_or_jsonata_jsonata. + def visitString_or_jsonata_jsonata(self, ctx:LSLParser.String_or_jsonata_jsonataContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#error_name. + def visitError_name(self, ctx:LSLParser.Error_nameContext): + return self.visitChildren(ctx) + + + +del LSLParser \ No newline at end of file diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/__init__.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py new file mode 100644 index 0000000000000..1299167952cb5 --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py @@ -0,0 +1,287 @@ +import copy +from typing import Optional, OrderedDict + +from antlr4.ParserRuleContext import ParserRuleContext +from antlr4.tree.Tree import TerminalNodeImpl + +from localstack.services.stepfunctions.asl.antlr.runtime.LSLLexer import LSLLexer +from localstack.services.stepfunctions.asl.antlr.runtime.LSLParser import LSLParser +from localstack.services.stepfunctions.asl.antlr.runtime.LSLParserVisitor import LSLParserVisitor +from localstack.services.stepfunctions.asl.antlt4utils.antlr4utils import from_string_literal + + +class Scope: + _last_called: Optional[str] + _state_templates: dict[str, dict] + _start_at: Optional[str] + _states: OrderedDict[str, dict] + + def __init__(self): + self._last_called = None + self._start_at = None + self._states = OrderedDict() + self._state_templates = dict() + + def new_template(self, state_name: str, state: dict): + self._state_templates[state_name] = state + + def get_template(self, state_name): + template = self._state_templates[state_name] + return copy.deepcopy(template) + + def set_next(self, state_name: str, state: dict): + if self._start_at is None: + self._start_at = state_name + else: + last_state = self._states[self._last_called] + last_state.pop("End", None) + last_state["Next"] = state_name + self._last_called = state_name + self._states[state_name] = state + + def to_scope_workflow(self) -> dict: + return {"StartAt": self._start_at, "States": {**self._states}} + + +class Transpiler(LSLParserVisitor): + _scopes: list[Scope] + + def __init__(self): + self._scopes = list() + self._scopes.append(Scope()) + + def get_workflow(self) -> dict: + scope = self._this_scope() + scope_workflow = scope.to_scope_workflow() + workflow = {"Comment": "Auto-generated", "QueryLanguage": "JSONata", **scope_workflow} + return workflow + + def _this_scope(self) -> Scope: + return self._scopes[-1] + + def visitState_declaration(self, ctx: LSLParser.State_declarationContext): + state_name = from_string_literal(ctx.IDEN()) + state = self.visit(ctx.state_()) + state_type = state["Type"] + if state_type not in {"Fail", "Pass"}: + parameters = self.visitParameter_list(ctx.parameter_list()) + cleanup_assign = dict.fromkeys(parameters) + state["Assign"] = cleanup_assign + state["Output"] = "{% $states.result %}" + + scope = self._this_scope() + scope.new_template(state_name=state_name, state=state) + + return state_name, state + + def transpile_inner_state_call(self, state_name: str, state: dict): + scope = self._this_scope() + scope.set_next(state_name=state_name, state=state) + + def visitState_call_named(self, ctx: LSLParser.State_call_namedContext): + inner_name = from_string_literal(ctx.IDEN()) + state = self.visit(ctx.state_()) + self.transpile_inner_state_call(state_name=inner_name, state=state) + + def visitState_call_anonymous(self, ctx: LSLParser.State_call_anonymousContext): + anonymous_inner_name = f"call:{ctx.start.line}:{ctx.start.column}" + state = self.visit(ctx.state_()) + self.transpile_inner_state_call(state_name=anonymous_inner_name, state=state) + + def visitState_call_template(self, ctx: LSLParser.State_call_templateContext): + scope = self._this_scope() + call_marker = f"call:{ctx.start.line}:{ctx.start.column}" + + template_state_name = from_string_literal(ctx.IDEN()) + target_state_name = f"{call_marker}:{template_state_name}" + target_state = scope.get_template(state_name=template_state_name) + + input_state_name = f"{target_state_name}:input" + input_state = self.create_state_for_arg_assign_list( + target_state_name=target_state_name, ctx=ctx.args_assign_list() + ) + + scope.set_next(state_name=input_state_name, state=input_state) + scope.set_next(state_name=target_state_name, state=target_state) + + return target_state_name, input_state + + def create_state_for_arg_assign_list( + self, target_state_name: str, ctx: LSLParser.Args_assign_listContext + ): + assign_body = self.visitArgs_assign_list(ctx=ctx) + state = {"Type": "Pass", "Assign": assign_body, "Next": target_state_name} + return state + + def visitArgs_assign_list(self, ctx: LSLParser.Args_assign_listContext): + assign_body = dict() + for child in ctx.children: + if ( + isinstance(child, ParserRuleContext) + and child.getRuleIndex() == LSLParser.RULE_args_assign + ): + variable_name, value = self.visitArgs_assign(child) # noqa + assign_body[variable_name] = value + return assign_body + + def visitArgs_assign(self, ctx: LSLParser.Args_assignContext): + variable_name = from_string_literal(ctx.IDEN()) + value = self.visit(ctx.json_value()) + return variable_name, value + + def visitParameter_list(self, ctx: LSLParser.Parameter_listContext): + parameters = list() + for child in ctx.children: + if isinstance(child, TerminalNodeImpl) and child.symbol.type == LSLLexer.IDEN: + parameter_identifier = from_string_literal(child) # noqa + parameters.append(parameter_identifier) + return parameters + + def visitState_succeed(self, ctx: LSLParser.State_succeedContext): + where = self.visit(ctx.succeed_where()) + output_prepare_state = {"Type": "Pass", "End": True, **where} + return output_prepare_state + + def visitSucceed_where(self, ctx: LSLParser.Succeed_whereContext): + output_expression = self.visit(ctx.output_block()) + return {"Output": output_expression} + + def visitOutput_block(self, ctx: LSLParser.Output_blockContext): + value = self.visit(ctx.json_value()) + return value + + def visitState_fail(self, ctx: LSLParser.State_failContext): + where = self.visit(ctx.fail_where()) + state = {"Type": "Fail", **where} + return state + + def visitFail_where(self, ctx: LSLParser.Fail_whereContext): + where = dict() + for child in ctx.children: + if isinstance(child, ParserRuleContext) and child.getRuleIndex() in { + LSLParser.RULE_error, + LSLParser.RULE_cause, + }: + key, value = self.visit(child) + where[key] = value + return where + + def visitError(self, ctx: LSLParser.ErrorContext): + error_expr = self.visit(ctx.string_or_jsonata()) + return "Error", error_expr + + def visitCause(self, ctx: LSLParser.CauseContext): + cause_expr = self.visit(ctx.string_or_jsonata()) + return "Cause", cause_expr + + def visitState_task(self, ctx: LSLParser.State_taskContext): + service_name = self.visitService_name(ctx.service_name()) + action_name = from_string_literal(ctx.IDEN()) + where = self.visitTask_where(ctx.task_where()) + state = { + "Type": "Task", + # TODO: add support for aws-sdk, and callbacks + "Resource": f"arn:aws:states:::{service_name}:{action_name}", + "End": True, + **where, + } + return state + + def visitService_name(self, ctx: LSLParser.Service_nameContext): + service_name = from_string_literal(ctx.children[0]) + return service_name + + def visitTask_where(self, ctx: LSLParser.Task_whereContext): + where = dict() + for child in ctx.children: + if isinstance(child, ParserRuleContext) and child.getRuleIndex() in { + LSLParser.RULE_arguments, + LSLParser.RULE_catch_block, + }: + key, value = self.visit(child) + where[key] = value + return where + + def visitArguments(self, ctx: LSLParser.ArgumentsContext): + value = self.visit(ctx.json_value()) + return "Arguments", value + + def visitVar_assign_json_value(self, ctx: LSLParser.Var_assign_json_valueContext): + variable_name = from_string_literal(ctx.IDEN()) + value_expression = self.visit(ctx.json_value()) + + state_name = f"assign:{ctx.start.line}:{ctx.start.column}" + state = {"Type": "Pass", "Assign": {variable_name: value_expression}, "End": True} + + scope = self._this_scope() + scope.set_next(state_name=state_name, state=state) + + return state + + def visitVar_assign_state_call(self, ctx: LSLParser.Var_assign_state_callContext): + super().visit(ctx.state_call()) + + variable_name = from_string_literal(ctx.IDEN()) + + state_name = f"assign:{ctx.start.line}:{ctx.start.column}" + state = {"Type": "Pass", "Assign": {variable_name: "{% $states.input %}"}, "End": True} + + scope = self._this_scope() + scope.set_next(state_name=state_name, state=state) + + return state + + def visitJson_value_int(self, ctx: LSLParser.Json_value_intContext): + return int(ctx.INT().getText()) + + def visitJson_value_float(self, ctx: LSLParser.Json_value_floatContext): + return float(ctx.NUMBER().getText()) + + def visitJson_value_bool(self, ctx: LSLParser.Json_value_boolContext): + bool_child = ctx.children[0] + bool_term_rule: int = bool_child.getSymbol().type + bool_val: bool = bool_term_rule == LSLLexer.TRUE + return bool_val + + def visitJson_value_null(self, ctx: LSLParser.Json_value_nullContext): + return None + + def visitJson_binding(self, ctx: LSLParser.Json_bindingContext): + key = from_string_literal(ctx.children[0]) + value = self.visit(ctx.json_value()) + return key, value + + def visitJson_value_str(self, ctx: LSLParser.Json_value_strContext): + string = from_string_literal(ctx.STRING()) + return string + + def visitJson_value_jsonata(self, ctx: LSLParser.Json_value_jsonataContext): + jsonata_expression = ctx.JSONATA().getText()[len("jsonata(") : -1] + return "{% " + jsonata_expression + " %}" + + def visitJson_object(self, ctx: LSLParser.Json_objectContext): + o = dict() + for child in ctx.children: + if ( + isinstance(child, ParserRuleContext) + and child.getRuleIndex() == LSLParser.RULE_json_binding + ): + key, value = self.visitJson_binding(ctx=child) # noqa + o[key] = value + return o + + def visitJson_arr(self, ctx: LSLParser.Json_arrContext): + arr = list() + for child in ctx.children: + if isinstance(child, ParserRuleContext): + value = self.visit(child) + arr.append(value) + return arr + + def visitString_or_jsonata_string(self, ctx: LSLParser.String_or_jsonata_stringContext): + string = from_string_literal(ctx.STRING()) + return string + + def visitString_or_jsonata_jsonata(self, ctx: LSLParser.String_or_jsonata_jsonataContext): + jsonata_expression = ctx.JSONATA().getText()[len("jsonata(") : -1] + return "{% " + jsonata_expression + " %}" diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py new file mode 100644 index 0000000000000..6d5abf355df3a --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py @@ -0,0 +1,21 @@ +import abc + +from antlr4 import CommonTokenStream, InputStream + +from localstack.services.stepfunctions.asl.antlr.runtime.LSLLexer import LSLLexer +from localstack.services.stepfunctions.asl.antlr.runtime.LSLParser import LSLParser +from localstack.services.stepfunctions.asl.parse.lsl.transpiler import Transpiler + + +class LocalStackStateLanguageParser(abc.ABC): + @staticmethod + def parse(definition: str) -> dict: + input_stream = InputStream(definition) + lexer = LSLLexer(input_stream) + stream = CommonTokenStream(lexer) + parser = LSLParser(stream) + tree = parser.state_machine() + transpiler = Transpiler() + transpiler.visit(tree) + workflow = transpiler.get_workflow() + return workflow diff --git a/tests/aws/services/stepfunctions/v2/localstack_states_language.py b/tests/aws/services/stepfunctions/v2/localstack_states_language.py new file mode 100644 index 0000000000000..e9ff78cd38466 --- /dev/null +++ b/tests/aws/services/stepfunctions/v2/localstack_states_language.py @@ -0,0 +1,353 @@ +import json + +from aws.services.stepfunctions.templates.services.services_templates import ServicesTemplates +from localstack.aws.api.lambda_ import Runtime +from localstack.services.stepfunctions.asl.parse.lsl_parser import LocalStackStateLanguageParser +from localstack.testing.pytest import markers +from localstack.testing.pytest.stepfunctions.utils import await_execution_terminated +from localstack.utils.strings import short_uid + + +class TestLocalStackStatesLanguage: + @markers.aws.only_localstack + def test_assign_invoke_succeed( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + LambdaGreet(first_name, last_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata($first_name & " " & $last_name) + } + } + + user_name = "John" + user_surname = "Smith" + greeting_output = LambdaGreet( + first_name=jsonata($user_name), + last_name=jsonata($user_surname) + ) + payload_value = jsonata($greeting_output.Payload) + succeed where output jsonata($payload_value) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_ID_FUNCTION, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "John Smith" in details["output"] + + @markers.aws.only_localstack + def test_assign_and_invoke( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + LambdaGreet(first_name, last_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata($first_name & " " & $last_name) + } + } + user_name = "John" + user_surname = "Smith" + LambdaGreet( + first_name=jsonata($user_name), + last_name=jsonata($user_surname) + ) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_RETURN_DECORATED_INPUT, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "John Smith" in details["output"] + + @markers.aws.only_localstack + def test_assign_and_succeed(self, aws_client): + state_machine = LocalStackStateLanguageParser.parse(""" + WorkflowSucceeded(value) = succeed where output jsonata($value) + output_message = jsonata("Hello" & " " & "World!") + WorkflowSucceeded(value = jsonata($output_message)) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "Hello World" in details["output"] + + @markers.aws.only_localstack + def test_succeed_template(self, aws_client): + state_machine = LocalStackStateLanguageParser.parse(""" + WorkflowSucceeded(value) = succeed where output jsonata($value) + WorkflowSucceeded(value = {"message": "string-literal"}) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert details["output"] == '{"message":"string-literal"}' + + @markers.aws.only_localstack + def test_succeed_inplace(self, aws_client): + state_machine = LocalStackStateLanguageParser.parse(""" + WorkflowSucceeded as succeed where output jsonata('string' & ' ' & 'literal') + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert details["output"] == '"string literal"' + + @markers.aws.only_localstack + def test_succeed_anonymous_inplace(self, aws_client): + state_machine = LocalStackStateLanguageParser.parse(""" + succeed where output jsonata('string' & ' ' & 'literal') + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert details["output"] == '"string literal"' + + @markers.aws.only_localstack + def test_lambda_invoke_anonymous_inplace( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata('John' & " " & 'Smith') + } + } + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_RETURN_DECORATED_INPUT, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + + @markers.aws.only_localstack + def test_lambda_invoke_named_inplace( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + LambdaGreet as lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata('John' & " " & 'Smith') + } + } + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_RETURN_DECORATED_INPUT, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + + @markers.aws.only_localstack + def test_lambda_invoke( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + LambdaGreet(first_name, last_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata($first_name & " " & $last_name) + } + } + + LambdaGreet(first_name="John", last_name="Smith") + LambdaGreet(first_name="second", last_name="s") # create a copy of the target on demand! + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_RETURN_DECORATED_INPUT, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] From 75c2f2330f73a6534ca089b29fb84f62c1a1c50e Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Wed, 14 May 2025 15:26:29 +0200 Subject: [PATCH 3/6] use return instead of succeed where, more familiar syntax but not orthogonal --- .../stepfunctions/asl/antlr/LSLLexer.g4 | 2 +- .../stepfunctions/asl/antlr/LSLParser.g4 | 5 +- .../asl/antlr/runtime/LSLLexer.py | 242 +++---- .../asl/antlr/runtime/LSLParser.py | 588 +++++++----------- .../asl/antlr/runtime/LSLParserListener.py | 26 +- .../asl/antlr/runtime/LSLParserVisitor.py | 14 +- .../stepfunctions/asl/parse/lsl/transpiler.py | 14 +- .../v2/localstack_states_language.py | 10 +- 8 files changed, 375 insertions(+), 526 deletions(-) diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 index be4986b4ddebe..9141d854585b0 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 @@ -48,7 +48,7 @@ WHERE: 'where'; AS: 'as'; FAIL: 'fail'; OUTPUT: 'output'; -SUCCEED: 'succeed'; +RETURN: 'return'; ERROR: 'error'; CAUSE: 'cause'; LAMBDA: 'lambda'; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 index fd6900a0cc766..60a331c546f62 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 @@ -23,14 +23,13 @@ state_call: state: service_name COLON IDEN task_where # state_task | FAIL fail_where # state_fail - | SUCCEED succeed_where # state_succeed + | RETURN json_value # state_return ; service_name: LAMBDA; task_where: WHERE arguments? catch_block?; fail_where: WHERE error cause?; -succeed_where: WHERE output_block; arguments: ARGUMENTS json_value; catch_block: CATCH LBRACE catch_case (catch_case)* RBRACE; @@ -48,8 +47,6 @@ args_assign: IDEN EQUALS json_value; error: ERROR string_or_jsonata; cause: CAUSE string_or_jsonata; -output_block: OUTPUT json_value; - var_assign: IDEN EQUALS state_call # var_assign_state_call | IDEN EQUALS json_value # var_assign_json_value diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py index 2632b0b0de0db..1f84a1dc62fd6 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py @@ -10,7 +10,7 @@ def serializedATN(): return [ - 4,0,48,684,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 4,0,48,683,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, @@ -49,80 +49,80 @@ def serializedATN(): 1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,28,1,28, 1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30, 1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33, - 1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35, - 1,35,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37, - 1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38, - 1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40, - 1,40,1,40,1,40,1,40,5,40,598,8,40,10,40,12,40,601,9,40,1,40,3,40, - 604,8,40,1,41,1,41,1,41,1,41,5,41,610,8,41,10,41,12,41,613,9,41, - 1,42,1,42,1,42,5,42,618,8,42,10,42,12,42,621,9,42,1,42,1,42,1,43, - 1,43,1,43,3,43,628,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45, - 1,46,1,46,1,47,1,47,1,47,5,47,643,8,47,10,47,12,47,646,9,47,3,47, - 648,8,47,1,48,3,48,651,8,48,1,48,1,48,1,48,4,48,656,8,48,11,48,12, - 48,657,3,48,660,8,48,1,48,3,48,663,8,48,1,49,1,49,3,49,667,8,49, - 1,49,1,49,1,50,4,50,672,8,50,11,50,12,50,673,1,51,4,51,677,8,51, - 11,51,12,51,678,1,51,1,51,1,52,1,52,0,0,53,1,1,3,2,5,3,7,4,9,5,11, - 6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17, - 35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28, - 57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39, - 79,40,81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,44,97,45,99,0,101, - 46,103,47,105,48,1,0,13,2,0,10,10,12,13,1,0,41,41,2,0,46,46,91,91, - 3,0,65,90,95,95,97,122,8,0,34,34,47,47,92,92,98,98,102,102,110,110, - 114,114,116,116,3,0,48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0, - 49,57,1,0,48,57,2,0,69,69,101,101,2,0,43,43,45,45,5,0,45,45,48,57, - 65,90,95,95,97,122,3,0,9,10,13,13,32,32,697,0,1,1,0,0,0,0,3,1,0, - 0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0, - 0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0, - 0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0, - 0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0, - 0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0, - 0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0, - 0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0, - 0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0, - 0,0,85,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,101,1,0,0,0,0,103,1,0, - 0,0,0,105,1,0,0,0,1,107,1,0,0,0,3,116,1,0,0,0,5,133,1,0,0,0,7,144, - 1,0,0,0,9,169,1,0,0,0,11,193,1,0,0,0,13,208,1,0,0,0,15,226,1,0,0, - 0,17,245,1,0,0,0,19,275,1,0,0,0,21,303,1,0,0,0,23,323,1,0,0,0,25, - 346,1,0,0,0,27,370,1,0,0,0,29,409,1,0,0,0,31,433,1,0,0,0,33,459, - 1,0,0,0,35,487,1,0,0,0,37,490,1,0,0,0,39,492,1,0,0,0,41,494,1,0, - 0,0,43,496,1,0,0,0,45,498,1,0,0,0,47,500,1,0,0,0,49,502,1,0,0,0, - 51,504,1,0,0,0,53,506,1,0,0,0,55,508,1,0,0,0,57,513,1,0,0,0,59,519, - 1,0,0,0,61,524,1,0,0,0,63,530,1,0,0,0,65,533,1,0,0,0,67,538,1,0, - 0,0,69,545,1,0,0,0,71,553,1,0,0,0,73,559,1,0,0,0,75,565,1,0,0,0, - 77,572,1,0,0,0,79,582,1,0,0,0,81,603,1,0,0,0,83,605,1,0,0,0,85,614, - 1,0,0,0,87,624,1,0,0,0,89,629,1,0,0,0,91,635,1,0,0,0,93,637,1,0, - 0,0,95,647,1,0,0,0,97,650,1,0,0,0,99,664,1,0,0,0,101,671,1,0,0,0, - 103,676,1,0,0,0,105,682,1,0,0,0,107,111,5,35,0,0,108,110,8,0,0,0, - 109,108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0, - 112,114,1,0,0,0,113,111,1,0,0,0,114,115,6,0,0,0,115,2,1,0,0,0,116, - 117,5,106,0,0,117,118,5,115,0,0,118,119,5,111,0,0,119,120,5,110, - 0,0,120,121,5,97,0,0,121,122,5,116,0,0,122,123,5,97,0,0,123,124, - 5,40,0,0,124,128,1,0,0,0,125,127,8,1,0,0,126,125,1,0,0,0,127,130, - 1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128, - 1,0,0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,83,0,0,134,135, - 5,116,0,0,135,136,5,97,0,0,136,137,5,116,0,0,137,138,5,101,0,0,138, - 139,5,115,0,0,139,140,5,46,0,0,140,141,5,65,0,0,141,142,5,76,0,0, - 142,143,5,76,0,0,143,6,1,0,0,0,144,145,5,83,0,0,145,146,5,116,0, - 0,146,147,5,97,0,0,147,148,5,116,0,0,148,149,5,101,0,0,149,150,5, - 115,0,0,150,151,5,46,0,0,151,152,5,68,0,0,152,153,5,97,0,0,153,154, - 5,116,0,0,154,155,5,97,0,0,155,156,5,76,0,0,156,157,5,105,0,0,157, - 158,5,109,0,0,158,159,5,105,0,0,159,160,5,116,0,0,160,161,5,69,0, - 0,161,162,5,120,0,0,162,163,5,99,0,0,163,164,5,101,0,0,164,165,5, - 101,0,0,165,166,5,100,0,0,166,167,5,101,0,0,167,168,5,100,0,0,168, - 8,1,0,0,0,169,170,5,83,0,0,170,171,5,116,0,0,171,172,5,97,0,0,172, - 173,5,116,0,0,173,174,5,101,0,0,174,175,5,115,0,0,175,176,5,46,0, - 0,176,177,5,72,0,0,177,178,5,101,0,0,178,179,5,97,0,0,179,180,5, - 114,0,0,180,181,5,116,0,0,181,182,5,98,0,0,182,183,5,101,0,0,183, - 184,5,97,0,0,184,185,5,116,0,0,185,186,5,84,0,0,186,187,5,105,0, - 0,187,188,5,109,0,0,188,189,5,101,0,0,189,190,5,111,0,0,190,191, - 5,117,0,0,191,192,5,116,0,0,192,10,1,0,0,0,193,194,5,83,0,0,194, - 195,5,116,0,0,195,196,5,97,0,0,196,197,5,116,0,0,197,198,5,101,0, - 0,198,199,5,115,0,0,199,200,5,46,0,0,200,201,5,84,0,0,201,202,5, - 105,0,0,202,203,5,109,0,0,203,204,5,101,0,0,204,205,5,111,0,0,205, - 206,5,117,0,0,206,207,5,116,0,0,207,12,1,0,0,0,208,209,5,83,0,0, - 209,210,5,116,0,0,210,211,5,97,0,0,211,212,5,116,0,0,212,213,5,101, - 0,0,213,214,5,115,0,0,214,215,5,46,0,0,215,216,5,84,0,0,216,217, - 5,97,0,0,217,218,5,115,0,0,218,219,5,107,0,0,219,220,5,70,0,0,220, + 1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35, + 1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37, + 1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38, + 1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,40, + 1,40,1,40,1,40,5,40,597,8,40,10,40,12,40,600,9,40,1,40,3,40,603, + 8,40,1,41,1,41,1,41,1,41,5,41,609,8,41,10,41,12,41,612,9,41,1,42, + 1,42,1,42,5,42,617,8,42,10,42,12,42,620,9,42,1,42,1,42,1,43,1,43, + 1,43,3,43,627,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,46, + 1,46,1,47,1,47,1,47,5,47,642,8,47,10,47,12,47,645,9,47,3,47,647, + 8,47,1,48,3,48,650,8,48,1,48,1,48,1,48,4,48,655,8,48,11,48,12,48, + 656,3,48,659,8,48,1,48,3,48,662,8,48,1,49,1,49,3,49,666,8,49,1,49, + 1,49,1,50,4,50,671,8,50,11,50,12,50,672,1,51,4,51,676,8,51,11,51, + 12,51,677,1,51,1,51,1,52,1,52,0,0,53,1,1,3,2,5,3,7,4,9,5,11,6,13, + 7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18, + 37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29, + 59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40, + 81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,44,97,45,99,0,101,46,103, + 47,105,48,1,0,13,2,0,10,10,12,13,1,0,41,41,2,0,46,46,91,91,3,0,65, + 90,95,95,97,122,8,0,34,34,47,47,92,92,98,98,102,102,110,110,114, + 114,116,116,3,0,48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0,49,57, + 1,0,48,57,2,0,69,69,101,101,2,0,43,43,45,45,5,0,45,45,48,57,65,90, + 95,95,97,122,3,0,9,10,13,13,32,32,696,0,1,1,0,0,0,0,3,1,0,0,0,0, + 5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15, + 1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25, + 1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35, + 1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45, + 1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55, + 1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65, + 1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75, + 1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85, + 1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0, + 105,1,0,0,0,1,107,1,0,0,0,3,116,1,0,0,0,5,133,1,0,0,0,7,144,1,0, + 0,0,9,169,1,0,0,0,11,193,1,0,0,0,13,208,1,0,0,0,15,226,1,0,0,0,17, + 245,1,0,0,0,19,275,1,0,0,0,21,303,1,0,0,0,23,323,1,0,0,0,25,346, + 1,0,0,0,27,370,1,0,0,0,29,409,1,0,0,0,31,433,1,0,0,0,33,459,1,0, + 0,0,35,487,1,0,0,0,37,490,1,0,0,0,39,492,1,0,0,0,41,494,1,0,0,0, + 43,496,1,0,0,0,45,498,1,0,0,0,47,500,1,0,0,0,49,502,1,0,0,0,51,504, + 1,0,0,0,53,506,1,0,0,0,55,508,1,0,0,0,57,513,1,0,0,0,59,519,1,0, + 0,0,61,524,1,0,0,0,63,530,1,0,0,0,65,533,1,0,0,0,67,538,1,0,0,0, + 69,545,1,0,0,0,71,552,1,0,0,0,73,558,1,0,0,0,75,564,1,0,0,0,77,571, + 1,0,0,0,79,581,1,0,0,0,81,602,1,0,0,0,83,604,1,0,0,0,85,613,1,0, + 0,0,87,623,1,0,0,0,89,628,1,0,0,0,91,634,1,0,0,0,93,636,1,0,0,0, + 95,646,1,0,0,0,97,649,1,0,0,0,99,663,1,0,0,0,101,670,1,0,0,0,103, + 675,1,0,0,0,105,681,1,0,0,0,107,111,5,35,0,0,108,110,8,0,0,0,109, + 108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112, + 114,1,0,0,0,113,111,1,0,0,0,114,115,6,0,0,0,115,2,1,0,0,0,116,117, + 5,106,0,0,117,118,5,115,0,0,118,119,5,111,0,0,119,120,5,110,0,0, + 120,121,5,97,0,0,121,122,5,116,0,0,122,123,5,97,0,0,123,124,5,40, + 0,0,124,128,1,0,0,0,125,127,8,1,0,0,126,125,1,0,0,0,127,130,1,0, + 0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0, + 0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,83,0,0,134,135,5,116, + 0,0,135,136,5,97,0,0,136,137,5,116,0,0,137,138,5,101,0,0,138,139, + 5,115,0,0,139,140,5,46,0,0,140,141,5,65,0,0,141,142,5,76,0,0,142, + 143,5,76,0,0,143,6,1,0,0,0,144,145,5,83,0,0,145,146,5,116,0,0,146, + 147,5,97,0,0,147,148,5,116,0,0,148,149,5,101,0,0,149,150,5,115,0, + 0,150,151,5,46,0,0,151,152,5,68,0,0,152,153,5,97,0,0,153,154,5,116, + 0,0,154,155,5,97,0,0,155,156,5,76,0,0,156,157,5,105,0,0,157,158, + 5,109,0,0,158,159,5,105,0,0,159,160,5,116,0,0,160,161,5,69,0,0,161, + 162,5,120,0,0,162,163,5,99,0,0,163,164,5,101,0,0,164,165,5,101,0, + 0,165,166,5,100,0,0,166,167,5,101,0,0,167,168,5,100,0,0,168,8,1, + 0,0,0,169,170,5,83,0,0,170,171,5,116,0,0,171,172,5,97,0,0,172,173, + 5,116,0,0,173,174,5,101,0,0,174,175,5,115,0,0,175,176,5,46,0,0,176, + 177,5,72,0,0,177,178,5,101,0,0,178,179,5,97,0,0,179,180,5,114,0, + 0,180,181,5,116,0,0,181,182,5,98,0,0,182,183,5,101,0,0,183,184,5, + 97,0,0,184,185,5,116,0,0,185,186,5,84,0,0,186,187,5,105,0,0,187, + 188,5,109,0,0,188,189,5,101,0,0,189,190,5,111,0,0,190,191,5,117, + 0,0,191,192,5,116,0,0,192,10,1,0,0,0,193,194,5,83,0,0,194,195,5, + 116,0,0,195,196,5,97,0,0,196,197,5,116,0,0,197,198,5,101,0,0,198, + 199,5,115,0,0,199,200,5,46,0,0,200,201,5,84,0,0,201,202,5,105,0, + 0,202,203,5,109,0,0,203,204,5,101,0,0,204,205,5,111,0,0,205,206, + 5,117,0,0,206,207,5,116,0,0,207,12,1,0,0,0,208,209,5,83,0,0,209, + 210,5,116,0,0,210,211,5,97,0,0,211,212,5,116,0,0,212,213,5,101,0, + 0,213,214,5,115,0,0,214,215,5,46,0,0,215,216,5,84,0,0,216,217,5, + 97,0,0,217,218,5,115,0,0,218,219,5,107,0,0,219,220,5,70,0,0,220, 221,5,97,0,0,221,222,5,105,0,0,222,223,5,108,0,0,223,224,5,101,0, 0,224,225,5,100,0,0,225,14,1,0,0,0,226,227,5,83,0,0,227,228,5,116, 0,0,228,229,5,97,0,0,229,230,5,116,0,0,230,231,5,101,0,0,231,232, @@ -210,48 +210,48 @@ def serializedATN(): 534,5,102,0,0,534,535,5,97,0,0,535,536,5,105,0,0,536,537,5,108,0, 0,537,66,1,0,0,0,538,539,5,111,0,0,539,540,5,117,0,0,540,541,5,116, 0,0,541,542,5,112,0,0,542,543,5,117,0,0,543,544,5,116,0,0,544,68, - 1,0,0,0,545,546,5,115,0,0,546,547,5,117,0,0,547,548,5,99,0,0,548, - 549,5,99,0,0,549,550,5,101,0,0,550,551,5,101,0,0,551,552,5,100,0, - 0,552,70,1,0,0,0,553,554,5,101,0,0,554,555,5,114,0,0,555,556,5,114, - 0,0,556,557,5,111,0,0,557,558,5,114,0,0,558,72,1,0,0,0,559,560,5, - 99,0,0,560,561,5,97,0,0,561,562,5,117,0,0,562,563,5,115,0,0,563, - 564,5,101,0,0,564,74,1,0,0,0,565,566,5,108,0,0,566,567,5,97,0,0, - 567,568,5,109,0,0,568,569,5,98,0,0,569,570,5,100,0,0,570,571,5,97, - 0,0,571,76,1,0,0,0,572,573,5,97,0,0,573,574,5,114,0,0,574,575,5, - 103,0,0,575,576,5,117,0,0,576,577,5,109,0,0,577,578,5,101,0,0,578, - 579,5,110,0,0,579,580,5,116,0,0,580,581,5,115,0,0,581,78,1,0,0,0, - 582,583,5,99,0,0,583,584,5,97,0,0,584,585,5,116,0,0,585,586,5,99, - 0,0,586,587,5,104,0,0,587,80,1,0,0,0,588,589,5,34,0,0,589,590,5, - 36,0,0,590,604,5,34,0,0,591,592,5,34,0,0,592,593,5,36,0,0,593,594, - 1,0,0,0,594,599,7,2,0,0,595,598,3,87,43,0,596,598,3,93,46,0,597, - 595,1,0,0,0,597,596,1,0,0,0,598,601,1,0,0,0,599,597,1,0,0,0,599, - 600,1,0,0,0,600,602,1,0,0,0,601,599,1,0,0,0,602,604,5,34,0,0,603, - 588,1,0,0,0,603,591,1,0,0,0,604,82,1,0,0,0,605,606,5,36,0,0,606, - 611,7,3,0,0,607,610,3,87,43,0,608,610,3,93,46,0,609,607,1,0,0,0, - 609,608,1,0,0,0,610,613,1,0,0,0,611,609,1,0,0,0,611,612,1,0,0,0, - 612,84,1,0,0,0,613,611,1,0,0,0,614,619,5,34,0,0,615,618,3,87,43, - 0,616,618,3,93,46,0,617,615,1,0,0,0,617,616,1,0,0,0,618,621,1,0, - 0,0,619,617,1,0,0,0,619,620,1,0,0,0,620,622,1,0,0,0,621,619,1,0, - 0,0,622,623,5,34,0,0,623,86,1,0,0,0,624,627,5,92,0,0,625,628,7,4, - 0,0,626,628,3,89,44,0,627,625,1,0,0,0,627,626,1,0,0,0,628,88,1,0, - 0,0,629,630,5,117,0,0,630,631,3,91,45,0,631,632,3,91,45,0,632,633, - 3,91,45,0,633,634,3,91,45,0,634,90,1,0,0,0,635,636,7,5,0,0,636,92, - 1,0,0,0,637,638,8,6,0,0,638,94,1,0,0,0,639,648,5,48,0,0,640,644, - 7,7,0,0,641,643,7,8,0,0,642,641,1,0,0,0,643,646,1,0,0,0,644,642, - 1,0,0,0,644,645,1,0,0,0,645,648,1,0,0,0,646,644,1,0,0,0,647,639, - 1,0,0,0,647,640,1,0,0,0,648,96,1,0,0,0,649,651,5,45,0,0,650,649, - 1,0,0,0,650,651,1,0,0,0,651,652,1,0,0,0,652,659,3,95,47,0,653,655, - 5,46,0,0,654,656,7,8,0,0,655,654,1,0,0,0,656,657,1,0,0,0,657,655, - 1,0,0,0,657,658,1,0,0,0,658,660,1,0,0,0,659,653,1,0,0,0,659,660, - 1,0,0,0,660,662,1,0,0,0,661,663,3,99,49,0,662,661,1,0,0,0,662,663, - 1,0,0,0,663,98,1,0,0,0,664,666,7,9,0,0,665,667,7,10,0,0,666,665, - 1,0,0,0,666,667,1,0,0,0,667,668,1,0,0,0,668,669,3,95,47,0,669,100, - 1,0,0,0,670,672,7,11,0,0,671,670,1,0,0,0,672,673,1,0,0,0,673,671, - 1,0,0,0,673,674,1,0,0,0,674,102,1,0,0,0,675,677,7,12,0,0,676,675, - 1,0,0,0,677,678,1,0,0,0,678,676,1,0,0,0,678,679,1,0,0,0,679,680, - 1,0,0,0,680,681,6,51,0,0,681,104,1,0,0,0,682,683,9,0,0,0,683,106, - 1,0,0,0,20,0,111,128,597,599,603,609,611,617,619,627,644,647,650, - 657,659,662,666,673,678,1,6,0,0 + 1,0,0,0,545,546,5,114,0,0,546,547,5,101,0,0,547,548,5,116,0,0,548, + 549,5,117,0,0,549,550,5,114,0,0,550,551,5,110,0,0,551,70,1,0,0,0, + 552,553,5,101,0,0,553,554,5,114,0,0,554,555,5,114,0,0,555,556,5, + 111,0,0,556,557,5,114,0,0,557,72,1,0,0,0,558,559,5,99,0,0,559,560, + 5,97,0,0,560,561,5,117,0,0,561,562,5,115,0,0,562,563,5,101,0,0,563, + 74,1,0,0,0,564,565,5,108,0,0,565,566,5,97,0,0,566,567,5,109,0,0, + 567,568,5,98,0,0,568,569,5,100,0,0,569,570,5,97,0,0,570,76,1,0,0, + 0,571,572,5,97,0,0,572,573,5,114,0,0,573,574,5,103,0,0,574,575,5, + 117,0,0,575,576,5,109,0,0,576,577,5,101,0,0,577,578,5,110,0,0,578, + 579,5,116,0,0,579,580,5,115,0,0,580,78,1,0,0,0,581,582,5,99,0,0, + 582,583,5,97,0,0,583,584,5,116,0,0,584,585,5,99,0,0,585,586,5,104, + 0,0,586,80,1,0,0,0,587,588,5,34,0,0,588,589,5,36,0,0,589,603,5,34, + 0,0,590,591,5,34,0,0,591,592,5,36,0,0,592,593,1,0,0,0,593,598,7, + 2,0,0,594,597,3,87,43,0,595,597,3,93,46,0,596,594,1,0,0,0,596,595, + 1,0,0,0,597,600,1,0,0,0,598,596,1,0,0,0,598,599,1,0,0,0,599,601, + 1,0,0,0,600,598,1,0,0,0,601,603,5,34,0,0,602,587,1,0,0,0,602,590, + 1,0,0,0,603,82,1,0,0,0,604,605,5,36,0,0,605,610,7,3,0,0,606,609, + 3,87,43,0,607,609,3,93,46,0,608,606,1,0,0,0,608,607,1,0,0,0,609, + 612,1,0,0,0,610,608,1,0,0,0,610,611,1,0,0,0,611,84,1,0,0,0,612,610, + 1,0,0,0,613,618,5,34,0,0,614,617,3,87,43,0,615,617,3,93,46,0,616, + 614,1,0,0,0,616,615,1,0,0,0,617,620,1,0,0,0,618,616,1,0,0,0,618, + 619,1,0,0,0,619,621,1,0,0,0,620,618,1,0,0,0,621,622,5,34,0,0,622, + 86,1,0,0,0,623,626,5,92,0,0,624,627,7,4,0,0,625,627,3,89,44,0,626, + 624,1,0,0,0,626,625,1,0,0,0,627,88,1,0,0,0,628,629,5,117,0,0,629, + 630,3,91,45,0,630,631,3,91,45,0,631,632,3,91,45,0,632,633,3,91,45, + 0,633,90,1,0,0,0,634,635,7,5,0,0,635,92,1,0,0,0,636,637,8,6,0,0, + 637,94,1,0,0,0,638,647,5,48,0,0,639,643,7,7,0,0,640,642,7,8,0,0, + 641,640,1,0,0,0,642,645,1,0,0,0,643,641,1,0,0,0,643,644,1,0,0,0, + 644,647,1,0,0,0,645,643,1,0,0,0,646,638,1,0,0,0,646,639,1,0,0,0, + 647,96,1,0,0,0,648,650,5,45,0,0,649,648,1,0,0,0,649,650,1,0,0,0, + 650,651,1,0,0,0,651,658,3,95,47,0,652,654,5,46,0,0,653,655,7,8,0, + 0,654,653,1,0,0,0,655,656,1,0,0,0,656,654,1,0,0,0,656,657,1,0,0, + 0,657,659,1,0,0,0,658,652,1,0,0,0,658,659,1,0,0,0,659,661,1,0,0, + 0,660,662,3,99,49,0,661,660,1,0,0,0,661,662,1,0,0,0,662,98,1,0,0, + 0,663,665,7,9,0,0,664,666,7,10,0,0,665,664,1,0,0,0,665,666,1,0,0, + 0,666,667,1,0,0,0,667,668,3,95,47,0,668,100,1,0,0,0,669,671,7,11, + 0,0,670,669,1,0,0,0,671,672,1,0,0,0,672,670,1,0,0,0,672,673,1,0, + 0,0,673,102,1,0,0,0,674,676,7,12,0,0,675,674,1,0,0,0,676,677,1,0, + 0,0,677,675,1,0,0,0,677,678,1,0,0,0,678,679,1,0,0,0,679,680,6,51, + 0,0,680,104,1,0,0,0,681,682,9,0,0,0,682,106,1,0,0,0,20,0,111,128, + 596,598,602,608,610,616,618,626,643,646,649,656,658,661,665,672, + 677,1,6,0,0 ] class LSLLexer(Lexer): @@ -294,7 +294,7 @@ class LSLLexer(Lexer): AS = 32 FAIL = 33 OUTPUT = 34 - SUCCEED = 35 + RETURN = 35 ERROR = 36 CAUSE = 37 LAMBDA = 38 @@ -322,7 +322,7 @@ class LSLLexer(Lexer): "'States.ResultWriterFailed'", "'States.QueryEvaluationError'", "'->'", "'='", "','", "':'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'true'", "'false'", "'null'", "'where'", "'as'", "'fail'", - "'output'", "'succeed'", "'error'", "'cause'", "'lambda'", "'arguments'", + "'output'", "'return'", "'error'", "'cause'", "'lambda'", "'arguments'", "'catch'" ] symbolicNames = [ "", @@ -335,7 +335,7 @@ class LSLLexer(Lexer): "ERRORNAMEStatesResultWriterFailed", "ERRORNAMEStatesQueryEvaluationError", "ARROW", "EQUALS", "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", - "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", "LAMBDA", + "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", "LAMBDA", "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "INT", "NUMBER", "IDEN", "WS", "TOK" ] @@ -349,7 +349,7 @@ class LSLLexer(Lexer): "ERRORNAMEStatesQueryEvaluationError", "ARROW", "EQUALS", "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", - "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", "LAMBDA", + "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", "LAMBDA", "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "ESC", "UNICODE", "HEX", "SAFECODEPOINT", "INT", "NUMBER", "EXP", "IDEN", "WS", "TOK" ] diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py index 1ecb08e87e59d..d7928a8400c6e 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py @@ -10,79 +10,76 @@ def serializedATN(): return [ - 4,1,48,217,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 4,1,48,207,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, - 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,1,0,1,0,1,0,4,0,54, - 8,0,11,0,12,0,55,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2, - 1,2,3,2,71,8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,82,8,3,1, - 4,1,4,1,5,1,5,3,5,88,8,5,1,5,3,5,91,8,5,1,6,1,6,1,6,3,6,96,8,6,1, - 7,1,7,1,7,1,8,1,8,1,8,1,9,1,9,1,9,1,9,5,9,108,8,9,10,9,12,9,111, - 9,9,1,9,1,9,1,10,1,10,1,10,1,10,1,11,1,11,3,11,121,8,11,1,11,1,11, - 5,11,125,8,11,10,11,12,11,128,9,11,1,11,1,11,1,12,1,12,1,12,1,12, - 5,12,136,8,12,10,12,12,12,139,9,12,1,12,1,12,1,13,1,13,1,13,1,13, - 1,14,1,14,1,14,1,15,1,15,1,15,1,16,1,16,1,16,1,17,1,17,1,17,1,17, - 1,17,1,17,3,17,162,8,17,1,18,1,18,1,18,3,18,167,8,18,1,19,1,19,1, - 19,1,19,5,19,173,8,19,10,19,12,19,176,9,19,1,19,1,19,1,19,1,19,3, - 19,182,8,19,1,20,1,20,1,20,1,20,1,21,1,21,1,21,1,21,5,21,192,8,21, - 10,21,12,21,195,9,21,1,21,1,21,1,21,1,21,3,21,201,8,21,1,22,1,22, - 1,22,1,22,1,22,1,22,3,22,209,8,22,1,23,1,23,3,23,213,8,23,1,24,1, - 24,1,24,0,0,25,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34, - 36,38,40,42,44,46,48,0,3,2,0,43,43,46,46,1,0,28,29,2,0,3,17,43,43, - 218,0,53,1,0,0,0,2,59,1,0,0,0,4,70,1,0,0,0,6,81,1,0,0,0,8,83,1,0, - 0,0,10,85,1,0,0,0,12,92,1,0,0,0,14,97,1,0,0,0,16,100,1,0,0,0,18, - 103,1,0,0,0,20,114,1,0,0,0,22,118,1,0,0,0,24,131,1,0,0,0,26,142, - 1,0,0,0,28,146,1,0,0,0,30,149,1,0,0,0,32,152,1,0,0,0,34,161,1,0, - 0,0,36,166,1,0,0,0,38,181,1,0,0,0,40,183,1,0,0,0,42,200,1,0,0,0, - 44,208,1,0,0,0,46,212,1,0,0,0,48,214,1,0,0,0,50,54,3,2,1,0,51,54, - 3,34,17,0,52,54,3,4,2,0,53,50,1,0,0,0,53,51,1,0,0,0,53,52,1,0,0, - 0,54,55,1,0,0,0,55,53,1,0,0,0,55,56,1,0,0,0,56,57,1,0,0,0,57,58, - 5,0,0,1,58,1,1,0,0,0,59,60,5,46,0,0,60,61,3,22,11,0,61,62,5,19,0, - 0,62,63,3,6,3,0,63,3,1,0,0,0,64,65,5,46,0,0,65,71,3,24,12,0,66,67, - 5,46,0,0,67,68,5,32,0,0,68,71,3,6,3,0,69,71,3,6,3,0,70,64,1,0,0, - 0,70,66,1,0,0,0,70,69,1,0,0,0,71,5,1,0,0,0,72,73,3,8,4,0,73,74,5, - 21,0,0,74,75,5,46,0,0,75,76,3,10,5,0,76,82,1,0,0,0,77,78,5,33,0, - 0,78,82,3,12,6,0,79,80,5,35,0,0,80,82,3,14,7,0,81,72,1,0,0,0,81, - 77,1,0,0,0,81,79,1,0,0,0,82,7,1,0,0,0,83,84,5,38,0,0,84,9,1,0,0, - 0,85,87,5,31,0,0,86,88,3,16,8,0,87,86,1,0,0,0,87,88,1,0,0,0,88,90, - 1,0,0,0,89,91,3,18,9,0,90,89,1,0,0,0,90,91,1,0,0,0,91,11,1,0,0,0, - 92,93,5,31,0,0,93,95,3,28,14,0,94,96,3,30,15,0,95,94,1,0,0,0,95, - 96,1,0,0,0,96,13,1,0,0,0,97,98,5,31,0,0,98,99,3,32,16,0,99,15,1, - 0,0,0,100,101,5,39,0,0,101,102,3,36,18,0,102,17,1,0,0,0,103,104, - 5,40,0,0,104,105,5,26,0,0,105,109,3,20,10,0,106,108,3,20,10,0,107, - 106,1,0,0,0,108,111,1,0,0,0,109,107,1,0,0,0,109,110,1,0,0,0,110, - 112,1,0,0,0,111,109,1,0,0,0,112,113,5,27,0,0,113,19,1,0,0,0,114, - 115,3,48,24,0,115,116,5,18,0,0,116,117,3,4,2,0,117,21,1,0,0,0,118, - 120,5,22,0,0,119,121,5,46,0,0,120,119,1,0,0,0,120,121,1,0,0,0,121, - 126,1,0,0,0,122,123,5,20,0,0,123,125,5,46,0,0,124,122,1,0,0,0,125, - 128,1,0,0,0,126,124,1,0,0,0,126,127,1,0,0,0,127,129,1,0,0,0,128, - 126,1,0,0,0,129,130,5,23,0,0,130,23,1,0,0,0,131,132,5,22,0,0,132, - 137,3,26,13,0,133,134,5,20,0,0,134,136,3,26,13,0,135,133,1,0,0,0, - 136,139,1,0,0,0,137,135,1,0,0,0,137,138,1,0,0,0,138,140,1,0,0,0, - 139,137,1,0,0,0,140,141,5,23,0,0,141,25,1,0,0,0,142,143,5,46,0,0, - 143,144,5,19,0,0,144,145,3,36,18,0,145,27,1,0,0,0,146,147,5,36,0, - 0,147,148,3,46,23,0,148,29,1,0,0,0,149,150,5,37,0,0,150,151,3,46, - 23,0,151,31,1,0,0,0,152,153,5,34,0,0,153,154,3,36,18,0,154,33,1, - 0,0,0,155,156,5,46,0,0,156,157,5,19,0,0,157,162,3,4,2,0,158,159, - 5,46,0,0,159,160,5,19,0,0,160,162,3,36,18,0,161,155,1,0,0,0,161, - 158,1,0,0,0,162,35,1,0,0,0,163,167,3,38,19,0,164,167,3,42,21,0,165, - 167,3,44,22,0,166,163,1,0,0,0,166,164,1,0,0,0,166,165,1,0,0,0,167, - 37,1,0,0,0,168,169,5,26,0,0,169,174,3,40,20,0,170,171,5,20,0,0,171, - 173,3,40,20,0,172,170,1,0,0,0,173,176,1,0,0,0,174,172,1,0,0,0,174, - 175,1,0,0,0,175,177,1,0,0,0,176,174,1,0,0,0,177,178,5,27,0,0,178, - 182,1,0,0,0,179,180,5,26,0,0,180,182,5,27,0,0,181,168,1,0,0,0,181, - 179,1,0,0,0,182,39,1,0,0,0,183,184,7,0,0,0,184,185,5,21,0,0,185, - 186,3,36,18,0,186,41,1,0,0,0,187,188,5,24,0,0,188,193,3,36,18,0, - 189,190,5,20,0,0,190,192,3,36,18,0,191,189,1,0,0,0,192,195,1,0,0, - 0,193,191,1,0,0,0,193,194,1,0,0,0,194,196,1,0,0,0,195,193,1,0,0, - 0,196,197,5,25,0,0,197,201,1,0,0,0,198,199,5,24,0,0,199,201,5,25, - 0,0,200,187,1,0,0,0,200,198,1,0,0,0,201,43,1,0,0,0,202,209,5,45, - 0,0,203,209,5,44,0,0,204,209,7,1,0,0,205,209,5,30,0,0,206,209,5, - 43,0,0,207,209,5,2,0,0,208,202,1,0,0,0,208,203,1,0,0,0,208,204,1, - 0,0,0,208,205,1,0,0,0,208,206,1,0,0,0,208,207,1,0,0,0,209,45,1,0, - 0,0,210,213,5,43,0,0,211,213,5,2,0,0,212,210,1,0,0,0,212,211,1,0, - 0,0,213,47,1,0,0,0,214,215,7,2,0,0,215,49,1,0,0,0,19,53,55,70,81, - 87,90,95,109,120,126,137,161,166,174,181,193,200,208,212 + 7,20,2,21,7,21,2,22,7,22,1,0,1,0,1,0,4,0,50,8,0,11,0,12,0,51,1,0, + 1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,3,2,67,8,2,1,3,1, + 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,78,8,3,1,4,1,4,1,5,1,5,3,5,84, + 8,5,1,5,3,5,87,8,5,1,6,1,6,1,6,3,6,92,8,6,1,7,1,7,1,7,1,8,1,8,1, + 8,1,8,5,8,101,8,8,10,8,12,8,104,9,8,1,8,1,8,1,9,1,9,1,9,1,9,1,10, + 1,10,3,10,114,8,10,1,10,1,10,5,10,118,8,10,10,10,12,10,121,9,10, + 1,10,1,10,1,11,1,11,1,11,1,11,5,11,129,8,11,10,11,12,11,132,9,11, + 1,11,1,11,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,14,1,14,1,14,1,15, + 1,15,1,15,1,15,1,15,1,15,3,15,152,8,15,1,16,1,16,1,16,3,16,157,8, + 16,1,17,1,17,1,17,1,17,5,17,163,8,17,10,17,12,17,166,9,17,1,17,1, + 17,1,17,1,17,3,17,172,8,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1, + 19,5,19,182,8,19,10,19,12,19,185,9,19,1,19,1,19,1,19,1,19,3,19,191, + 8,19,1,20,1,20,1,20,1,20,1,20,1,20,3,20,199,8,20,1,21,1,21,3,21, + 203,8,21,1,22,1,22,1,22,0,0,23,0,2,4,6,8,10,12,14,16,18,20,22,24, + 26,28,30,32,34,36,38,40,42,44,0,3,2,0,43,43,46,46,1,0,28,29,2,0, + 3,17,43,43,210,0,49,1,0,0,0,2,55,1,0,0,0,4,66,1,0,0,0,6,77,1,0,0, + 0,8,79,1,0,0,0,10,81,1,0,0,0,12,88,1,0,0,0,14,93,1,0,0,0,16,96,1, + 0,0,0,18,107,1,0,0,0,20,111,1,0,0,0,22,124,1,0,0,0,24,135,1,0,0, + 0,26,139,1,0,0,0,28,142,1,0,0,0,30,151,1,0,0,0,32,156,1,0,0,0,34, + 171,1,0,0,0,36,173,1,0,0,0,38,190,1,0,0,0,40,198,1,0,0,0,42,202, + 1,0,0,0,44,204,1,0,0,0,46,50,3,2,1,0,47,50,3,30,15,0,48,50,3,4,2, + 0,49,46,1,0,0,0,49,47,1,0,0,0,49,48,1,0,0,0,50,51,1,0,0,0,51,49, + 1,0,0,0,51,52,1,0,0,0,52,53,1,0,0,0,53,54,5,0,0,1,54,1,1,0,0,0,55, + 56,5,46,0,0,56,57,3,20,10,0,57,58,5,19,0,0,58,59,3,6,3,0,59,3,1, + 0,0,0,60,61,5,46,0,0,61,67,3,22,11,0,62,63,5,46,0,0,63,64,5,32,0, + 0,64,67,3,6,3,0,65,67,3,6,3,0,66,60,1,0,0,0,66,62,1,0,0,0,66,65, + 1,0,0,0,67,5,1,0,0,0,68,69,3,8,4,0,69,70,5,21,0,0,70,71,5,46,0,0, + 71,72,3,10,5,0,72,78,1,0,0,0,73,74,5,33,0,0,74,78,3,12,6,0,75,76, + 5,35,0,0,76,78,3,32,16,0,77,68,1,0,0,0,77,73,1,0,0,0,77,75,1,0,0, + 0,78,7,1,0,0,0,79,80,5,38,0,0,80,9,1,0,0,0,81,83,5,31,0,0,82,84, + 3,14,7,0,83,82,1,0,0,0,83,84,1,0,0,0,84,86,1,0,0,0,85,87,3,16,8, + 0,86,85,1,0,0,0,86,87,1,0,0,0,87,11,1,0,0,0,88,89,5,31,0,0,89,91, + 3,26,13,0,90,92,3,28,14,0,91,90,1,0,0,0,91,92,1,0,0,0,92,13,1,0, + 0,0,93,94,5,39,0,0,94,95,3,32,16,0,95,15,1,0,0,0,96,97,5,40,0,0, + 97,98,5,26,0,0,98,102,3,18,9,0,99,101,3,18,9,0,100,99,1,0,0,0,101, + 104,1,0,0,0,102,100,1,0,0,0,102,103,1,0,0,0,103,105,1,0,0,0,104, + 102,1,0,0,0,105,106,5,27,0,0,106,17,1,0,0,0,107,108,3,44,22,0,108, + 109,5,18,0,0,109,110,3,4,2,0,110,19,1,0,0,0,111,113,5,22,0,0,112, + 114,5,46,0,0,113,112,1,0,0,0,113,114,1,0,0,0,114,119,1,0,0,0,115, + 116,5,20,0,0,116,118,5,46,0,0,117,115,1,0,0,0,118,121,1,0,0,0,119, + 117,1,0,0,0,119,120,1,0,0,0,120,122,1,0,0,0,121,119,1,0,0,0,122, + 123,5,23,0,0,123,21,1,0,0,0,124,125,5,22,0,0,125,130,3,24,12,0,126, + 127,5,20,0,0,127,129,3,24,12,0,128,126,1,0,0,0,129,132,1,0,0,0,130, + 128,1,0,0,0,130,131,1,0,0,0,131,133,1,0,0,0,132,130,1,0,0,0,133, + 134,5,23,0,0,134,23,1,0,0,0,135,136,5,46,0,0,136,137,5,19,0,0,137, + 138,3,32,16,0,138,25,1,0,0,0,139,140,5,36,0,0,140,141,3,42,21,0, + 141,27,1,0,0,0,142,143,5,37,0,0,143,144,3,42,21,0,144,29,1,0,0,0, + 145,146,5,46,0,0,146,147,5,19,0,0,147,152,3,4,2,0,148,149,5,46,0, + 0,149,150,5,19,0,0,150,152,3,32,16,0,151,145,1,0,0,0,151,148,1,0, + 0,0,152,31,1,0,0,0,153,157,3,34,17,0,154,157,3,38,19,0,155,157,3, + 40,20,0,156,153,1,0,0,0,156,154,1,0,0,0,156,155,1,0,0,0,157,33,1, + 0,0,0,158,159,5,26,0,0,159,164,3,36,18,0,160,161,5,20,0,0,161,163, + 3,36,18,0,162,160,1,0,0,0,163,166,1,0,0,0,164,162,1,0,0,0,164,165, + 1,0,0,0,165,167,1,0,0,0,166,164,1,0,0,0,167,168,5,27,0,0,168,172, + 1,0,0,0,169,170,5,26,0,0,170,172,5,27,0,0,171,158,1,0,0,0,171,169, + 1,0,0,0,172,35,1,0,0,0,173,174,7,0,0,0,174,175,5,21,0,0,175,176, + 3,32,16,0,176,37,1,0,0,0,177,178,5,24,0,0,178,183,3,32,16,0,179, + 180,5,20,0,0,180,182,3,32,16,0,181,179,1,0,0,0,182,185,1,0,0,0,183, + 181,1,0,0,0,183,184,1,0,0,0,184,186,1,0,0,0,185,183,1,0,0,0,186, + 187,5,25,0,0,187,191,1,0,0,0,188,189,5,24,0,0,189,191,5,25,0,0,190, + 177,1,0,0,0,190,188,1,0,0,0,191,39,1,0,0,0,192,199,5,45,0,0,193, + 199,5,44,0,0,194,199,7,1,0,0,195,199,5,30,0,0,196,199,5,43,0,0,197, + 199,5,2,0,0,198,192,1,0,0,0,198,193,1,0,0,0,198,194,1,0,0,0,198, + 195,1,0,0,0,198,196,1,0,0,0,198,197,1,0,0,0,199,41,1,0,0,0,200,203, + 5,43,0,0,201,203,5,2,0,0,202,200,1,0,0,0,202,201,1,0,0,0,203,43, + 1,0,0,0,204,205,7,2,0,0,205,45,1,0,0,0,19,49,51,66,77,83,86,91,102, + 113,119,130,151,156,164,171,183,190,198,202 ] class LSLParser ( Parser ): @@ -105,7 +102,7 @@ class LSLParser ( Parser ): "'States.QueryEvaluationError'", "'->'", "'='", "','", "':'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'true'", "'false'", "'null'", "'where'", "'as'", "'fail'", "'output'", - "'succeed'", "'error'", "'cause'", "'lambda'", "'arguments'", + "'return'", "'error'", "'cause'", "'lambda'", "'arguments'", "'catch'" ] symbolicNames = [ "", "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", @@ -119,7 +116,7 @@ class LSLParser ( Parser ): "ERRORNAMEStatesQueryEvaluationError", "ARROW", "EQUALS", "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", - "AS", "FAIL", "OUTPUT", "SUCCEED", "ERROR", "CAUSE", + "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", "LAMBDA", "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "INT", "NUMBER", "IDEN", "WS", "TOK" ] @@ -130,32 +127,29 @@ class LSLParser ( Parser ): RULE_service_name = 4 RULE_task_where = 5 RULE_fail_where = 6 - RULE_succeed_where = 7 - RULE_arguments = 8 - RULE_catch_block = 9 - RULE_catch_case = 10 - RULE_parameter_list = 11 - RULE_args_assign_list = 12 - RULE_args_assign = 13 - RULE_error = 14 - RULE_cause = 15 - RULE_output_block = 16 - RULE_var_assign = 17 - RULE_json_value = 18 - RULE_json_object = 19 - RULE_json_binding = 20 - RULE_json_arr = 21 - RULE_json_value_lit = 22 - RULE_string_or_jsonata = 23 - RULE_error_name = 24 + RULE_arguments = 7 + RULE_catch_block = 8 + RULE_catch_case = 9 + RULE_parameter_list = 10 + RULE_args_assign_list = 11 + RULE_args_assign = 12 + RULE_error = 13 + RULE_cause = 14 + RULE_var_assign = 15 + RULE_json_value = 16 + RULE_json_object = 17 + RULE_json_binding = 18 + RULE_json_arr = 19 + RULE_json_value_lit = 20 + RULE_string_or_jsonata = 21 + RULE_error_name = 22 ruleNames = [ "state_machine", "state_declaration", "state_call", "state", - "service_name", "task_where", "fail_where", "succeed_where", - "arguments", "catch_block", "catch_case", "parameter_list", - "args_assign_list", "args_assign", "error", "cause", - "output_block", "var_assign", "json_value", "json_object", - "json_binding", "json_arr", "json_value_lit", "string_or_jsonata", - "error_name" ] + "service_name", "task_where", "fail_where", "arguments", + "catch_block", "catch_case", "parameter_list", "args_assign_list", + "args_assign", "error", "cause", "var_assign", "json_value", + "json_object", "json_binding", "json_arr", "json_value_lit", + "string_or_jsonata", "error_name" ] EOF = Token.EOF LINECOMMENT=1 @@ -192,7 +186,7 @@ class LSLParser ( Parser ): AS=32 FAIL=33 OUTPUT=34 - SUCCEED=35 + RETURN=35 ERROR=36 CAUSE=37 LAMBDA=38 @@ -274,36 +268,36 @@ def state_machine(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 53 + self.state = 49 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 53 + self.state = 49 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,0,self._ctx) if la_ == 1: - self.state = 50 + self.state = 46 self.state_declaration() pass elif la_ == 2: - self.state = 51 + self.state = 47 self.var_assign() pass elif la_ == 3: - self.state = 52 + self.state = 48 self.state_call() pass - self.state = 55 + self.state = 51 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 70686571757568) != 0)): break - self.state = 57 + self.state = 53 self.match(LSLParser.EOF) except RecognitionException as re: localctx.exception = re @@ -361,13 +355,13 @@ def state_declaration(self): self.enterRule(localctx, 2, self.RULE_state_declaration) try: self.enterOuterAlt(localctx, 1) - self.state = 59 + self.state = 55 self.match(LSLParser.IDEN) - self.state = 60 + self.state = 56 self.parameter_list() - self.state = 61 + self.state = 57 self.match(LSLParser.EQUALS) - self.state = 62 + self.state = 58 self.state_() except RecognitionException as re: localctx.exception = re @@ -482,33 +476,33 @@ def state_call(self): localctx = LSLParser.State_callContext(self, self._ctx, self.state) self.enterRule(localctx, 4, self.RULE_state_call) try: - self.state = 70 + self.state = 66 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,2,self._ctx) if la_ == 1: localctx = LSLParser.State_call_templateContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 64 + self.state = 60 self.match(LSLParser.IDEN) - self.state = 65 + self.state = 61 self.args_assign_list() pass elif la_ == 2: localctx = LSLParser.State_call_namedContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 66 + self.state = 62 self.match(LSLParser.IDEN) - self.state = 67 + self.state = 63 self.match(LSLParser.AS) - self.state = 68 + self.state = 64 self.state_() pass elif la_ == 3: localctx = LSLParser.State_call_anonymousContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 69 + self.state = 65 self.state_() pass @@ -566,29 +560,29 @@ def accept(self, visitor:ParseTreeVisitor): return visitor.visitChildren(self) - class State_succeedContext(StateContext): + class State_returnContext(StateContext): def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext super().__init__(parser) self.copyFrom(ctx) - def SUCCEED(self): - return self.getToken(LSLParser.SUCCEED, 0) - def succeed_where(self): - return self.getTypedRuleContext(LSLParser.Succeed_whereContext,0) + def RETURN(self): + return self.getToken(LSLParser.RETURN, 0) + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterState_succeed" ): - listener.enterState_succeed(self) + if hasattr( listener, "enterState_return" ): + listener.enterState_return(self) def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitState_succeed" ): - listener.exitState_succeed(self) + if hasattr( listener, "exitState_return" ): + listener.exitState_return(self) def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitState_succeed" ): - return visitor.visitState_succeed(self) + if hasattr( visitor, "visitState_return" ): + return visitor.visitState_return(self) else: return visitor.visitChildren(self) @@ -631,36 +625,36 @@ def state_(self): localctx = LSLParser.StateContext(self, self._ctx, self.state) self.enterRule(localctx, 6, self.RULE_state) try: - self.state = 81 + self.state = 77 self._errHandler.sync(self) token = self._input.LA(1) if token in [38]: localctx = LSLParser.State_taskContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 72 + self.state = 68 self.service_name() - self.state = 73 + self.state = 69 self.match(LSLParser.COLON) - self.state = 74 + self.state = 70 self.match(LSLParser.IDEN) - self.state = 75 + self.state = 71 self.task_where() pass elif token in [33]: localctx = LSLParser.State_failContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 77 + self.state = 73 self.match(LSLParser.FAIL) - self.state = 78 + self.state = 74 self.fail_where() pass elif token in [35]: - localctx = LSLParser.State_succeedContext(self, localctx) + localctx = LSLParser.State_returnContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 79 - self.match(LSLParser.SUCCEED) - self.state = 80 - self.succeed_where() + self.state = 75 + self.match(LSLParser.RETURN) + self.state = 76 + self.json_value() pass else: raise NoViableAltException(self) @@ -710,7 +704,7 @@ def service_name(self): self.enterRule(localctx, 8, self.RULE_service_name) try: self.enterOuterAlt(localctx, 1) - self.state = 83 + self.state = 79 self.match(LSLParser.LAMBDA) except RecognitionException as re: localctx.exception = re @@ -766,21 +760,21 @@ def task_where(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 85 + self.state = 81 self.match(LSLParser.WHERE) - self.state = 87 + self.state = 83 self._errHandler.sync(self) _la = self._input.LA(1) if _la==39: - self.state = 86 + self.state = 82 self.arguments() - self.state = 90 + self.state = 86 self._errHandler.sync(self) _la = self._input.LA(1) if _la==40: - self.state = 89 + self.state = 85 self.catch_block() @@ -838,15 +832,15 @@ def fail_where(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 92 + self.state = 88 self.match(LSLParser.WHERE) - self.state = 93 + self.state = 89 self.error() - self.state = 95 + self.state = 91 self._errHandler.sync(self) _la = self._input.LA(1) if _la==37: - self.state = 94 + self.state = 90 self.cause() @@ -859,59 +853,6 @@ def fail_where(self): return localctx - class Succeed_whereContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def WHERE(self): - return self.getToken(LSLParser.WHERE, 0) - - def output_block(self): - return self.getTypedRuleContext(LSLParser.Output_blockContext,0) - - - def getRuleIndex(self): - return LSLParser.RULE_succeed_where - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterSucceed_where" ): - listener.enterSucceed_where(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitSucceed_where" ): - listener.exitSucceed_where(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitSucceed_where" ): - return visitor.visitSucceed_where(self) - else: - return visitor.visitChildren(self) - - - - - def succeed_where(self): - - localctx = LSLParser.Succeed_whereContext(self, self._ctx, self.state) - self.enterRule(localctx, 14, self.RULE_succeed_where) - try: - self.enterOuterAlt(localctx, 1) - self.state = 97 - self.match(LSLParser.WHERE) - self.state = 98 - self.output_block() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - class ArgumentsContext(ParserRuleContext): __slots__ = 'parser' @@ -949,12 +890,12 @@ def accept(self, visitor:ParseTreeVisitor): def arguments(self): localctx = LSLParser.ArgumentsContext(self, self._ctx, self.state) - self.enterRule(localctx, 16, self.RULE_arguments) + self.enterRule(localctx, 14, self.RULE_arguments) try: self.enterOuterAlt(localctx, 1) - self.state = 100 + self.state = 93 self.match(LSLParser.ARGUMENTS) - self.state = 101 + self.state = 94 self.json_value() except RecognitionException as re: localctx.exception = re @@ -1011,27 +952,27 @@ def accept(self, visitor:ParseTreeVisitor): def catch_block(self): localctx = LSLParser.Catch_blockContext(self, self._ctx, self.state) - self.enterRule(localctx, 18, self.RULE_catch_block) + self.enterRule(localctx, 16, self.RULE_catch_block) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 103 + self.state = 96 self.match(LSLParser.CATCH) - self.state = 104 + self.state = 97 self.match(LSLParser.LBRACE) - self.state = 105 + self.state = 98 self.catch_case() - self.state = 109 + self.state = 102 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0): - self.state = 106 + self.state = 99 self.catch_case() - self.state = 111 + self.state = 104 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 112 + self.state = 105 self.match(LSLParser.RBRACE) except RecognitionException as re: localctx.exception = re @@ -1083,14 +1024,14 @@ def accept(self, visitor:ParseTreeVisitor): def catch_case(self): localctx = LSLParser.Catch_caseContext(self, self._ctx, self.state) - self.enterRule(localctx, 20, self.RULE_catch_case) + self.enterRule(localctx, 18, self.RULE_catch_case) try: self.enterOuterAlt(localctx, 1) - self.state = 114 + self.state = 107 self.error_name() - self.state = 115 + self.state = 108 self.match(LSLParser.ARROW) - self.state = 116 + self.state = 109 self.state_call() except RecognitionException as re: localctx.exception = re @@ -1149,33 +1090,33 @@ def accept(self, visitor:ParseTreeVisitor): def parameter_list(self): localctx = LSLParser.Parameter_listContext(self, self._ctx, self.state) - self.enterRule(localctx, 22, self.RULE_parameter_list) + self.enterRule(localctx, 20, self.RULE_parameter_list) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 118 + self.state = 111 self.match(LSLParser.LPAREN) - self.state = 120 + self.state = 113 self._errHandler.sync(self) _la = self._input.LA(1) if _la==46: - self.state = 119 + self.state = 112 self.match(LSLParser.IDEN) - self.state = 126 + self.state = 119 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 122 + self.state = 115 self.match(LSLParser.COMMA) - self.state = 123 + self.state = 116 self.match(LSLParser.IDEN) - self.state = 128 + self.state = 121 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 129 + self.state = 122 self.match(LSLParser.RPAREN) except RecognitionException as re: localctx.exception = re @@ -1235,27 +1176,27 @@ def accept(self, visitor:ParseTreeVisitor): def args_assign_list(self): localctx = LSLParser.Args_assign_listContext(self, self._ctx, self.state) - self.enterRule(localctx, 24, self.RULE_args_assign_list) + self.enterRule(localctx, 22, self.RULE_args_assign_list) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 131 + self.state = 124 self.match(LSLParser.LPAREN) - self.state = 132 + self.state = 125 self.args_assign() - self.state = 137 + self.state = 130 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 133 + self.state = 126 self.match(LSLParser.COMMA) - self.state = 134 + self.state = 127 self.args_assign() - self.state = 139 + self.state = 132 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 140 + self.state = 133 self.match(LSLParser.RPAREN) except RecognitionException as re: localctx.exception = re @@ -1306,14 +1247,14 @@ def accept(self, visitor:ParseTreeVisitor): def args_assign(self): localctx = LSLParser.Args_assignContext(self, self._ctx, self.state) - self.enterRule(localctx, 26, self.RULE_args_assign) + self.enterRule(localctx, 24, self.RULE_args_assign) try: self.enterOuterAlt(localctx, 1) - self.state = 142 + self.state = 135 self.match(LSLParser.IDEN) - self.state = 143 + self.state = 136 self.match(LSLParser.EQUALS) - self.state = 144 + self.state = 137 self.json_value() except RecognitionException as re: localctx.exception = re @@ -1361,12 +1302,12 @@ def accept(self, visitor:ParseTreeVisitor): def error(self): localctx = LSLParser.ErrorContext(self, self._ctx, self.state) - self.enterRule(localctx, 28, self.RULE_error) + self.enterRule(localctx, 26, self.RULE_error) try: self.enterOuterAlt(localctx, 1) - self.state = 146 + self.state = 139 self.match(LSLParser.ERROR) - self.state = 147 + self.state = 140 self.string_or_jsonata() except RecognitionException as re: localctx.exception = re @@ -1414,12 +1355,12 @@ def accept(self, visitor:ParseTreeVisitor): def cause(self): localctx = LSLParser.CauseContext(self, self._ctx, self.state) - self.enterRule(localctx, 30, self.RULE_cause) + self.enterRule(localctx, 28, self.RULE_cause) try: self.enterOuterAlt(localctx, 1) - self.state = 149 + self.state = 142 self.match(LSLParser.CAUSE) - self.state = 150 + self.state = 143 self.string_or_jsonata() except RecognitionException as re: localctx.exception = re @@ -1430,59 +1371,6 @@ def cause(self): return localctx - class Output_blockContext(ParserRuleContext): - __slots__ = 'parser' - - def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): - super().__init__(parent, invokingState) - self.parser = parser - - def OUTPUT(self): - return self.getToken(LSLParser.OUTPUT, 0) - - def json_value(self): - return self.getTypedRuleContext(LSLParser.Json_valueContext,0) - - - def getRuleIndex(self): - return LSLParser.RULE_output_block - - def enterRule(self, listener:ParseTreeListener): - if hasattr( listener, "enterOutput_block" ): - listener.enterOutput_block(self) - - def exitRule(self, listener:ParseTreeListener): - if hasattr( listener, "exitOutput_block" ): - listener.exitOutput_block(self) - - def accept(self, visitor:ParseTreeVisitor): - if hasattr( visitor, "visitOutput_block" ): - return visitor.visitOutput_block(self) - else: - return visitor.visitChildren(self) - - - - - def output_block(self): - - localctx = LSLParser.Output_blockContext(self, self._ctx, self.state) - self.enterRule(localctx, 32, self.RULE_output_block) - try: - self.enterOuterAlt(localctx, 1) - self.state = 152 - self.match(LSLParser.OUTPUT) - self.state = 153 - self.json_value() - except RecognitionException as re: - localctx.exception = re - self._errHandler.reportError(self, re) - self._errHandler.recover(self, re) - finally: - self.exitRule() - return localctx - - class Var_assignContext(ParserRuleContext): __slots__ = 'parser' @@ -1562,30 +1450,30 @@ def accept(self, visitor:ParseTreeVisitor): def var_assign(self): localctx = LSLParser.Var_assignContext(self, self._ctx, self.state) - self.enterRule(localctx, 34, self.RULE_var_assign) + self.enterRule(localctx, 30, self.RULE_var_assign) try: - self.state = 161 + self.state = 151 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,11,self._ctx) if la_ == 1: localctx = LSLParser.Var_assign_state_callContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 155 + self.state = 145 self.match(LSLParser.IDEN) - self.state = 156 + self.state = 146 self.match(LSLParser.EQUALS) - self.state = 157 + self.state = 147 self.state_call() pass elif la_ == 2: localctx = LSLParser.Var_assign_json_valueContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 158 + self.state = 148 self.match(LSLParser.IDEN) - self.state = 159 + self.state = 149 self.match(LSLParser.EQUALS) - self.state = 160 + self.state = 150 self.json_value() pass @@ -1641,24 +1529,24 @@ def accept(self, visitor:ParseTreeVisitor): def json_value(self): localctx = LSLParser.Json_valueContext(self, self._ctx, self.state) - self.enterRule(localctx, 36, self.RULE_json_value) + self.enterRule(localctx, 32, self.RULE_json_value) try: - self.state = 166 + self.state = 156 self._errHandler.sync(self) token = self._input.LA(1) if token in [26]: self.enterOuterAlt(localctx, 1) - self.state = 163 + self.state = 153 self.json_object() pass elif token in [24]: self.enterOuterAlt(localctx, 2) - self.state = 164 + self.state = 154 self.json_arr() pass elif token in [2, 28, 29, 30, 43, 44, 45]: self.enterOuterAlt(localctx, 3) - self.state = 165 + self.state = 155 self.json_value_lit() pass else: @@ -1722,39 +1610,39 @@ def accept(self, visitor:ParseTreeVisitor): def json_object(self): localctx = LSLParser.Json_objectContext(self, self._ctx, self.state) - self.enterRule(localctx, 38, self.RULE_json_object) + self.enterRule(localctx, 34, self.RULE_json_object) self._la = 0 # Token type try: - self.state = 181 + self.state = 171 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,14,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 168 + self.state = 158 self.match(LSLParser.LBRACE) - self.state = 169 + self.state = 159 self.json_binding() - self.state = 174 + self.state = 164 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 170 + self.state = 160 self.match(LSLParser.COMMA) - self.state = 171 + self.state = 161 self.json_binding() - self.state = 176 + self.state = 166 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 177 + self.state = 167 self.match(LSLParser.RBRACE) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 179 + self.state = 169 self.match(LSLParser.LBRACE) - self.state = 180 + self.state = 170 self.match(LSLParser.RBRACE) pass @@ -1811,20 +1699,20 @@ def accept(self, visitor:ParseTreeVisitor): def json_binding(self): localctx = LSLParser.Json_bindingContext(self, self._ctx, self.state) - self.enterRule(localctx, 40, self.RULE_json_binding) + self.enterRule(localctx, 36, self.RULE_json_binding) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 183 + self.state = 173 _la = self._input.LA(1) if not(_la==43 or _la==46): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 184 + self.state = 174 self.match(LSLParser.COLON) - self.state = 185 + self.state = 175 self.json_value() except RecognitionException as re: localctx.exception = re @@ -1884,39 +1772,39 @@ def accept(self, visitor:ParseTreeVisitor): def json_arr(self): localctx = LSLParser.Json_arrContext(self, self._ctx, self.state) - self.enterRule(localctx, 42, self.RULE_json_arr) + self.enterRule(localctx, 38, self.RULE_json_arr) self._la = 0 # Token type try: - self.state = 200 + self.state = 190 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,16,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 187 + self.state = 177 self.match(LSLParser.LBRACK) - self.state = 188 + self.state = 178 self.json_value() - self.state = 193 + self.state = 183 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 189 + self.state = 179 self.match(LSLParser.COMMA) - self.state = 190 + self.state = 180 self.json_value() - self.state = 195 + self.state = 185 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 196 + self.state = 186 self.match(LSLParser.RBRACK) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 198 + self.state = 188 self.match(LSLParser.LBRACK) - self.state = 199 + self.state = 189 self.match(LSLParser.RBRACK) pass @@ -2097,28 +1985,28 @@ def accept(self, visitor:ParseTreeVisitor): def json_value_lit(self): localctx = LSLParser.Json_value_litContext(self, self._ctx, self.state) - self.enterRule(localctx, 44, self.RULE_json_value_lit) + self.enterRule(localctx, 40, self.RULE_json_value_lit) self._la = 0 # Token type try: - self.state = 208 + self.state = 198 self._errHandler.sync(self) token = self._input.LA(1) if token in [45]: localctx = LSLParser.Json_value_floatContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 202 + self.state = 192 self.match(LSLParser.NUMBER) pass elif token in [44]: localctx = LSLParser.Json_value_intContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 203 + self.state = 193 self.match(LSLParser.INT) pass elif token in [28, 29]: localctx = LSLParser.Json_value_boolContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 204 + self.state = 194 _la = self._input.LA(1) if not(_la==28 or _la==29): self._errHandler.recoverInline(self) @@ -2129,19 +2017,19 @@ def json_value_lit(self): elif token in [30]: localctx = LSLParser.Json_value_nullContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 205 + self.state = 195 self.match(LSLParser.NULL) pass elif token in [43]: localctx = LSLParser.Json_value_strContext(self, localctx) self.enterOuterAlt(localctx, 5) - self.state = 206 + self.state = 196 self.match(LSLParser.STRING) pass elif token in [2]: localctx = LSLParser.Json_value_jsonataContext(self, localctx) self.enterOuterAlt(localctx, 6) - self.state = 207 + self.state = 197 self.match(LSLParser.JSONATA) pass else: @@ -2225,21 +2113,21 @@ def accept(self, visitor:ParseTreeVisitor): def string_or_jsonata(self): localctx = LSLParser.String_or_jsonataContext(self, self._ctx, self.state) - self.enterRule(localctx, 46, self.RULE_string_or_jsonata) + self.enterRule(localctx, 42, self.RULE_string_or_jsonata) try: - self.state = 212 + self.state = 202 self._errHandler.sync(self) token = self._input.LA(1) if token in [43]: localctx = LSLParser.String_or_jsonata_stringContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 210 + self.state = 200 self.match(LSLParser.STRING) pass elif token in [2]: localctx = LSLParser.String_or_jsonata_jsonataContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 211 + self.state = 201 self.match(LSLParser.JSONATA) pass else: @@ -2332,11 +2220,11 @@ def accept(self, visitor:ParseTreeVisitor): def error_name(self): localctx = LSLParser.Error_nameContext(self, self._ctx, self.state) - self.enterRule(localctx, 48, self.RULE_error_name) + self.enterRule(localctx, 44, self.RULE_error_name) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 214 + self.state = 204 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0)): self._errHandler.recoverInline(self) diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py index 5a894e10029b6..91bd8c579f707 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py @@ -71,12 +71,12 @@ def exitState_fail(self, ctx:LSLParser.State_failContext): pass - # Enter a parse tree produced by LSLParser#state_succeed. - def enterState_succeed(self, ctx:LSLParser.State_succeedContext): + # Enter a parse tree produced by LSLParser#state_return. + def enterState_return(self, ctx:LSLParser.State_returnContext): pass - # Exit a parse tree produced by LSLParser#state_succeed. - def exitState_succeed(self, ctx:LSLParser.State_succeedContext): + # Exit a parse tree produced by LSLParser#state_return. + def exitState_return(self, ctx:LSLParser.State_returnContext): pass @@ -107,15 +107,6 @@ def exitFail_where(self, ctx:LSLParser.Fail_whereContext): pass - # Enter a parse tree produced by LSLParser#succeed_where. - def enterSucceed_where(self, ctx:LSLParser.Succeed_whereContext): - pass - - # Exit a parse tree produced by LSLParser#succeed_where. - def exitSucceed_where(self, ctx:LSLParser.Succeed_whereContext): - pass - - # Enter a parse tree produced by LSLParser#arguments. def enterArguments(self, ctx:LSLParser.ArgumentsContext): pass @@ -188,15 +179,6 @@ def exitCause(self, ctx:LSLParser.CauseContext): pass - # Enter a parse tree produced by LSLParser#output_block. - def enterOutput_block(self, ctx:LSLParser.Output_blockContext): - pass - - # Exit a parse tree produced by LSLParser#output_block. - def exitOutput_block(self, ctx:LSLParser.Output_blockContext): - pass - - # Enter a parse tree produced by LSLParser#var_assign_state_call. def enterVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): pass diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py index d649b989376b5..311d994041ed7 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py @@ -44,8 +44,8 @@ def visitState_fail(self, ctx:LSLParser.State_failContext): return self.visitChildren(ctx) - # Visit a parse tree produced by LSLParser#state_succeed. - def visitState_succeed(self, ctx:LSLParser.State_succeedContext): + # Visit a parse tree produced by LSLParser#state_return. + def visitState_return(self, ctx:LSLParser.State_returnContext): return self.visitChildren(ctx) @@ -64,11 +64,6 @@ def visitFail_where(self, ctx:LSLParser.Fail_whereContext): return self.visitChildren(ctx) - # Visit a parse tree produced by LSLParser#succeed_where. - def visitSucceed_where(self, ctx:LSLParser.Succeed_whereContext): - return self.visitChildren(ctx) - - # Visit a parse tree produced by LSLParser#arguments. def visitArguments(self, ctx:LSLParser.ArgumentsContext): return self.visitChildren(ctx) @@ -109,11 +104,6 @@ def visitCause(self, ctx:LSLParser.CauseContext): return self.visitChildren(ctx) - # Visit a parse tree produced by LSLParser#output_block. - def visitOutput_block(self, ctx:LSLParser.Output_blockContext): - return self.visitChildren(ctx) - - # Visit a parse tree produced by LSLParser#var_assign_state_call. def visitVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): return self.visitChildren(ctx) diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py index 1299167952cb5..2fe52a643f53e 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py @@ -137,19 +137,11 @@ def visitParameter_list(self, ctx: LSLParser.Parameter_listContext): parameters.append(parameter_identifier) return parameters - def visitState_succeed(self, ctx: LSLParser.State_succeedContext): - where = self.visit(ctx.succeed_where()) - output_prepare_state = {"Type": "Pass", "End": True, **where} + def visitState_return(self, ctx: LSLParser.State_returnContext): + output_expression = self.visit(ctx.json_value()) + output_prepare_state = {"Type": "Pass", "End": True, "Output": output_expression} return output_prepare_state - def visitSucceed_where(self, ctx: LSLParser.Succeed_whereContext): - output_expression = self.visit(ctx.output_block()) - return {"Output": output_expression} - - def visitOutput_block(self, ctx: LSLParser.Output_blockContext): - value = self.visit(ctx.json_value()) - return value - def visitState_fail(self, ctx: LSLParser.State_failContext): where = self.visit(ctx.fail_where()) state = {"Type": "Fail", **where} diff --git a/tests/aws/services/stepfunctions/v2/localstack_states_language.py b/tests/aws/services/stepfunctions/v2/localstack_states_language.py index e9ff78cd38466..be49f6c38031f 100644 --- a/tests/aws/services/stepfunctions/v2/localstack_states_language.py +++ b/tests/aws/services/stepfunctions/v2/localstack_states_language.py @@ -31,7 +31,7 @@ def test_assign_invoke_succeed( last_name=jsonata($user_surname) ) payload_value = jsonata($greeting_output.Payload) - succeed where output jsonata($payload_value) + return jsonata($payload_value) """) definition = json.dumps(state_machine) @@ -115,7 +115,7 @@ def test_assign_and_invoke( @markers.aws.only_localstack def test_assign_and_succeed(self, aws_client): state_machine = LocalStackStateLanguageParser.parse(""" - WorkflowSucceeded(value) = succeed where output jsonata($value) + WorkflowSucceeded(value) = return jsonata($value) output_message = jsonata("Hello" & " " & "World!") WorkflowSucceeded(value = jsonata($output_message)) """) @@ -144,7 +144,7 @@ def test_assign_and_succeed(self, aws_client): @markers.aws.only_localstack def test_succeed_template(self, aws_client): state_machine = LocalStackStateLanguageParser.parse(""" - WorkflowSucceeded(value) = succeed where output jsonata($value) + WorkflowSucceeded(value) = return jsonata($value) WorkflowSucceeded(value = {"message": "string-literal"}) """) definition = json.dumps(state_machine) @@ -172,7 +172,7 @@ def test_succeed_template(self, aws_client): @markers.aws.only_localstack def test_succeed_inplace(self, aws_client): state_machine = LocalStackStateLanguageParser.parse(""" - WorkflowSucceeded as succeed where output jsonata('string' & ' ' & 'literal') + WorkflowSucceeded as return jsonata('string' & ' ' & 'literal') """) definition = json.dumps(state_machine) @@ -199,7 +199,7 @@ def test_succeed_inplace(self, aws_client): @markers.aws.only_localstack def test_succeed_anonymous_inplace(self, aws_client): state_machine = LocalStackStateLanguageParser.parse(""" - succeed where output jsonata('string' & ' ' & 'literal') + return jsonata('string' & ' ' & 'literal') """) definition = json.dumps(state_machine) From e417c2e864ed1b7ac9c3e606e657eb59a488bf41 Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Wed, 14 May 2025 17:46:27 +0200 Subject: [PATCH 4/6] map states --- .../stepfunctions/asl/antlr/LSLLexer.g4 | 4 + .../stepfunctions/asl/antlr/LSLParser.g4 | 10 +- .../asl/antlr/runtime/LSLLexer.py | 498 +++++++------ .../asl/antlr/runtime/LSLParser.py | 684 ++++++++++++------ .../asl/antlr/runtime/LSLParserListener.py | 27 + .../asl/antlr/runtime/LSLParserVisitor.py | 15 + .../stepfunctions/asl/parse/lsl/transpiler.py | 53 +- .../v2/localstack_states_language.py | 107 +++ 8 files changed, 925 insertions(+), 473 deletions(-) diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 index 9141d854585b0..328dafab1c35e 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 @@ -54,6 +54,10 @@ CAUSE: 'cause'; LAMBDA: 'lambda'; ARGUMENTS: 'arguments'; CATCH: 'catch'; +FOR: 'for'; +IN: 'in'; +PROCESS: 'process'; +PARALLEL: 'parallel'; STRINGPATH: '"$"' | '"$' ('.' | '[') (ESC | SAFECODEPOINT)* '"'; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 index 60a331c546f62..3f49bb15a003b 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLParser.g4 @@ -21,9 +21,11 @@ state_call: ; state: - service_name COLON IDEN task_where # state_task - | FAIL fail_where # state_fail - | RETURN json_value # state_return + service_name COLON IDEN task_where # state_task + | FAIL fail_where # state_fail + | RETURN json_value # state_return + | FOR IDEN IN json_value WHERE process # state_map + | PARALLEL WHERE process+ # state_parallel ; service_name: LAMBDA; @@ -47,6 +49,8 @@ args_assign: IDEN EQUALS json_value; error: ERROR string_or_jsonata; cause: CAUSE string_or_jsonata; +process: PROCESS LBRACE (state_declaration | var_assign | state_call)+ RBRACE; + var_assign: IDEN EQUALS state_call # var_assign_state_call | IDEN EQUALS json_value # var_assign_json_value diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py index 1f84a1dc62fd6..30760540eb7df 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLLexer.py @@ -10,7 +10,7 @@ def serializedATN(): return [ - 4,0,48,683,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 4,0,52,715,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, @@ -18,240 +18,251 @@ def serializedATN(): 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, - 52,7,52,1,0,1,0,5,0,110,8,0,10,0,12,0,113,9,0,1,0,1,0,1,1,1,1,1, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,127,8,1,10,1,12,1,130,9,1,1,1, - 1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5, - 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6, - 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7, - 1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7, - 1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, - 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,9, + 52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,1,0,1,0,5,0,118, + 8,0,10,0,12,0,121,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,5,1,135,8,1,10,1,12,1,138,9,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2, + 1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,4, + 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, + 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7, + 1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8, + 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, + 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9, 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9, - 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10, - 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, - 1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, + 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11, 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11, + 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12, 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13, + 1,12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13, 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, - 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14, + 1,13,1,13,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,14, 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14, - 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15, + 1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15, 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15, - 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16, + 1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16, 1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16, - 1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17, - 1,17,1,18,1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23, - 1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,28,1,28, - 1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30, - 1,30,1,30,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33, - 1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35, - 1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37, - 1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38, - 1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,40, - 1,40,1,40,1,40,5,40,597,8,40,10,40,12,40,600,9,40,1,40,3,40,603, - 8,40,1,41,1,41,1,41,1,41,5,41,609,8,41,10,41,12,41,612,9,41,1,42, - 1,42,1,42,5,42,617,8,42,10,42,12,42,620,9,42,1,42,1,42,1,43,1,43, - 1,43,3,43,627,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,46, - 1,46,1,47,1,47,1,47,5,47,642,8,47,10,47,12,47,645,9,47,3,47,647, - 8,47,1,48,3,48,650,8,48,1,48,1,48,1,48,4,48,655,8,48,11,48,12,48, - 656,3,48,659,8,48,1,48,3,48,662,8,48,1,49,1,49,3,49,666,8,49,1,49, - 1,49,1,50,4,50,671,8,50,11,50,12,50,672,1,51,4,51,676,8,51,11,51, - 12,51,677,1,51,1,51,1,52,1,52,0,0,53,1,1,3,2,5,3,7,4,9,5,11,6,13, - 7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18, - 37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29, - 59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,77,39,79,40, - 81,41,83,42,85,43,87,0,89,0,91,0,93,0,95,44,97,45,99,0,101,46,103, - 47,105,48,1,0,13,2,0,10,10,12,13,1,0,41,41,2,0,46,46,91,91,3,0,65, - 90,95,95,97,122,8,0,34,34,47,47,92,92,98,98,102,102,110,110,114, - 114,116,116,3,0,48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0,49,57, - 1,0,48,57,2,0,69,69,101,101,2,0,43,43,45,45,5,0,45,45,48,57,65,90, - 95,95,97,122,3,0,9,10,13,13,32,32,696,0,1,1,0,0,0,0,3,1,0,0,0,0, - 5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15, - 1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25, - 1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35, - 1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45, - 1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55, - 1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65, - 1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75, - 1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85, - 1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0, - 105,1,0,0,0,1,107,1,0,0,0,3,116,1,0,0,0,5,133,1,0,0,0,7,144,1,0, - 0,0,9,169,1,0,0,0,11,193,1,0,0,0,13,208,1,0,0,0,15,226,1,0,0,0,17, - 245,1,0,0,0,19,275,1,0,0,0,21,303,1,0,0,0,23,323,1,0,0,0,25,346, - 1,0,0,0,27,370,1,0,0,0,29,409,1,0,0,0,31,433,1,0,0,0,33,459,1,0, - 0,0,35,487,1,0,0,0,37,490,1,0,0,0,39,492,1,0,0,0,41,494,1,0,0,0, - 43,496,1,0,0,0,45,498,1,0,0,0,47,500,1,0,0,0,49,502,1,0,0,0,51,504, - 1,0,0,0,53,506,1,0,0,0,55,508,1,0,0,0,57,513,1,0,0,0,59,519,1,0, - 0,0,61,524,1,0,0,0,63,530,1,0,0,0,65,533,1,0,0,0,67,538,1,0,0,0, - 69,545,1,0,0,0,71,552,1,0,0,0,73,558,1,0,0,0,75,564,1,0,0,0,77,571, - 1,0,0,0,79,581,1,0,0,0,81,602,1,0,0,0,83,604,1,0,0,0,85,613,1,0, - 0,0,87,623,1,0,0,0,89,628,1,0,0,0,91,634,1,0,0,0,93,636,1,0,0,0, - 95,646,1,0,0,0,97,649,1,0,0,0,99,663,1,0,0,0,101,670,1,0,0,0,103, - 675,1,0,0,0,105,681,1,0,0,0,107,111,5,35,0,0,108,110,8,0,0,0,109, - 108,1,0,0,0,110,113,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112, - 114,1,0,0,0,113,111,1,0,0,0,114,115,6,0,0,0,115,2,1,0,0,0,116,117, - 5,106,0,0,117,118,5,115,0,0,118,119,5,111,0,0,119,120,5,110,0,0, - 120,121,5,97,0,0,121,122,5,116,0,0,122,123,5,97,0,0,123,124,5,40, - 0,0,124,128,1,0,0,0,125,127,8,1,0,0,126,125,1,0,0,0,127,130,1,0, - 0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,131,1,0,0,0,130,128,1,0, - 0,0,131,132,5,41,0,0,132,4,1,0,0,0,133,134,5,83,0,0,134,135,5,116, - 0,0,135,136,5,97,0,0,136,137,5,116,0,0,137,138,5,101,0,0,138,139, - 5,115,0,0,139,140,5,46,0,0,140,141,5,65,0,0,141,142,5,76,0,0,142, - 143,5,76,0,0,143,6,1,0,0,0,144,145,5,83,0,0,145,146,5,116,0,0,146, - 147,5,97,0,0,147,148,5,116,0,0,148,149,5,101,0,0,149,150,5,115,0, - 0,150,151,5,46,0,0,151,152,5,68,0,0,152,153,5,97,0,0,153,154,5,116, - 0,0,154,155,5,97,0,0,155,156,5,76,0,0,156,157,5,105,0,0,157,158, - 5,109,0,0,158,159,5,105,0,0,159,160,5,116,0,0,160,161,5,69,0,0,161, - 162,5,120,0,0,162,163,5,99,0,0,163,164,5,101,0,0,164,165,5,101,0, - 0,165,166,5,100,0,0,166,167,5,101,0,0,167,168,5,100,0,0,168,8,1, - 0,0,0,169,170,5,83,0,0,170,171,5,116,0,0,171,172,5,97,0,0,172,173, - 5,116,0,0,173,174,5,101,0,0,174,175,5,115,0,0,175,176,5,46,0,0,176, - 177,5,72,0,0,177,178,5,101,0,0,178,179,5,97,0,0,179,180,5,114,0, - 0,180,181,5,116,0,0,181,182,5,98,0,0,182,183,5,101,0,0,183,184,5, - 97,0,0,184,185,5,116,0,0,185,186,5,84,0,0,186,187,5,105,0,0,187, - 188,5,109,0,0,188,189,5,101,0,0,189,190,5,111,0,0,190,191,5,117, - 0,0,191,192,5,116,0,0,192,10,1,0,0,0,193,194,5,83,0,0,194,195,5, - 116,0,0,195,196,5,97,0,0,196,197,5,116,0,0,197,198,5,101,0,0,198, - 199,5,115,0,0,199,200,5,46,0,0,200,201,5,84,0,0,201,202,5,105,0, - 0,202,203,5,109,0,0,203,204,5,101,0,0,204,205,5,111,0,0,205,206, - 5,117,0,0,206,207,5,116,0,0,207,12,1,0,0,0,208,209,5,83,0,0,209, - 210,5,116,0,0,210,211,5,97,0,0,211,212,5,116,0,0,212,213,5,101,0, - 0,213,214,5,115,0,0,214,215,5,46,0,0,215,216,5,84,0,0,216,217,5, - 97,0,0,217,218,5,115,0,0,218,219,5,107,0,0,219,220,5,70,0,0,220, - 221,5,97,0,0,221,222,5,105,0,0,222,223,5,108,0,0,223,224,5,101,0, - 0,224,225,5,100,0,0,225,14,1,0,0,0,226,227,5,83,0,0,227,228,5,116, - 0,0,228,229,5,97,0,0,229,230,5,116,0,0,230,231,5,101,0,0,231,232, - 5,115,0,0,232,233,5,46,0,0,233,234,5,80,0,0,234,235,5,101,0,0,235, - 236,5,114,0,0,236,237,5,109,0,0,237,238,5,105,0,0,238,239,5,115, - 0,0,239,240,5,115,0,0,240,241,5,105,0,0,241,242,5,111,0,0,242,243, - 5,110,0,0,243,244,5,115,0,0,244,16,1,0,0,0,245,246,5,83,0,0,246, - 247,5,116,0,0,247,248,5,97,0,0,248,249,5,116,0,0,249,250,5,101,0, - 0,250,251,5,115,0,0,251,252,5,46,0,0,252,253,5,82,0,0,253,254,5, - 101,0,0,254,255,5,115,0,0,255,256,5,117,0,0,256,257,5,108,0,0,257, - 258,5,116,0,0,258,259,5,80,0,0,259,260,5,97,0,0,260,261,5,116,0, - 0,261,262,5,104,0,0,262,263,5,77,0,0,263,264,5,97,0,0,264,265,5, - 116,0,0,265,266,5,99,0,0,266,267,5,104,0,0,267,268,5,70,0,0,268, - 269,5,97,0,0,269,270,5,105,0,0,270,271,5,108,0,0,271,272,5,117,0, - 0,272,273,5,114,0,0,273,274,5,101,0,0,274,18,1,0,0,0,275,276,5,83, - 0,0,276,277,5,116,0,0,277,278,5,97,0,0,278,279,5,116,0,0,279,280, - 5,101,0,0,280,281,5,115,0,0,281,282,5,46,0,0,282,283,5,80,0,0,283, - 284,5,97,0,0,284,285,5,114,0,0,285,286,5,97,0,0,286,287,5,109,0, - 0,287,288,5,101,0,0,288,289,5,116,0,0,289,290,5,101,0,0,290,291, - 5,114,0,0,291,292,5,80,0,0,292,293,5,97,0,0,293,294,5,116,0,0,294, - 295,5,104,0,0,295,296,5,70,0,0,296,297,5,97,0,0,297,298,5,105,0, - 0,298,299,5,108,0,0,299,300,5,117,0,0,300,301,5,114,0,0,301,302, - 5,101,0,0,302,20,1,0,0,0,303,304,5,83,0,0,304,305,5,116,0,0,305, - 306,5,97,0,0,306,307,5,116,0,0,307,308,5,101,0,0,308,309,5,115,0, - 0,309,310,5,46,0,0,310,311,5,66,0,0,311,312,5,114,0,0,312,313,5, - 97,0,0,313,314,5,110,0,0,314,315,5,99,0,0,315,316,5,104,0,0,316, - 317,5,70,0,0,317,318,5,97,0,0,318,319,5,105,0,0,319,320,5,108,0, - 0,320,321,5,101,0,0,321,322,5,100,0,0,322,22,1,0,0,0,323,324,5,83, - 0,0,324,325,5,116,0,0,325,326,5,97,0,0,326,327,5,116,0,0,327,328, - 5,101,0,0,328,329,5,115,0,0,329,330,5,46,0,0,330,331,5,78,0,0,331, - 332,5,111,0,0,332,333,5,67,0,0,333,334,5,104,0,0,334,335,5,111,0, - 0,335,336,5,105,0,0,336,337,5,99,0,0,337,338,5,101,0,0,338,339,5, - 77,0,0,339,340,5,97,0,0,340,341,5,116,0,0,341,342,5,99,0,0,342,343, - 5,104,0,0,343,344,5,101,0,0,344,345,5,100,0,0,345,24,1,0,0,0,346, - 347,5,83,0,0,347,348,5,116,0,0,348,349,5,97,0,0,349,350,5,116,0, - 0,350,351,5,101,0,0,351,352,5,115,0,0,352,353,5,46,0,0,353,354,5, - 73,0,0,354,355,5,110,0,0,355,356,5,116,0,0,356,357,5,114,0,0,357, - 358,5,105,0,0,358,359,5,110,0,0,359,360,5,115,0,0,360,361,5,105, - 0,0,361,362,5,99,0,0,362,363,5,70,0,0,363,364,5,97,0,0,364,365,5, - 105,0,0,365,366,5,108,0,0,366,367,5,117,0,0,367,368,5,114,0,0,368, - 369,5,101,0,0,369,26,1,0,0,0,370,371,5,83,0,0,371,372,5,116,0,0, - 372,373,5,97,0,0,373,374,5,116,0,0,374,375,5,101,0,0,375,376,5,115, - 0,0,376,377,5,46,0,0,377,378,5,69,0,0,378,379,5,120,0,0,379,380, - 5,99,0,0,380,381,5,101,0,0,381,382,5,101,0,0,382,383,5,100,0,0,383, - 384,5,84,0,0,384,385,5,111,0,0,385,386,5,108,0,0,386,387,5,101,0, - 0,387,388,5,114,0,0,388,389,5,97,0,0,389,390,5,116,0,0,390,391,5, - 101,0,0,391,392,5,100,0,0,392,393,5,70,0,0,393,394,5,97,0,0,394, - 395,5,105,0,0,395,396,5,108,0,0,396,397,5,117,0,0,397,398,5,114, - 0,0,398,399,5,101,0,0,399,400,5,84,0,0,400,401,5,104,0,0,401,402, - 5,114,0,0,402,403,5,101,0,0,403,404,5,115,0,0,404,405,5,104,0,0, - 405,406,5,111,0,0,406,407,5,108,0,0,407,408,5,100,0,0,408,28,1,0, - 0,0,409,410,5,83,0,0,410,411,5,116,0,0,411,412,5,97,0,0,412,413, - 5,116,0,0,413,414,5,101,0,0,414,415,5,115,0,0,415,416,5,46,0,0,416, - 417,5,73,0,0,417,418,5,116,0,0,418,419,5,101,0,0,419,420,5,109,0, - 0,420,421,5,82,0,0,421,422,5,101,0,0,422,423,5,97,0,0,423,424,5, - 100,0,0,424,425,5,101,0,0,425,426,5,114,0,0,426,427,5,70,0,0,427, - 428,5,97,0,0,428,429,5,105,0,0,429,430,5,108,0,0,430,431,5,101,0, - 0,431,432,5,100,0,0,432,30,1,0,0,0,433,434,5,83,0,0,434,435,5,116, - 0,0,435,436,5,97,0,0,436,437,5,116,0,0,437,438,5,101,0,0,438,439, - 5,115,0,0,439,440,5,46,0,0,440,441,5,82,0,0,441,442,5,101,0,0,442, - 443,5,115,0,0,443,444,5,117,0,0,444,445,5,108,0,0,445,446,5,116, - 0,0,446,447,5,87,0,0,447,448,5,114,0,0,448,449,5,105,0,0,449,450, - 5,116,0,0,450,451,5,101,0,0,451,452,5,114,0,0,452,453,5,70,0,0,453, - 454,5,97,0,0,454,455,5,105,0,0,455,456,5,108,0,0,456,457,5,101,0, - 0,457,458,5,100,0,0,458,32,1,0,0,0,459,460,5,83,0,0,460,461,5,116, - 0,0,461,462,5,97,0,0,462,463,5,116,0,0,463,464,5,101,0,0,464,465, - 5,115,0,0,465,466,5,46,0,0,466,467,5,81,0,0,467,468,5,117,0,0,468, - 469,5,101,0,0,469,470,5,114,0,0,470,471,5,121,0,0,471,472,5,69,0, - 0,472,473,5,118,0,0,473,474,5,97,0,0,474,475,5,108,0,0,475,476,5, - 117,0,0,476,477,5,97,0,0,477,478,5,116,0,0,478,479,5,105,0,0,479, - 480,5,111,0,0,480,481,5,110,0,0,481,482,5,69,0,0,482,483,5,114,0, - 0,483,484,5,114,0,0,484,485,5,111,0,0,485,486,5,114,0,0,486,34,1, - 0,0,0,487,488,5,45,0,0,488,489,5,62,0,0,489,36,1,0,0,0,490,491,5, - 61,0,0,491,38,1,0,0,0,492,493,5,44,0,0,493,40,1,0,0,0,494,495,5, - 58,0,0,495,42,1,0,0,0,496,497,5,40,0,0,497,44,1,0,0,0,498,499,5, - 41,0,0,499,46,1,0,0,0,500,501,5,91,0,0,501,48,1,0,0,0,502,503,5, - 93,0,0,503,50,1,0,0,0,504,505,5,123,0,0,505,52,1,0,0,0,506,507,5, - 125,0,0,507,54,1,0,0,0,508,509,5,116,0,0,509,510,5,114,0,0,510,511, - 5,117,0,0,511,512,5,101,0,0,512,56,1,0,0,0,513,514,5,102,0,0,514, - 515,5,97,0,0,515,516,5,108,0,0,516,517,5,115,0,0,517,518,5,101,0, - 0,518,58,1,0,0,0,519,520,5,110,0,0,520,521,5,117,0,0,521,522,5,108, - 0,0,522,523,5,108,0,0,523,60,1,0,0,0,524,525,5,119,0,0,525,526,5, - 104,0,0,526,527,5,101,0,0,527,528,5,114,0,0,528,529,5,101,0,0,529, - 62,1,0,0,0,530,531,5,97,0,0,531,532,5,115,0,0,532,64,1,0,0,0,533, - 534,5,102,0,0,534,535,5,97,0,0,535,536,5,105,0,0,536,537,5,108,0, - 0,537,66,1,0,0,0,538,539,5,111,0,0,539,540,5,117,0,0,540,541,5,116, - 0,0,541,542,5,112,0,0,542,543,5,117,0,0,543,544,5,116,0,0,544,68, - 1,0,0,0,545,546,5,114,0,0,546,547,5,101,0,0,547,548,5,116,0,0,548, - 549,5,117,0,0,549,550,5,114,0,0,550,551,5,110,0,0,551,70,1,0,0,0, - 552,553,5,101,0,0,553,554,5,114,0,0,554,555,5,114,0,0,555,556,5, - 111,0,0,556,557,5,114,0,0,557,72,1,0,0,0,558,559,5,99,0,0,559,560, - 5,97,0,0,560,561,5,117,0,0,561,562,5,115,0,0,562,563,5,101,0,0,563, - 74,1,0,0,0,564,565,5,108,0,0,565,566,5,97,0,0,566,567,5,109,0,0, - 567,568,5,98,0,0,568,569,5,100,0,0,569,570,5,97,0,0,570,76,1,0,0, - 0,571,572,5,97,0,0,572,573,5,114,0,0,573,574,5,103,0,0,574,575,5, - 117,0,0,575,576,5,109,0,0,576,577,5,101,0,0,577,578,5,110,0,0,578, - 579,5,116,0,0,579,580,5,115,0,0,580,78,1,0,0,0,581,582,5,99,0,0, - 582,583,5,97,0,0,583,584,5,116,0,0,584,585,5,99,0,0,585,586,5,104, - 0,0,586,80,1,0,0,0,587,588,5,34,0,0,588,589,5,36,0,0,589,603,5,34, - 0,0,590,591,5,34,0,0,591,592,5,36,0,0,592,593,1,0,0,0,593,598,7, - 2,0,0,594,597,3,87,43,0,595,597,3,93,46,0,596,594,1,0,0,0,596,595, - 1,0,0,0,597,600,1,0,0,0,598,596,1,0,0,0,598,599,1,0,0,0,599,601, - 1,0,0,0,600,598,1,0,0,0,601,603,5,34,0,0,602,587,1,0,0,0,602,590, - 1,0,0,0,603,82,1,0,0,0,604,605,5,36,0,0,605,610,7,3,0,0,606,609, - 3,87,43,0,607,609,3,93,46,0,608,606,1,0,0,0,608,607,1,0,0,0,609, - 612,1,0,0,0,610,608,1,0,0,0,610,611,1,0,0,0,611,84,1,0,0,0,612,610, - 1,0,0,0,613,618,5,34,0,0,614,617,3,87,43,0,615,617,3,93,46,0,616, - 614,1,0,0,0,616,615,1,0,0,0,617,620,1,0,0,0,618,616,1,0,0,0,618, - 619,1,0,0,0,619,621,1,0,0,0,620,618,1,0,0,0,621,622,5,34,0,0,622, - 86,1,0,0,0,623,626,5,92,0,0,624,627,7,4,0,0,625,627,3,89,44,0,626, - 624,1,0,0,0,626,625,1,0,0,0,627,88,1,0,0,0,628,629,5,117,0,0,629, - 630,3,91,45,0,630,631,3,91,45,0,631,632,3,91,45,0,632,633,3,91,45, - 0,633,90,1,0,0,0,634,635,7,5,0,0,635,92,1,0,0,0,636,637,8,6,0,0, - 637,94,1,0,0,0,638,647,5,48,0,0,639,643,7,7,0,0,640,642,7,8,0,0, - 641,640,1,0,0,0,642,645,1,0,0,0,643,641,1,0,0,0,643,644,1,0,0,0, - 644,647,1,0,0,0,645,643,1,0,0,0,646,638,1,0,0,0,646,639,1,0,0,0, - 647,96,1,0,0,0,648,650,5,45,0,0,649,648,1,0,0,0,649,650,1,0,0,0, - 650,651,1,0,0,0,651,658,3,95,47,0,652,654,5,46,0,0,653,655,7,8,0, - 0,654,653,1,0,0,0,655,656,1,0,0,0,656,654,1,0,0,0,656,657,1,0,0, - 0,657,659,1,0,0,0,658,652,1,0,0,0,658,659,1,0,0,0,659,661,1,0,0, - 0,660,662,3,99,49,0,661,660,1,0,0,0,661,662,1,0,0,0,662,98,1,0,0, - 0,663,665,7,9,0,0,664,666,7,10,0,0,665,664,1,0,0,0,665,666,1,0,0, - 0,666,667,1,0,0,0,667,668,3,95,47,0,668,100,1,0,0,0,669,671,7,11, - 0,0,670,669,1,0,0,0,671,672,1,0,0,0,672,670,1,0,0,0,672,673,1,0, - 0,0,673,102,1,0,0,0,674,676,7,12,0,0,675,674,1,0,0,0,676,677,1,0, - 0,0,677,675,1,0,0,0,677,678,1,0,0,0,678,679,1,0,0,0,679,680,6,51, - 0,0,680,104,1,0,0,0,681,682,9,0,0,0,682,106,1,0,0,0,20,0,111,128, - 596,598,602,608,610,616,618,626,643,646,649,656,658,661,665,672, - 677,1,6,0,0 + 1,16,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,19,1,19, + 1,20,1,20,1,21,1,21,1,22,1,22,1,23,1,23,1,24,1,24,1,25,1,25,1,26, + 1,26,1,27,1,27,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,29, + 1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31, + 1,32,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34, + 1,34,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,35,1,36, + 1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37,1,37,1,37,1,38, + 1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39, + 1,39,1,39,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,42,1,42,1,42,1,42, + 1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43,1,43, + 1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,5,44,629,8,44,10,44, + 12,44,632,9,44,1,44,3,44,635,8,44,1,45,1,45,1,45,1,45,5,45,641,8, + 45,10,45,12,45,644,9,45,1,46,1,46,1,46,5,46,649,8,46,10,46,12,46, + 652,9,46,1,46,1,46,1,47,1,47,1,47,3,47,659,8,47,1,48,1,48,1,48,1, + 48,1,48,1,48,1,49,1,49,1,50,1,50,1,51,1,51,1,51,5,51,674,8,51,10, + 51,12,51,677,9,51,3,51,679,8,51,1,52,3,52,682,8,52,1,52,1,52,1,52, + 4,52,687,8,52,11,52,12,52,688,3,52,691,8,52,1,52,3,52,694,8,52,1, + 53,1,53,3,53,698,8,53,1,53,1,53,1,54,4,54,703,8,54,11,54,12,54,704, + 1,55,4,55,708,8,55,11,55,12,55,709,1,55,1,55,1,56,1,56,0,0,57,1, + 1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27, + 14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49, + 25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71, + 36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93, + 47,95,0,97,0,99,0,101,0,103,48,105,49,107,0,109,50,111,51,113,52, + 1,0,13,2,0,10,10,12,13,1,0,41,41,2,0,46,46,91,91,3,0,65,90,95,95, + 97,122,8,0,34,34,47,47,92,92,98,98,102,102,110,110,114,114,116,116, + 3,0,48,57,65,70,97,102,3,0,0,31,34,34,92,92,1,0,49,57,1,0,48,57, + 2,0,69,69,101,101,2,0,43,43,45,45,5,0,45,45,48,57,65,90,95,95,97, + 122,3,0,9,10,13,13,32,32,728,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0, + 0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0, + 17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0, + 27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0, + 37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0, + 47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0, + 57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0, + 67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0, + 77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0, + 87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,103,1,0,0,0, + 0,105,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,1,115,1, + 0,0,0,3,124,1,0,0,0,5,141,1,0,0,0,7,152,1,0,0,0,9,177,1,0,0,0,11, + 201,1,0,0,0,13,216,1,0,0,0,15,234,1,0,0,0,17,253,1,0,0,0,19,283, + 1,0,0,0,21,311,1,0,0,0,23,331,1,0,0,0,25,354,1,0,0,0,27,378,1,0, + 0,0,29,417,1,0,0,0,31,441,1,0,0,0,33,467,1,0,0,0,35,495,1,0,0,0, + 37,498,1,0,0,0,39,500,1,0,0,0,41,502,1,0,0,0,43,504,1,0,0,0,45,506, + 1,0,0,0,47,508,1,0,0,0,49,510,1,0,0,0,51,512,1,0,0,0,53,514,1,0, + 0,0,55,516,1,0,0,0,57,521,1,0,0,0,59,527,1,0,0,0,61,532,1,0,0,0, + 63,538,1,0,0,0,65,541,1,0,0,0,67,546,1,0,0,0,69,553,1,0,0,0,71,560, + 1,0,0,0,73,566,1,0,0,0,75,572,1,0,0,0,77,579,1,0,0,0,79,589,1,0, + 0,0,81,595,1,0,0,0,83,599,1,0,0,0,85,602,1,0,0,0,87,610,1,0,0,0, + 89,634,1,0,0,0,91,636,1,0,0,0,93,645,1,0,0,0,95,655,1,0,0,0,97,660, + 1,0,0,0,99,666,1,0,0,0,101,668,1,0,0,0,103,678,1,0,0,0,105,681,1, + 0,0,0,107,695,1,0,0,0,109,702,1,0,0,0,111,707,1,0,0,0,113,713,1, + 0,0,0,115,119,5,35,0,0,116,118,8,0,0,0,117,116,1,0,0,0,118,121,1, + 0,0,0,119,117,1,0,0,0,119,120,1,0,0,0,120,122,1,0,0,0,121,119,1, + 0,0,0,122,123,6,0,0,0,123,2,1,0,0,0,124,125,5,106,0,0,125,126,5, + 115,0,0,126,127,5,111,0,0,127,128,5,110,0,0,128,129,5,97,0,0,129, + 130,5,116,0,0,130,131,5,97,0,0,131,132,5,40,0,0,132,136,1,0,0,0, + 133,135,8,1,0,0,134,133,1,0,0,0,135,138,1,0,0,0,136,134,1,0,0,0, + 136,137,1,0,0,0,137,139,1,0,0,0,138,136,1,0,0,0,139,140,5,41,0,0, + 140,4,1,0,0,0,141,142,5,83,0,0,142,143,5,116,0,0,143,144,5,97,0, + 0,144,145,5,116,0,0,145,146,5,101,0,0,146,147,5,115,0,0,147,148, + 5,46,0,0,148,149,5,65,0,0,149,150,5,76,0,0,150,151,5,76,0,0,151, + 6,1,0,0,0,152,153,5,83,0,0,153,154,5,116,0,0,154,155,5,97,0,0,155, + 156,5,116,0,0,156,157,5,101,0,0,157,158,5,115,0,0,158,159,5,46,0, + 0,159,160,5,68,0,0,160,161,5,97,0,0,161,162,5,116,0,0,162,163,5, + 97,0,0,163,164,5,76,0,0,164,165,5,105,0,0,165,166,5,109,0,0,166, + 167,5,105,0,0,167,168,5,116,0,0,168,169,5,69,0,0,169,170,5,120,0, + 0,170,171,5,99,0,0,171,172,5,101,0,0,172,173,5,101,0,0,173,174,5, + 100,0,0,174,175,5,101,0,0,175,176,5,100,0,0,176,8,1,0,0,0,177,178, + 5,83,0,0,178,179,5,116,0,0,179,180,5,97,0,0,180,181,5,116,0,0,181, + 182,5,101,0,0,182,183,5,115,0,0,183,184,5,46,0,0,184,185,5,72,0, + 0,185,186,5,101,0,0,186,187,5,97,0,0,187,188,5,114,0,0,188,189,5, + 116,0,0,189,190,5,98,0,0,190,191,5,101,0,0,191,192,5,97,0,0,192, + 193,5,116,0,0,193,194,5,84,0,0,194,195,5,105,0,0,195,196,5,109,0, + 0,196,197,5,101,0,0,197,198,5,111,0,0,198,199,5,117,0,0,199,200, + 5,116,0,0,200,10,1,0,0,0,201,202,5,83,0,0,202,203,5,116,0,0,203, + 204,5,97,0,0,204,205,5,116,0,0,205,206,5,101,0,0,206,207,5,115,0, + 0,207,208,5,46,0,0,208,209,5,84,0,0,209,210,5,105,0,0,210,211,5, + 109,0,0,211,212,5,101,0,0,212,213,5,111,0,0,213,214,5,117,0,0,214, + 215,5,116,0,0,215,12,1,0,0,0,216,217,5,83,0,0,217,218,5,116,0,0, + 218,219,5,97,0,0,219,220,5,116,0,0,220,221,5,101,0,0,221,222,5,115, + 0,0,222,223,5,46,0,0,223,224,5,84,0,0,224,225,5,97,0,0,225,226,5, + 115,0,0,226,227,5,107,0,0,227,228,5,70,0,0,228,229,5,97,0,0,229, + 230,5,105,0,0,230,231,5,108,0,0,231,232,5,101,0,0,232,233,5,100, + 0,0,233,14,1,0,0,0,234,235,5,83,0,0,235,236,5,116,0,0,236,237,5, + 97,0,0,237,238,5,116,0,0,238,239,5,101,0,0,239,240,5,115,0,0,240, + 241,5,46,0,0,241,242,5,80,0,0,242,243,5,101,0,0,243,244,5,114,0, + 0,244,245,5,109,0,0,245,246,5,105,0,0,246,247,5,115,0,0,247,248, + 5,115,0,0,248,249,5,105,0,0,249,250,5,111,0,0,250,251,5,110,0,0, + 251,252,5,115,0,0,252,16,1,0,0,0,253,254,5,83,0,0,254,255,5,116, + 0,0,255,256,5,97,0,0,256,257,5,116,0,0,257,258,5,101,0,0,258,259, + 5,115,0,0,259,260,5,46,0,0,260,261,5,82,0,0,261,262,5,101,0,0,262, + 263,5,115,0,0,263,264,5,117,0,0,264,265,5,108,0,0,265,266,5,116, + 0,0,266,267,5,80,0,0,267,268,5,97,0,0,268,269,5,116,0,0,269,270, + 5,104,0,0,270,271,5,77,0,0,271,272,5,97,0,0,272,273,5,116,0,0,273, + 274,5,99,0,0,274,275,5,104,0,0,275,276,5,70,0,0,276,277,5,97,0,0, + 277,278,5,105,0,0,278,279,5,108,0,0,279,280,5,117,0,0,280,281,5, + 114,0,0,281,282,5,101,0,0,282,18,1,0,0,0,283,284,5,83,0,0,284,285, + 5,116,0,0,285,286,5,97,0,0,286,287,5,116,0,0,287,288,5,101,0,0,288, + 289,5,115,0,0,289,290,5,46,0,0,290,291,5,80,0,0,291,292,5,97,0,0, + 292,293,5,114,0,0,293,294,5,97,0,0,294,295,5,109,0,0,295,296,5,101, + 0,0,296,297,5,116,0,0,297,298,5,101,0,0,298,299,5,114,0,0,299,300, + 5,80,0,0,300,301,5,97,0,0,301,302,5,116,0,0,302,303,5,104,0,0,303, + 304,5,70,0,0,304,305,5,97,0,0,305,306,5,105,0,0,306,307,5,108,0, + 0,307,308,5,117,0,0,308,309,5,114,0,0,309,310,5,101,0,0,310,20,1, + 0,0,0,311,312,5,83,0,0,312,313,5,116,0,0,313,314,5,97,0,0,314,315, + 5,116,0,0,315,316,5,101,0,0,316,317,5,115,0,0,317,318,5,46,0,0,318, + 319,5,66,0,0,319,320,5,114,0,0,320,321,5,97,0,0,321,322,5,110,0, + 0,322,323,5,99,0,0,323,324,5,104,0,0,324,325,5,70,0,0,325,326,5, + 97,0,0,326,327,5,105,0,0,327,328,5,108,0,0,328,329,5,101,0,0,329, + 330,5,100,0,0,330,22,1,0,0,0,331,332,5,83,0,0,332,333,5,116,0,0, + 333,334,5,97,0,0,334,335,5,116,0,0,335,336,5,101,0,0,336,337,5,115, + 0,0,337,338,5,46,0,0,338,339,5,78,0,0,339,340,5,111,0,0,340,341, + 5,67,0,0,341,342,5,104,0,0,342,343,5,111,0,0,343,344,5,105,0,0,344, + 345,5,99,0,0,345,346,5,101,0,0,346,347,5,77,0,0,347,348,5,97,0,0, + 348,349,5,116,0,0,349,350,5,99,0,0,350,351,5,104,0,0,351,352,5,101, + 0,0,352,353,5,100,0,0,353,24,1,0,0,0,354,355,5,83,0,0,355,356,5, + 116,0,0,356,357,5,97,0,0,357,358,5,116,0,0,358,359,5,101,0,0,359, + 360,5,115,0,0,360,361,5,46,0,0,361,362,5,73,0,0,362,363,5,110,0, + 0,363,364,5,116,0,0,364,365,5,114,0,0,365,366,5,105,0,0,366,367, + 5,110,0,0,367,368,5,115,0,0,368,369,5,105,0,0,369,370,5,99,0,0,370, + 371,5,70,0,0,371,372,5,97,0,0,372,373,5,105,0,0,373,374,5,108,0, + 0,374,375,5,117,0,0,375,376,5,114,0,0,376,377,5,101,0,0,377,26,1, + 0,0,0,378,379,5,83,0,0,379,380,5,116,0,0,380,381,5,97,0,0,381,382, + 5,116,0,0,382,383,5,101,0,0,383,384,5,115,0,0,384,385,5,46,0,0,385, + 386,5,69,0,0,386,387,5,120,0,0,387,388,5,99,0,0,388,389,5,101,0, + 0,389,390,5,101,0,0,390,391,5,100,0,0,391,392,5,84,0,0,392,393,5, + 111,0,0,393,394,5,108,0,0,394,395,5,101,0,0,395,396,5,114,0,0,396, + 397,5,97,0,0,397,398,5,116,0,0,398,399,5,101,0,0,399,400,5,100,0, + 0,400,401,5,70,0,0,401,402,5,97,0,0,402,403,5,105,0,0,403,404,5, + 108,0,0,404,405,5,117,0,0,405,406,5,114,0,0,406,407,5,101,0,0,407, + 408,5,84,0,0,408,409,5,104,0,0,409,410,5,114,0,0,410,411,5,101,0, + 0,411,412,5,115,0,0,412,413,5,104,0,0,413,414,5,111,0,0,414,415, + 5,108,0,0,415,416,5,100,0,0,416,28,1,0,0,0,417,418,5,83,0,0,418, + 419,5,116,0,0,419,420,5,97,0,0,420,421,5,116,0,0,421,422,5,101,0, + 0,422,423,5,115,0,0,423,424,5,46,0,0,424,425,5,73,0,0,425,426,5, + 116,0,0,426,427,5,101,0,0,427,428,5,109,0,0,428,429,5,82,0,0,429, + 430,5,101,0,0,430,431,5,97,0,0,431,432,5,100,0,0,432,433,5,101,0, + 0,433,434,5,114,0,0,434,435,5,70,0,0,435,436,5,97,0,0,436,437,5, + 105,0,0,437,438,5,108,0,0,438,439,5,101,0,0,439,440,5,100,0,0,440, + 30,1,0,0,0,441,442,5,83,0,0,442,443,5,116,0,0,443,444,5,97,0,0,444, + 445,5,116,0,0,445,446,5,101,0,0,446,447,5,115,0,0,447,448,5,46,0, + 0,448,449,5,82,0,0,449,450,5,101,0,0,450,451,5,115,0,0,451,452,5, + 117,0,0,452,453,5,108,0,0,453,454,5,116,0,0,454,455,5,87,0,0,455, + 456,5,114,0,0,456,457,5,105,0,0,457,458,5,116,0,0,458,459,5,101, + 0,0,459,460,5,114,0,0,460,461,5,70,0,0,461,462,5,97,0,0,462,463, + 5,105,0,0,463,464,5,108,0,0,464,465,5,101,0,0,465,466,5,100,0,0, + 466,32,1,0,0,0,467,468,5,83,0,0,468,469,5,116,0,0,469,470,5,97,0, + 0,470,471,5,116,0,0,471,472,5,101,0,0,472,473,5,115,0,0,473,474, + 5,46,0,0,474,475,5,81,0,0,475,476,5,117,0,0,476,477,5,101,0,0,477, + 478,5,114,0,0,478,479,5,121,0,0,479,480,5,69,0,0,480,481,5,118,0, + 0,481,482,5,97,0,0,482,483,5,108,0,0,483,484,5,117,0,0,484,485,5, + 97,0,0,485,486,5,116,0,0,486,487,5,105,0,0,487,488,5,111,0,0,488, + 489,5,110,0,0,489,490,5,69,0,0,490,491,5,114,0,0,491,492,5,114,0, + 0,492,493,5,111,0,0,493,494,5,114,0,0,494,34,1,0,0,0,495,496,5,45, + 0,0,496,497,5,62,0,0,497,36,1,0,0,0,498,499,5,61,0,0,499,38,1,0, + 0,0,500,501,5,44,0,0,501,40,1,0,0,0,502,503,5,58,0,0,503,42,1,0, + 0,0,504,505,5,40,0,0,505,44,1,0,0,0,506,507,5,41,0,0,507,46,1,0, + 0,0,508,509,5,91,0,0,509,48,1,0,0,0,510,511,5,93,0,0,511,50,1,0, + 0,0,512,513,5,123,0,0,513,52,1,0,0,0,514,515,5,125,0,0,515,54,1, + 0,0,0,516,517,5,116,0,0,517,518,5,114,0,0,518,519,5,117,0,0,519, + 520,5,101,0,0,520,56,1,0,0,0,521,522,5,102,0,0,522,523,5,97,0,0, + 523,524,5,108,0,0,524,525,5,115,0,0,525,526,5,101,0,0,526,58,1,0, + 0,0,527,528,5,110,0,0,528,529,5,117,0,0,529,530,5,108,0,0,530,531, + 5,108,0,0,531,60,1,0,0,0,532,533,5,119,0,0,533,534,5,104,0,0,534, + 535,5,101,0,0,535,536,5,114,0,0,536,537,5,101,0,0,537,62,1,0,0,0, + 538,539,5,97,0,0,539,540,5,115,0,0,540,64,1,0,0,0,541,542,5,102, + 0,0,542,543,5,97,0,0,543,544,5,105,0,0,544,545,5,108,0,0,545,66, + 1,0,0,0,546,547,5,111,0,0,547,548,5,117,0,0,548,549,5,116,0,0,549, + 550,5,112,0,0,550,551,5,117,0,0,551,552,5,116,0,0,552,68,1,0,0,0, + 553,554,5,114,0,0,554,555,5,101,0,0,555,556,5,116,0,0,556,557,5, + 117,0,0,557,558,5,114,0,0,558,559,5,110,0,0,559,70,1,0,0,0,560,561, + 5,101,0,0,561,562,5,114,0,0,562,563,5,114,0,0,563,564,5,111,0,0, + 564,565,5,114,0,0,565,72,1,0,0,0,566,567,5,99,0,0,567,568,5,97,0, + 0,568,569,5,117,0,0,569,570,5,115,0,0,570,571,5,101,0,0,571,74,1, + 0,0,0,572,573,5,108,0,0,573,574,5,97,0,0,574,575,5,109,0,0,575,576, + 5,98,0,0,576,577,5,100,0,0,577,578,5,97,0,0,578,76,1,0,0,0,579,580, + 5,97,0,0,580,581,5,114,0,0,581,582,5,103,0,0,582,583,5,117,0,0,583, + 584,5,109,0,0,584,585,5,101,0,0,585,586,5,110,0,0,586,587,5,116, + 0,0,587,588,5,115,0,0,588,78,1,0,0,0,589,590,5,99,0,0,590,591,5, + 97,0,0,591,592,5,116,0,0,592,593,5,99,0,0,593,594,5,104,0,0,594, + 80,1,0,0,0,595,596,5,102,0,0,596,597,5,111,0,0,597,598,5,114,0,0, + 598,82,1,0,0,0,599,600,5,105,0,0,600,601,5,110,0,0,601,84,1,0,0, + 0,602,603,5,112,0,0,603,604,5,114,0,0,604,605,5,111,0,0,605,606, + 5,99,0,0,606,607,5,101,0,0,607,608,5,115,0,0,608,609,5,115,0,0,609, + 86,1,0,0,0,610,611,5,112,0,0,611,612,5,97,0,0,612,613,5,114,0,0, + 613,614,5,97,0,0,614,615,5,108,0,0,615,616,5,108,0,0,616,617,5,101, + 0,0,617,618,5,108,0,0,618,88,1,0,0,0,619,620,5,34,0,0,620,621,5, + 36,0,0,621,635,5,34,0,0,622,623,5,34,0,0,623,624,5,36,0,0,624,625, + 1,0,0,0,625,630,7,2,0,0,626,629,3,95,47,0,627,629,3,101,50,0,628, + 626,1,0,0,0,628,627,1,0,0,0,629,632,1,0,0,0,630,628,1,0,0,0,630, + 631,1,0,0,0,631,633,1,0,0,0,632,630,1,0,0,0,633,635,5,34,0,0,634, + 619,1,0,0,0,634,622,1,0,0,0,635,90,1,0,0,0,636,637,5,36,0,0,637, + 642,7,3,0,0,638,641,3,95,47,0,639,641,3,101,50,0,640,638,1,0,0,0, + 640,639,1,0,0,0,641,644,1,0,0,0,642,640,1,0,0,0,642,643,1,0,0,0, + 643,92,1,0,0,0,644,642,1,0,0,0,645,650,5,34,0,0,646,649,3,95,47, + 0,647,649,3,101,50,0,648,646,1,0,0,0,648,647,1,0,0,0,649,652,1,0, + 0,0,650,648,1,0,0,0,650,651,1,0,0,0,651,653,1,0,0,0,652,650,1,0, + 0,0,653,654,5,34,0,0,654,94,1,0,0,0,655,658,5,92,0,0,656,659,7,4, + 0,0,657,659,3,97,48,0,658,656,1,0,0,0,658,657,1,0,0,0,659,96,1,0, + 0,0,660,661,5,117,0,0,661,662,3,99,49,0,662,663,3,99,49,0,663,664, + 3,99,49,0,664,665,3,99,49,0,665,98,1,0,0,0,666,667,7,5,0,0,667,100, + 1,0,0,0,668,669,8,6,0,0,669,102,1,0,0,0,670,679,5,48,0,0,671,675, + 7,7,0,0,672,674,7,8,0,0,673,672,1,0,0,0,674,677,1,0,0,0,675,673, + 1,0,0,0,675,676,1,0,0,0,676,679,1,0,0,0,677,675,1,0,0,0,678,670, + 1,0,0,0,678,671,1,0,0,0,679,104,1,0,0,0,680,682,5,45,0,0,681,680, + 1,0,0,0,681,682,1,0,0,0,682,683,1,0,0,0,683,690,3,103,51,0,684,686, + 5,46,0,0,685,687,7,8,0,0,686,685,1,0,0,0,687,688,1,0,0,0,688,686, + 1,0,0,0,688,689,1,0,0,0,689,691,1,0,0,0,690,684,1,0,0,0,690,691, + 1,0,0,0,691,693,1,0,0,0,692,694,3,107,53,0,693,692,1,0,0,0,693,694, + 1,0,0,0,694,106,1,0,0,0,695,697,7,9,0,0,696,698,7,10,0,0,697,696, + 1,0,0,0,697,698,1,0,0,0,698,699,1,0,0,0,699,700,3,103,51,0,700,108, + 1,0,0,0,701,703,7,11,0,0,702,701,1,0,0,0,703,704,1,0,0,0,704,702, + 1,0,0,0,704,705,1,0,0,0,705,110,1,0,0,0,706,708,7,12,0,0,707,706, + 1,0,0,0,708,709,1,0,0,0,709,707,1,0,0,0,709,710,1,0,0,0,710,711, + 1,0,0,0,711,712,6,55,0,0,712,112,1,0,0,0,713,714,9,0,0,0,714,114, + 1,0,0,0,20,0,119,136,628,630,634,640,642,648,650,658,675,678,681, + 688,690,693,697,704,709,1,6,0,0 ] class LSLLexer(Lexer): @@ -300,14 +311,18 @@ class LSLLexer(Lexer): LAMBDA = 38 ARGUMENTS = 39 CATCH = 40 - STRINGPATH = 41 - VAR = 42 - STRING = 43 - INT = 44 - NUMBER = 45 - IDEN = 46 - WS = 47 - TOK = 48 + FOR = 41 + IN = 42 + PROCESS = 43 + PARALLEL = 44 + STRINGPATH = 45 + VAR = 46 + STRING = 47 + INT = 48 + NUMBER = 49 + IDEN = 50 + WS = 51 + TOK = 52 channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] @@ -323,7 +338,7 @@ class LSLLexer(Lexer): "'->'", "'='", "','", "':'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'true'", "'false'", "'null'", "'where'", "'as'", "'fail'", "'output'", "'return'", "'error'", "'cause'", "'lambda'", "'arguments'", - "'catch'" ] + "'catch'", "'for'", "'in'", "'process'", "'parallel'" ] symbolicNames = [ "", "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", "ERRORNAMEStatesDataLimitExceeded", @@ -336,8 +351,8 @@ class LSLLexer(Lexer): "ARROW", "EQUALS", "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", "LAMBDA", - "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "INT", - "NUMBER", "IDEN", "WS", "TOK" ] + "ARGUMENTS", "CATCH", "FOR", "IN", "PROCESS", "PARALLEL", "STRINGPATH", + "VAR", "STRING", "INT", "NUMBER", "IDEN", "WS", "TOK" ] ruleNames = [ "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", "ERRORNAMEStatesDataLimitExceeded", "ERRORNAMEStatesHeartbeatTimeout", "ERRORNAMEStatesTimeout", @@ -350,9 +365,10 @@ class LSLLexer(Lexer): "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", "LAMBDA", - "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", "STRING", "ESC", - "UNICODE", "HEX", "SAFECODEPOINT", "INT", "NUMBER", "EXP", - "IDEN", "WS", "TOK" ] + "ARGUMENTS", "CATCH", "FOR", "IN", "PROCESS", "PARALLEL", + "STRINGPATH", "VAR", "STRING", "ESC", "UNICODE", "HEX", + "SAFECODEPOINT", "INT", "NUMBER", "EXP", "IDEN", "WS", + "TOK" ] grammarFileName = "LSLLexer.g4" diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py index d7928a8400c6e..47fb97ccb3e3a 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParser.py @@ -10,76 +10,87 @@ def serializedATN(): return [ - 4,1,48,207,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 4,1,52,234,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, - 7,20,2,21,7,21,2,22,7,22,1,0,1,0,1,0,4,0,50,8,0,11,0,12,0,51,1,0, - 1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,3,2,67,8,2,1,3,1, - 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,78,8,3,1,4,1,4,1,5,1,5,3,5,84, - 8,5,1,5,3,5,87,8,5,1,6,1,6,1,6,3,6,92,8,6,1,7,1,7,1,7,1,8,1,8,1, - 8,1,8,5,8,101,8,8,10,8,12,8,104,9,8,1,8,1,8,1,9,1,9,1,9,1,9,1,10, - 1,10,3,10,114,8,10,1,10,1,10,5,10,118,8,10,10,10,12,10,121,9,10, - 1,10,1,10,1,11,1,11,1,11,1,11,5,11,129,8,11,10,11,12,11,132,9,11, - 1,11,1,11,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,14,1,14,1,14,1,15, - 1,15,1,15,1,15,1,15,1,15,3,15,152,8,15,1,16,1,16,1,16,3,16,157,8, - 16,1,17,1,17,1,17,1,17,5,17,163,8,17,10,17,12,17,166,9,17,1,17,1, - 17,1,17,1,17,3,17,172,8,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1, - 19,5,19,182,8,19,10,19,12,19,185,9,19,1,19,1,19,1,19,1,19,3,19,191, - 8,19,1,20,1,20,1,20,1,20,1,20,1,20,3,20,199,8,20,1,21,1,21,3,21, - 203,8,21,1,22,1,22,1,22,0,0,23,0,2,4,6,8,10,12,14,16,18,20,22,24, - 26,28,30,32,34,36,38,40,42,44,0,3,2,0,43,43,46,46,1,0,28,29,2,0, - 3,17,43,43,210,0,49,1,0,0,0,2,55,1,0,0,0,4,66,1,0,0,0,6,77,1,0,0, - 0,8,79,1,0,0,0,10,81,1,0,0,0,12,88,1,0,0,0,14,93,1,0,0,0,16,96,1, - 0,0,0,18,107,1,0,0,0,20,111,1,0,0,0,22,124,1,0,0,0,24,135,1,0,0, - 0,26,139,1,0,0,0,28,142,1,0,0,0,30,151,1,0,0,0,32,156,1,0,0,0,34, - 171,1,0,0,0,36,173,1,0,0,0,38,190,1,0,0,0,40,198,1,0,0,0,42,202, - 1,0,0,0,44,204,1,0,0,0,46,50,3,2,1,0,47,50,3,30,15,0,48,50,3,4,2, - 0,49,46,1,0,0,0,49,47,1,0,0,0,49,48,1,0,0,0,50,51,1,0,0,0,51,49, - 1,0,0,0,51,52,1,0,0,0,52,53,1,0,0,0,53,54,5,0,0,1,54,1,1,0,0,0,55, - 56,5,46,0,0,56,57,3,20,10,0,57,58,5,19,0,0,58,59,3,6,3,0,59,3,1, - 0,0,0,60,61,5,46,0,0,61,67,3,22,11,0,62,63,5,46,0,0,63,64,5,32,0, - 0,64,67,3,6,3,0,65,67,3,6,3,0,66,60,1,0,0,0,66,62,1,0,0,0,66,65, - 1,0,0,0,67,5,1,0,0,0,68,69,3,8,4,0,69,70,5,21,0,0,70,71,5,46,0,0, - 71,72,3,10,5,0,72,78,1,0,0,0,73,74,5,33,0,0,74,78,3,12,6,0,75,76, - 5,35,0,0,76,78,3,32,16,0,77,68,1,0,0,0,77,73,1,0,0,0,77,75,1,0,0, - 0,78,7,1,0,0,0,79,80,5,38,0,0,80,9,1,0,0,0,81,83,5,31,0,0,82,84, - 3,14,7,0,83,82,1,0,0,0,83,84,1,0,0,0,84,86,1,0,0,0,85,87,3,16,8, - 0,86,85,1,0,0,0,86,87,1,0,0,0,87,11,1,0,0,0,88,89,5,31,0,0,89,91, - 3,26,13,0,90,92,3,28,14,0,91,90,1,0,0,0,91,92,1,0,0,0,92,13,1,0, - 0,0,93,94,5,39,0,0,94,95,3,32,16,0,95,15,1,0,0,0,96,97,5,40,0,0, - 97,98,5,26,0,0,98,102,3,18,9,0,99,101,3,18,9,0,100,99,1,0,0,0,101, - 104,1,0,0,0,102,100,1,0,0,0,102,103,1,0,0,0,103,105,1,0,0,0,104, - 102,1,0,0,0,105,106,5,27,0,0,106,17,1,0,0,0,107,108,3,44,22,0,108, - 109,5,18,0,0,109,110,3,4,2,0,110,19,1,0,0,0,111,113,5,22,0,0,112, - 114,5,46,0,0,113,112,1,0,0,0,113,114,1,0,0,0,114,119,1,0,0,0,115, - 116,5,20,0,0,116,118,5,46,0,0,117,115,1,0,0,0,118,121,1,0,0,0,119, - 117,1,0,0,0,119,120,1,0,0,0,120,122,1,0,0,0,121,119,1,0,0,0,122, - 123,5,23,0,0,123,21,1,0,0,0,124,125,5,22,0,0,125,130,3,24,12,0,126, - 127,5,20,0,0,127,129,3,24,12,0,128,126,1,0,0,0,129,132,1,0,0,0,130, - 128,1,0,0,0,130,131,1,0,0,0,131,133,1,0,0,0,132,130,1,0,0,0,133, - 134,5,23,0,0,134,23,1,0,0,0,135,136,5,46,0,0,136,137,5,19,0,0,137, - 138,3,32,16,0,138,25,1,0,0,0,139,140,5,36,0,0,140,141,3,42,21,0, - 141,27,1,0,0,0,142,143,5,37,0,0,143,144,3,42,21,0,144,29,1,0,0,0, - 145,146,5,46,0,0,146,147,5,19,0,0,147,152,3,4,2,0,148,149,5,46,0, - 0,149,150,5,19,0,0,150,152,3,32,16,0,151,145,1,0,0,0,151,148,1,0, - 0,0,152,31,1,0,0,0,153,157,3,34,17,0,154,157,3,38,19,0,155,157,3, - 40,20,0,156,153,1,0,0,0,156,154,1,0,0,0,156,155,1,0,0,0,157,33,1, - 0,0,0,158,159,5,26,0,0,159,164,3,36,18,0,160,161,5,20,0,0,161,163, - 3,36,18,0,162,160,1,0,0,0,163,166,1,0,0,0,164,162,1,0,0,0,164,165, - 1,0,0,0,165,167,1,0,0,0,166,164,1,0,0,0,167,168,5,27,0,0,168,172, - 1,0,0,0,169,170,5,26,0,0,170,172,5,27,0,0,171,158,1,0,0,0,171,169, - 1,0,0,0,172,35,1,0,0,0,173,174,7,0,0,0,174,175,5,21,0,0,175,176, - 3,32,16,0,176,37,1,0,0,0,177,178,5,24,0,0,178,183,3,32,16,0,179, - 180,5,20,0,0,180,182,3,32,16,0,181,179,1,0,0,0,182,185,1,0,0,0,183, - 181,1,0,0,0,183,184,1,0,0,0,184,186,1,0,0,0,185,183,1,0,0,0,186, - 187,5,25,0,0,187,191,1,0,0,0,188,189,5,24,0,0,189,191,5,25,0,0,190, - 177,1,0,0,0,190,188,1,0,0,0,191,39,1,0,0,0,192,199,5,45,0,0,193, - 199,5,44,0,0,194,199,7,1,0,0,195,199,5,30,0,0,196,199,5,43,0,0,197, - 199,5,2,0,0,198,192,1,0,0,0,198,193,1,0,0,0,198,194,1,0,0,0,198, - 195,1,0,0,0,198,196,1,0,0,0,198,197,1,0,0,0,199,41,1,0,0,0,200,203, - 5,43,0,0,201,203,5,2,0,0,202,200,1,0,0,0,202,201,1,0,0,0,203,43, - 1,0,0,0,204,205,7,2,0,0,205,45,1,0,0,0,19,49,51,66,77,83,86,91,102, - 113,119,130,151,156,164,171,183,190,198,202 + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,1,0,1,0,1,0,4,0,52,8,0,11,0,12, + 0,53,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,3,2,69, + 8,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,3,4,3,90,8,3,11,3,12,3,91,3,3,94,8,3,1,4,1,4,1,5,1, + 5,3,5,100,8,5,1,5,3,5,103,8,5,1,6,1,6,1,6,3,6,108,8,6,1,7,1,7,1, + 7,1,8,1,8,1,8,1,8,5,8,117,8,8,10,8,12,8,120,9,8,1,8,1,8,1,9,1,9, + 1,9,1,9,1,10,1,10,3,10,130,8,10,1,10,1,10,5,10,134,8,10,10,10,12, + 10,137,9,10,1,10,1,10,1,11,1,11,1,11,1,11,5,11,145,8,11,10,11,12, + 11,148,9,11,1,11,1,11,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,14,1, + 14,1,14,1,15,1,15,1,15,1,15,1,15,4,15,167,8,15,11,15,12,15,168,1, + 15,1,15,1,16,1,16,1,16,1,16,1,16,1,16,3,16,179,8,16,1,17,1,17,1, + 17,3,17,184,8,17,1,18,1,18,1,18,1,18,5,18,190,8,18,10,18,12,18,193, + 9,18,1,18,1,18,1,18,1,18,3,18,199,8,18,1,19,1,19,1,19,1,19,1,20, + 1,20,1,20,1,20,5,20,209,8,20,10,20,12,20,212,9,20,1,20,1,20,1,20, + 1,20,3,20,218,8,20,1,21,1,21,1,21,1,21,1,21,1,21,3,21,226,8,21,1, + 22,1,22,3,22,230,8,22,1,23,1,23,1,23,0,0,24,0,2,4,6,8,10,12,14,16, + 18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,0,3,2,0,47,47,50,50, + 1,0,28,29,2,0,3,17,47,47,242,0,51,1,0,0,0,2,57,1,0,0,0,4,68,1,0, + 0,0,6,93,1,0,0,0,8,95,1,0,0,0,10,97,1,0,0,0,12,104,1,0,0,0,14,109, + 1,0,0,0,16,112,1,0,0,0,18,123,1,0,0,0,20,127,1,0,0,0,22,140,1,0, + 0,0,24,151,1,0,0,0,26,155,1,0,0,0,28,158,1,0,0,0,30,161,1,0,0,0, + 32,178,1,0,0,0,34,183,1,0,0,0,36,198,1,0,0,0,38,200,1,0,0,0,40,217, + 1,0,0,0,42,225,1,0,0,0,44,229,1,0,0,0,46,231,1,0,0,0,48,52,3,2,1, + 0,49,52,3,32,16,0,50,52,3,4,2,0,51,48,1,0,0,0,51,49,1,0,0,0,51,50, + 1,0,0,0,52,53,1,0,0,0,53,51,1,0,0,0,53,54,1,0,0,0,54,55,1,0,0,0, + 55,56,5,0,0,1,56,1,1,0,0,0,57,58,5,50,0,0,58,59,3,20,10,0,59,60, + 5,19,0,0,60,61,3,6,3,0,61,3,1,0,0,0,62,63,5,50,0,0,63,69,3,22,11, + 0,64,65,5,50,0,0,65,66,5,32,0,0,66,69,3,6,3,0,67,69,3,6,3,0,68,62, + 1,0,0,0,68,64,1,0,0,0,68,67,1,0,0,0,69,5,1,0,0,0,70,71,3,8,4,0,71, + 72,5,21,0,0,72,73,5,50,0,0,73,74,3,10,5,0,74,94,1,0,0,0,75,76,5, + 33,0,0,76,94,3,12,6,0,77,78,5,35,0,0,78,94,3,34,17,0,79,80,5,41, + 0,0,80,81,5,50,0,0,81,82,5,42,0,0,82,83,3,34,17,0,83,84,5,31,0,0, + 84,85,3,30,15,0,85,94,1,0,0,0,86,87,5,44,0,0,87,89,5,31,0,0,88,90, + 3,30,15,0,89,88,1,0,0,0,90,91,1,0,0,0,91,89,1,0,0,0,91,92,1,0,0, + 0,92,94,1,0,0,0,93,70,1,0,0,0,93,75,1,0,0,0,93,77,1,0,0,0,93,79, + 1,0,0,0,93,86,1,0,0,0,94,7,1,0,0,0,95,96,5,38,0,0,96,9,1,0,0,0,97, + 99,5,31,0,0,98,100,3,14,7,0,99,98,1,0,0,0,99,100,1,0,0,0,100,102, + 1,0,0,0,101,103,3,16,8,0,102,101,1,0,0,0,102,103,1,0,0,0,103,11, + 1,0,0,0,104,105,5,31,0,0,105,107,3,26,13,0,106,108,3,28,14,0,107, + 106,1,0,0,0,107,108,1,0,0,0,108,13,1,0,0,0,109,110,5,39,0,0,110, + 111,3,34,17,0,111,15,1,0,0,0,112,113,5,40,0,0,113,114,5,26,0,0,114, + 118,3,18,9,0,115,117,3,18,9,0,116,115,1,0,0,0,117,120,1,0,0,0,118, + 116,1,0,0,0,118,119,1,0,0,0,119,121,1,0,0,0,120,118,1,0,0,0,121, + 122,5,27,0,0,122,17,1,0,0,0,123,124,3,46,23,0,124,125,5,18,0,0,125, + 126,3,4,2,0,126,19,1,0,0,0,127,129,5,22,0,0,128,130,5,50,0,0,129, + 128,1,0,0,0,129,130,1,0,0,0,130,135,1,0,0,0,131,132,5,20,0,0,132, + 134,5,50,0,0,133,131,1,0,0,0,134,137,1,0,0,0,135,133,1,0,0,0,135, + 136,1,0,0,0,136,138,1,0,0,0,137,135,1,0,0,0,138,139,5,23,0,0,139, + 21,1,0,0,0,140,141,5,22,0,0,141,146,3,24,12,0,142,143,5,20,0,0,143, + 145,3,24,12,0,144,142,1,0,0,0,145,148,1,0,0,0,146,144,1,0,0,0,146, + 147,1,0,0,0,147,149,1,0,0,0,148,146,1,0,0,0,149,150,5,23,0,0,150, + 23,1,0,0,0,151,152,5,50,0,0,152,153,5,19,0,0,153,154,3,34,17,0,154, + 25,1,0,0,0,155,156,5,36,0,0,156,157,3,44,22,0,157,27,1,0,0,0,158, + 159,5,37,0,0,159,160,3,44,22,0,160,29,1,0,0,0,161,162,5,43,0,0,162, + 166,5,26,0,0,163,167,3,2,1,0,164,167,3,32,16,0,165,167,3,4,2,0,166, + 163,1,0,0,0,166,164,1,0,0,0,166,165,1,0,0,0,167,168,1,0,0,0,168, + 166,1,0,0,0,168,169,1,0,0,0,169,170,1,0,0,0,170,171,5,27,0,0,171, + 31,1,0,0,0,172,173,5,50,0,0,173,174,5,19,0,0,174,179,3,4,2,0,175, + 176,5,50,0,0,176,177,5,19,0,0,177,179,3,34,17,0,178,172,1,0,0,0, + 178,175,1,0,0,0,179,33,1,0,0,0,180,184,3,36,18,0,181,184,3,40,20, + 0,182,184,3,42,21,0,183,180,1,0,0,0,183,181,1,0,0,0,183,182,1,0, + 0,0,184,35,1,0,0,0,185,186,5,26,0,0,186,191,3,38,19,0,187,188,5, + 20,0,0,188,190,3,38,19,0,189,187,1,0,0,0,190,193,1,0,0,0,191,189, + 1,0,0,0,191,192,1,0,0,0,192,194,1,0,0,0,193,191,1,0,0,0,194,195, + 5,27,0,0,195,199,1,0,0,0,196,197,5,26,0,0,197,199,5,27,0,0,198,185, + 1,0,0,0,198,196,1,0,0,0,199,37,1,0,0,0,200,201,7,0,0,0,201,202,5, + 21,0,0,202,203,3,34,17,0,203,39,1,0,0,0,204,205,5,24,0,0,205,210, + 3,34,17,0,206,207,5,20,0,0,207,209,3,34,17,0,208,206,1,0,0,0,209, + 212,1,0,0,0,210,208,1,0,0,0,210,211,1,0,0,0,211,213,1,0,0,0,212, + 210,1,0,0,0,213,214,5,25,0,0,214,218,1,0,0,0,215,216,5,24,0,0,216, + 218,5,25,0,0,217,204,1,0,0,0,217,215,1,0,0,0,218,41,1,0,0,0,219, + 226,5,49,0,0,220,226,5,48,0,0,221,226,7,1,0,0,222,226,5,30,0,0,223, + 226,5,47,0,0,224,226,5,2,0,0,225,219,1,0,0,0,225,220,1,0,0,0,225, + 221,1,0,0,0,225,222,1,0,0,0,225,223,1,0,0,0,225,224,1,0,0,0,226, + 43,1,0,0,0,227,230,5,47,0,0,228,230,5,2,0,0,229,227,1,0,0,0,229, + 228,1,0,0,0,230,45,1,0,0,0,231,232,7,2,0,0,232,47,1,0,0,0,22,51, + 53,68,91,93,99,102,107,118,129,135,146,166,168,178,183,191,198,210, + 217,225,229 ] class LSLParser ( Parser ): @@ -103,7 +114,7 @@ class LSLParser ( Parser ): "':'", "'('", "')'", "'['", "']'", "'{'", "'}'", "'true'", "'false'", "'null'", "'where'", "'as'", "'fail'", "'output'", "'return'", "'error'", "'cause'", "'lambda'", "'arguments'", - "'catch'" ] + "'catch'", "'for'", "'in'", "'process'", "'parallel'" ] symbolicNames = [ "", "LINECOMMENT", "JSONATA", "ERRORNAMEStatesALL", "ERRORNAMEStatesDataLimitExceeded", "ERRORNAMEStatesHeartbeatTimeout", @@ -117,8 +128,9 @@ class LSLParser ( Parser ): "COMMA", "COLON", "LPAREN", "RPAREN", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "TRUE", "FALSE", "NULL", "WHERE", "AS", "FAIL", "OUTPUT", "RETURN", "ERROR", "CAUSE", - "LAMBDA", "ARGUMENTS", "CATCH", "STRINGPATH", "VAR", - "STRING", "INT", "NUMBER", "IDEN", "WS", "TOK" ] + "LAMBDA", "ARGUMENTS", "CATCH", "FOR", "IN", "PROCESS", + "PARALLEL", "STRINGPATH", "VAR", "STRING", "INT", + "NUMBER", "IDEN", "WS", "TOK" ] RULE_state_machine = 0 RULE_state_declaration = 1 @@ -135,21 +147,22 @@ class LSLParser ( Parser ): RULE_args_assign = 12 RULE_error = 13 RULE_cause = 14 - RULE_var_assign = 15 - RULE_json_value = 16 - RULE_json_object = 17 - RULE_json_binding = 18 - RULE_json_arr = 19 - RULE_json_value_lit = 20 - RULE_string_or_jsonata = 21 - RULE_error_name = 22 + RULE_process = 15 + RULE_var_assign = 16 + RULE_json_value = 17 + RULE_json_object = 18 + RULE_json_binding = 19 + RULE_json_arr = 20 + RULE_json_value_lit = 21 + RULE_string_or_jsonata = 22 + RULE_error_name = 23 ruleNames = [ "state_machine", "state_declaration", "state_call", "state", "service_name", "task_where", "fail_where", "arguments", "catch_block", "catch_case", "parameter_list", "args_assign_list", - "args_assign", "error", "cause", "var_assign", "json_value", - "json_object", "json_binding", "json_arr", "json_value_lit", - "string_or_jsonata", "error_name" ] + "args_assign", "error", "cause", "process", "var_assign", + "json_value", "json_object", "json_binding", "json_arr", + "json_value_lit", "string_or_jsonata", "error_name" ] EOF = Token.EOF LINECOMMENT=1 @@ -192,14 +205,18 @@ class LSLParser ( Parser ): LAMBDA=38 ARGUMENTS=39 CATCH=40 - STRINGPATH=41 - VAR=42 - STRING=43 - INT=44 - NUMBER=45 - IDEN=46 - WS=47 - TOK=48 + FOR=41 + IN=42 + PROCESS=43 + PARALLEL=44 + STRINGPATH=45 + VAR=46 + STRING=47 + INT=48 + NUMBER=49 + IDEN=50 + WS=51 + TOK=52 def __init__(self, input:TokenStream, output:TextIO = sys.stdout): super().__init__(input, output) @@ -268,36 +285,36 @@ def state_machine(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 49 + self.state = 51 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 49 + self.state = 51 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,0,self._ctx) if la_ == 1: - self.state = 46 + self.state = 48 self.state_declaration() pass elif la_ == 2: - self.state = 47 + self.state = 49 self.var_assign() pass elif la_ == 3: - self.state = 48 + self.state = 50 self.state_call() pass - self.state = 51 + self.state = 53 self._errHandler.sync(self) _la = self._input.LA(1) - if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 70686571757568) != 0)): + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1146008943722496) != 0)): break - self.state = 53 + self.state = 55 self.match(LSLParser.EOF) except RecognitionException as re: localctx.exception = re @@ -355,13 +372,13 @@ def state_declaration(self): self.enterRule(localctx, 2, self.RULE_state_declaration) try: self.enterOuterAlt(localctx, 1) - self.state = 55 + self.state = 57 self.match(LSLParser.IDEN) - self.state = 56 + self.state = 58 self.parameter_list() - self.state = 57 + self.state = 59 self.match(LSLParser.EQUALS) - self.state = 58 + self.state = 60 self.state_() except RecognitionException as re: localctx.exception = re @@ -476,33 +493,33 @@ def state_call(self): localctx = LSLParser.State_callContext(self, self._ctx, self.state) self.enterRule(localctx, 4, self.RULE_state_call) try: - self.state = 66 + self.state = 68 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,2,self._ctx) if la_ == 1: localctx = LSLParser.State_call_templateContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 60 + self.state = 62 self.match(LSLParser.IDEN) - self.state = 61 + self.state = 63 self.args_assign_list() pass elif la_ == 2: localctx = LSLParser.State_call_namedContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 62 + self.state = 64 self.match(LSLParser.IDEN) - self.state = 63 + self.state = 65 self.match(LSLParser.AS) - self.state = 64 + self.state = 66 self.state_() pass elif la_ == 3: localctx = LSLParser.State_call_anonymousContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 65 + self.state = 67 self.state_() pass @@ -587,6 +604,38 @@ def accept(self, visitor:ParseTreeVisitor): return visitor.visitChildren(self) + class State_parallelContext(StateContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext + super().__init__(parser) + self.copyFrom(ctx) + + def PARALLEL(self): + return self.getToken(LSLParser.PARALLEL, 0) + def WHERE(self): + return self.getToken(LSLParser.WHERE, 0) + def process(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.ProcessContext) + else: + return self.getTypedRuleContext(LSLParser.ProcessContext,i) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_parallel" ): + listener.enterState_parallel(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_parallel" ): + listener.exitState_parallel(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_parallel" ): + return visitor.visitState_parallel(self) + else: + return visitor.visitChildren(self) + + class State_taskContext(StateContext): def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext @@ -619,42 +668,115 @@ def accept(self, visitor:ParseTreeVisitor): return visitor.visitChildren(self) + class State_mapContext(StateContext): + + def __init__(self, parser, ctx:ParserRuleContext): # actually a LSLParser.StateContext + super().__init__(parser) + self.copyFrom(ctx) + + def FOR(self): + return self.getToken(LSLParser.FOR, 0) + def IDEN(self): + return self.getToken(LSLParser.IDEN, 0) + def IN(self): + return self.getToken(LSLParser.IN, 0) + def json_value(self): + return self.getTypedRuleContext(LSLParser.Json_valueContext,0) + + def WHERE(self): + return self.getToken(LSLParser.WHERE, 0) + def process(self): + return self.getTypedRuleContext(LSLParser.ProcessContext,0) + + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterState_map" ): + listener.enterState_map(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitState_map" ): + listener.exitState_map(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitState_map" ): + return visitor.visitState_map(self) + else: + return visitor.visitChildren(self) + + def state_(self): localctx = LSLParser.StateContext(self, self._ctx, self.state) self.enterRule(localctx, 6, self.RULE_state) + self._la = 0 # Token type try: - self.state = 77 + self.state = 93 self._errHandler.sync(self) token = self._input.LA(1) if token in [38]: localctx = LSLParser.State_taskContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 68 + self.state = 70 self.service_name() - self.state = 69 + self.state = 71 self.match(LSLParser.COLON) - self.state = 70 + self.state = 72 self.match(LSLParser.IDEN) - self.state = 71 + self.state = 73 self.task_where() pass elif token in [33]: localctx = LSLParser.State_failContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 73 + self.state = 75 self.match(LSLParser.FAIL) - self.state = 74 + self.state = 76 self.fail_where() pass elif token in [35]: localctx = LSLParser.State_returnContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 75 + self.state = 77 self.match(LSLParser.RETURN) - self.state = 76 + self.state = 78 self.json_value() + pass + elif token in [41]: + localctx = LSLParser.State_mapContext(self, localctx) + self.enterOuterAlt(localctx, 4) + self.state = 79 + self.match(LSLParser.FOR) + self.state = 80 + self.match(LSLParser.IDEN) + self.state = 81 + self.match(LSLParser.IN) + self.state = 82 + self.json_value() + self.state = 83 + self.match(LSLParser.WHERE) + self.state = 84 + self.process() + pass + elif token in [44]: + localctx = LSLParser.State_parallelContext(self, localctx) + self.enterOuterAlt(localctx, 5) + self.state = 86 + self.match(LSLParser.PARALLEL) + self.state = 87 + self.match(LSLParser.WHERE) + self.state = 89 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 88 + self.process() + self.state = 91 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not (_la==43): + break + pass else: raise NoViableAltException(self) @@ -704,7 +826,7 @@ def service_name(self): self.enterRule(localctx, 8, self.RULE_service_name) try: self.enterOuterAlt(localctx, 1) - self.state = 79 + self.state = 95 self.match(LSLParser.LAMBDA) except RecognitionException as re: localctx.exception = re @@ -760,21 +882,21 @@ def task_where(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 81 + self.state = 97 self.match(LSLParser.WHERE) - self.state = 83 + self.state = 99 self._errHandler.sync(self) _la = self._input.LA(1) if _la==39: - self.state = 82 + self.state = 98 self.arguments() - self.state = 86 + self.state = 102 self._errHandler.sync(self) _la = self._input.LA(1) if _la==40: - self.state = 85 + self.state = 101 self.catch_block() @@ -832,15 +954,15 @@ def fail_where(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 88 + self.state = 104 self.match(LSLParser.WHERE) - self.state = 89 + self.state = 105 self.error() - self.state = 91 + self.state = 107 self._errHandler.sync(self) _la = self._input.LA(1) if _la==37: - self.state = 90 + self.state = 106 self.cause() @@ -893,9 +1015,9 @@ def arguments(self): self.enterRule(localctx, 14, self.RULE_arguments) try: self.enterOuterAlt(localctx, 1) - self.state = 93 + self.state = 109 self.match(LSLParser.ARGUMENTS) - self.state = 94 + self.state = 110 self.json_value() except RecognitionException as re: localctx.exception = re @@ -956,23 +1078,23 @@ def catch_block(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 96 + self.state = 112 self.match(LSLParser.CATCH) - self.state = 97 + self.state = 113 self.match(LSLParser.LBRACE) - self.state = 98 + self.state = 114 self.catch_case() - self.state = 102 + self.state = 118 self._errHandler.sync(self) _la = self._input.LA(1) - while (((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0): - self.state = 99 + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 140737488617464) != 0): + self.state = 115 self.catch_case() - self.state = 104 + self.state = 120 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 105 + self.state = 121 self.match(LSLParser.RBRACE) except RecognitionException as re: localctx.exception = re @@ -1027,11 +1149,11 @@ def catch_case(self): self.enterRule(localctx, 18, self.RULE_catch_case) try: self.enterOuterAlt(localctx, 1) - self.state = 107 + self.state = 123 self.error_name() - self.state = 108 + self.state = 124 self.match(LSLParser.ARROW) - self.state = 109 + self.state = 125 self.state_call() except RecognitionException as re: localctx.exception = re @@ -1094,29 +1216,29 @@ def parameter_list(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 111 + self.state = 127 self.match(LSLParser.LPAREN) - self.state = 113 + self.state = 129 self._errHandler.sync(self) _la = self._input.LA(1) - if _la==46: - self.state = 112 + if _la==50: + self.state = 128 self.match(LSLParser.IDEN) - self.state = 119 + self.state = 135 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 115 + self.state = 131 self.match(LSLParser.COMMA) - self.state = 116 + self.state = 132 self.match(LSLParser.IDEN) - self.state = 121 + self.state = 137 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 122 + self.state = 138 self.match(LSLParser.RPAREN) except RecognitionException as re: localctx.exception = re @@ -1180,23 +1302,23 @@ def args_assign_list(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 124 + self.state = 140 self.match(LSLParser.LPAREN) - self.state = 125 + self.state = 141 self.args_assign() - self.state = 130 + self.state = 146 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 126 + self.state = 142 self.match(LSLParser.COMMA) - self.state = 127 + self.state = 143 self.args_assign() - self.state = 132 + self.state = 148 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 133 + self.state = 149 self.match(LSLParser.RPAREN) except RecognitionException as re: localctx.exception = re @@ -1250,11 +1372,11 @@ def args_assign(self): self.enterRule(localctx, 24, self.RULE_args_assign) try: self.enterOuterAlt(localctx, 1) - self.state = 135 + self.state = 151 self.match(LSLParser.IDEN) - self.state = 136 + self.state = 152 self.match(LSLParser.EQUALS) - self.state = 137 + self.state = 153 self.json_value() except RecognitionException as re: localctx.exception = re @@ -1305,9 +1427,9 @@ def error(self): self.enterRule(localctx, 26, self.RULE_error) try: self.enterOuterAlt(localctx, 1) - self.state = 139 + self.state = 155 self.match(LSLParser.ERROR) - self.state = 140 + self.state = 156 self.string_or_jsonata() except RecognitionException as re: localctx.exception = re @@ -1358,9 +1480,9 @@ def cause(self): self.enterRule(localctx, 28, self.RULE_cause) try: self.enterOuterAlt(localctx, 1) - self.state = 142 + self.state = 158 self.match(LSLParser.CAUSE) - self.state = 143 + self.state = 159 self.string_or_jsonata() except RecognitionException as re: localctx.exception = re @@ -1371,6 +1493,114 @@ def cause(self): return localctx + class ProcessContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def PROCESS(self): + return self.getToken(LSLParser.PROCESS, 0) + + def LBRACE(self): + return self.getToken(LSLParser.LBRACE, 0) + + def RBRACE(self): + return self.getToken(LSLParser.RBRACE, 0) + + def state_declaration(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.State_declarationContext) + else: + return self.getTypedRuleContext(LSLParser.State_declarationContext,i) + + + def var_assign(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.Var_assignContext) + else: + return self.getTypedRuleContext(LSLParser.Var_assignContext,i) + + + def state_call(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(LSLParser.State_callContext) + else: + return self.getTypedRuleContext(LSLParser.State_callContext,i) + + + def getRuleIndex(self): + return LSLParser.RULE_process + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterProcess" ): + listener.enterProcess(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitProcess" ): + listener.exitProcess(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitProcess" ): + return visitor.visitProcess(self) + else: + return visitor.visitChildren(self) + + + + + def process(self): + + localctx = LSLParser.ProcessContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_process) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 161 + self.match(LSLParser.PROCESS) + self.state = 162 + self.match(LSLParser.LBRACE) + self.state = 166 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 166 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,12,self._ctx) + if la_ == 1: + self.state = 163 + self.state_declaration() + pass + + elif la_ == 2: + self.state = 164 + self.var_assign() + pass + + elif la_ == 3: + self.state = 165 + self.state_call() + pass + + + self.state = 168 + self._errHandler.sync(self) + _la = self._input.LA(1) + if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 1146008943722496) != 0)): + break + + self.state = 170 + self.match(LSLParser.RBRACE) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + class Var_assignContext(ParserRuleContext): __slots__ = 'parser' @@ -1450,30 +1680,30 @@ def accept(self, visitor:ParseTreeVisitor): def var_assign(self): localctx = LSLParser.Var_assignContext(self, self._ctx, self.state) - self.enterRule(localctx, 30, self.RULE_var_assign) + self.enterRule(localctx, 32, self.RULE_var_assign) try: - self.state = 151 + self.state = 178 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,11,self._ctx) + la_ = self._interp.adaptivePredict(self._input,14,self._ctx) if la_ == 1: localctx = LSLParser.Var_assign_state_callContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 145 + self.state = 172 self.match(LSLParser.IDEN) - self.state = 146 + self.state = 173 self.match(LSLParser.EQUALS) - self.state = 147 + self.state = 174 self.state_call() pass elif la_ == 2: localctx = LSLParser.Var_assign_json_valueContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 148 + self.state = 175 self.match(LSLParser.IDEN) - self.state = 149 + self.state = 176 self.match(LSLParser.EQUALS) - self.state = 150 + self.state = 177 self.json_value() pass @@ -1529,24 +1759,24 @@ def accept(self, visitor:ParseTreeVisitor): def json_value(self): localctx = LSLParser.Json_valueContext(self, self._ctx, self.state) - self.enterRule(localctx, 32, self.RULE_json_value) + self.enterRule(localctx, 34, self.RULE_json_value) try: - self.state = 156 + self.state = 183 self._errHandler.sync(self) token = self._input.LA(1) if token in [26]: self.enterOuterAlt(localctx, 1) - self.state = 153 + self.state = 180 self.json_object() pass elif token in [24]: self.enterOuterAlt(localctx, 2) - self.state = 154 + self.state = 181 self.json_arr() pass - elif token in [2, 28, 29, 30, 43, 44, 45]: + elif token in [2, 28, 29, 30, 47, 48, 49]: self.enterOuterAlt(localctx, 3) - self.state = 155 + self.state = 182 self.json_value_lit() pass else: @@ -1610,39 +1840,39 @@ def accept(self, visitor:ParseTreeVisitor): def json_object(self): localctx = LSLParser.Json_objectContext(self, self._ctx, self.state) - self.enterRule(localctx, 34, self.RULE_json_object) + self.enterRule(localctx, 36, self.RULE_json_object) self._la = 0 # Token type try: - self.state = 171 + self.state = 198 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,14,self._ctx) + la_ = self._interp.adaptivePredict(self._input,17,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 158 + self.state = 185 self.match(LSLParser.LBRACE) - self.state = 159 + self.state = 186 self.json_binding() - self.state = 164 + self.state = 191 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 160 + self.state = 187 self.match(LSLParser.COMMA) - self.state = 161 + self.state = 188 self.json_binding() - self.state = 166 + self.state = 193 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 167 + self.state = 194 self.match(LSLParser.RBRACE) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 169 + self.state = 196 self.match(LSLParser.LBRACE) - self.state = 170 + self.state = 197 self.match(LSLParser.RBRACE) pass @@ -1699,20 +1929,20 @@ def accept(self, visitor:ParseTreeVisitor): def json_binding(self): localctx = LSLParser.Json_bindingContext(self, self._ctx, self.state) - self.enterRule(localctx, 36, self.RULE_json_binding) + self.enterRule(localctx, 38, self.RULE_json_binding) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 173 + self.state = 200 _la = self._input.LA(1) - if not(_la==43 or _la==46): + if not(_la==47 or _la==50): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 174 + self.state = 201 self.match(LSLParser.COLON) - self.state = 175 + self.state = 202 self.json_value() except RecognitionException as re: localctx.exception = re @@ -1772,39 +2002,39 @@ def accept(self, visitor:ParseTreeVisitor): def json_arr(self): localctx = LSLParser.Json_arrContext(self, self._ctx, self.state) - self.enterRule(localctx, 38, self.RULE_json_arr) + self.enterRule(localctx, 40, self.RULE_json_arr) self._la = 0 # Token type try: - self.state = 190 + self.state = 217 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,16,self._ctx) + la_ = self._interp.adaptivePredict(self._input,19,self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) - self.state = 177 + self.state = 204 self.match(LSLParser.LBRACK) - self.state = 178 + self.state = 205 self.json_value() - self.state = 183 + self.state = 210 self._errHandler.sync(self) _la = self._input.LA(1) while _la==20: - self.state = 179 + self.state = 206 self.match(LSLParser.COMMA) - self.state = 180 + self.state = 207 self.json_value() - self.state = 185 + self.state = 212 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 186 + self.state = 213 self.match(LSLParser.RBRACK) pass elif la_ == 2: self.enterOuterAlt(localctx, 2) - self.state = 188 + self.state = 215 self.match(LSLParser.LBRACK) - self.state = 189 + self.state = 216 self.match(LSLParser.RBRACK) pass @@ -1985,28 +2215,28 @@ def accept(self, visitor:ParseTreeVisitor): def json_value_lit(self): localctx = LSLParser.Json_value_litContext(self, self._ctx, self.state) - self.enterRule(localctx, 40, self.RULE_json_value_lit) + self.enterRule(localctx, 42, self.RULE_json_value_lit) self._la = 0 # Token type try: - self.state = 198 + self.state = 225 self._errHandler.sync(self) token = self._input.LA(1) - if token in [45]: + if token in [49]: localctx = LSLParser.Json_value_floatContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 192 + self.state = 219 self.match(LSLParser.NUMBER) pass - elif token in [44]: + elif token in [48]: localctx = LSLParser.Json_value_intContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 193 + self.state = 220 self.match(LSLParser.INT) pass elif token in [28, 29]: localctx = LSLParser.Json_value_boolContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 194 + self.state = 221 _la = self._input.LA(1) if not(_la==28 or _la==29): self._errHandler.recoverInline(self) @@ -2017,19 +2247,19 @@ def json_value_lit(self): elif token in [30]: localctx = LSLParser.Json_value_nullContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 195 + self.state = 222 self.match(LSLParser.NULL) pass - elif token in [43]: + elif token in [47]: localctx = LSLParser.Json_value_strContext(self, localctx) self.enterOuterAlt(localctx, 5) - self.state = 196 + self.state = 223 self.match(LSLParser.STRING) pass elif token in [2]: localctx = LSLParser.Json_value_jsonataContext(self, localctx) self.enterOuterAlt(localctx, 6) - self.state = 197 + self.state = 224 self.match(LSLParser.JSONATA) pass else: @@ -2113,21 +2343,21 @@ def accept(self, visitor:ParseTreeVisitor): def string_or_jsonata(self): localctx = LSLParser.String_or_jsonataContext(self, self._ctx, self.state) - self.enterRule(localctx, 42, self.RULE_string_or_jsonata) + self.enterRule(localctx, 44, self.RULE_string_or_jsonata) try: - self.state = 202 + self.state = 229 self._errHandler.sync(self) token = self._input.LA(1) - if token in [43]: + if token in [47]: localctx = LSLParser.String_or_jsonata_stringContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 200 + self.state = 227 self.match(LSLParser.STRING) pass elif token in [2]: localctx = LSLParser.String_or_jsonata_jsonataContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 201 + self.state = 228 self.match(LSLParser.JSONATA) pass else: @@ -2220,13 +2450,13 @@ def accept(self, visitor:ParseTreeVisitor): def error_name(self): localctx = LSLParser.Error_nameContext(self, self._ctx, self.state) - self.enterRule(localctx, 44, self.RULE_error_name) + self.enterRule(localctx, 46, self.RULE_error_name) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 204 + self.state = 231 _la = self._input.LA(1) - if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 8796093284344) != 0)): + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 140737488617464) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py index 91bd8c579f707..aed092e7d465f 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserListener.py @@ -80,6 +80,24 @@ def exitState_return(self, ctx:LSLParser.State_returnContext): pass + # Enter a parse tree produced by LSLParser#state_map. + def enterState_map(self, ctx:LSLParser.State_mapContext): + pass + + # Exit a parse tree produced by LSLParser#state_map. + def exitState_map(self, ctx:LSLParser.State_mapContext): + pass + + + # Enter a parse tree produced by LSLParser#state_parallel. + def enterState_parallel(self, ctx:LSLParser.State_parallelContext): + pass + + # Exit a parse tree produced by LSLParser#state_parallel. + def exitState_parallel(self, ctx:LSLParser.State_parallelContext): + pass + + # Enter a parse tree produced by LSLParser#service_name. def enterService_name(self, ctx:LSLParser.Service_nameContext): pass @@ -179,6 +197,15 @@ def exitCause(self, ctx:LSLParser.CauseContext): pass + # Enter a parse tree produced by LSLParser#process. + def enterProcess(self, ctx:LSLParser.ProcessContext): + pass + + # Exit a parse tree produced by LSLParser#process. + def exitProcess(self, ctx:LSLParser.ProcessContext): + pass + + # Enter a parse tree produced by LSLParser#var_assign_state_call. def enterVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): pass diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py index 311d994041ed7..7184533fb4e6c 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/LSLParserVisitor.py @@ -49,6 +49,16 @@ def visitState_return(self, ctx:LSLParser.State_returnContext): return self.visitChildren(ctx) + # Visit a parse tree produced by LSLParser#state_map. + def visitState_map(self, ctx:LSLParser.State_mapContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by LSLParser#state_parallel. + def visitState_parallel(self, ctx:LSLParser.State_parallelContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LSLParser#service_name. def visitService_name(self, ctx:LSLParser.Service_nameContext): return self.visitChildren(ctx) @@ -104,6 +114,11 @@ def visitCause(self, ctx:LSLParser.CauseContext): return self.visitChildren(ctx) + # Visit a parse tree produced by LSLParser#process. + def visitProcess(self, ctx:LSLParser.ProcessContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by LSLParser#var_assign_state_call. def visitVar_assign_state_call(self, ctx:LSLParser.Var_assign_state_callContext): return self.visitChildren(ctx) diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py index 2fe52a643f53e..9cdd73c0497c7 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import copy from typing import Optional, OrderedDict @@ -16,11 +18,14 @@ class Scope: _start_at: Optional[str] _states: OrderedDict[str, dict] - def __init__(self): + def __init__(self, upper_scope: Optional[Scope] = None): self._last_called = None self._start_at = None + if upper_scope is not None: + self._state_templates = copy.deepcopy(upper_scope._state_templates) + else: + self._state_templates = dict() self._states = OrderedDict() - self._state_templates = dict() def new_template(self, state_name: str, state: dict): self._state_templates[state_name] = state @@ -194,6 +199,50 @@ def visitTask_where(self, ctx: LSLParser.Task_whereContext): where[key] = value return where + def new_inner_scope(self): + scope = Scope(self._this_scope()) + self._scopes.append(scope) + return scope + + def close_scope(self): + self._scopes.pop() + + def visitState_map(self, ctx: LSLParser.State_mapContext): + scope = self.new_inner_scope() + items_var_name = from_string_literal(ctx.IDEN()) + input_state_name = f"map:process:{ctx.start.line}:{ctx.start.column}:input" + input_state = { + "Type": "Pass", + "Assign": {items_var_name: "{% $states.input %}"}, + "End": True, + } + scope.set_next(state_name=input_state_name, state=input_state) + self.visit(ctx.process()) + self.close_scope() + inner_workflow = scope.to_scope_workflow() + + items_expression = self.visit(ctx.json_value()) + state = { + "Type": "Map", + "End": True, + "Items": items_expression, + "MaxConcurrency": 1, + "ItemProcessor": {"ProcessorConfig": {"Mode": "INLINE"}, **inner_workflow}, + } + return state + + def visitProcess(self, ctx: LSLParser.ProcessContext): + expressions = list() + for child in ctx.children: + if isinstance(child, ParserRuleContext) and child.getRuleIndex() in { + LSLParser.RULE_state_call, + LSLParser.RULE_state_declaration, + LSLParser.RULE_var_assign, + }: + expression = self.visit(child) + expressions.append(expression) + return expressions + def visitArguments(self, ctx: LSLParser.ArgumentsContext): value = self.visit(ctx.json_value()) return "Arguments", value diff --git a/tests/aws/services/stepfunctions/v2/localstack_states_language.py b/tests/aws/services/stepfunctions/v2/localstack_states_language.py index be49f6c38031f..b886baaaffb54 100644 --- a/tests/aws/services/stepfunctions/v2/localstack_states_language.py +++ b/tests/aws/services/stepfunctions/v2/localstack_states_language.py @@ -9,6 +9,113 @@ class TestLocalStackStatesLanguage: + @markers.aws.only_localstack + def test_map_template_anonymous_inner_task( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + MapState(names) = for name in jsonata($names) where + process { + greet_result = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata("Hello " & $name) + } + } + greet_value = jsonata($greet_result.Payload) + return jsonata($greet_value) + } + user_names = ["John", "Lewis"] + all_greetings = MapState(names = jsonata($user_names)) + return jsonata($all_greetings) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_ID_FUNCTION, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "Hello John" in details["output"] + assert "Hello Lewis" in details["output"] + + @markers.aws.only_localstack + def test_map_anonymous_inner( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + LambdaGreet(first_name, last_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata($first_name & " " & $last_name) + } + } + + user_names = ["John", "Lewis"] + all_greetings = for name in jsonata($user_names) where + process { + greet_result = LambdaGreet(first_name=jsonata($name), last_name="value") + greet_value = jsonata($greet_result.Payload) + return jsonata($greet_value) + } + return jsonata($all_greetings) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_ID_FUNCTION, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "John" in details["output"] + assert "Lewis" in details["output"] + @markers.aws.only_localstack def test_assign_invoke_succeed( self, From a04fd44b7d9d64144a9ae1ea5d9903e010d85c3f Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Wed, 14 May 2025 18:30:28 +0200 Subject: [PATCH 5/6] parallel support --- .../stepfunctions/asl/antlr/LSLLexer.g4 | 2 - .../stepfunctions/asl/parse/lsl/transpiler.py | 15 ++++ .../v2/localstack_states_language.py | 75 +++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 index 328dafab1c35e..2cfb37094b6cb 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/LSLLexer.g4 @@ -61,8 +61,6 @@ PARALLEL: 'parallel'; STRINGPATH: '"$"' | '"$' ('.' | '[') (ESC | SAFECODEPOINT)* '"'; -VAR: '$' [a-zA-Z_] (ESC | SAFECODEPOINT)*; - STRING: '"' (ESC | SAFECODEPOINT)* '"'; fragment ESC: '\\' (["\\/bfnrt] | UNICODE); diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py index 9cdd73c0497c7..8d7e3521cdcd7 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py @@ -207,6 +207,21 @@ def new_inner_scope(self): def close_scope(self): self._scopes.pop() + def visitState_parallel(self, ctx: LSLParser.State_parallelContext): + branches = list() + for child in ctx.children: + if ( + isinstance(child, ParserRuleContext) + and child.getRuleIndex() == LSLParser.RULE_process + ): + scope = self.new_inner_scope() + self.visit(child) + self.close_scope() + workflow = scope.to_scope_workflow() + branches.append(workflow) + state = {"Type": "Parallel", "End": True, "Branches": [*branches]} + return state + def visitState_map(self, ctx: LSLParser.State_mapContext): scope = self.new_inner_scope() items_var_name = from_string_literal(ctx.IDEN()) diff --git a/tests/aws/services/stepfunctions/v2/localstack_states_language.py b/tests/aws/services/stepfunctions/v2/localstack_states_language.py index b886baaaffb54..9e4a31ab41a14 100644 --- a/tests/aws/services/stepfunctions/v2/localstack_states_language.py +++ b/tests/aws/services/stepfunctions/v2/localstack_states_language.py @@ -9,6 +9,81 @@ class TestLocalStackStatesLanguage: + @markers.aws.only_localstack + def test_parallel_anonymous( + self, + aws_client, + create_lambda_function, + ): + state_machine = LocalStackStateLanguageParser.parse(""" + # Uses lambda to gree the user. + GreetUser(user_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata("Hello " & $user_name) + } + } + # Users lambda to email the user. + EmailUser(user_name) = lambda:invoke where + arguments { + FunctionName: "GreetingFunction", + Payload: { + full_name: jsonata("an email to " & $user_name) + } + } + # Runs all of the tasks for a new user. + NewUserTasks(user) = parallel where + process { + greet = GreetUser(user_name = jsonata($user)) + return jsonata($greet) + } + process { + email = EmailUser(user_name = jsonata($user)) + return jsonata($email.Payload) + } + # Run all the new user tasks for all the users. + user_names = ["Lewis", "George", "James"] + tasks_outcomes = for next_user_name in jsonata($user_names) where + process { + NewUserTasks(user = jsonata($next_user_name)) + } + return jsonata($tasks_outcomes) + """) + definition = json.dumps(state_machine) + + sfn = aws_client.stepfunctions + + create_state_machine_response = sfn.create_state_machine( + name=f"autogen-{short_uid()}", + definition=definition, + roleArn="arn:aws:iam::000000000000:role/dummy", + ) + state_machine_arn = create_state_machine_response["stateMachineArn"] + + function_name = "GreetingFunction" + create_lambda_function( + func_name=function_name, + handler_file=ServicesTemplates.LAMBDA_ID_FUNCTION, + runtime=Runtime.python3_12, + ) + + execute_state_machine_response = sfn.start_execution(stateMachineArn=state_machine_arn) + execution_arn = execute_state_machine_response["executionArn"] + + await_execution_terminated( + stepfunctions_client=aws_client.stepfunctions, execution_arn=execution_arn + ) + execution_history_response = sfn.get_execution_history(executionArn=execution_arn) + assert "executionSucceededEventDetails" in execution_history_response["events"][-1] + details = execution_history_response["events"][-1]["executionSucceededEventDetails"] + assert "Hello George" in details["output"] + assert "Hello Lewis" in details["output"] + assert "Hello James" in details["output"] + assert "an email to George" in details["output"] + assert "an email to Lewis" in details["output"] + assert "an email to James" in details["output"] + @markers.aws.only_localstack def test_map_template_anonymous_inner_task( self, From 982ed1d64c20f4f266803e6f76d85b1f58df22ff Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Thu, 15 May 2025 14:09:25 +0200 Subject: [PATCH 6/6] tmp cli --- .../asl/{parse => }/lsl/__init__.py | 0 .../services/stepfunctions/asl/lsl/lsl_cli.py | 34 +++++++++++++++++++ .../asl/{parse => }/lsl/transpiler.py | 27 +++++++++++---- .../stepfunctions/asl/parse/lsl_parser.py | 21 ------------ .../v2/localstack_states_language.py | 26 +++++++------- 5 files changed, 67 insertions(+), 41 deletions(-) rename localstack-core/localstack/services/stepfunctions/asl/{parse => }/lsl/__init__.py (100%) create mode 100644 localstack-core/localstack/services/stepfunctions/asl/lsl/lsl_cli.py rename localstack-core/localstack/services/stepfunctions/asl/{parse => }/lsl/transpiler.py (95%) delete mode 100644 localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/__init__.py b/localstack-core/localstack/services/stepfunctions/asl/lsl/__init__.py similarity index 100% rename from localstack-core/localstack/services/stepfunctions/asl/parse/lsl/__init__.py rename to localstack-core/localstack/services/stepfunctions/asl/lsl/__init__.py diff --git a/localstack-core/localstack/services/stepfunctions/asl/lsl/lsl_cli.py b/localstack-core/localstack/services/stepfunctions/asl/lsl/lsl_cli.py new file mode 100644 index 0000000000000..bb94ce7e6a10c --- /dev/null +++ b/localstack-core/localstack/services/stepfunctions/asl/lsl/lsl_cli.py @@ -0,0 +1,34 @@ +import json +import os + +import click + +from localstack.services.stepfunctions.asl.lsl.transpiler import transpile + + +@click.command() +@click.argument( + "input_file", type=click.Path(exists=True, dir_okay=False, readable=True, path_type=str) +) +@click.option( + "--output", + "-o", + type=click.Path(dir_okay=False, writable=True, path_type=str), + help="Path to output JSON file.", +) +def cli(input_file: str, output: str): + """Transpile an LSL derivation file to JSON.""" + with open(input_file, "r") as f: + content = f.read() + + result = transpile(content) + + output_file = output or os.path.splitext(input_file)[0] + ".asl.json" + with open(output_file, "w") as f: + json.dump(result, f, indent=2) + + click.echo(f"Transpiled successfully to {output_file}") + + +if __name__ == "__main__": + cli() diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py b/localstack-core/localstack/services/stepfunctions/asl/lsl/transpiler.py similarity index 95% rename from localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py rename to localstack-core/localstack/services/stepfunctions/asl/lsl/transpiler.py index 8d7e3521cdcd7..8c4058178f98c 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl/transpiler.py +++ b/localstack-core/localstack/services/stepfunctions/asl/lsl/transpiler.py @@ -3,6 +3,7 @@ import copy from typing import Optional, OrderedDict +from antlr4 import CommonTokenStream, InputStream from antlr4.ParserRuleContext import ParserRuleContext from antlr4.tree.Tree import TerminalNodeImpl @@ -12,13 +13,25 @@ from localstack.services.stepfunctions.asl.antlt4utils.antlr4utils import from_string_literal -class Scope: +def transpile(lsl_derivation: str) -> dict: + input_stream = InputStream(lsl_derivation) + lexer = LSLLexer(input_stream) + stream = CommonTokenStream(lexer) + parser = LSLParser(stream) + tree = parser.state_machine() + transpiler = _Transpiler() + transpiler.visit(tree) + workflow = transpiler.get_workflow() + return workflow + + +class _Scope: _last_called: Optional[str] _state_templates: dict[str, dict] _start_at: Optional[str] _states: OrderedDict[str, dict] - def __init__(self, upper_scope: Optional[Scope] = None): + def __init__(self, upper_scope: Optional[_Scope] = None): self._last_called = None self._start_at = None if upper_scope is not None: @@ -48,12 +61,12 @@ def to_scope_workflow(self) -> dict: return {"StartAt": self._start_at, "States": {**self._states}} -class Transpiler(LSLParserVisitor): - _scopes: list[Scope] +class _Transpiler(LSLParserVisitor): + _scopes: list[_Scope] def __init__(self): self._scopes = list() - self._scopes.append(Scope()) + self._scopes.append(_Scope()) def get_workflow(self) -> dict: scope = self._this_scope() @@ -61,7 +74,7 @@ def get_workflow(self) -> dict: workflow = {"Comment": "Auto-generated", "QueryLanguage": "JSONata", **scope_workflow} return workflow - def _this_scope(self) -> Scope: + def _this_scope(self) -> _Scope: return self._scopes[-1] def visitState_declaration(self, ctx: LSLParser.State_declarationContext): @@ -200,7 +213,7 @@ def visitTask_where(self, ctx: LSLParser.Task_whereContext): return where def new_inner_scope(self): - scope = Scope(self._this_scope()) + scope = _Scope(self._this_scope()) self._scopes.append(scope) return scope diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py b/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py deleted file mode 100644 index 6d5abf355df3a..0000000000000 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/lsl_parser.py +++ /dev/null @@ -1,21 +0,0 @@ -import abc - -from antlr4 import CommonTokenStream, InputStream - -from localstack.services.stepfunctions.asl.antlr.runtime.LSLLexer import LSLLexer -from localstack.services.stepfunctions.asl.antlr.runtime.LSLParser import LSLParser -from localstack.services.stepfunctions.asl.parse.lsl.transpiler import Transpiler - - -class LocalStackStateLanguageParser(abc.ABC): - @staticmethod - def parse(definition: str) -> dict: - input_stream = InputStream(definition) - lexer = LSLLexer(input_stream) - stream = CommonTokenStream(lexer) - parser = LSLParser(stream) - tree = parser.state_machine() - transpiler = Transpiler() - transpiler.visit(tree) - workflow = transpiler.get_workflow() - return workflow diff --git a/tests/aws/services/stepfunctions/v2/localstack_states_language.py b/tests/aws/services/stepfunctions/v2/localstack_states_language.py index 9e4a31ab41a14..84ce5291e4220 100644 --- a/tests/aws/services/stepfunctions/v2/localstack_states_language.py +++ b/tests/aws/services/stepfunctions/v2/localstack_states_language.py @@ -2,7 +2,7 @@ from aws.services.stepfunctions.templates.services.services_templates import ServicesTemplates from localstack.aws.api.lambda_ import Runtime -from localstack.services.stepfunctions.asl.parse.lsl_parser import LocalStackStateLanguageParser +from localstack.services.stepfunctions.asl.lsl.transpiler import transpile from localstack.testing.pytest import markers from localstack.testing.pytest.stepfunctions.utils import await_execution_terminated from localstack.utils.strings import short_uid @@ -15,7 +15,7 @@ def test_parallel_anonymous( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" # Uses lambda to gree the user. GreetUser(user_name) = lambda:invoke where arguments { @@ -90,7 +90,7 @@ def test_map_template_anonymous_inner_task( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" MapState(names) = for name in jsonata($names) where process { greet_result = lambda:invoke where @@ -143,7 +143,7 @@ def test_map_anonymous_inner( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" LambdaGreet(first_name, last_name) = lambda:invoke where arguments { FunctionName: "GreetingFunction", @@ -197,7 +197,7 @@ def test_assign_invoke_succeed( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" LambdaGreet(first_name, last_name) = lambda:invoke where arguments { FunctionName: "GreetingFunction", @@ -250,7 +250,7 @@ def test_assign_and_invoke( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" LambdaGreet(first_name, last_name) = lambda:invoke where arguments { FunctionName: "GreetingFunction", @@ -296,7 +296,7 @@ def test_assign_and_invoke( @markers.aws.only_localstack def test_assign_and_succeed(self, aws_client): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" WorkflowSucceeded(value) = return jsonata($value) output_message = jsonata("Hello" & " " & "World!") WorkflowSucceeded(value = jsonata($output_message)) @@ -325,7 +325,7 @@ def test_assign_and_succeed(self, aws_client): @markers.aws.only_localstack def test_succeed_template(self, aws_client): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" WorkflowSucceeded(value) = return jsonata($value) WorkflowSucceeded(value = {"message": "string-literal"}) """) @@ -353,7 +353,7 @@ def test_succeed_template(self, aws_client): @markers.aws.only_localstack def test_succeed_inplace(self, aws_client): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" WorkflowSucceeded as return jsonata('string' & ' ' & 'literal') """) definition = json.dumps(state_machine) @@ -380,7 +380,7 @@ def test_succeed_inplace(self, aws_client): @markers.aws.only_localstack def test_succeed_anonymous_inplace(self, aws_client): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" return jsonata('string' & ' ' & 'literal') """) definition = json.dumps(state_machine) @@ -411,7 +411,7 @@ def test_lambda_invoke_anonymous_inplace( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" lambda:invoke where arguments { FunctionName: "GreetingFunction", @@ -453,7 +453,7 @@ def test_lambda_invoke_named_inplace( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" LambdaGreet as lambda:invoke where arguments { FunctionName: "GreetingFunction", @@ -495,7 +495,7 @@ def test_lambda_invoke( aws_client, create_lambda_function, ): - state_machine = LocalStackStateLanguageParser.parse(""" + state_machine = transpile(""" LambdaGreet(first_name, last_name) = lambda:invoke where arguments { FunctionName: "GreetingFunction",