StepFunctions: Proper Parser (#7418)

This commit is contained in:
Bert Blommers 2024-03-16 14:03:41 +00:00 committed by GitHub
parent 6e0b4c6519
commit 5d4ea2f393
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
333 changed files with 60939 additions and 78 deletions

View File

@ -69,6 +69,7 @@ jobs:
pip install -r requirements-dev.txt pip install -r requirements-dev.txt
- name: Lint - name: Lint
run: run:
mkdir .mypy_cache
make lint make lint
javatest: javatest:

View File

@ -59,10 +59,11 @@ jobs:
- name: "Stop MotoServer" - name: "Stop MotoServer"
if: always() if: always()
run: | run: |
ls -la
docker stop motoserver
mkdir serverlogs mkdir serverlogs
cp server_output.log serverlogs/server_output.log cp server_output.log serverlogs/server_output.log
docker stop motoserver - name: Archive Server logs
- name: Archive TF logs
if: always() if: always()
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:

View File

@ -7731,7 +7731,7 @@
## stepfunctions ## stepfunctions
<details> <details>
<summary>36% implemented</summary> <summary>55% implemented</summary>
- [ ] create_activity - [ ] create_activity
- [X] create_state_machine - [X] create_state_machine
@ -7742,31 +7742,31 @@
- [ ] delete_state_machine_version - [ ] delete_state_machine_version
- [ ] describe_activity - [ ] describe_activity
- [X] describe_execution - [X] describe_execution
- [ ] describe_map_run - [X] describe_map_run
- [X] describe_state_machine - [X] describe_state_machine
- [ ] describe_state_machine_alias - [ ] describe_state_machine_alias
- [ ] describe_state_machine_for_execution - [X] describe_state_machine_for_execution
- [ ] get_activity_task - [ ] get_activity_task
- [X] get_execution_history - [X] get_execution_history
- [ ] list_activities - [ ] list_activities
- [X] list_executions - [X] list_executions
- [ ] list_map_runs - [X] list_map_runs
- [ ] list_state_machine_aliases - [ ] list_state_machine_aliases
- [ ] list_state_machine_versions - [ ] list_state_machine_versions
- [X] list_state_machines - [X] list_state_machines
- [X] list_tags_for_resource - [X] list_tags_for_resource
- [ ] publish_state_machine_version - [ ] publish_state_machine_version
- [ ] redrive_execution - [ ] redrive_execution
- [ ] send_task_failure - [X] send_task_failure
- [ ] send_task_heartbeat - [X] send_task_heartbeat
- [ ] send_task_success - [X] send_task_success
- [X] start_execution - [X] start_execution
- [ ] start_sync_execution - [ ] start_sync_execution
- [X] stop_execution - [X] stop_execution
- [X] tag_resource - [X] tag_resource
- [ ] test_state - [ ] test_state
- [X] untag_resource - [X] untag_resource
- [ ] update_map_run - [X] update_map_run
- [X] update_state_machine - [X] update_state_machine
- [ ] update_state_machine_alias - [ ] update_state_machine_alias
</details> </details>

View File

@ -1,3 +1,6 @@
ignore:
- "moto/stepfunctions/parser/asl/antlr"
codecov: codecov:
notify: notify:
# Leave a GitHub comment after all builds have passed # Leave a GitHub comment after all builds have passed

View File

@ -22,6 +22,7 @@ If you are using the decorators, some options are configurable within the decora
"reset_boto3_session": True, "reset_boto3_session": True,
}, },
"iam": {"load_aws_managed_policies": False}, "iam": {"load_aws_managed_policies": False},
"stepfunctions": {"execute_state_machine": True},
}) })

View File

@ -12,6 +12,8 @@
stepfunctions stepfunctions
============= =============
.. autoclass:: moto.stepfunctions.models.StepFunctionBackend
|start-h3| Implemented features for this service |end-h3| |start-h3| Implemented features for this service |end-h3|
- [ ] create_activity - [ ] create_activity
@ -23,58 +25,31 @@ stepfunctions
- [ ] delete_state_machine_version - [ ] delete_state_machine_version
- [ ] describe_activity - [ ] describe_activity
- [X] describe_execution - [X] describe_execution
- [X] describe_map_run
The status of every execution is set to 'RUNNING' by default.
Set the following environment variable if you want to get a FAILED status back:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
- [ ] describe_map_run
- [X] describe_state_machine - [X] describe_state_machine
- [ ] describe_state_machine_alias - [ ] describe_state_machine_alias
- [ ] describe_state_machine_for_execution - [X] describe_state_machine_for_execution
- [ ] get_activity_task - [ ] get_activity_task
- [X] get_execution_history - [X] get_execution_history
A static list of successful events is returned by default.
Set the following environment variable if you want to get a static list of events for a failed execution:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
- [ ] list_activities - [ ] list_activities
- [X] list_executions - [X] list_executions
- [X] list_map_runs
The status of every execution is set to 'RUNNING' by default.
Set the following environment variable if you want to get a FAILED status back:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
- [ ] list_map_runs
- [ ] list_state_machine_aliases - [ ] list_state_machine_aliases
- [ ] list_state_machine_versions - [ ] list_state_machine_versions
- [X] list_state_machines - [X] list_state_machines
- [X] list_tags_for_resource - [X] list_tags_for_resource
- [ ] publish_state_machine_version - [ ] publish_state_machine_version
- [ ] redrive_execution - [ ] redrive_execution
- [ ] send_task_failure - [X] send_task_failure
- [ ] send_task_heartbeat - [X] send_task_heartbeat
- [ ] send_task_success - [X] send_task_success
- [X] start_execution - [X] start_execution
- [ ] start_sync_execution - [ ] start_sync_execution
- [X] stop_execution - [X] stop_execution
- [X] tag_resource - [X] tag_resource
- [ ] test_state - [ ] test_state
- [X] untag_resource - [X] untag_resource
- [ ] update_map_run - [X] update_map_run
- [X] update_state_machine - [X] update_state_machine
- [ ] update_state_machine_alias - [ ] update_state_machine_alias

View File

@ -21,6 +21,10 @@ class _iam_config(TypedDict, total=False):
load_aws_managed_policies: bool load_aws_managed_policies: bool
class _sfn_config(TypedDict, total=False):
execute_state_machine: bool
DefaultConfig = TypedDict( DefaultConfig = TypedDict(
"DefaultConfig", "DefaultConfig",
{ {
@ -28,6 +32,7 @@ DefaultConfig = TypedDict(
"core": _core_config, "core": _core_config,
"lambda": _docker_config, "lambda": _docker_config,
"iam": _iam_config, "iam": _iam_config,
"stepfunctions": _sfn_config,
}, },
total=False, total=False,
) )
@ -41,6 +46,7 @@ default_user_config: DefaultConfig = {
"reset_boto3_session": True, "reset_boto3_session": True,
}, },
"iam": {"load_aws_managed_policies": False}, "iam": {"load_aws_managed_policies": False},
"stepfunctions": {"execute_state_machine": False},
} }

View File

@ -128,6 +128,8 @@ class MotoAPIBackend(BaseBackend):
default_user_config["batch"] = config["batch"] default_user_config["batch"] = config["batch"]
if "lambda" in config: if "lambda" in config:
default_user_config["lambda"] = config["lambda"] default_user_config["lambda"] = config["lambda"]
if "stepfunctions" in config:
default_user_config["stepfunctions"] = config["stepfunctions"]
moto_api_backend = MotoAPIBackend(region_name="global", account_id=DEFAULT_ACCOUNT_ID) moto_api_backend = MotoAPIBackend(region_name="global", account_id=DEFAULT_ACCOUNT_ID)

View File

@ -73,7 +73,7 @@ class StateMachine(CloudFormationModel):
raise ExecutionDoesNotExist( raise ExecutionDoesNotExist(
"Execution Does Not Exist: '" + execution_arn + "'" "Execution Does Not Exist: '" + execution_arn + "'"
) )
execution.stop() execution.stop(stop_date=datetime.now(), error="", cause="")
return execution return execution
def _ensure_execution_name_doesnt_exist(self, name: str) -> None: def _ensure_execution_name_doesnt_exist(self, name: str) -> None:
@ -265,6 +265,12 @@ class Execution:
else "FAILED" else "FAILED"
) )
self.stop_date: Optional[str] = None self.stop_date: Optional[str] = None
self.account_id = account_id
self.region_name = region_name
self.output: Optional[str] = None
self.output_details: Optional[str] = None
self.cause: Optional[str] = None
self.error: Optional[str] = None
def get_execution_history(self, roleArn: str) -> List[Dict[str, Any]]: def get_execution_history(self, roleArn: str) -> List[Dict[str, Any]]:
sf_execution_history_type = settings.get_sf_execution_history_type() sf_execution_history_type = settings.get_sf_execution_history_type()
@ -365,12 +371,28 @@ class Execution:
] ]
return [] return []
def stop(self) -> None: def stop(self, *args: Any, **kwargs: Any) -> None:
self.status = "ABORTED" self.status = "ABORTED"
self.stop_date = iso_8601_datetime_with_milliseconds() self.stop_date = iso_8601_datetime_with_milliseconds()
class StepFunctionBackend(BaseBackend): class StepFunctionBackend(BaseBackend):
"""
Configure Moto to explicitly parse and execute the StateMachine:
.. sourcecode:: python
@mock_aws(config={"stepfunctions": {"execute_state_machine": True}})
By default, executing a StateMachine does nothing, and calling `describe_state_machine` will return static data.
Set the following environment variable if you want to get the static data to have a FAILED status:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
"""
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html#SFN.Client.create_state_machine # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html#SFN.Client.create_state_machine
# A name must not contain: # A name must not contain:
@ -484,7 +506,6 @@ class StepFunctionBackend(BaseBackend):
def __init__(self, region_name: str, account_id: str): def __init__(self, region_name: str, account_id: str):
super().__init__(region_name, account_id) super().__init__(region_name, account_id)
self.state_machines: List[StateMachine] = [] self.state_machines: List[StateMachine] = []
self.executions: List[Execution] = []
self._account_id = None self._account_id = None
def create_state_machine( def create_state_machine(
@ -556,14 +577,6 @@ class StepFunctionBackend(BaseBackend):
def list_executions( def list_executions(
self, state_machine_arn: str, status_filter: Optional[str] = None self, state_machine_arn: str, status_filter: Optional[str] = None
) -> List[Execution]: ) -> List[Execution]:
"""
The status of every execution is set to 'RUNNING' by default.
Set the following environment variable if you want to get a FAILED status back:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
"""
executions = self.describe_state_machine(state_machine_arn).executions executions = self.describe_state_machine(state_machine_arn).executions
if status_filter: if status_filter:
@ -572,14 +585,6 @@ class StepFunctionBackend(BaseBackend):
return sorted(executions, key=lambda x: x.start_date, reverse=True) return sorted(executions, key=lambda x: x.start_date, reverse=True)
def describe_execution(self, execution_arn: str) -> Execution: def describe_execution(self, execution_arn: str) -> Execution:
"""
The status of every execution is set to 'RUNNING' by default.
Set the following environment variable if you want to get a FAILED status back:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
"""
self._validate_execution_arn(execution_arn) self._validate_execution_arn(execution_arn)
state_machine = self._get_state_machine_for_execution(execution_arn) state_machine = self._get_state_machine_for_execution(execution_arn)
exctn = next( exctn = next(
@ -593,14 +598,6 @@ class StepFunctionBackend(BaseBackend):
return exctn return exctn
def get_execution_history(self, execution_arn: str) -> List[Dict[str, Any]]: def get_execution_history(self, execution_arn: str) -> List[Dict[str, Any]]:
"""
A static list of successful events is returned by default.
Set the following environment variable if you want to get a static list of events for a failed execution:
.. sourcecode:: bash
SF_EXECUTION_HISTORY_TYPE=FAILURE
"""
self._validate_execution_arn(execution_arn) self._validate_execution_arn(execution_arn)
state_machine = self._get_state_machine_for_execution(execution_arn) state_machine = self._get_state_machine_for_execution(execution_arn)
execution = next( execution = next(
@ -613,6 +610,13 @@ class StepFunctionBackend(BaseBackend):
) )
return execution.get_execution_history(state_machine.roleArn) return execution.get_execution_history(state_machine.roleArn)
def describe_state_machine_for_execution(self, execution_arn: str) -> StateMachine:
for sm in self.state_machines:
for exc in sm.executions:
if exc.execution_arn == execution_arn:
return sm
raise ResourceNotFound(execution_arn)
def list_tags_for_resource(self, arn: str) -> List[Dict[str, str]]: def list_tags_for_resource(self, arn: str) -> List[Dict[str, str]]:
try: try:
state_machine = self.describe_state_machine(arn) state_machine = self.describe_state_machine(arn)
@ -634,6 +638,30 @@ class StepFunctionBackend(BaseBackend):
except StateMachineDoesNotExist: except StateMachineDoesNotExist:
raise ResourceNotFound(resource_arn) raise ResourceNotFound(resource_arn)
def send_task_failure(self, task_token: str) -> None:
pass
def send_task_heartbeat(self, task_token: str) -> None:
pass
def send_task_success(self, task_token: str, outcome: str) -> None:
pass
def describe_map_run(self, map_run_arn: str) -> Dict[str, Any]:
return {}
def list_map_runs(self, execution_arn: str) -> Any:
return []
def update_map_run(
self,
map_run_arn: str,
max_concurrency: int,
tolerated_failure_count: str,
tolerated_failure_percentage: str,
) -> None:
pass
def _validate_name(self, name: str) -> None: def _validate_name(self, name: str) -> None:
if any(invalid_char in name for invalid_char in self.invalid_chars_for_name): if any(invalid_char in name for invalid_char in self.invalid_chars_for_name):
raise InvalidName("Invalid Name: '" + name + "'") raise InvalidName("Invalid Name: '" + name + "'")

View File

@ -0,0 +1,3 @@
In-memory ASL (Amazon StepFunctions Language) parser.
Created for Localstack by @mepalma (https://github.com/MEPalma)

View File

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
lexer grammar ASLIntrinsicLexer;
DOLLAR: '$';
DOT: '.';
STAR: '*';
COMMA: ',';
LPAREN: '(';
RPAREN: ')';
LBRACK: '[';
RBRACK: ']';
LDIAM: '<';
RDIAM: '>';
ATDOT: '@.';
ATDOTLENGTHDASH: '@.length-';
ANDAND: '&&';
OROR: '||';
EQEQ: '==';
EQ: '=';
TRUE: 'true';
FALSE: 'false';
States: 'States';
Format: 'Format';
StringToJson: 'StringToJson';
JsonToString: 'JsonToString';
Array: 'Array';
ArrayPartition: 'ArrayPartition';
ArrayContains: 'ArrayContains';
ArrayRange: 'ArrayRange';
ArrayGetItem: 'ArrayGetItem';
ArrayLength: 'ArrayLength';
ArrayUnique: 'ArrayUnique';
Base64Encode: 'Base64Encode';
Base64Decode: 'Base64Decode';
Hash: 'Hash';
JsonMerge: 'JsonMerge';
MathRandom: 'MathRandom';
MathAdd: 'MathAdd';
StringSplit: 'StringSplit';
UUID: 'UUID';
STRING
: '\'' (ESC | SAFECODEPOINT)*? '\''
;
fragment ESC
: '\\' (UNICODE | .)
;
fragment UNICODE
: 'u' HEX HEX HEX HEX
;
fragment HEX
: [0-9a-fA-F]
;
fragment SAFECODEPOINT
: ~ ['\\\u0000-\u001F]
;
INT
: '-'? ('0' | [1-9] [0-9]*)
;
NUMBER
: '-'? INT ('.' [0-9] +)? EXP?
;
fragment EXP
: [Ee] [+\-]? INT
;
IDENTIFIER
: ([0-9a-zA-Z_] | UNICODE)+
;
WS
: [ \t\n] + -> skip
;

View File

@ -0,0 +1,92 @@
parser grammar ASLIntrinsicParser;
options {
tokenVocab=ASLIntrinsicLexer;
}
func_decl
: states_func_decl
;
states_func_decl
: States DOT state_fun_name func_arg_list
;
state_fun_name
: Format
| StringToJson
| JsonToString
| Array
| ArrayPartition
| ArrayContains
| ArrayRange
| ArrayGetItem
| ArrayLength
| ArrayUnique
| Base64Encode
| Base64Decode
| Hash
| JsonMerge
| MathRandom
| MathAdd
| StringSplit
| UUID
;
func_arg_list
: LPAREN func_arg (COMMA func_arg)* RPAREN
| LPAREN RPAREN
;
func_arg
: STRING #func_arg_string
| INT #func_arg_int
| NUMBER #func_arg_float
| (TRUE | FALSE) #func_arg_bool
| context_path #func_arg_context_path
| json_path #func_arg_json_path
| func_decl #func_arg_func_decl
;
context_path
: DOLLAR json_path
;
json_path
: DOLLAR DOT json_path_part (DOT json_path_part)*
;
json_path_part
: json_path_iden
| json_path_iden_qual
;
json_path_iden
: identifier
;
json_path_iden_qual
: json_path_iden json_path_qual
;
json_path_qual
: LBRACK RBRACK #json_path_qual_void
| LBRACK INT RBRACK #json_path_qual_idx
| LBRACK json_path_query RBRACK #json_path_qual_query
;
json_path_query
: STAR # json_path_query_star
| ATDOT json_path_iden
( (LDIAM | RDIAM | EQEQ) INT
| EQ STRING
) # json_path_query_cmp
| ATDOTLENGTHDASH INT # json_path_query_length
| json_path_query ((ANDAND | OROR) json_path_query)+ # json_path_query_binary
;
identifier
: IDENTIFIER
// States.
| state_fun_name
;

View File

@ -0,0 +1,200 @@
lexer grammar ASLLexer;
// Symbols.
COMMA: ',';
COLON: ':';
LBRACK: '[';
RBRACK: ']';
LBRACE: '{';
RBRACE: '}';
// Literals.
TRUE: 'true';
FALSE: 'false';
NULL: 'null';
// Keywords.
COMMENT: '"Comment"';
STATES: '"States"';
STARTAT: '"StartAt"';
NEXTSTATE: '"NextState"';
VERSION: '"Version"';
TYPE: '"Type"';
TASK: '"Task"';
CHOICE: '"Choice"';
FAIL: '"Fail"';
SUCCEED: '"Succeed"';
PASS: '"Pass"';
WAIT: '"Wait"';
PARALLEL: '"Parallel"';
MAP: '"Map"';
CHOICES: '"Choices"';
VARIABLE: '"Variable"';
DEFAULT: '"Default"';
BRANCHES: '"Branches"';
AND: '"And"';
BOOLEANEQUALS: '"BooleanEquals"';
BOOLEANQUALSPATH: '"BooleanEqualsPath"';
ISBOOLEAN: '"IsBoolean"';
ISNULL: '"IsNull"';
ISNUMERIC: '"IsNumeric"';
ISPRESENT: '"IsPresent"';
ISSTRING: '"IsString"';
ISTIMESTAMP: '"IsTimestamp"';
NOT: '"Not"';
NUMERICEQUALS: '"NumericEquals"';
NUMERICEQUALSPATH: '"NumericEqualsPath"';
NUMERICGREATERTHAN: '"NumericGreaterThan"';
NUMERICGREATERTHANPATH: '"NumericGreaterThanPath"';
NUMERICGREATERTHANEQUALS: '"NumericGreaterThanEquals"';
NUMERICGREATERTHANEQUALSPATH: '"NumericGreaterThanEqualsPath"';
NUMERICLESSTHAN: '"NumericLessThan"';
NUMERICLESSTHANPATH: '"NumericLessThanPath"';
NUMERICLESSTHANEQUALS: '"NumericLessThanEquals"';
NUMERICLESSTHANEQUALSPATH: '"NumericLessThanEqualsPath"';
OR: '"Or"';
STRINGEQUALS: '"StringEquals"';
STRINGEQUALSPATH: '"StringEqualsPath"';
STRINGGREATERTHAN: '"StringGreaterThan"';
STRINGGREATERTHANPATH: '"StringGreaterThanPath"';
STRINGGREATERTHANEQUALS: '"StringGreaterThanEquals"';
STRINGGREATERTHANEQUALSPATH: '"StringGreaterThanEqualsPath"';
STRINGLESSTHAN: '"StringLessThan"';
STRINGLESSTHANPATH: '"StringLessThanPath"';
STRINGLESSTHANEQUALS: '"StringLessThanEquals"';
STRINGLESSTHANEQUALSPATH: '"StringLessThanEqualsPath"';
STRINGMATCHES: '"StringMatches"';
TIMESTAMPEQUALS: '"TimestampEquals"';
TIMESTAMPEQUALSPATH: '"TimestampEqualsPath"';
TIMESTAMPGREATERTHAN: '"TimestampGreaterThan"';
TIMESTAMPGREATERTHANPATH: '"TimestampGreaterThanPath"';
TIMESTAMPGREATERTHANEQUALS: '"TimestampGreaterThanEquals"';
TIMESTAMPGREATERTHANEQUALSPATH: '"TimestampGreaterThanEqualsPath"';
TIMESTAMPLESSTHAN: '"TimestampLessThan"';
TIMESTAMPLESSTHANPATH: '"TimestampLessThanPath"';
TIMESTAMPLESSTHANEQUALS: '"TimestampLessThanEquals"';
TIMESTAMPLESSTHANEQUALSPATH: '"TimestampLessThanEqualsPath"';
SECONDSPATH: '"SecondsPath"';
SECONDS: '"Seconds"';
TIMESTAMPPATH: '"TimestampPath"';
TIMESTAMP: '"Timestamp"';
TIMEOUTSECONDS: '"TimeoutSeconds"';
TIMEOUTSECONDSPATH: '"TimeoutSecondsPath"';
HEARTBEATSECONDS: '"HeartbeatSeconds"';
HEARTBEATSECONDSPATH: '"HeartbeatSecondsPath"';
PROCESSORCONFIG: '"ProcessorConfig"';
MODE: '"Mode"';
INLINE: '"INLINE"';
DISTRIBUTED: '"DISTRIBUTED"';
EXECUTIONTYPE: '"ExecutionType"';
STANDARD: '"STANDARD"';
ITEMPROCESSOR: '"ItemProcessor"';
ITERATOR: '"Iterator"';
ITEMSELECTOR: '"ItemSelector"';
MAXCONCURRENCY: '"MaxConcurrency"';
RESOURCE: '"Resource"';
INPUTPATH: '"InputPath"';
OUTPUTPATH: '"OutputPath"';
ITEMSPATH: '"ItemsPath"';
RESULTPATH: '"ResultPath"';
RESULT: '"Result"';
PARAMETERS: '"Parameters"';
RESULTSELECTOR: '"ResultSelector"';
ITEMREADER: '"ItemReader"';
READERCONFIG: '"ReaderConfig"';
INPUTTYPE: '"InputType"';
CSVHEADERLOCATION: '"CSVHeaderLocation"';
CSVHEADERS: '"CSVHeaders"';
MAXITEMS: '"MaxItems"';
MAXITEMSPATH: '"MaxItemsPath"';
NEXT: '"Next"';
END: '"End"';
CAUSE: '"Cause"';
ERROR: '"Error"';
// Retry.
RETRY: '"Retry"';
ERROREQUALS: '"ErrorEquals"';
INTERVALSECONDS: '"IntervalSeconds"';
MAXATTEMPTS: '"MaxAttempts"';
BACKOFFRATE: '"BackoffRate"';
// Catch.
CATCH: '"Catch"';
// ErrorNames
ERRORNAMEStatesALL: '"States.ALL"';
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"';
// Read-only:
ERRORNAMEStatesRuntime: '"States.Runtime"';
// Strings.
STRINGDOLLAR
: '"' (ESC | SAFECODEPOINT)* '.$"'
;
STRINGPATHCONTEXTOBJ
: '"$$' (ESC | SAFECODEPOINT)* '"'
;
STRINGPATH
: '"$' (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
;
// Whitespace.
WS
: [ \t\n\r] + -> skip
;

View File

@ -0,0 +1,682 @@
parser grammar ASLParser;
options {
tokenVocab=ASLLexer;
}
program_decl
: LBRACE
top_layer_stmt (COMMA top_layer_stmt)*
RBRACE
;
top_layer_stmt
: comment_decl
| version_decl
| startat_decl
| states_decl
| timeout_seconds_decl
;
startat_decl
: STARTAT COLON keyword_or_string
;
comment_decl
: COMMENT COLON keyword_or_string
;
version_decl
: VERSION COLON keyword_or_string
;
state_stmt
: comment_decl
| type_decl
| input_path_decl
| resource_decl
| next_decl
| result_decl
| result_path_decl
| output_path_decl
| end_decl
| default_decl
| choices_decl
| error_decl
| cause_decl
| seconds_decl
| seconds_path_decl
| timestamp_decl
| timestamp_path_decl
| items_path_decl
| item_processor_decl
| iterator_decl
| item_selector_decl
| item_reader_decl
| max_concurrency_decl
| timeout_seconds_decl
| timeout_seconds_path_decl
| heartbeat_seconds_decl
| heartbeat_seconds_path_decl
| branches_decl
| parameters_decl
| retry_decl
| catch_decl
| result_selector_decl
;
states_decl
: STATES
COLON
LBRACE
state_decl (COMMA state_decl)*
RBRACE
;
state_name
: keyword_or_string
;
// TODO: avoid redefinitions? -> check listener ok?
state_decl
: state_name
COLON
state_decl_body
;
state_decl_body
: LBRACE
state_stmt (COMMA state_stmt)*
RBRACE
;
type_decl
: TYPE COLON state_type
;
next_decl
: NEXT COLON keyword_or_string
;
resource_decl
: RESOURCE COLON keyword_or_string
;
input_path_decl
: INPUTPATH COLON (NULL | keyword_or_string)
;
result_decl
: RESULT COLON json_value_decl
;
result_path_decl
: RESULTPATH COLON (NULL | keyword_or_string)
;
output_path_decl
: OUTPUTPATH COLON (NULL | keyword_or_string)
;
end_decl
: END COLON (TRUE | FALSE)
;
default_decl
: DEFAULT COLON keyword_or_string
;
error_decl
: ERROR COLON keyword_or_string
;
cause_decl
: CAUSE COLON keyword_or_string
;
seconds_decl
: SECONDS COLON INT
;
seconds_path_decl
: SECONDSPATH COLON keyword_or_string
;
timestamp_decl
: TIMESTAMP COLON keyword_or_string
;
timestamp_path_decl
: TIMESTAMPPATH COLON keyword_or_string
;
items_path_decl
: ITEMSPATH COLON keyword_or_string
;
max_concurrency_decl
: MAXCONCURRENCY COLON INT
;
parameters_decl
: PARAMETERS COLON payload_tmpl_decl
;
timeout_seconds_decl
: TIMEOUTSECONDS COLON INT
;
timeout_seconds_path_decl
: TIMEOUTSECONDSPATH COLON STRINGPATH
;
heartbeat_seconds_decl
: HEARTBEATSECONDS COLON INT
;
heartbeat_seconds_path_decl
: HEARTBEATSECONDSPATH COLON STRINGPATH
;
payload_tmpl_decl
: LBRACE payload_binding (COMMA payload_binding)* RBRACE
| LBRACE RBRACE
;
payload_binding
: STRINGDOLLAR COLON STRINGPATH #payload_binding_path
| STRINGDOLLAR COLON STRINGPATHCONTEXTOBJ #payload_binding_path_context_obj
| STRINGDOLLAR COLON intrinsic_func #payload_binding_intrinsic_func
| keyword_or_string COLON payload_value_decl #payload_binding_value
;
intrinsic_func
: STRING
;
payload_arr_decl
: LBRACK payload_value_decl (COMMA payload_value_decl)* RBRACK
| LBRACK RBRACK
;
payload_value_decl
: payload_binding
| payload_arr_decl
| payload_tmpl_decl
| payload_value_lit
;
payload_value_lit
: NUMBER #payload_value_float
| INT #payload_value_int
| (TRUE | FALSE) #payload_value_bool
| NULL #payload_value_null
| keyword_or_string #payload_value_str
;
result_selector_decl
: RESULTSELECTOR COLON payload_tmpl_decl
;
state_type
: TASK
| PASS
| CHOICE
| FAIL
| SUCCEED
| WAIT
| MAP
| PARALLEL
;
choices_decl
: CHOICES
COLON
LBRACK
choice_rule (COMMA choice_rule)*
RBRACK
;
choice_rule
: LBRACE
comparison_variable_stmt (COMMA comparison_variable_stmt)+
RBRACE #choice_rule_comparison_variable
| LBRACE
comparison_composite_stmt (COMMA comparison_composite_stmt)*
RBRACE #choice_rule_comparison_composite
;
comparison_variable_stmt
: variable_decl
| comparison_func
| next_decl
;
comparison_composite_stmt
: comparison_composite
| next_decl
;
comparison_composite
// TODO: this allows for Next definitions in nested choice_rules, is this supported at parse time?
: choice_operator COLON
( choice_rule
| LBRACK
choice_rule (COMMA choice_rule)*
RBRACK
)
;
variable_decl
: VARIABLE COLON keyword_or_string
;
comparison_func
: comparison_op COLON json_value_decl
;
branches_decl
: BRANCHES
COLON
LBRACK
program_decl (COMMA program_decl)*
RBRACK
;
item_processor_decl
: ITEMPROCESSOR
COLON
LBRACE
item_processor_item (COMMA item_processor_item)*
RBRACE
;
item_processor_item
: processor_config_decl
| startat_decl
| states_decl
| comment_decl
;
processor_config_decl
: PROCESSORCONFIG
COLON
LBRACE
processor_config_field (COMMA processor_config_field)*
RBRACE
;
processor_config_field
: mode_decl
| execution_decl
;
mode_decl
: MODE COLON mode_type
;
mode_type
: INLINE
| DISTRIBUTED
;
execution_decl
: EXECUTIONTYPE COLON execution_type
;
execution_type
: STANDARD
;
iterator_decl
: ITERATOR
COLON
LBRACE
iterator_decl_item (COMMA iterator_decl_item)*
RBRACE
;
iterator_decl_item
: startat_decl
| states_decl
| comment_decl
;
item_selector_decl
: ITEMSELECTOR COLON payload_tmpl_decl
;
item_reader_decl
: ITEMREADER
COLON
LBRACE
items_reader_field (COMMA items_reader_field)*
RBRACE
;
items_reader_field
: resource_decl
| parameters_decl
| reader_config_decl
;
reader_config_decl
: READERCONFIG
COLON
LBRACE
reader_config_field (COMMA reader_config_field)*
RBRACE
;
reader_config_field
: input_type_decl
| csv_header_location_decl
| csv_headers_decl
| max_items_decl
| max_items_path_decl
;
input_type_decl
: INPUTTYPE COLON keyword_or_string
;
csv_header_location_decl
: CSVHEADERLOCATION COLON keyword_or_string
;
csv_headers_decl // TODO: are empty "CSVHeaders" list values supported?
: CSVHEADERS
COLON
LBRACK
keyword_or_string (COMMA keyword_or_string)*
RBRACK
;
max_items_decl
: MAXITEMS COLON INT
;
max_items_path_decl
: MAXITEMSPATH COLON STRINGPATH
;
retry_decl
: RETRY
COLON
LBRACK
(retrier_decl (COMMA retrier_decl)*)?
RBRACK
;
retrier_decl
: LBRACE
retrier_stmt (COMMA retrier_stmt)*
RBRACE
;
retrier_stmt
: error_equals_decl
| interval_seconds_decl
| max_attempts_decl
| backoff_rate_decl
;
error_equals_decl
: ERROREQUALS
COLON
LBRACK
error_name (COMMA error_name)*
RBRACK
;
interval_seconds_decl
: INTERVALSECONDS COLON INT
;
max_attempts_decl
: MAXATTEMPTS COLON INT
;
backoff_rate_decl
: BACKOFFRATE COLON (INT | NUMBER)
;
catch_decl
: CATCH
COLON
LBRACK
(catcher_decl (COMMA catcher_decl)*)?
RBRACK
;
catcher_decl
: LBRACE
catcher_stmt (COMMA catcher_stmt)*
RBRACE
;
catcher_stmt
: error_equals_decl
| result_path_decl
| next_decl
;
comparison_op
: BOOLEANEQUALS
| BOOLEANQUALSPATH
| ISBOOLEAN
| ISNULL
| ISNUMERIC
| ISPRESENT
| ISSTRING
| ISTIMESTAMP
| NUMERICEQUALS
| NUMERICEQUALSPATH
| NUMERICGREATERTHAN
| NUMERICGREATERTHANPATH
| NUMERICGREATERTHANEQUALS
| NUMERICGREATERTHANEQUALSPATH
| NUMERICLESSTHAN
| NUMERICLESSTHANPATH
| NUMERICLESSTHANEQUALS
| NUMERICLESSTHANEQUALSPATH
| STRINGEQUALS
| STRINGEQUALSPATH
| STRINGGREATERTHAN
| STRINGGREATERTHANPATH
| STRINGGREATERTHANEQUALS
| STRINGGREATERTHANEQUALSPATH
| STRINGLESSTHAN
| STRINGLESSTHANPATH
| STRINGLESSTHANEQUALS
| STRINGLESSTHANEQUALSPATH
| STRINGMATCHES
| TIMESTAMPEQUALS
| TIMESTAMPEQUALSPATH
| TIMESTAMPGREATERTHAN
| TIMESTAMPGREATERTHANPATH
| TIMESTAMPGREATERTHANEQUALS
| TIMESTAMPGREATERTHANEQUALSPATH
| TIMESTAMPLESSTHAN
| TIMESTAMPLESSTHANPATH
| TIMESTAMPLESSTHANEQUALS
| TIMESTAMPLESSTHANEQUALSPATH
;
choice_operator
: NOT
| AND
| OR
;
states_error_name
: ERRORNAMEStatesALL
| ERRORNAMEStatesHeartbeatTimeout
| ERRORNAMEStatesTimeout
| ERRORNAMEStatesTaskFailed
| ERRORNAMEStatesPermissions
| ERRORNAMEStatesResultPathMatchFailure
| ERRORNAMEStatesParameterPathFailure
| ERRORNAMEStatesBranchFailed
| ERRORNAMEStatesNoChoiceMatched
| ERRORNAMEStatesIntrinsicFailure
| ERRORNAMEStatesExceedToleratedFailureThreshold
| ERRORNAMEStatesItemReaderFailed
| ERRORNAMEStatesResultWriterFailed
| ERRORNAMEStatesRuntime
;
error_name
: states_error_name
| keyword_or_string
;
json_obj_decl
: LBRACE json_binding (COMMA json_binding)* RBRACE
| LBRACE RBRACE
;
json_binding
: keyword_or_string COLON json_value_decl
;
json_arr_decl
: LBRACK json_value_decl (COMMA json_value_decl)* RBRACK
| LBRACK RBRACK
;
json_value_decl
: NUMBER
| INT
| TRUE
| FALSE
| NULL
| json_binding
| json_arr_decl
| json_obj_decl
| keyword_or_string
;
keyword_or_string // TODO: check keywords can be used as strings.
: STRINGDOLLAR
| STRINGPATHCONTEXTOBJ
| STRINGPATH
| STRING
//
| COMMENT
| STATES
| STARTAT
| NEXTSTATE
| TYPE
| TASK
| CHOICE
| FAIL
| SUCCEED
| PASS
| WAIT
| PARALLEL
| MAP
| CHOICES
| VARIABLE
| DEFAULT
| BRANCHES
| AND
| BOOLEANEQUALS
| BOOLEANQUALSPATH
| ISBOOLEAN
| ISNULL
| ISNUMERIC
| ISPRESENT
| ISSTRING
| ISTIMESTAMP
| NOT
| NUMERICEQUALS
| NUMERICEQUALSPATH
| NUMERICGREATERTHAN
| NUMERICGREATERTHANPATH
| NUMERICGREATERTHANEQUALS
| NUMERICGREATERTHANEQUALSPATH
| NUMERICLESSTHAN
| NUMERICLESSTHANPATH
| NUMERICLESSTHANEQUALS
| NUMERICLESSTHANEQUALSPATH
| OR
| STRINGEQUALS
| STRINGEQUALSPATH
| STRINGGREATERTHAN
| STRINGGREATERTHANPATH
| STRINGGREATERTHANEQUALS
| STRINGGREATERTHANEQUALSPATH
| STRINGLESSTHAN
| STRINGLESSTHANPATH
| STRINGLESSTHANEQUALS
| STRINGLESSTHANEQUALSPATH
| STRINGMATCHES
| TIMESTAMPEQUALS
| TIMESTAMPEQUALSPATH
| TIMESTAMPGREATERTHAN
| TIMESTAMPGREATERTHANPATH
| TIMESTAMPGREATERTHANEQUALS
| TIMESTAMPGREATERTHANEQUALSPATH
| TIMESTAMPLESSTHAN
| TIMESTAMPLESSTHANPATH
| TIMESTAMPLESSTHANEQUALS
| TIMESTAMPLESSTHANEQUALSPATH
| SECONDSPATH
| SECONDS
| TIMESTAMPPATH
| TIMESTAMP
| TIMEOUTSECONDS
| TIMEOUTSECONDSPATH
| HEARTBEATSECONDS
| HEARTBEATSECONDSPATH
| PROCESSORCONFIG
| MODE
| INLINE
| DISTRIBUTED
| EXECUTIONTYPE
| STANDARD
| ITEMPROCESSOR
| ITERATOR
| ITEMSELECTOR
| MAXCONCURRENCY
| RESOURCE
| INPUTPATH
| OUTPUTPATH
| ITEMSPATH
| RESULTPATH
| RESULT
| PARAMETERS
| RESULTSELECTOR
| ITEMREADER
| READERCONFIG
| INPUTTYPE
| CSVHEADERLOCATION
| CSVHEADERS
| MAXITEMS
| MAXITEMSPATH
| NEXT
| END
| CAUSE
| ERROR
| RETRY
| ERROREQUALS
| INTERVALSECONDS
| MAXATTEMPTS
| BACKOFFRATE
| CATCH
| ERRORNAMEStatesALL
| ERRORNAMEStatesHeartbeatTimeout
| ERRORNAMEStatesTimeout
| ERRORNAMEStatesTaskFailed
| ERRORNAMEStatesPermissions
| ERRORNAMEStatesResultPathMatchFailure
| ERRORNAMEStatesParameterPathFailure
| ERRORNAMEStatesBranchFailed
| ERRORNAMEStatesNoChoiceMatched
| ERRORNAMEStatesIntrinsicFailure
| ERRORNAMEStatesExceedToleratedFailureThreshold
| ERRORNAMEStatesItemReaderFailed
| ERRORNAMEStatesResultWriterFailed
| ERRORNAMEStatesRuntime
;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
DOLLAR=1
DOT=2
STAR=3
COMMA=4
LPAREN=5
RPAREN=6
LBRACK=7
RBRACK=8
LDIAM=9
RDIAM=10
ATDOT=11
ATDOTLENGTHDASH=12
ANDAND=13
OROR=14
EQEQ=15
EQ=16
TRUE=17
FALSE=18
States=19
Format=20
StringToJson=21
JsonToString=22
Array=23
ArrayPartition=24
ArrayContains=25
ArrayRange=26
ArrayGetItem=27
ArrayLength=28
ArrayUnique=29
Base64Encode=30
Base64Decode=31
Hash=32
JsonMerge=33
MathRandom=34
MathAdd=35
StringSplit=36
UUID=37
STRING=38
INT=39
NUMBER=40
IDENTIFIER=41
WS=42
'$'=1
'.'=2
'*'=3
','=4
'('=5
')'=6
'['=7
']'=8
'<'=9
'>'=10
'@.'=11
'@.length-'=12
'&&'=13
'||'=14
'=='=15
'='=16
'true'=17
'false'=18
'States'=19
'Format'=20
'StringToJson'=21
'JsonToString'=22
'Array'=23
'ArrayPartition'=24
'ArrayContains'=25
'ArrayRange'=26
'ArrayGetItem'=27
'ArrayLength'=28
'ArrayUnique'=29
'Base64Encode'=30
'Base64Decode'=31
'Hash'=32
'JsonMerge'=33
'MathRandom'=34
'MathAdd'=35
'StringSplit'=36
'UUID'=37

View File

@ -0,0 +1,108 @@
token literal names:
null
'$'
'.'
'*'
','
'('
')'
'['
']'
'<'
'>'
'@.'
'@.length-'
'&&'
'||'
'=='
'='
'true'
'false'
'States'
'Format'
'StringToJson'
'JsonToString'
'Array'
'ArrayPartition'
'ArrayContains'
'ArrayRange'
'ArrayGetItem'
'ArrayLength'
'ArrayUnique'
'Base64Encode'
'Base64Decode'
'Hash'
'JsonMerge'
'MathRandom'
'MathAdd'
'StringSplit'
'UUID'
null
null
null
null
null
token symbolic names:
null
DOLLAR
DOT
STAR
COMMA
LPAREN
RPAREN
LBRACK
RBRACK
LDIAM
RDIAM
ATDOT
ATDOTLENGTHDASH
ANDAND
OROR
EQEQ
EQ
TRUE
FALSE
States
Format
StringToJson
JsonToString
Array
ArrayPartition
ArrayContains
ArrayRange
ArrayGetItem
ArrayLength
ArrayUnique
Base64Encode
Base64Decode
Hash
JsonMerge
MathRandom
MathAdd
StringSplit
UUID
STRING
INT
NUMBER
IDENTIFIER
WS
rule names:
func_decl
states_func_decl
state_fun_name
func_arg_list
func_arg
context_path
json_path
json_path_part
json_path_iden
json_path_iden_qual
json_path_qual
json_path_query
identifier
atn:
[4, 1, 42, 123, 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, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 5, 3, 40, 8, 3, 10, 3, 12, 3, 43, 9, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 49, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 58, 8, 4, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 68, 8, 6, 10, 6, 12, 6, 71, 9, 6, 1, 7, 1, 7, 3, 7, 75, 8, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 91, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 101, 8, 11, 1, 11, 1, 11, 3, 11, 105, 8, 11, 1, 11, 1, 11, 1, 11, 4, 11, 110, 8, 11, 11, 11, 12, 11, 111, 5, 11, 114, 8, 11, 10, 11, 12, 11, 117, 9, 11, 1, 12, 1, 12, 3, 12, 121, 8, 12, 1, 12, 0, 1, 22, 13, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 0, 4, 1, 0, 20, 37, 1, 0, 17, 18, 2, 0, 9, 10, 15, 15, 1, 0, 13, 14, 127, 0, 26, 1, 0, 0, 0, 2, 28, 1, 0, 0, 0, 4, 33, 1, 0, 0, 0, 6, 48, 1, 0, 0, 0, 8, 57, 1, 0, 0, 0, 10, 59, 1, 0, 0, 0, 12, 62, 1, 0, 0, 0, 14, 74, 1, 0, 0, 0, 16, 76, 1, 0, 0, 0, 18, 78, 1, 0, 0, 0, 20, 90, 1, 0, 0, 0, 22, 104, 1, 0, 0, 0, 24, 120, 1, 0, 0, 0, 26, 27, 3, 2, 1, 0, 27, 1, 1, 0, 0, 0, 28, 29, 5, 19, 0, 0, 29, 30, 5, 2, 0, 0, 30, 31, 3, 4, 2, 0, 31, 32, 3, 6, 3, 0, 32, 3, 1, 0, 0, 0, 33, 34, 7, 0, 0, 0, 34, 5, 1, 0, 0, 0, 35, 36, 5, 5, 0, 0, 36, 41, 3, 8, 4, 0, 37, 38, 5, 4, 0, 0, 38, 40, 3, 8, 4, 0, 39, 37, 1, 0, 0, 0, 40, 43, 1, 0, 0, 0, 41, 39, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 44, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 44, 45, 5, 6, 0, 0, 45, 49, 1, 0, 0, 0, 46, 47, 5, 5, 0, 0, 47, 49, 5, 6, 0, 0, 48, 35, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 49, 7, 1, 0, 0, 0, 50, 58, 5, 38, 0, 0, 51, 58, 5, 39, 0, 0, 52, 58, 5, 40, 0, 0, 53, 58, 7, 1, 0, 0, 54, 58, 3, 10, 5, 0, 55, 58, 3, 12, 6, 0, 56, 58, 3, 0, 0, 0, 57, 50, 1, 0, 0, 0, 57, 51, 1, 0, 0, 0, 57, 52, 1, 0, 0, 0, 57, 53, 1, 0, 0, 0, 57, 54, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 57, 56, 1, 0, 0, 0, 58, 9, 1, 0, 0, 0, 59, 60, 5, 1, 0, 0, 60, 61, 3, 12, 6, 0, 61, 11, 1, 0, 0, 0, 62, 63, 5, 1, 0, 0, 63, 64, 5, 2, 0, 0, 64, 69, 3, 14, 7, 0, 65, 66, 5, 2, 0, 0, 66, 68, 3, 14, 7, 0, 67, 65, 1, 0, 0, 0, 68, 71, 1, 0, 0, 0, 69, 67, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 13, 1, 0, 0, 0, 71, 69, 1, 0, 0, 0, 72, 75, 3, 16, 8, 0, 73, 75, 3, 18, 9, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 15, 1, 0, 0, 0, 76, 77, 3, 24, 12, 0, 77, 17, 1, 0, 0, 0, 78, 79, 3, 16, 8, 0, 79, 80, 3, 20, 10, 0, 80, 19, 1, 0, 0, 0, 81, 82, 5, 7, 0, 0, 82, 91, 5, 8, 0, 0, 83, 84, 5, 7, 0, 0, 84, 85, 5, 39, 0, 0, 85, 91, 5, 8, 0, 0, 86, 87, 5, 7, 0, 0, 87, 88, 3, 22, 11, 0, 88, 89, 5, 8, 0, 0, 89, 91, 1, 0, 0, 0, 90, 81, 1, 0, 0, 0, 90, 83, 1, 0, 0, 0, 90, 86, 1, 0, 0, 0, 91, 21, 1, 0, 0, 0, 92, 93, 6, 11, -1, 0, 93, 105, 5, 3, 0, 0, 94, 95, 5, 11, 0, 0, 95, 100, 3, 16, 8, 0, 96, 97, 7, 2, 0, 0, 97, 101, 5, 39, 0, 0, 98, 99, 5, 16, 0, 0, 99, 101, 5, 38, 0, 0, 100, 96, 1, 0, 0, 0, 100, 98, 1, 0, 0, 0, 101, 105, 1, 0, 0, 0, 102, 103, 5, 12, 0, 0, 103, 105, 5, 39, 0, 0, 104, 92, 1, 0, 0, 0, 104, 94, 1, 0, 0, 0, 104, 102, 1, 0, 0, 0, 105, 115, 1, 0, 0, 0, 106, 109, 10, 1, 0, 0, 107, 108, 7, 3, 0, 0, 108, 110, 3, 22, 11, 0, 109, 107, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 109, 1, 0, 0, 0, 111, 112, 1, 0, 0, 0, 112, 114, 1, 0, 0, 0, 113, 106, 1, 0, 0, 0, 114, 117, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 23, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 118, 121, 5, 41, 0, 0, 119, 121, 3, 4, 2, 0, 120, 118, 1, 0, 0, 0, 120, 119, 1, 0, 0, 0, 121, 25, 1, 0, 0, 0, 11, 41, 48, 57, 69, 74, 90, 100, 104, 111, 115, 120]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
DOLLAR=1
DOT=2
STAR=3
COMMA=4
LPAREN=5
RPAREN=6
LBRACK=7
RBRACK=8
LDIAM=9
RDIAM=10
ATDOT=11
ATDOTLENGTHDASH=12
ANDAND=13
OROR=14
EQEQ=15
EQ=16
TRUE=17
FALSE=18
States=19
Format=20
StringToJson=21
JsonToString=22
Array=23
ArrayPartition=24
ArrayContains=25
ArrayRange=26
ArrayGetItem=27
ArrayLength=28
ArrayUnique=29
Base64Encode=30
Base64Decode=31
Hash=32
JsonMerge=33
MathRandom=34
MathAdd=35
StringSplit=36
UUID=37
STRING=38
INT=39
NUMBER=40
IDENTIFIER=41
WS=42
'$'=1
'.'=2
'*'=3
','=4
'('=5
')'=6
'['=7
']'=8
'<'=9
'>'=10
'@.'=11
'@.length-'=12
'&&'=13
'||'=14
'=='=15
'='=16
'true'=17
'false'=18
'States'=19
'Format'=20
'StringToJson'=21
'JsonToString'=22
'Array'=23
'ArrayPartition'=24
'ArrayContains'=25
'ArrayRange'=26
'ArrayGetItem'=27
'ArrayLength'=28
'ArrayUnique'=29
'Base64Encode'=30
'Base64Decode'=31
'Hash'=32
'JsonMerge'=33
'MathRandom'=34
'MathAdd'=35
'StringSplit'=36
'UUID'=37

View File

@ -0,0 +1,243 @@
# Generated from /Users/mep/LocalStack/localstack/localstack/services/stepfunctions/asl/antlr/ASLIntrinsicParser.g4 by ANTLR 4.13.1
from antlr4 import ParseTreeListener
if "." in __name__:
from .ASLIntrinsicParser import ASLIntrinsicParser
else:
from ASLIntrinsicParser import ASLIntrinsicParser
# This class defines a complete listener for a parse tree produced by ASLIntrinsicParser.
class ASLIntrinsicParserListener(ParseTreeListener):
# Enter a parse tree produced by ASLIntrinsicParser#func_decl.
def enterFunc_decl(self, ctx: ASLIntrinsicParser.Func_declContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_decl.
def exitFunc_decl(self, ctx: ASLIntrinsicParser.Func_declContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#states_func_decl.
def enterStates_func_decl(self, ctx: ASLIntrinsicParser.States_func_declContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#states_func_decl.
def exitStates_func_decl(self, ctx: ASLIntrinsicParser.States_func_declContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#state_fun_name.
def enterState_fun_name(self, ctx: ASLIntrinsicParser.State_fun_nameContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#state_fun_name.
def exitState_fun_name(self, ctx: ASLIntrinsicParser.State_fun_nameContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_list.
def enterFunc_arg_list(self, ctx: ASLIntrinsicParser.Func_arg_listContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_list.
def exitFunc_arg_list(self, ctx: ASLIntrinsicParser.Func_arg_listContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_string.
def enterFunc_arg_string(self, ctx: ASLIntrinsicParser.Func_arg_stringContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_string.
def exitFunc_arg_string(self, ctx: ASLIntrinsicParser.Func_arg_stringContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_int.
def enterFunc_arg_int(self, ctx: ASLIntrinsicParser.Func_arg_intContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_int.
def exitFunc_arg_int(self, ctx: ASLIntrinsicParser.Func_arg_intContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_float.
def enterFunc_arg_float(self, ctx: ASLIntrinsicParser.Func_arg_floatContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_float.
def exitFunc_arg_float(self, ctx: ASLIntrinsicParser.Func_arg_floatContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_bool.
def enterFunc_arg_bool(self, ctx: ASLIntrinsicParser.Func_arg_boolContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_bool.
def exitFunc_arg_bool(self, ctx: ASLIntrinsicParser.Func_arg_boolContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_context_path.
def enterFunc_arg_context_path(
self, ctx: ASLIntrinsicParser.Func_arg_context_pathContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_context_path.
def exitFunc_arg_context_path(
self, ctx: ASLIntrinsicParser.Func_arg_context_pathContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_json_path.
def enterFunc_arg_json_path(
self, ctx: ASLIntrinsicParser.Func_arg_json_pathContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_json_path.
def exitFunc_arg_json_path(self, ctx: ASLIntrinsicParser.Func_arg_json_pathContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#func_arg_func_decl.
def enterFunc_arg_func_decl(
self, ctx: ASLIntrinsicParser.Func_arg_func_declContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#func_arg_func_decl.
def exitFunc_arg_func_decl(self, ctx: ASLIntrinsicParser.Func_arg_func_declContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#context_path.
def enterContext_path(self, ctx: ASLIntrinsicParser.Context_pathContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#context_path.
def exitContext_path(self, ctx: ASLIntrinsicParser.Context_pathContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path.
def enterJson_path(self, ctx: ASLIntrinsicParser.Json_pathContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path.
def exitJson_path(self, ctx: ASLIntrinsicParser.Json_pathContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_part.
def enterJson_path_part(self, ctx: ASLIntrinsicParser.Json_path_partContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_part.
def exitJson_path_part(self, ctx: ASLIntrinsicParser.Json_path_partContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_iden.
def enterJson_path_iden(self, ctx: ASLIntrinsicParser.Json_path_idenContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_iden.
def exitJson_path_iden(self, ctx: ASLIntrinsicParser.Json_path_idenContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_iden_qual.
def enterJson_path_iden_qual(
self, ctx: ASLIntrinsicParser.Json_path_iden_qualContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_iden_qual.
def exitJson_path_iden_qual(
self, ctx: ASLIntrinsicParser.Json_path_iden_qualContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_qual_void.
def enterJson_path_qual_void(
self, ctx: ASLIntrinsicParser.Json_path_qual_voidContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_qual_void.
def exitJson_path_qual_void(
self, ctx: ASLIntrinsicParser.Json_path_qual_voidContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_qual_idx.
def enterJson_path_qual_idx(
self, ctx: ASLIntrinsicParser.Json_path_qual_idxContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_qual_idx.
def exitJson_path_qual_idx(self, ctx: ASLIntrinsicParser.Json_path_qual_idxContext):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_qual_query.
def enterJson_path_qual_query(
self, ctx: ASLIntrinsicParser.Json_path_qual_queryContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_qual_query.
def exitJson_path_qual_query(
self, ctx: ASLIntrinsicParser.Json_path_qual_queryContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_query_cmp.
def enterJson_path_query_cmp(
self, ctx: ASLIntrinsicParser.Json_path_query_cmpContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_query_cmp.
def exitJson_path_query_cmp(
self, ctx: ASLIntrinsicParser.Json_path_query_cmpContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_query_length.
def enterJson_path_query_length(
self, ctx: ASLIntrinsicParser.Json_path_query_lengthContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_query_length.
def exitJson_path_query_length(
self, ctx: ASLIntrinsicParser.Json_path_query_lengthContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_query_binary.
def enterJson_path_query_binary(
self, ctx: ASLIntrinsicParser.Json_path_query_binaryContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_query_binary.
def exitJson_path_query_binary(
self, ctx: ASLIntrinsicParser.Json_path_query_binaryContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#json_path_query_star.
def enterJson_path_query_star(
self, ctx: ASLIntrinsicParser.Json_path_query_starContext
):
pass
# Exit a parse tree produced by ASLIntrinsicParser#json_path_query_star.
def exitJson_path_query_star(
self, ctx: ASLIntrinsicParser.Json_path_query_starContext
):
pass
# Enter a parse tree produced by ASLIntrinsicParser#identifier.
def enterIdentifier(self, ctx: ASLIntrinsicParser.IdentifierContext):
pass
# Exit a parse tree produced by ASLIntrinsicParser#identifier.
def exitIdentifier(self, ctx: ASLIntrinsicParser.IdentifierContext):
pass
del ASLIntrinsicParser

View File

@ -0,0 +1,133 @@
# Generated from /Users/mep/LocalStack/localstack/localstack/services/stepfunctions/asl/antlr/ASLIntrinsicParser.g4 by ANTLR 4.13.1
from antlr4 import ParseTreeVisitor
if "." in __name__:
from .ASLIntrinsicParser import ASLIntrinsicParser
else:
from ASLIntrinsicParser import ASLIntrinsicParser
# This class defines a complete generic visitor for a parse tree produced by ASLIntrinsicParser.
class ASLIntrinsicParserVisitor(ParseTreeVisitor):
# Visit a parse tree produced by ASLIntrinsicParser#func_decl.
def visitFunc_decl(self, ctx: ASLIntrinsicParser.Func_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#states_func_decl.
def visitStates_func_decl(self, ctx: ASLIntrinsicParser.States_func_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#state_fun_name.
def visitState_fun_name(self, ctx: ASLIntrinsicParser.State_fun_nameContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_list.
def visitFunc_arg_list(self, ctx: ASLIntrinsicParser.Func_arg_listContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_string.
def visitFunc_arg_string(self, ctx: ASLIntrinsicParser.Func_arg_stringContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_int.
def visitFunc_arg_int(self, ctx: ASLIntrinsicParser.Func_arg_intContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_float.
def visitFunc_arg_float(self, ctx: ASLIntrinsicParser.Func_arg_floatContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_bool.
def visitFunc_arg_bool(self, ctx: ASLIntrinsicParser.Func_arg_boolContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_context_path.
def visitFunc_arg_context_path(
self, ctx: ASLIntrinsicParser.Func_arg_context_pathContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_json_path.
def visitFunc_arg_json_path(
self, ctx: ASLIntrinsicParser.Func_arg_json_pathContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#func_arg_func_decl.
def visitFunc_arg_func_decl(
self, ctx: ASLIntrinsicParser.Func_arg_func_declContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#context_path.
def visitContext_path(self, ctx: ASLIntrinsicParser.Context_pathContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path.
def visitJson_path(self, ctx: ASLIntrinsicParser.Json_pathContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_part.
def visitJson_path_part(self, ctx: ASLIntrinsicParser.Json_path_partContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_iden.
def visitJson_path_iden(self, ctx: ASLIntrinsicParser.Json_path_idenContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_iden_qual.
def visitJson_path_iden_qual(
self, ctx: ASLIntrinsicParser.Json_path_iden_qualContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_qual_void.
def visitJson_path_qual_void(
self, ctx: ASLIntrinsicParser.Json_path_qual_voidContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_qual_idx.
def visitJson_path_qual_idx(
self, ctx: ASLIntrinsicParser.Json_path_qual_idxContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_qual_query.
def visitJson_path_qual_query(
self, ctx: ASLIntrinsicParser.Json_path_qual_queryContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_query_cmp.
def visitJson_path_query_cmp(
self, ctx: ASLIntrinsicParser.Json_path_query_cmpContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_query_length.
def visitJson_path_query_length(
self, ctx: ASLIntrinsicParser.Json_path_query_lengthContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_query_binary.
def visitJson_path_query_binary(
self, ctx: ASLIntrinsicParser.Json_path_query_binaryContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#json_path_query_star.
def visitJson_path_query_star(
self, ctx: ASLIntrinsicParser.Json_path_query_starContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLIntrinsicParser#identifier.
def visitIdentifier(self, ctx: ASLIntrinsicParser.IdentifierContext):
return self.visitChildren(ctx)
del ASLIntrinsicParser

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,259 @@
COMMA=1
COLON=2
LBRACK=3
RBRACK=4
LBRACE=5
RBRACE=6
TRUE=7
FALSE=8
NULL=9
COMMENT=10
STATES=11
STARTAT=12
NEXTSTATE=13
VERSION=14
TYPE=15
TASK=16
CHOICE=17
FAIL=18
SUCCEED=19
PASS=20
WAIT=21
PARALLEL=22
MAP=23
CHOICES=24
VARIABLE=25
DEFAULT=26
BRANCHES=27
AND=28
BOOLEANEQUALS=29
BOOLEANQUALSPATH=30
ISBOOLEAN=31
ISNULL=32
ISNUMERIC=33
ISPRESENT=34
ISSTRING=35
ISTIMESTAMP=36
NOT=37
NUMERICEQUALS=38
NUMERICEQUALSPATH=39
NUMERICGREATERTHAN=40
NUMERICGREATERTHANPATH=41
NUMERICGREATERTHANEQUALS=42
NUMERICGREATERTHANEQUALSPATH=43
NUMERICLESSTHAN=44
NUMERICLESSTHANPATH=45
NUMERICLESSTHANEQUALS=46
NUMERICLESSTHANEQUALSPATH=47
OR=48
STRINGEQUALS=49
STRINGEQUALSPATH=50
STRINGGREATERTHAN=51
STRINGGREATERTHANPATH=52
STRINGGREATERTHANEQUALS=53
STRINGGREATERTHANEQUALSPATH=54
STRINGLESSTHAN=55
STRINGLESSTHANPATH=56
STRINGLESSTHANEQUALS=57
STRINGLESSTHANEQUALSPATH=58
STRINGMATCHES=59
TIMESTAMPEQUALS=60
TIMESTAMPEQUALSPATH=61
TIMESTAMPGREATERTHAN=62
TIMESTAMPGREATERTHANPATH=63
TIMESTAMPGREATERTHANEQUALS=64
TIMESTAMPGREATERTHANEQUALSPATH=65
TIMESTAMPLESSTHAN=66
TIMESTAMPLESSTHANPATH=67
TIMESTAMPLESSTHANEQUALS=68
TIMESTAMPLESSTHANEQUALSPATH=69
SECONDSPATH=70
SECONDS=71
TIMESTAMPPATH=72
TIMESTAMP=73
TIMEOUTSECONDS=74
TIMEOUTSECONDSPATH=75
HEARTBEATSECONDS=76
HEARTBEATSECONDSPATH=77
PROCESSORCONFIG=78
MODE=79
INLINE=80
DISTRIBUTED=81
EXECUTIONTYPE=82
STANDARD=83
ITEMPROCESSOR=84
ITERATOR=85
ITEMSELECTOR=86
MAXCONCURRENCY=87
RESOURCE=88
INPUTPATH=89
OUTPUTPATH=90
ITEMSPATH=91
RESULTPATH=92
RESULT=93
PARAMETERS=94
RESULTSELECTOR=95
ITEMREADER=96
READERCONFIG=97
INPUTTYPE=98
CSVHEADERLOCATION=99
CSVHEADERS=100
MAXITEMS=101
MAXITEMSPATH=102
NEXT=103
END=104
CAUSE=105
ERROR=106
RETRY=107
ERROREQUALS=108
INTERVALSECONDS=109
MAXATTEMPTS=110
BACKOFFRATE=111
CATCH=112
ERRORNAMEStatesALL=113
ERRORNAMEStatesHeartbeatTimeout=114
ERRORNAMEStatesTimeout=115
ERRORNAMEStatesTaskFailed=116
ERRORNAMEStatesPermissions=117
ERRORNAMEStatesResultPathMatchFailure=118
ERRORNAMEStatesParameterPathFailure=119
ERRORNAMEStatesBranchFailed=120
ERRORNAMEStatesNoChoiceMatched=121
ERRORNAMEStatesIntrinsicFailure=122
ERRORNAMEStatesExceedToleratedFailureThreshold=123
ERRORNAMEStatesItemReaderFailed=124
ERRORNAMEStatesResultWriterFailed=125
ERRORNAMEStatesRuntime=126
STRINGDOLLAR=127
STRINGPATHCONTEXTOBJ=128
STRINGPATH=129
STRING=130
INT=131
NUMBER=132
WS=133
','=1
':'=2
'['=3
']'=4
'{'=5
'}'=6
'true'=7
'false'=8
'null'=9
'"Comment"'=10
'"States"'=11
'"StartAt"'=12
'"NextState"'=13
'"Version"'=14
'"Type"'=15
'"Task"'=16
'"Choice"'=17
'"Fail"'=18
'"Succeed"'=19
'"Pass"'=20
'"Wait"'=21
'"Parallel"'=22
'"Map"'=23
'"Choices"'=24
'"Variable"'=25
'"Default"'=26
'"Branches"'=27
'"And"'=28
'"BooleanEquals"'=29
'"BooleanEqualsPath"'=30
'"IsBoolean"'=31
'"IsNull"'=32
'"IsNumeric"'=33
'"IsPresent"'=34
'"IsString"'=35
'"IsTimestamp"'=36
'"Not"'=37
'"NumericEquals"'=38
'"NumericEqualsPath"'=39
'"NumericGreaterThan"'=40
'"NumericGreaterThanPath"'=41
'"NumericGreaterThanEquals"'=42
'"NumericGreaterThanEqualsPath"'=43
'"NumericLessThan"'=44
'"NumericLessThanPath"'=45
'"NumericLessThanEquals"'=46
'"NumericLessThanEqualsPath"'=47
'"Or"'=48
'"StringEquals"'=49
'"StringEqualsPath"'=50
'"StringGreaterThan"'=51
'"StringGreaterThanPath"'=52
'"StringGreaterThanEquals"'=53
'"StringGreaterThanEqualsPath"'=54
'"StringLessThan"'=55
'"StringLessThanPath"'=56
'"StringLessThanEquals"'=57
'"StringLessThanEqualsPath"'=58
'"StringMatches"'=59
'"TimestampEquals"'=60
'"TimestampEqualsPath"'=61
'"TimestampGreaterThan"'=62
'"TimestampGreaterThanPath"'=63
'"TimestampGreaterThanEquals"'=64
'"TimestampGreaterThanEqualsPath"'=65
'"TimestampLessThan"'=66
'"TimestampLessThanPath"'=67
'"TimestampLessThanEquals"'=68
'"TimestampLessThanEqualsPath"'=69
'"SecondsPath"'=70
'"Seconds"'=71
'"TimestampPath"'=72
'"Timestamp"'=73
'"TimeoutSeconds"'=74
'"TimeoutSecondsPath"'=75
'"HeartbeatSeconds"'=76
'"HeartbeatSecondsPath"'=77
'"ProcessorConfig"'=78
'"Mode"'=79
'"INLINE"'=80
'"DISTRIBUTED"'=81
'"ExecutionType"'=82
'"STANDARD"'=83
'"ItemProcessor"'=84
'"Iterator"'=85
'"ItemSelector"'=86
'"MaxConcurrency"'=87
'"Resource"'=88
'"InputPath"'=89
'"OutputPath"'=90
'"ItemsPath"'=91
'"ResultPath"'=92
'"Result"'=93
'"Parameters"'=94
'"ResultSelector"'=95
'"ItemReader"'=96
'"ReaderConfig"'=97
'"InputType"'=98
'"CSVHeaderLocation"'=99
'"CSVHeaders"'=100
'"MaxItems"'=101
'"MaxItemsPath"'=102
'"Next"'=103
'"End"'=104
'"Cause"'=105
'"Error"'=106
'"Retry"'=107
'"ErrorEquals"'=108
'"IntervalSeconds"'=109
'"MaxAttempts"'=110
'"BackoffRate"'=111
'"Catch"'=112
'"States.ALL"'=113
'"States.HeartbeatTimeout"'=114
'"States.Timeout"'=115
'"States.TaskFailed"'=116
'"States.Permissions"'=117
'"States.ResultPathMatchFailure"'=118
'"States.ParameterPathFailure"'=119
'"States.BranchFailed"'=120
'"States.NoChoiceMatched"'=121
'"States.IntrinsicFailure"'=122
'"States.ExceedToleratedFailureThreshold"'=123
'"States.ItemReaderFailed"'=124
'"States.ResultWriterFailed"'=125
'"States.Runtime"'=126

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,259 @@
COMMA=1
COLON=2
LBRACK=3
RBRACK=4
LBRACE=5
RBRACE=6
TRUE=7
FALSE=8
NULL=9
COMMENT=10
STATES=11
STARTAT=12
NEXTSTATE=13
VERSION=14
TYPE=15
TASK=16
CHOICE=17
FAIL=18
SUCCEED=19
PASS=20
WAIT=21
PARALLEL=22
MAP=23
CHOICES=24
VARIABLE=25
DEFAULT=26
BRANCHES=27
AND=28
BOOLEANEQUALS=29
BOOLEANQUALSPATH=30
ISBOOLEAN=31
ISNULL=32
ISNUMERIC=33
ISPRESENT=34
ISSTRING=35
ISTIMESTAMP=36
NOT=37
NUMERICEQUALS=38
NUMERICEQUALSPATH=39
NUMERICGREATERTHAN=40
NUMERICGREATERTHANPATH=41
NUMERICGREATERTHANEQUALS=42
NUMERICGREATERTHANEQUALSPATH=43
NUMERICLESSTHAN=44
NUMERICLESSTHANPATH=45
NUMERICLESSTHANEQUALS=46
NUMERICLESSTHANEQUALSPATH=47
OR=48
STRINGEQUALS=49
STRINGEQUALSPATH=50
STRINGGREATERTHAN=51
STRINGGREATERTHANPATH=52
STRINGGREATERTHANEQUALS=53
STRINGGREATERTHANEQUALSPATH=54
STRINGLESSTHAN=55
STRINGLESSTHANPATH=56
STRINGLESSTHANEQUALS=57
STRINGLESSTHANEQUALSPATH=58
STRINGMATCHES=59
TIMESTAMPEQUALS=60
TIMESTAMPEQUALSPATH=61
TIMESTAMPGREATERTHAN=62
TIMESTAMPGREATERTHANPATH=63
TIMESTAMPGREATERTHANEQUALS=64
TIMESTAMPGREATERTHANEQUALSPATH=65
TIMESTAMPLESSTHAN=66
TIMESTAMPLESSTHANPATH=67
TIMESTAMPLESSTHANEQUALS=68
TIMESTAMPLESSTHANEQUALSPATH=69
SECONDSPATH=70
SECONDS=71
TIMESTAMPPATH=72
TIMESTAMP=73
TIMEOUTSECONDS=74
TIMEOUTSECONDSPATH=75
HEARTBEATSECONDS=76
HEARTBEATSECONDSPATH=77
PROCESSORCONFIG=78
MODE=79
INLINE=80
DISTRIBUTED=81
EXECUTIONTYPE=82
STANDARD=83
ITEMPROCESSOR=84
ITERATOR=85
ITEMSELECTOR=86
MAXCONCURRENCY=87
RESOURCE=88
INPUTPATH=89
OUTPUTPATH=90
ITEMSPATH=91
RESULTPATH=92
RESULT=93
PARAMETERS=94
RESULTSELECTOR=95
ITEMREADER=96
READERCONFIG=97
INPUTTYPE=98
CSVHEADERLOCATION=99
CSVHEADERS=100
MAXITEMS=101
MAXITEMSPATH=102
NEXT=103
END=104
CAUSE=105
ERROR=106
RETRY=107
ERROREQUALS=108
INTERVALSECONDS=109
MAXATTEMPTS=110
BACKOFFRATE=111
CATCH=112
ERRORNAMEStatesALL=113
ERRORNAMEStatesHeartbeatTimeout=114
ERRORNAMEStatesTimeout=115
ERRORNAMEStatesTaskFailed=116
ERRORNAMEStatesPermissions=117
ERRORNAMEStatesResultPathMatchFailure=118
ERRORNAMEStatesParameterPathFailure=119
ERRORNAMEStatesBranchFailed=120
ERRORNAMEStatesNoChoiceMatched=121
ERRORNAMEStatesIntrinsicFailure=122
ERRORNAMEStatesExceedToleratedFailureThreshold=123
ERRORNAMEStatesItemReaderFailed=124
ERRORNAMEStatesResultWriterFailed=125
ERRORNAMEStatesRuntime=126
STRINGDOLLAR=127
STRINGPATHCONTEXTOBJ=128
STRINGPATH=129
STRING=130
INT=131
NUMBER=132
WS=133
','=1
':'=2
'['=3
']'=4
'{'=5
'}'=6
'true'=7
'false'=8
'null'=9
'"Comment"'=10
'"States"'=11
'"StartAt"'=12
'"NextState"'=13
'"Version"'=14
'"Type"'=15
'"Task"'=16
'"Choice"'=17
'"Fail"'=18
'"Succeed"'=19
'"Pass"'=20
'"Wait"'=21
'"Parallel"'=22
'"Map"'=23
'"Choices"'=24
'"Variable"'=25
'"Default"'=26
'"Branches"'=27
'"And"'=28
'"BooleanEquals"'=29
'"BooleanEqualsPath"'=30
'"IsBoolean"'=31
'"IsNull"'=32
'"IsNumeric"'=33
'"IsPresent"'=34
'"IsString"'=35
'"IsTimestamp"'=36
'"Not"'=37
'"NumericEquals"'=38
'"NumericEqualsPath"'=39
'"NumericGreaterThan"'=40
'"NumericGreaterThanPath"'=41
'"NumericGreaterThanEquals"'=42
'"NumericGreaterThanEqualsPath"'=43
'"NumericLessThan"'=44
'"NumericLessThanPath"'=45
'"NumericLessThanEquals"'=46
'"NumericLessThanEqualsPath"'=47
'"Or"'=48
'"StringEquals"'=49
'"StringEqualsPath"'=50
'"StringGreaterThan"'=51
'"StringGreaterThanPath"'=52
'"StringGreaterThanEquals"'=53
'"StringGreaterThanEqualsPath"'=54
'"StringLessThan"'=55
'"StringLessThanPath"'=56
'"StringLessThanEquals"'=57
'"StringLessThanEqualsPath"'=58
'"StringMatches"'=59
'"TimestampEquals"'=60
'"TimestampEqualsPath"'=61
'"TimestampGreaterThan"'=62
'"TimestampGreaterThanPath"'=63
'"TimestampGreaterThanEquals"'=64
'"TimestampGreaterThanEqualsPath"'=65
'"TimestampLessThan"'=66
'"TimestampLessThanPath"'=67
'"TimestampLessThanEquals"'=68
'"TimestampLessThanEqualsPath"'=69
'"SecondsPath"'=70
'"Seconds"'=71
'"TimestampPath"'=72
'"Timestamp"'=73
'"TimeoutSeconds"'=74
'"TimeoutSecondsPath"'=75
'"HeartbeatSeconds"'=76
'"HeartbeatSecondsPath"'=77
'"ProcessorConfig"'=78
'"Mode"'=79
'"INLINE"'=80
'"DISTRIBUTED"'=81
'"ExecutionType"'=82
'"STANDARD"'=83
'"ItemProcessor"'=84
'"Iterator"'=85
'"ItemSelector"'=86
'"MaxConcurrency"'=87
'"Resource"'=88
'"InputPath"'=89
'"OutputPath"'=90
'"ItemsPath"'=91
'"ResultPath"'=92
'"Result"'=93
'"Parameters"'=94
'"ResultSelector"'=95
'"ItemReader"'=96
'"ReaderConfig"'=97
'"InputType"'=98
'"CSVHeaderLocation"'=99
'"CSVHeaders"'=100
'"MaxItems"'=101
'"MaxItemsPath"'=102
'"Next"'=103
'"End"'=104
'"Cause"'=105
'"Error"'=106
'"Retry"'=107
'"ErrorEquals"'=108
'"IntervalSeconds"'=109
'"MaxAttempts"'=110
'"BackoffRate"'=111
'"Catch"'=112
'"States.ALL"'=113
'"States.HeartbeatTimeout"'=114
'"States.Timeout"'=115
'"States.TaskFailed"'=116
'"States.Permissions"'=117
'"States.ResultPathMatchFailure"'=118
'"States.ParameterPathFailure"'=119
'"States.BranchFailed"'=120
'"States.NoChoiceMatched"'=121
'"States.IntrinsicFailure"'=122
'"States.ExceedToleratedFailureThreshold"'=123
'"States.ItemReaderFailed"'=124
'"States.ResultWriterFailed"'=125
'"States.Runtime"'=126

View File

@ -0,0 +1,809 @@
# Generated from /Users/mep/LocalStack/localstack/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 by ANTLR 4.13.1
from antlr4 import ParseTreeListener
if "." in __name__:
from .ASLParser import ASLParser
else:
from ASLParser import ASLParser
# This class defines a complete listener for a parse tree produced by ASLParser.
class ASLParserListener(ParseTreeListener):
# Enter a parse tree produced by ASLParser#program_decl.
def enterProgram_decl(self, ctx: ASLParser.Program_declContext):
pass
# Exit a parse tree produced by ASLParser#program_decl.
def exitProgram_decl(self, ctx: ASLParser.Program_declContext):
pass
# Enter a parse tree produced by ASLParser#top_layer_stmt.
def enterTop_layer_stmt(self, ctx: ASLParser.Top_layer_stmtContext):
pass
# Exit a parse tree produced by ASLParser#top_layer_stmt.
def exitTop_layer_stmt(self, ctx: ASLParser.Top_layer_stmtContext):
pass
# Enter a parse tree produced by ASLParser#startat_decl.
def enterStartat_decl(self, ctx: ASLParser.Startat_declContext):
pass
# Exit a parse tree produced by ASLParser#startat_decl.
def exitStartat_decl(self, ctx: ASLParser.Startat_declContext):
pass
# Enter a parse tree produced by ASLParser#comment_decl.
def enterComment_decl(self, ctx: ASLParser.Comment_declContext):
pass
# Exit a parse tree produced by ASLParser#comment_decl.
def exitComment_decl(self, ctx: ASLParser.Comment_declContext):
pass
# Enter a parse tree produced by ASLParser#version_decl.
def enterVersion_decl(self, ctx: ASLParser.Version_declContext):
pass
# Exit a parse tree produced by ASLParser#version_decl.
def exitVersion_decl(self, ctx: ASLParser.Version_declContext):
pass
# Enter a parse tree produced by ASLParser#state_stmt.
def enterState_stmt(self, ctx: ASLParser.State_stmtContext):
pass
# Exit a parse tree produced by ASLParser#state_stmt.
def exitState_stmt(self, ctx: ASLParser.State_stmtContext):
pass
# Enter a parse tree produced by ASLParser#states_decl.
def enterStates_decl(self, ctx: ASLParser.States_declContext):
pass
# Exit a parse tree produced by ASLParser#states_decl.
def exitStates_decl(self, ctx: ASLParser.States_declContext):
pass
# Enter a parse tree produced by ASLParser#state_name.
def enterState_name(self, ctx: ASLParser.State_nameContext):
pass
# Exit a parse tree produced by ASLParser#state_name.
def exitState_name(self, ctx: ASLParser.State_nameContext):
pass
# Enter a parse tree produced by ASLParser#state_decl.
def enterState_decl(self, ctx: ASLParser.State_declContext):
pass
# Exit a parse tree produced by ASLParser#state_decl.
def exitState_decl(self, ctx: ASLParser.State_declContext):
pass
# Enter a parse tree produced by ASLParser#state_decl_body.
def enterState_decl_body(self, ctx: ASLParser.State_decl_bodyContext):
pass
# Exit a parse tree produced by ASLParser#state_decl_body.
def exitState_decl_body(self, ctx: ASLParser.State_decl_bodyContext):
pass
# Enter a parse tree produced by ASLParser#type_decl.
def enterType_decl(self, ctx: ASLParser.Type_declContext):
pass
# Exit a parse tree produced by ASLParser#type_decl.
def exitType_decl(self, ctx: ASLParser.Type_declContext):
pass
# Enter a parse tree produced by ASLParser#next_decl.
def enterNext_decl(self, ctx: ASLParser.Next_declContext):
pass
# Exit a parse tree produced by ASLParser#next_decl.
def exitNext_decl(self, ctx: ASLParser.Next_declContext):
pass
# Enter a parse tree produced by ASLParser#resource_decl.
def enterResource_decl(self, ctx: ASLParser.Resource_declContext):
pass
# Exit a parse tree produced by ASLParser#resource_decl.
def exitResource_decl(self, ctx: ASLParser.Resource_declContext):
pass
# Enter a parse tree produced by ASLParser#input_path_decl.
def enterInput_path_decl(self, ctx: ASLParser.Input_path_declContext):
pass
# Exit a parse tree produced by ASLParser#input_path_decl.
def exitInput_path_decl(self, ctx: ASLParser.Input_path_declContext):
pass
# Enter a parse tree produced by ASLParser#result_decl.
def enterResult_decl(self, ctx: ASLParser.Result_declContext):
pass
# Exit a parse tree produced by ASLParser#result_decl.
def exitResult_decl(self, ctx: ASLParser.Result_declContext):
pass
# Enter a parse tree produced by ASLParser#result_path_decl.
def enterResult_path_decl(self, ctx: ASLParser.Result_path_declContext):
pass
# Exit a parse tree produced by ASLParser#result_path_decl.
def exitResult_path_decl(self, ctx: ASLParser.Result_path_declContext):
pass
# Enter a parse tree produced by ASLParser#output_path_decl.
def enterOutput_path_decl(self, ctx: ASLParser.Output_path_declContext):
pass
# Exit a parse tree produced by ASLParser#output_path_decl.
def exitOutput_path_decl(self, ctx: ASLParser.Output_path_declContext):
pass
# Enter a parse tree produced by ASLParser#end_decl.
def enterEnd_decl(self, ctx: ASLParser.End_declContext):
pass
# Exit a parse tree produced by ASLParser#end_decl.
def exitEnd_decl(self, ctx: ASLParser.End_declContext):
pass
# Enter a parse tree produced by ASLParser#default_decl.
def enterDefault_decl(self, ctx: ASLParser.Default_declContext):
pass
# Exit a parse tree produced by ASLParser#default_decl.
def exitDefault_decl(self, ctx: ASLParser.Default_declContext):
pass
# Enter a parse tree produced by ASLParser#error_decl.
def enterError_decl(self, ctx: ASLParser.Error_declContext):
pass
# Exit a parse tree produced by ASLParser#error_decl.
def exitError_decl(self, ctx: ASLParser.Error_declContext):
pass
# Enter a parse tree produced by ASLParser#cause_decl.
def enterCause_decl(self, ctx: ASLParser.Cause_declContext):
pass
# Exit a parse tree produced by ASLParser#cause_decl.
def exitCause_decl(self, ctx: ASLParser.Cause_declContext):
pass
# Enter a parse tree produced by ASLParser#seconds_decl.
def enterSeconds_decl(self, ctx: ASLParser.Seconds_declContext):
pass
# Exit a parse tree produced by ASLParser#seconds_decl.
def exitSeconds_decl(self, ctx: ASLParser.Seconds_declContext):
pass
# Enter a parse tree produced by ASLParser#seconds_path_decl.
def enterSeconds_path_decl(self, ctx: ASLParser.Seconds_path_declContext):
pass
# Exit a parse tree produced by ASLParser#seconds_path_decl.
def exitSeconds_path_decl(self, ctx: ASLParser.Seconds_path_declContext):
pass
# Enter a parse tree produced by ASLParser#timestamp_decl.
def enterTimestamp_decl(self, ctx: ASLParser.Timestamp_declContext):
pass
# Exit a parse tree produced by ASLParser#timestamp_decl.
def exitTimestamp_decl(self, ctx: ASLParser.Timestamp_declContext):
pass
# Enter a parse tree produced by ASLParser#timestamp_path_decl.
def enterTimestamp_path_decl(self, ctx: ASLParser.Timestamp_path_declContext):
pass
# Exit a parse tree produced by ASLParser#timestamp_path_decl.
def exitTimestamp_path_decl(self, ctx: ASLParser.Timestamp_path_declContext):
pass
# Enter a parse tree produced by ASLParser#items_path_decl.
def enterItems_path_decl(self, ctx: ASLParser.Items_path_declContext):
pass
# Exit a parse tree produced by ASLParser#items_path_decl.
def exitItems_path_decl(self, ctx: ASLParser.Items_path_declContext):
pass
# Enter a parse tree produced by ASLParser#max_concurrency_decl.
def enterMax_concurrency_decl(self, ctx: ASLParser.Max_concurrency_declContext):
pass
# Exit a parse tree produced by ASLParser#max_concurrency_decl.
def exitMax_concurrency_decl(self, ctx: ASLParser.Max_concurrency_declContext):
pass
# Enter a parse tree produced by ASLParser#parameters_decl.
def enterParameters_decl(self, ctx: ASLParser.Parameters_declContext):
pass
# Exit a parse tree produced by ASLParser#parameters_decl.
def exitParameters_decl(self, ctx: ASLParser.Parameters_declContext):
pass
# Enter a parse tree produced by ASLParser#timeout_seconds_decl.
def enterTimeout_seconds_decl(self, ctx: ASLParser.Timeout_seconds_declContext):
pass
# Exit a parse tree produced by ASLParser#timeout_seconds_decl.
def exitTimeout_seconds_decl(self, ctx: ASLParser.Timeout_seconds_declContext):
pass
# Enter a parse tree produced by ASLParser#timeout_seconds_path_decl.
def enterTimeout_seconds_path_decl(
self, ctx: ASLParser.Timeout_seconds_path_declContext
):
pass
# Exit a parse tree produced by ASLParser#timeout_seconds_path_decl.
def exitTimeout_seconds_path_decl(
self, ctx: ASLParser.Timeout_seconds_path_declContext
):
pass
# Enter a parse tree produced by ASLParser#heartbeat_seconds_decl.
def enterHeartbeat_seconds_decl(self, ctx: ASLParser.Heartbeat_seconds_declContext):
pass
# Exit a parse tree produced by ASLParser#heartbeat_seconds_decl.
def exitHeartbeat_seconds_decl(self, ctx: ASLParser.Heartbeat_seconds_declContext):
pass
# Enter a parse tree produced by ASLParser#heartbeat_seconds_path_decl.
def enterHeartbeat_seconds_path_decl(
self, ctx: ASLParser.Heartbeat_seconds_path_declContext
):
pass
# Exit a parse tree produced by ASLParser#heartbeat_seconds_path_decl.
def exitHeartbeat_seconds_path_decl(
self, ctx: ASLParser.Heartbeat_seconds_path_declContext
):
pass
# Enter a parse tree produced by ASLParser#payload_tmpl_decl.
def enterPayload_tmpl_decl(self, ctx: ASLParser.Payload_tmpl_declContext):
pass
# Exit a parse tree produced by ASLParser#payload_tmpl_decl.
def exitPayload_tmpl_decl(self, ctx: ASLParser.Payload_tmpl_declContext):
pass
# Enter a parse tree produced by ASLParser#payload_binding_path.
def enterPayload_binding_path(self, ctx: ASLParser.Payload_binding_pathContext):
pass
# Exit a parse tree produced by ASLParser#payload_binding_path.
def exitPayload_binding_path(self, ctx: ASLParser.Payload_binding_pathContext):
pass
# Enter a parse tree produced by ASLParser#payload_binding_path_context_obj.
def enterPayload_binding_path_context_obj(
self, ctx: ASLParser.Payload_binding_path_context_objContext
):
pass
# Exit a parse tree produced by ASLParser#payload_binding_path_context_obj.
def exitPayload_binding_path_context_obj(
self, ctx: ASLParser.Payload_binding_path_context_objContext
):
pass
# Enter a parse tree produced by ASLParser#payload_binding_intrinsic_func.
def enterPayload_binding_intrinsic_func(
self, ctx: ASLParser.Payload_binding_intrinsic_funcContext
):
pass
# Exit a parse tree produced by ASLParser#payload_binding_intrinsic_func.
def exitPayload_binding_intrinsic_func(
self, ctx: ASLParser.Payload_binding_intrinsic_funcContext
):
pass
# Enter a parse tree produced by ASLParser#payload_binding_value.
def enterPayload_binding_value(self, ctx: ASLParser.Payload_binding_valueContext):
pass
# Exit a parse tree produced by ASLParser#payload_binding_value.
def exitPayload_binding_value(self, ctx: ASLParser.Payload_binding_valueContext):
pass
# Enter a parse tree produced by ASLParser#intrinsic_func.
def enterIntrinsic_func(self, ctx: ASLParser.Intrinsic_funcContext):
pass
# Exit a parse tree produced by ASLParser#intrinsic_func.
def exitIntrinsic_func(self, ctx: ASLParser.Intrinsic_funcContext):
pass
# Enter a parse tree produced by ASLParser#payload_arr_decl.
def enterPayload_arr_decl(self, ctx: ASLParser.Payload_arr_declContext):
pass
# Exit a parse tree produced by ASLParser#payload_arr_decl.
def exitPayload_arr_decl(self, ctx: ASLParser.Payload_arr_declContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_decl.
def enterPayload_value_decl(self, ctx: ASLParser.Payload_value_declContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_decl.
def exitPayload_value_decl(self, ctx: ASLParser.Payload_value_declContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_float.
def enterPayload_value_float(self, ctx: ASLParser.Payload_value_floatContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_float.
def exitPayload_value_float(self, ctx: ASLParser.Payload_value_floatContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_int.
def enterPayload_value_int(self, ctx: ASLParser.Payload_value_intContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_int.
def exitPayload_value_int(self, ctx: ASLParser.Payload_value_intContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_bool.
def enterPayload_value_bool(self, ctx: ASLParser.Payload_value_boolContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_bool.
def exitPayload_value_bool(self, ctx: ASLParser.Payload_value_boolContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_null.
def enterPayload_value_null(self, ctx: ASLParser.Payload_value_nullContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_null.
def exitPayload_value_null(self, ctx: ASLParser.Payload_value_nullContext):
pass
# Enter a parse tree produced by ASLParser#payload_value_str.
def enterPayload_value_str(self, ctx: ASLParser.Payload_value_strContext):
pass
# Exit a parse tree produced by ASLParser#payload_value_str.
def exitPayload_value_str(self, ctx: ASLParser.Payload_value_strContext):
pass
# Enter a parse tree produced by ASLParser#result_selector_decl.
def enterResult_selector_decl(self, ctx: ASLParser.Result_selector_declContext):
pass
# Exit a parse tree produced by ASLParser#result_selector_decl.
def exitResult_selector_decl(self, ctx: ASLParser.Result_selector_declContext):
pass
# Enter a parse tree produced by ASLParser#state_type.
def enterState_type(self, ctx: ASLParser.State_typeContext):
pass
# Exit a parse tree produced by ASLParser#state_type.
def exitState_type(self, ctx: ASLParser.State_typeContext):
pass
# Enter a parse tree produced by ASLParser#choices_decl.
def enterChoices_decl(self, ctx: ASLParser.Choices_declContext):
pass
# Exit a parse tree produced by ASLParser#choices_decl.
def exitChoices_decl(self, ctx: ASLParser.Choices_declContext):
pass
# Enter a parse tree produced by ASLParser#choice_rule_comparison_variable.
def enterChoice_rule_comparison_variable(
self, ctx: ASLParser.Choice_rule_comparison_variableContext
):
pass
# Exit a parse tree produced by ASLParser#choice_rule_comparison_variable.
def exitChoice_rule_comparison_variable(
self, ctx: ASLParser.Choice_rule_comparison_variableContext
):
pass
# Enter a parse tree produced by ASLParser#choice_rule_comparison_composite.
def enterChoice_rule_comparison_composite(
self, ctx: ASLParser.Choice_rule_comparison_compositeContext
):
pass
# Exit a parse tree produced by ASLParser#choice_rule_comparison_composite.
def exitChoice_rule_comparison_composite(
self, ctx: ASLParser.Choice_rule_comparison_compositeContext
):
pass
# Enter a parse tree produced by ASLParser#comparison_variable_stmt.
def enterComparison_variable_stmt(
self, ctx: ASLParser.Comparison_variable_stmtContext
):
pass
# Exit a parse tree produced by ASLParser#comparison_variable_stmt.
def exitComparison_variable_stmt(
self, ctx: ASLParser.Comparison_variable_stmtContext
):
pass
# Enter a parse tree produced by ASLParser#comparison_composite_stmt.
def enterComparison_composite_stmt(
self, ctx: ASLParser.Comparison_composite_stmtContext
):
pass
# Exit a parse tree produced by ASLParser#comparison_composite_stmt.
def exitComparison_composite_stmt(
self, ctx: ASLParser.Comparison_composite_stmtContext
):
pass
# Enter a parse tree produced by ASLParser#comparison_composite.
def enterComparison_composite(self, ctx: ASLParser.Comparison_compositeContext):
pass
# Exit a parse tree produced by ASLParser#comparison_composite.
def exitComparison_composite(self, ctx: ASLParser.Comparison_compositeContext):
pass
# Enter a parse tree produced by ASLParser#variable_decl.
def enterVariable_decl(self, ctx: ASLParser.Variable_declContext):
pass
# Exit a parse tree produced by ASLParser#variable_decl.
def exitVariable_decl(self, ctx: ASLParser.Variable_declContext):
pass
# Enter a parse tree produced by ASLParser#comparison_func.
def enterComparison_func(self, ctx: ASLParser.Comparison_funcContext):
pass
# Exit a parse tree produced by ASLParser#comparison_func.
def exitComparison_func(self, ctx: ASLParser.Comparison_funcContext):
pass
# Enter a parse tree produced by ASLParser#branches_decl.
def enterBranches_decl(self, ctx: ASLParser.Branches_declContext):
pass
# Exit a parse tree produced by ASLParser#branches_decl.
def exitBranches_decl(self, ctx: ASLParser.Branches_declContext):
pass
# Enter a parse tree produced by ASLParser#item_processor_decl.
def enterItem_processor_decl(self, ctx: ASLParser.Item_processor_declContext):
pass
# Exit a parse tree produced by ASLParser#item_processor_decl.
def exitItem_processor_decl(self, ctx: ASLParser.Item_processor_declContext):
pass
# Enter a parse tree produced by ASLParser#item_processor_item.
def enterItem_processor_item(self, ctx: ASLParser.Item_processor_itemContext):
pass
# Exit a parse tree produced by ASLParser#item_processor_item.
def exitItem_processor_item(self, ctx: ASLParser.Item_processor_itemContext):
pass
# Enter a parse tree produced by ASLParser#processor_config_decl.
def enterProcessor_config_decl(self, ctx: ASLParser.Processor_config_declContext):
pass
# Exit a parse tree produced by ASLParser#processor_config_decl.
def exitProcessor_config_decl(self, ctx: ASLParser.Processor_config_declContext):
pass
# Enter a parse tree produced by ASLParser#processor_config_field.
def enterProcessor_config_field(self, ctx: ASLParser.Processor_config_fieldContext):
pass
# Exit a parse tree produced by ASLParser#processor_config_field.
def exitProcessor_config_field(self, ctx: ASLParser.Processor_config_fieldContext):
pass
# Enter a parse tree produced by ASLParser#mode_decl.
def enterMode_decl(self, ctx: ASLParser.Mode_declContext):
pass
# Exit a parse tree produced by ASLParser#mode_decl.
def exitMode_decl(self, ctx: ASLParser.Mode_declContext):
pass
# Enter a parse tree produced by ASLParser#mode_type.
def enterMode_type(self, ctx: ASLParser.Mode_typeContext):
pass
# Exit a parse tree produced by ASLParser#mode_type.
def exitMode_type(self, ctx: ASLParser.Mode_typeContext):
pass
# Enter a parse tree produced by ASLParser#execution_decl.
def enterExecution_decl(self, ctx: ASLParser.Execution_declContext):
pass
# Exit a parse tree produced by ASLParser#execution_decl.
def exitExecution_decl(self, ctx: ASLParser.Execution_declContext):
pass
# Enter a parse tree produced by ASLParser#execution_type.
def enterExecution_type(self, ctx: ASLParser.Execution_typeContext):
pass
# Exit a parse tree produced by ASLParser#execution_type.
def exitExecution_type(self, ctx: ASLParser.Execution_typeContext):
pass
# Enter a parse tree produced by ASLParser#iterator_decl.
def enterIterator_decl(self, ctx: ASLParser.Iterator_declContext):
pass
# Exit a parse tree produced by ASLParser#iterator_decl.
def exitIterator_decl(self, ctx: ASLParser.Iterator_declContext):
pass
# Enter a parse tree produced by ASLParser#iterator_decl_item.
def enterIterator_decl_item(self, ctx: ASLParser.Iterator_decl_itemContext):
pass
# Exit a parse tree produced by ASLParser#iterator_decl_item.
def exitIterator_decl_item(self, ctx: ASLParser.Iterator_decl_itemContext):
pass
# Enter a parse tree produced by ASLParser#item_selector_decl.
def enterItem_selector_decl(self, ctx: ASLParser.Item_selector_declContext):
pass
# Exit a parse tree produced by ASLParser#item_selector_decl.
def exitItem_selector_decl(self, ctx: ASLParser.Item_selector_declContext):
pass
# Enter a parse tree produced by ASLParser#item_reader_decl.
def enterItem_reader_decl(self, ctx: ASLParser.Item_reader_declContext):
pass
# Exit a parse tree produced by ASLParser#item_reader_decl.
def exitItem_reader_decl(self, ctx: ASLParser.Item_reader_declContext):
pass
# Enter a parse tree produced by ASLParser#items_reader_field.
def enterItems_reader_field(self, ctx: ASLParser.Items_reader_fieldContext):
pass
# Exit a parse tree produced by ASLParser#items_reader_field.
def exitItems_reader_field(self, ctx: ASLParser.Items_reader_fieldContext):
pass
# Enter a parse tree produced by ASLParser#reader_config_decl.
def enterReader_config_decl(self, ctx: ASLParser.Reader_config_declContext):
pass
# Exit a parse tree produced by ASLParser#reader_config_decl.
def exitReader_config_decl(self, ctx: ASLParser.Reader_config_declContext):
pass
# Enter a parse tree produced by ASLParser#reader_config_field.
def enterReader_config_field(self, ctx: ASLParser.Reader_config_fieldContext):
pass
# Exit a parse tree produced by ASLParser#reader_config_field.
def exitReader_config_field(self, ctx: ASLParser.Reader_config_fieldContext):
pass
# Enter a parse tree produced by ASLParser#input_type_decl.
def enterInput_type_decl(self, ctx: ASLParser.Input_type_declContext):
pass
# Exit a parse tree produced by ASLParser#input_type_decl.
def exitInput_type_decl(self, ctx: ASLParser.Input_type_declContext):
pass
# Enter a parse tree produced by ASLParser#csv_header_location_decl.
def enterCsv_header_location_decl(
self, ctx: ASLParser.Csv_header_location_declContext
):
pass
# Exit a parse tree produced by ASLParser#csv_header_location_decl.
def exitCsv_header_location_decl(
self, ctx: ASLParser.Csv_header_location_declContext
):
pass
# Enter a parse tree produced by ASLParser#csv_headers_decl.
def enterCsv_headers_decl(self, ctx: ASLParser.Csv_headers_declContext):
pass
# Exit a parse tree produced by ASLParser#csv_headers_decl.
def exitCsv_headers_decl(self, ctx: ASLParser.Csv_headers_declContext):
pass
# Enter a parse tree produced by ASLParser#max_items_decl.
def enterMax_items_decl(self, ctx: ASLParser.Max_items_declContext):
pass
# Exit a parse tree produced by ASLParser#max_items_decl.
def exitMax_items_decl(self, ctx: ASLParser.Max_items_declContext):
pass
# Enter a parse tree produced by ASLParser#max_items_path_decl.
def enterMax_items_path_decl(self, ctx: ASLParser.Max_items_path_declContext):
pass
# Exit a parse tree produced by ASLParser#max_items_path_decl.
def exitMax_items_path_decl(self, ctx: ASLParser.Max_items_path_declContext):
pass
# Enter a parse tree produced by ASLParser#retry_decl.
def enterRetry_decl(self, ctx: ASLParser.Retry_declContext):
pass
# Exit a parse tree produced by ASLParser#retry_decl.
def exitRetry_decl(self, ctx: ASLParser.Retry_declContext):
pass
# Enter a parse tree produced by ASLParser#retrier_decl.
def enterRetrier_decl(self, ctx: ASLParser.Retrier_declContext):
pass
# Exit a parse tree produced by ASLParser#retrier_decl.
def exitRetrier_decl(self, ctx: ASLParser.Retrier_declContext):
pass
# Enter a parse tree produced by ASLParser#retrier_stmt.
def enterRetrier_stmt(self, ctx: ASLParser.Retrier_stmtContext):
pass
# Exit a parse tree produced by ASLParser#retrier_stmt.
def exitRetrier_stmt(self, ctx: ASLParser.Retrier_stmtContext):
pass
# Enter a parse tree produced by ASLParser#error_equals_decl.
def enterError_equals_decl(self, ctx: ASLParser.Error_equals_declContext):
pass
# Exit a parse tree produced by ASLParser#error_equals_decl.
def exitError_equals_decl(self, ctx: ASLParser.Error_equals_declContext):
pass
# Enter a parse tree produced by ASLParser#interval_seconds_decl.
def enterInterval_seconds_decl(self, ctx: ASLParser.Interval_seconds_declContext):
pass
# Exit a parse tree produced by ASLParser#interval_seconds_decl.
def exitInterval_seconds_decl(self, ctx: ASLParser.Interval_seconds_declContext):
pass
# Enter a parse tree produced by ASLParser#max_attempts_decl.
def enterMax_attempts_decl(self, ctx: ASLParser.Max_attempts_declContext):
pass
# Exit a parse tree produced by ASLParser#max_attempts_decl.
def exitMax_attempts_decl(self, ctx: ASLParser.Max_attempts_declContext):
pass
# Enter a parse tree produced by ASLParser#backoff_rate_decl.
def enterBackoff_rate_decl(self, ctx: ASLParser.Backoff_rate_declContext):
pass
# Exit a parse tree produced by ASLParser#backoff_rate_decl.
def exitBackoff_rate_decl(self, ctx: ASLParser.Backoff_rate_declContext):
pass
# Enter a parse tree produced by ASLParser#catch_decl.
def enterCatch_decl(self, ctx: ASLParser.Catch_declContext):
pass
# Exit a parse tree produced by ASLParser#catch_decl.
def exitCatch_decl(self, ctx: ASLParser.Catch_declContext):
pass
# Enter a parse tree produced by ASLParser#catcher_decl.
def enterCatcher_decl(self, ctx: ASLParser.Catcher_declContext):
pass
# Exit a parse tree produced by ASLParser#catcher_decl.
def exitCatcher_decl(self, ctx: ASLParser.Catcher_declContext):
pass
# Enter a parse tree produced by ASLParser#catcher_stmt.
def enterCatcher_stmt(self, ctx: ASLParser.Catcher_stmtContext):
pass
# Exit a parse tree produced by ASLParser#catcher_stmt.
def exitCatcher_stmt(self, ctx: ASLParser.Catcher_stmtContext):
pass
# Enter a parse tree produced by ASLParser#comparison_op.
def enterComparison_op(self, ctx: ASLParser.Comparison_opContext):
pass
# Exit a parse tree produced by ASLParser#comparison_op.
def exitComparison_op(self, ctx: ASLParser.Comparison_opContext):
pass
# Enter a parse tree produced by ASLParser#choice_operator.
def enterChoice_operator(self, ctx: ASLParser.Choice_operatorContext):
pass
# Exit a parse tree produced by ASLParser#choice_operator.
def exitChoice_operator(self, ctx: ASLParser.Choice_operatorContext):
pass
# Enter a parse tree produced by ASLParser#states_error_name.
def enterStates_error_name(self, ctx: ASLParser.States_error_nameContext):
pass
# Exit a parse tree produced by ASLParser#states_error_name.
def exitStates_error_name(self, ctx: ASLParser.States_error_nameContext):
pass
# Enter a parse tree produced by ASLParser#error_name.
def enterError_name(self, ctx: ASLParser.Error_nameContext):
pass
# Exit a parse tree produced by ASLParser#error_name.
def exitError_name(self, ctx: ASLParser.Error_nameContext):
pass
# Enter a parse tree produced by ASLParser#json_obj_decl.
def enterJson_obj_decl(self, ctx: ASLParser.Json_obj_declContext):
pass
# Exit a parse tree produced by ASLParser#json_obj_decl.
def exitJson_obj_decl(self, ctx: ASLParser.Json_obj_declContext):
pass
# Enter a parse tree produced by ASLParser#json_binding.
def enterJson_binding(self, ctx: ASLParser.Json_bindingContext):
pass
# Exit a parse tree produced by ASLParser#json_binding.
def exitJson_binding(self, ctx: ASLParser.Json_bindingContext):
pass
# Enter a parse tree produced by ASLParser#json_arr_decl.
def enterJson_arr_decl(self, ctx: ASLParser.Json_arr_declContext):
pass
# Exit a parse tree produced by ASLParser#json_arr_decl.
def exitJson_arr_decl(self, ctx: ASLParser.Json_arr_declContext):
pass
# Enter a parse tree produced by ASLParser#json_value_decl.
def enterJson_value_decl(self, ctx: ASLParser.Json_value_declContext):
pass
# Exit a parse tree produced by ASLParser#json_value_decl.
def exitJson_value_decl(self, ctx: ASLParser.Json_value_declContext):
pass
# Enter a parse tree produced by ASLParser#keyword_or_string.
def enterKeyword_or_string(self, ctx: ASLParser.Keyword_or_stringContext):
pass
# Exit a parse tree produced by ASLParser#keyword_or_string.
def exitKeyword_or_string(self, ctx: ASLParser.Keyword_or_stringContext):
pass
del ASLParser

View File

@ -0,0 +1,413 @@
# Generated from /Users/mep/LocalStack/localstack/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 by ANTLR 4.13.1
from antlr4 import ParseTreeVisitor
if "." in __name__:
from .ASLParser import ASLParser
else:
from ASLParser import ASLParser
# This class defines a complete generic visitor for a parse tree produced by ASLParser.
class ASLParserVisitor(ParseTreeVisitor):
# Visit a parse tree produced by ASLParser#program_decl.
def visitProgram_decl(self, ctx: ASLParser.Program_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#top_layer_stmt.
def visitTop_layer_stmt(self, ctx: ASLParser.Top_layer_stmtContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#startat_decl.
def visitStartat_decl(self, ctx: ASLParser.Startat_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comment_decl.
def visitComment_decl(self, ctx: ASLParser.Comment_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#version_decl.
def visitVersion_decl(self, ctx: ASLParser.Version_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#state_stmt.
def visitState_stmt(self, ctx: ASLParser.State_stmtContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#states_decl.
def visitStates_decl(self, ctx: ASLParser.States_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#state_name.
def visitState_name(self, ctx: ASLParser.State_nameContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#state_decl.
def visitState_decl(self, ctx: ASLParser.State_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#state_decl_body.
def visitState_decl_body(self, ctx: ASLParser.State_decl_bodyContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#type_decl.
def visitType_decl(self, ctx: ASLParser.Type_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#next_decl.
def visitNext_decl(self, ctx: ASLParser.Next_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#resource_decl.
def visitResource_decl(self, ctx: ASLParser.Resource_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#input_path_decl.
def visitInput_path_decl(self, ctx: ASLParser.Input_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#result_decl.
def visitResult_decl(self, ctx: ASLParser.Result_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#result_path_decl.
def visitResult_path_decl(self, ctx: ASLParser.Result_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#output_path_decl.
def visitOutput_path_decl(self, ctx: ASLParser.Output_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#end_decl.
def visitEnd_decl(self, ctx: ASLParser.End_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#default_decl.
def visitDefault_decl(self, ctx: ASLParser.Default_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#error_decl.
def visitError_decl(self, ctx: ASLParser.Error_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#cause_decl.
def visitCause_decl(self, ctx: ASLParser.Cause_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#seconds_decl.
def visitSeconds_decl(self, ctx: ASLParser.Seconds_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#seconds_path_decl.
def visitSeconds_path_decl(self, ctx: ASLParser.Seconds_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#timestamp_decl.
def visitTimestamp_decl(self, ctx: ASLParser.Timestamp_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#timestamp_path_decl.
def visitTimestamp_path_decl(self, ctx: ASLParser.Timestamp_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#items_path_decl.
def visitItems_path_decl(self, ctx: ASLParser.Items_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#max_concurrency_decl.
def visitMax_concurrency_decl(self, ctx: ASLParser.Max_concurrency_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#parameters_decl.
def visitParameters_decl(self, ctx: ASLParser.Parameters_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#timeout_seconds_decl.
def visitTimeout_seconds_decl(self, ctx: ASLParser.Timeout_seconds_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#timeout_seconds_path_decl.
def visitTimeout_seconds_path_decl(
self, ctx: ASLParser.Timeout_seconds_path_declContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#heartbeat_seconds_decl.
def visitHeartbeat_seconds_decl(self, ctx: ASLParser.Heartbeat_seconds_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#heartbeat_seconds_path_decl.
def visitHeartbeat_seconds_path_decl(
self, ctx: ASLParser.Heartbeat_seconds_path_declContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_tmpl_decl.
def visitPayload_tmpl_decl(self, ctx: ASLParser.Payload_tmpl_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_binding_path.
def visitPayload_binding_path(self, ctx: ASLParser.Payload_binding_pathContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_binding_path_context_obj.
def visitPayload_binding_path_context_obj(
self, ctx: ASLParser.Payload_binding_path_context_objContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_binding_intrinsic_func.
def visitPayload_binding_intrinsic_func(
self, ctx: ASLParser.Payload_binding_intrinsic_funcContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_binding_value.
def visitPayload_binding_value(self, ctx: ASLParser.Payload_binding_valueContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#intrinsic_func.
def visitIntrinsic_func(self, ctx: ASLParser.Intrinsic_funcContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_arr_decl.
def visitPayload_arr_decl(self, ctx: ASLParser.Payload_arr_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_decl.
def visitPayload_value_decl(self, ctx: ASLParser.Payload_value_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_float.
def visitPayload_value_float(self, ctx: ASLParser.Payload_value_floatContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_int.
def visitPayload_value_int(self, ctx: ASLParser.Payload_value_intContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_bool.
def visitPayload_value_bool(self, ctx: ASLParser.Payload_value_boolContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_null.
def visitPayload_value_null(self, ctx: ASLParser.Payload_value_nullContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#payload_value_str.
def visitPayload_value_str(self, ctx: ASLParser.Payload_value_strContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#result_selector_decl.
def visitResult_selector_decl(self, ctx: ASLParser.Result_selector_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#state_type.
def visitState_type(self, ctx: ASLParser.State_typeContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#choices_decl.
def visitChoices_decl(self, ctx: ASLParser.Choices_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#choice_rule_comparison_variable.
def visitChoice_rule_comparison_variable(
self, ctx: ASLParser.Choice_rule_comparison_variableContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#choice_rule_comparison_composite.
def visitChoice_rule_comparison_composite(
self, ctx: ASLParser.Choice_rule_comparison_compositeContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comparison_variable_stmt.
def visitComparison_variable_stmt(
self, ctx: ASLParser.Comparison_variable_stmtContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comparison_composite_stmt.
def visitComparison_composite_stmt(
self, ctx: ASLParser.Comparison_composite_stmtContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comparison_composite.
def visitComparison_composite(self, ctx: ASLParser.Comparison_compositeContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#variable_decl.
def visitVariable_decl(self, ctx: ASLParser.Variable_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comparison_func.
def visitComparison_func(self, ctx: ASLParser.Comparison_funcContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#branches_decl.
def visitBranches_decl(self, ctx: ASLParser.Branches_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#item_processor_decl.
def visitItem_processor_decl(self, ctx: ASLParser.Item_processor_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#item_processor_item.
def visitItem_processor_item(self, ctx: ASLParser.Item_processor_itemContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#processor_config_decl.
def visitProcessor_config_decl(self, ctx: ASLParser.Processor_config_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#processor_config_field.
def visitProcessor_config_field(self, ctx: ASLParser.Processor_config_fieldContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#mode_decl.
def visitMode_decl(self, ctx: ASLParser.Mode_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#mode_type.
def visitMode_type(self, ctx: ASLParser.Mode_typeContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#execution_decl.
def visitExecution_decl(self, ctx: ASLParser.Execution_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#execution_type.
def visitExecution_type(self, ctx: ASLParser.Execution_typeContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#iterator_decl.
def visitIterator_decl(self, ctx: ASLParser.Iterator_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#iterator_decl_item.
def visitIterator_decl_item(self, ctx: ASLParser.Iterator_decl_itemContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#item_selector_decl.
def visitItem_selector_decl(self, ctx: ASLParser.Item_selector_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#item_reader_decl.
def visitItem_reader_decl(self, ctx: ASLParser.Item_reader_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#items_reader_field.
def visitItems_reader_field(self, ctx: ASLParser.Items_reader_fieldContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#reader_config_decl.
def visitReader_config_decl(self, ctx: ASLParser.Reader_config_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#reader_config_field.
def visitReader_config_field(self, ctx: ASLParser.Reader_config_fieldContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#input_type_decl.
def visitInput_type_decl(self, ctx: ASLParser.Input_type_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#csv_header_location_decl.
def visitCsv_header_location_decl(
self, ctx: ASLParser.Csv_header_location_declContext
):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#csv_headers_decl.
def visitCsv_headers_decl(self, ctx: ASLParser.Csv_headers_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#max_items_decl.
def visitMax_items_decl(self, ctx: ASLParser.Max_items_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#max_items_path_decl.
def visitMax_items_path_decl(self, ctx: ASLParser.Max_items_path_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#retry_decl.
def visitRetry_decl(self, ctx: ASLParser.Retry_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#retrier_decl.
def visitRetrier_decl(self, ctx: ASLParser.Retrier_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#retrier_stmt.
def visitRetrier_stmt(self, ctx: ASLParser.Retrier_stmtContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#error_equals_decl.
def visitError_equals_decl(self, ctx: ASLParser.Error_equals_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#interval_seconds_decl.
def visitInterval_seconds_decl(self, ctx: ASLParser.Interval_seconds_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#max_attempts_decl.
def visitMax_attempts_decl(self, ctx: ASLParser.Max_attempts_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#backoff_rate_decl.
def visitBackoff_rate_decl(self, ctx: ASLParser.Backoff_rate_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#catch_decl.
def visitCatch_decl(self, ctx: ASLParser.Catch_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#catcher_decl.
def visitCatcher_decl(self, ctx: ASLParser.Catcher_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#catcher_stmt.
def visitCatcher_stmt(self, ctx: ASLParser.Catcher_stmtContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#comparison_op.
def visitComparison_op(self, ctx: ASLParser.Comparison_opContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#choice_operator.
def visitChoice_operator(self, ctx: ASLParser.Choice_operatorContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#states_error_name.
def visitStates_error_name(self, ctx: ASLParser.States_error_nameContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#error_name.
def visitError_name(self, ctx: ASLParser.Error_nameContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#json_obj_decl.
def visitJson_obj_decl(self, ctx: ASLParser.Json_obj_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#json_binding.
def visitJson_binding(self, ctx: ASLParser.Json_bindingContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#json_arr_decl.
def visitJson_arr_decl(self, ctx: ASLParser.Json_arr_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#json_value_decl.
def visitJson_value_decl(self, ctx: ASLParser.Json_value_declContext):
return self.visitChildren(ctx)
# Visit a parse tree produced by ASLParser#keyword_or_string.
def visitKeyword_or_string(self, ctx: ASLParser.Keyword_or_stringContext):
return self.visitChildren(ctx)
del ASLParser

View File

@ -0,0 +1,27 @@
from typing import Optional
from antlr4 import ParserRuleContext
from antlr4.tree.Tree import ParseTree, TerminalNodeImpl
class Antlr4Utils:
@staticmethod
def is_production(
pt: ParseTree, rule_index: Optional[int] = None
) -> Optional[ParserRuleContext]:
if isinstance(pt, ParserRuleContext):
prc = pt.getRuleContext() # noqa
if rule_index is not None:
return prc if prc.getRuleIndex() == rule_index else None
return prc
return None
@staticmethod
def is_terminal(
pt: ParseTree, token_type: Optional[int] = None
) -> Optional[TerminalNodeImpl]:
if isinstance(pt, TerminalNodeImpl):
if token_type is not None:
return pt if pt.getSymbol().type == token_type else None
return pt
return None

View File

@ -0,0 +1,30 @@
from typing import Final, List
from moto.stepfunctions.parser.asl.component.common.catch.catch_outcome import (
CatchOutcome,
)
from moto.stepfunctions.parser.asl.component.common.catch.catcher_decl import (
CatcherDecl,
)
from moto.stepfunctions.parser.asl.component.common.catch.catcher_outcome import (
CatcherOutcome,
CatcherOutcomeCaught,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class CatchDecl(EvalComponent):
def __init__(self, catchers: List[CatcherDecl]):
self.catchers: Final[List[CatcherDecl]] = catchers
def _eval_body(self, env: Environment) -> None:
for catcher in self.catchers:
catcher.eval(env)
catcher_outcome: CatcherOutcome = env.stack.pop()
if isinstance(catcher_outcome, CatcherOutcomeCaught):
env.stack.append(CatchOutcome.Caught)
return
env.stack.append(CatchOutcome.NotCaught)

View File

@ -0,0 +1,6 @@
from enum import Enum
class CatchOutcome(Enum):
Caught = 0
NotCaught = 1

View File

@ -0,0 +1,96 @@
from __future__ import annotations
from typing import Final
from moto.stepfunctions.parser.asl.component.common.catch.catcher_outcome import (
CatcherOutcomeCaught,
CatcherOutcomeNotCaught,
)
from moto.stepfunctions.parser.asl.component.common.catch.catcher_props import (
CatcherProps,
)
from moto.stepfunctions.parser.asl.component.common.error_name.error_equals_decl import (
ErrorEqualsDecl,
)
from moto.stepfunctions.parser.asl.component.common.error_name.failure_event import (
FailureEvent,
)
from moto.stepfunctions.parser.asl.component.common.flow.next import Next
from moto.stepfunctions.parser.asl.component.common.path.result_path import ResultPath
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class CatcherDecl(EvalComponent):
_DEFAULT_RESULT_PATH: Final[ResultPath] = ResultPath(result_path_src="$")
def __init__(
self,
error_equals: ErrorEqualsDecl,
next_decl: Next,
result_path: ResultPath = _DEFAULT_RESULT_PATH,
):
self.error_equals: Final[ErrorEqualsDecl] = error_equals
self.result_path: Final[ResultPath] = (
result_path or CatcherDecl._DEFAULT_RESULT_PATH
)
self.next_decl: Final[Next] = next_decl
@classmethod
def from_catcher_props(cls, props: CatcherProps) -> CatcherDecl:
return cls(
error_equals=props.get(
typ=ErrorEqualsDecl,
raise_on_missing=ValueError(
f"Missing ErrorEquals declaration for Catcher declaration, in props '{props}'."
),
),
next_decl=props.get(
typ=Next,
raise_on_missing=ValueError(
f"Missing Next declaration for Catcher declaration, in props '{props}'."
),
),
result_path=props.get(typ=ResultPath),
)
@staticmethod
def _extract_error_cause(failure_event: FailureEvent) -> dict:
# TODO: consider formalising all EventDetails to ensure FailureEvent can always reach the state below.
# As per AWS's Api specification, all failure event carry one
# details field, with at least fields 'cause and 'error'
specs_event_details = list(failure_event.event_details.values())
if (
len(specs_event_details) != 1
and "error" in specs_event_details
and "cause" in specs_event_details
):
raise RuntimeError(
f"Internal Error: invalid event details declaration in FailureEvent: '{failure_event}'."
)
spec_event_details: dict = list(failure_event.event_details.values())[0]
error = spec_event_details["error"]
cause = spec_event_details.get("cause") or ""
# Stepfunctions renames these fields to capital in this scenario.
return {
"Error": error,
"Cause": cause,
}
def _eval_body(self, env: Environment) -> None:
failure_event: FailureEvent = env.stack.pop()
env.stack.append(failure_event.error_name)
self.error_equals.eval(env)
equals: bool = env.stack.pop()
if equals:
error_cause: dict = self._extract_error_cause(failure_event)
env.stack.append(error_cause)
self.result_path.eval(env)
env.next_state_name = self.next_decl.name
env.stack.append(CatcherOutcomeCaught())
else:
env.stack.append(failure_event)
env.stack.append(CatcherOutcomeNotCaught())

View File

@ -0,0 +1,13 @@
import abc
class CatcherOutcome(abc.ABC):
...
class CatcherOutcomeCaught(CatcherOutcome):
pass
class CatcherOutcomeNotCaught(CatcherOutcome):
pass

View File

@ -0,0 +1,5 @@
from moto.stepfunctions.parser.asl.parse.typed_props import TypedProps
class CatcherProps(TypedProps):
pass

View File

@ -0,0 +1,8 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class CauseDecl(Component):
def __init__(self, cause: str):
self.cause: Final[str] = cause

View File

@ -0,0 +1,8 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class Comment(Component):
def __init__(self, comment: str):
self.comment: Final[str] = comment

View File

@ -0,0 +1,8 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class ErrorDecl(Component):
def __init__(self, error: str):
self.error: Final[str] = error

View File

@ -0,0 +1,20 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.common.error_name.error_name import (
ErrorName,
)
class CustomErrorName(ErrorName):
"""
States MAY report errors with other names, which MUST NOT begin with the prefix "States.".
"""
_ILLEGAL_PREFIX: Final[str] = "States."
def __init__(self, error_name: str):
if error_name.startswith(CustomErrorName._ILLEGAL_PREFIX):
raise ValueError(
f"Custom Error Names MUST NOT begin with the prefix 'States.', got '{error_name}'."
)
super().__init__(error_name=error_name)

View File

@ -0,0 +1,62 @@
from typing import Final, List
from moto.stepfunctions.parser.asl.component.common.error_name.error_name import (
ErrorName,
)
from moto.stepfunctions.parser.asl.component.common.error_name.states_error_name import (
StatesErrorName,
)
from moto.stepfunctions.parser.asl.component.common.error_name.states_error_name_type import (
StatesErrorNameType,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class ErrorEqualsDecl(EvalComponent):
"""
ErrorEquals value MUST be a non-empty array of Strings, which match Error Names.
Each Retrier MUST contain a field named "ErrorEquals" whose value MUST be a non-empty array of Strings,
which match Error Names.
"""
_STATE_ALL_ERROR: Final[StatesErrorName] = StatesErrorName(
typ=StatesErrorNameType.StatesALL
)
_STATE_TASK_ERROR: Final[StatesErrorName] = StatesErrorName(
typ=StatesErrorNameType.StatesTaskFailed
)
def __init__(self, error_names: List[ErrorName]):
# The reserved name "States.ALL" in a Retriers "ErrorEquals" field is a wildcard
# and matches any Error Name. Such a value MUST appear alone in the "ErrorEquals"
# array and MUST appear in the last Retrier in the "Retry" array.
if ErrorEqualsDecl._STATE_ALL_ERROR in error_names and len(error_names) > 1:
raise ValueError(
f"States.ALL must appear alone in the ErrorEquals array, got '{error_names}'."
)
# TODO: how to handle duplicate ErrorName?
self.error_names: List[ErrorName] = error_names
def _eval_body(self, env: Environment) -> None:
"""
When a state reports an error, the interpreter scans through the Retriers and,
when the Error Name appears in the value of a Retriers "ErrorEquals" field, implements the retry policy
described in that Retrier.
This pops the error from the stack, and appends the bool of this check.
"""
# Try to reduce error response to ErrorName or pass exception upstream.
error_name: ErrorName = env.stack.pop()
if ErrorEqualsDecl._STATE_ALL_ERROR in self.error_names:
res = True
elif ErrorEqualsDecl._STATE_TASK_ERROR in self.error_names and not isinstance(
error_name, StatesErrorName
): # TODO: consider binding a 'context' variable to error_names to more formally detect their evaluation type.
res = True
else:
res = error_name in self.error_names
env.stack.append(res)

View File

@ -0,0 +1,19 @@
from __future__ import annotations
import abc
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class ErrorName(Component, abc.ABC):
def __init__(self, error_name: str):
self.error_name: Final[str] = error_name
def matches(self, error_name: str) -> bool:
return self.error_name == error_name
def __eq__(self, other):
if isinstance(other, ErrorName):
return self.matches(other.error_name)
return False

View File

@ -0,0 +1,58 @@
from typing import Final, Optional, Tuple
from moto.stepfunctions.parser.api import ExecutionFailedEventDetails, HistoryEventType
from moto.stepfunctions.parser.asl.component.common.error_name.error_name import (
ErrorName,
)
from moto.stepfunctions.parser.asl.eval.event.event_detail import EventDetails
class FailureEvent:
error_name: Final[Optional[ErrorName]]
event_type: Final[HistoryEventType]
event_details: Final[Optional[EventDetails]]
def __init__(
self,
error_name: Optional[ErrorName],
event_type: HistoryEventType,
event_details: Optional[EventDetails] = None,
):
self.error_name = error_name
self.event_type = event_type
self.event_details = event_details
class FailureEventException(Exception):
failure_event: Final[FailureEvent]
def __init__(self, failure_event: FailureEvent):
self.failure_event = failure_event
def extract_error_cause_pair(self) -> Optional[Tuple[Optional[str], Optional[str]]]:
if self.failure_event.event_details is None:
return None
failure_event_spec = list(self.failure_event.event_details.values())[0]
error = None
cause = None
if "error" in failure_event_spec:
error = failure_event_spec["error"]
if "cause" in failure_event_spec:
cause = failure_event_spec["cause"]
return error, cause
def get_execution_failed_event_details(
self,
) -> Optional[ExecutionFailedEventDetails]:
maybe_error_cause_pair = self.extract_error_cause_pair()
if maybe_error_cause_pair is None:
return None
execution_failed_event_details = ExecutionFailedEventDetails()
error, cause = maybe_error_cause_pair
if error:
execution_failed_event_details["error"] = error
if cause:
execution_failed_event_details["cause"] = cause
return execution_failed_event_details

View File

@ -0,0 +1,21 @@
from __future__ import annotations
from typing import Final
from moto.stepfunctions.parser.asl.component.common.error_name.error_name import (
ErrorName,
)
from moto.stepfunctions.parser.asl.component.common.error_name.states_error_name_type import (
StatesErrorNameType,
)
class StatesErrorName(ErrorName):
def __init__(self, typ: StatesErrorNameType):
super().__init__(error_name=typ.to_name())
self.typ: Final[StatesErrorNameType] = typ
@classmethod
def from_name(cls, error_name: str) -> StatesErrorName:
error_name_type: StatesErrorNameType = StatesErrorNameType.from_name(error_name)
return cls(typ=error_name_type)

View File

@ -0,0 +1,52 @@
from __future__ import annotations
from enum import Enum
from typing import Dict, Final
from moto.stepfunctions.parser.asl.antlr.runtime.ASLLexer import ASLLexer
class StatesErrorNameType(Enum):
StatesALL = ASLLexer.ERRORNAMEStatesALL
StatesHeartbeatTimeout = ASLLexer.ERRORNAMEStatesHeartbeatTimeout
StatesTimeout = ASLLexer.ERRORNAMEStatesTimeout
StatesTaskFailed = ASLLexer.ERRORNAMEStatesTaskFailed
StatesPermissions = ASLLexer.ERRORNAMEStatesPermissions
StatesResultPathMatchFailure = ASLLexer.ERRORNAMEStatesResultPathMatchFailure
StatesParameterPathFailure = ASLLexer.ERRORNAMEStatesParameterPathFailure
StatesBranchFailed = ASLLexer.ERRORNAMEStatesBranchFailed
StatesNoChoiceMatched = ASLLexer.ERRORNAMEStatesNoChoiceMatched
StatesIntrinsicFailure = ASLLexer.ERRORNAMEStatesIntrinsicFailure
StatesExceedToleratedFailureThreshold = (
ASLLexer.ERRORNAMEStatesExceedToleratedFailureThreshold
)
StatesItemReaderFailed = ASLLexer.ERRORNAMEStatesItemReaderFailed
StatesResultWriterFailed = ASLLexer.ERRORNAMEStatesResultWriterFailed
StatesRuntime = ASLLexer.ERRORNAMEStatesRuntime
def to_name(self) -> str:
return _error_name(self)
@classmethod
def from_name(cls, name: str) -> StatesErrorNameType:
error_name = _REVERSE_NAME_LOOKUP.get(name, None)
if error_name is None:
raise ValueError(f"Unknown ErrorName type, got: '{name}'.")
return cls(error_name.value)
def _error_name(error_name: StatesErrorNameType) -> str:
return ASLLexer.literalNames[error_name.value][2:-2]
def _reverse_error_name_lookup() -> Dict[str, StatesErrorNameType]:
lookup: Dict[str, StatesErrorNameType] = dict()
for error_name in StatesErrorNameType:
error_text: str = _error_name(error_name)
lookup[error_text] = error_name
return lookup
_REVERSE_NAME_LOOKUP: Final[
Dict[str, StatesErrorNameType]
] = _reverse_error_name_lookup()

View File

@ -0,0 +1,9 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class End(Component):
def __init__(self, is_end: bool):
# Designates this state as a terminal state (ends the execution) if set to true.
self.is_end: Final[bool] = is_end

View File

@ -0,0 +1,11 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class Next(Component):
name: Final[str]
def __init__(self, name: str):
# The name of the next state that is run when the current state finishes.
self.name = name

View File

@ -0,0 +1,8 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class StartAt(Component):
def __init__(self, start_at_name: str):
self.start_at_name: Final[str] = start_at_name

View File

@ -0,0 +1,15 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadtmpl.payload_tmpl import (
PayloadTmpl,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class Parameters(EvalComponent):
def __init__(self, payload_tmpl: PayloadTmpl):
self.payload_tmpl: Final[PayloadTmpl] = payload_tmpl
def _eval_body(self, env: Environment) -> None:
self.payload_tmpl.eval(env=env)

View File

@ -0,0 +1,24 @@
import copy
from typing import Final, Optional
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class InputPath(EvalComponent):
DEFAULT_PATH: Final[str] = "$"
input_path_src: Final[Optional[str]]
def __init__(self, input_path_src: Optional[str]):
self.input_path_src = input_path_src
def _eval_body(self, env: Environment) -> None:
if self.input_path_src is None:
value = dict()
elif self.input_path_src == InputPath.DEFAULT_PATH:
value = env.inp
else:
value = JSONPathUtils.extract_json(self.input_path_src, env.inp)
env.stack.append(copy.deepcopy(value))

View File

@ -0,0 +1,19 @@
import copy
from typing import Final
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class ItemsPath(EvalComponent):
DEFAULT_PATH: Final[str] = "$"
def __init__(self, items_path_src: str = DEFAULT_PATH):
self.items_path_src: Final[str] = items_path_src
def _eval_body(self, env: Environment) -> None:
if self.items_path_src != ItemsPath.DEFAULT_PATH:
value = copy.deepcopy(env.stack[-1])
value = JSONPathUtils.extract_json(self.items_path_src, value)
env.stack.append(value)

View File

@ -0,0 +1,22 @@
from typing import Final, Optional
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class OutputPath(EvalComponent):
DEFAULT_PATH: Final[str] = "$"
output_path: Final[Optional[str]]
def __init__(self, output_path: Optional[str]):
self.output_path = output_path
def _eval_body(self, env: Environment) -> None:
if self.output_path is None:
env.inp = dict()
else:
current_output = env.stack.pop()
state_output = JSONPathUtils.extract_json(self.output_path, current_output)
env.inp = state_output

View File

@ -0,0 +1,33 @@
import copy
from typing import Final, Optional
from jsonpath_ng import parse
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class ResultPath(EvalComponent):
DEFAULT_PATH: Final[str] = "$"
result_path_src: Final[Optional[str]]
def __init__(self, result_path_src: Optional[str]):
self.result_path_src = result_path_src
def _eval_body(self, env: Environment) -> None:
state_input = copy.deepcopy(env.inp)
# Discard task output if there is one, and set the output ot be the state's input.
if self.result_path_src is None:
env.stack.clear()
env.stack.append(state_input)
return
# Transform the output with the input.
current_output = env.stack.pop()
result_expr = parse(self.result_path_src)
state_output = result_expr.update_or_create(
state_input, copy.deepcopy(current_output)
)
env.stack.append(state_output)

View File

@ -0,0 +1,7 @@
import abc
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
class PayloadValue(EvalComponent, abc.ABC):
...

View File

@ -0,0 +1,18 @@
from typing import Final, List
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payload_value import (
PayloadValue,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
class PayloadArr(PayloadValue):
def __init__(self, payload_values: List[PayloadValue]):
self.payload_values: Final[List[PayloadValue]] = payload_values
def _eval_body(self, env: Environment) -> None:
arr = list()
for payload_value in self.payload_values:
payload_value.eval(env)
arr.append(env.stack.pop())
env.stack.append(arr)

View File

@ -0,0 +1,22 @@
import abc
from typing import Any, Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payload_value import (
PayloadValue,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
class PayloadBinding(PayloadValue, abc.ABC):
def __init__(self, field: str):
self.field: Final[str] = field
@abc.abstractmethod
def _eval_val(self, env: Environment) -> Any:
...
def _eval_body(self, env: Environment) -> None:
cnt: dict = env.stack.pop()
val = self._eval_val(env=env)
cnt[self.field] = val
env.stack.append(cnt)

View File

@ -0,0 +1,27 @@
from typing import Any, Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadbinding.payload_binding import (
PayloadBinding,
)
from moto.stepfunctions.parser.asl.component.intrinsic.function.function import Function
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.parse.intrinsic.intrinsic_parser import (
IntrinsicParser,
)
class PayloadBindingIntrinsicFunc(PayloadBinding):
def __init__(self, field: str, intrinsic_func: str):
super().__init__(field=field)
self.src: Final[str] = intrinsic_func
self.function: Final[Function] = IntrinsicParser.parse(self.src)
@classmethod
def from_raw(cls, string_dollar: str, intrinsic_func: str):
field: str = string_dollar[:-2]
return cls(field=field, intrinsic_func=intrinsic_func)
def _eval_val(self, env: Environment) -> Any:
self.function.eval(env=env)
val = env.stack.pop()
return val

View File

@ -0,0 +1,49 @@
from typing import Any, Final
from moto.stepfunctions.parser.api import HistoryEventType, TaskFailedEventDetails
from moto.stepfunctions.parser.asl.component.common.error_name.failure_event import (
FailureEvent,
FailureEventException,
)
from moto.stepfunctions.parser.asl.component.common.error_name.states_error_name import (
StatesErrorName,
)
from moto.stepfunctions.parser.asl.component.common.error_name.states_error_name_type import (
StatesErrorNameType,
)
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadbinding.payload_binding import (
PayloadBinding,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.eval.event.event_detail import EventDetails
from moto.stepfunctions.parser.asl.utils.encoding import to_json_str
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class PayloadBindingPath(PayloadBinding):
def __init__(self, field: str, path: str):
super().__init__(field=field)
self.path: Final[str] = path
@classmethod
def from_raw(cls, string_dollar: str, string_path: str):
field: str = string_dollar[:-2]
return cls(field=field, path=string_path)
def _eval_val(self, env: Environment) -> Any:
inp = env.stack[-1]
try:
value = JSONPathUtils.extract_json(self.path, inp)
except RuntimeError:
failure_event = FailureEvent(
error_name=StatesErrorName(typ=StatesErrorNameType.StatesRuntime),
event_type=HistoryEventType.TaskFailed,
event_details=EventDetails(
taskFailedEventDetails=TaskFailedEventDetails(
error=StatesErrorNameType.StatesRuntime.to_name(),
cause=f"The JSONPath {self.path} specified for the field {self.field}.$ could not be found in the input {to_json_str(inp)}",
)
),
)
raise FailureEventException(failure_event=failure_event)
return value

View File

@ -0,0 +1,30 @@
from typing import Any, Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadbinding.payload_binding import (
PayloadBinding,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class PayloadBindingPathContextObj(PayloadBinding):
def __init__(self, field: str, path_context_obj: str):
super().__init__(field=field)
self.path_context_obj: Final[str] = path_context_obj
@classmethod
def from_raw(cls, string_dollar: str, string_path_context_obj: str):
field: str = string_dollar[:-2]
path_context_obj: str = string_path_context_obj[1:]
return cls(field=field, path_context_obj=path_context_obj)
def _eval_val(self, env: Environment) -> Any:
if self.path_context_obj.endswith("Task.Token"):
task_token = env.context_object_manager.update_task_token()
env.callback_pool_manager.add(task_token)
value = task_token
else:
value = JSONPathUtils.extract_json(
self.path_context_obj, env.context_object_manager.context_object
)
return value

View File

@ -0,0 +1,20 @@
from typing import Any, Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payload_value import (
PayloadValue,
)
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadbinding.payload_binding import (
PayloadBinding,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
class PayloadBindingValue(PayloadBinding):
def __init__(self, field: str, value: PayloadValue):
super().__init__(field=field)
self.value: Final[PayloadValue] = value
def _eval_val(self, env: Environment) -> Any:
self.value.eval(env)
val: Any = env.stack.pop()
return val

View File

@ -0,0 +1,19 @@
from typing import Final, List
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payload_value import (
PayloadValue,
)
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadbinding.payload_binding import (
PayloadBinding,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
class PayloadTmpl(PayloadValue):
def __init__(self, payload_bindings: List[PayloadBinding]):
self.payload_bindings: Final[List[PayloadBinding]] = payload_bindings
def _eval_body(self, env: Environment) -> None:
env.stack.append(dict())
for payload_binding in self.payload_bindings:
payload_binding.eval(env)

View File

@ -0,0 +1,10 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadvaluelit.payload_value_lit import (
PayloadValueLit,
)
class PayloadValueBool(PayloadValueLit):
def __init__(self, val: bool):
self.val: Final[bool] = val

View File

@ -0,0 +1,10 @@
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadvaluelit.payload_value_lit import (
PayloadValueLit,
)
class PayloadValueFloat(PayloadValueLit):
val: float
def __init__(self, val: float):
super().__init__(val=val)

View File

@ -0,0 +1,10 @@
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadvaluelit.payload_value_lit import (
PayloadValueLit,
)
class PayloadValueInt(PayloadValueLit):
val: int
def __init__(self, val: int):
super().__init__(val=val)

View File

@ -0,0 +1,17 @@
import abc
from typing import Any
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payload_value import (
PayloadValue,
)
from moto.stepfunctions.parser.asl.eval.environment import Environment
class PayloadValueLit(PayloadValue, abc.ABC):
val: Any
def __init__(self, val: Any):
self.val: Any = val
def _eval_body(self, env: Environment) -> None:
env.stack.append(self.val)

View File

@ -0,0 +1,10 @@
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadvaluelit.payload_value_lit import (
PayloadValueLit,
)
class PayloadValueNull(PayloadValueLit):
val: None
def __init__(self):
super().__init__(val=None)

View File

@ -0,0 +1,10 @@
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadvaluelit.payload_value_lit import (
PayloadValueLit,
)
class PayloadValueStr(PayloadValueLit):
val: str
def __init__(self, val: str):
super().__init__(val=val)

View File

@ -0,0 +1,13 @@
from moto.stepfunctions.parser.asl.component.common.payload.payloadvalue.payloadtmpl.payload_tmpl import (
PayloadTmpl,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class ResultSelector(EvalComponent):
def __init__(self, payload_tmpl: PayloadTmpl):
self.payload_tmpl: PayloadTmpl = payload_tmpl
def _eval_body(self, env: Environment) -> None:
self.payload_tmpl.eval(env=env)

View File

@ -0,0 +1,20 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class BackoffRateDecl(Component):
"""
"BackoffRate": a number which is the multiplier that increases the retry interval on each
attempt (default: 2.0). The value of BackoffRate MUST be greater than or equal to 1.0.
"""
DEFAULT_RATE: Final[float] = 2.0
MIN_RATE: Final[float] = 1.0
def __init__(self, rate: float = DEFAULT_RATE):
if rate < self.MIN_RATE:
raise ValueError(
f"The value of BackoffRate MUST be greater than or equal to 1.0, got '{rate}'."
)
self.rate: Final[float] = rate

View File

@ -0,0 +1,19 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class IntervalSecondsDecl(Component):
"""
IntervalSeconds: its value MUST be a positive integer, representing the number of seconds before the
first retry attempt (default value: 1);
"""
DEFAULT_SECONDS: Final[int] = 1
def __init__(self, seconds: int = DEFAULT_SECONDS):
if seconds < 0:
raise ValueError(
f"IntervalSeconds value must be a positive integer, found '{seconds}'."
)
self.seconds: Final[int] = seconds

View File

@ -0,0 +1,19 @@
from typing import Final
from moto.stepfunctions.parser.asl.component.component import Component
class MaxAttemptsDecl(Component):
"""
"MaxAttempts": value MUST be a non-negative integer, representing the maximum number
of retry attempts (default: 3)
"""
DEFAULT_ATTEMPTS: Final[int] = 3
def __init__(self, attempts: int = DEFAULT_ATTEMPTS):
if attempts < 0:
raise ValueError(
f"MaxAttempts value MUST be a non-negative integer, got '{attempts}'."
)
self.attempts: Final[int] = attempts

View File

@ -0,0 +1,88 @@
from __future__ import annotations
import time
from typing import Final, Optional
from moto.stepfunctions.parser.asl.component.common.error_name.error_equals_decl import (
ErrorEqualsDecl,
)
from moto.stepfunctions.parser.asl.component.common.retry.backoff_rate_decl import (
BackoffRateDecl,
)
from moto.stepfunctions.parser.asl.component.common.retry.interval_seconds_decl import (
IntervalSecondsDecl,
)
from moto.stepfunctions.parser.asl.component.common.retry.max_attempts_decl import (
MaxAttemptsDecl,
)
from moto.stepfunctions.parser.asl.component.common.retry.retrier_outcome import (
RetrierOutcome,
)
from moto.stepfunctions.parser.asl.component.common.retry.retrier_props import (
RetrierProps,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class RetrierDecl(EvalComponent):
def __init__(
self,
error_equals: ErrorEqualsDecl,
interval_seconds: Optional[IntervalSecondsDecl] = None,
max_attempts: Optional[MaxAttemptsDecl] = None,
backoff_rate: Optional[BackoffRateDecl] = None,
):
self.error_equals: Final[ErrorEqualsDecl] = error_equals
self.interval_seconds: Final[IntervalSecondsDecl] = (
interval_seconds or IntervalSecondsDecl()
)
self.max_attempts: Final[MaxAttemptsDecl] = max_attempts or MaxAttemptsDecl()
self.backoff_rate: Final[BackoffRateDecl] = backoff_rate or BackoffRateDecl()
self._attempts_counter: int = 0
self._next_interval_seconds: float = self.interval_seconds.seconds
@classmethod
def from_retrier_props(cls, props: RetrierProps) -> RetrierDecl:
return cls(
error_equals=props.get(
typ=ErrorEqualsDecl,
raise_on_missing=ValueError(
f"Missing ErrorEquals declaration for Retrier declaration, in props '{props}'."
),
),
interval_seconds=props.get(IntervalSecondsDecl),
max_attempts=props.get(MaxAttemptsDecl),
backoff_rate=props.get(BackoffRateDecl),
)
def _eval_body(self, env: Environment) -> None:
# When a state reports an error, the interpreter scans through the Retriers and, when the Error Name appears
# in the value of a Retriers "ErrorEquals" field, implements the retry policy described in that Retrier.
self.error_equals.eval(env)
res: bool = env.stack.pop()
# This Retrier does not match
if not res:
env.stack.append(RetrierOutcome.Skipped)
return
# This is a matching Retrier, but was exhausted.
self._attempts_counter += 1
if self._attempts_counter > self.max_attempts.attempts:
env.stack.append(RetrierOutcome.Failed)
return
# Execute the Retrier logic.
# TODO: continue after interrupts?
time.sleep(self._next_interval_seconds)
self._next_interval_seconds = (
self._attempts_counter
* self.interval_seconds.seconds
* self.backoff_rate.rate
)
env.stack.append(RetrierOutcome.Executed)

View File

@ -0,0 +1,7 @@
import enum
class RetrierOutcome(enum.Enum):
Executed = 0
Failed = 1
Skipped = 2

View File

@ -0,0 +1,5 @@
from moto.stepfunctions.parser.asl.parse.typed_props import TypedProps
class RetrierProps(TypedProps):
pass

View File

@ -0,0 +1,40 @@
from typing import Final, List
from moto.stepfunctions.parser.asl.component.common.error_name.error_name import (
ErrorName,
)
from moto.stepfunctions.parser.asl.component.common.retry.retrier_decl import (
RetrierDecl,
)
from moto.stepfunctions.parser.asl.component.common.retry.retrier_outcome import (
RetrierOutcome,
)
from moto.stepfunctions.parser.asl.component.common.retry.retry_outcome import (
RetryOutcome,
)
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
class RetryDecl(EvalComponent):
def __init__(self, retriers: List[RetrierDecl]):
self.retriers: Final[List[RetrierDecl]] = retriers
def _eval_body(self, env: Environment) -> None:
error_name: ErrorName = env.stack.pop()
for retrier in self.retriers:
env.stack.append(error_name)
retrier.eval(env)
outcome: RetrierOutcome = env.stack.pop()
if outcome == RetrierOutcome.Skipped:
continue
elif outcome == RetrierOutcome.Executed:
env.stack.append(RetryOutcome.CanRetry)
return
elif outcome == RetrierOutcome.Failed:
env.stack.append(RetryOutcome.CannotRetry)
return
env.stack.append(RetryOutcome.NoRetrier)

View File

@ -0,0 +1,7 @@
from enum import Enum
class RetryOutcome(Enum):
CanRetry = 0
CannotRetry = 1
NoRetrier = 2

View File

@ -0,0 +1,46 @@
import abc
from typing import Final
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class Heartbeat(EvalComponent, abc.ABC):
@abc.abstractmethod
def _eval_seconds(self, env: Environment) -> int:
...
def _eval_body(self, env: Environment) -> None:
seconds = self._eval_seconds(env=env)
env.stack.append(seconds)
class HeartbeatSeconds(Heartbeat):
def __init__(self, heartbeat_seconds: int):
if not isinstance(heartbeat_seconds, int) and heartbeat_seconds <= 0:
raise ValueError(
f"Expected non-negative integer for HeartbeatSeconds, got '{heartbeat_seconds}' instead."
)
self.heartbeat_seconds: Final[int] = heartbeat_seconds
def _eval_seconds(self, env: Environment) -> int:
return self.heartbeat_seconds
class HeartbeatSecondsPath(Heartbeat):
def __init__(self, path: str):
self.path: Final[str] = path
@classmethod
def from_raw(cls, path: str):
return cls(path=path)
def _eval_seconds(self, env: Environment) -> int:
inp = env.stack[-1]
seconds = JSONPathUtils.extract_json(self.path, inp)
if not isinstance(seconds, int) and seconds <= 0:
raise ValueError(
f"Expected non-negative integer for HeartbeatSecondsPath, got '{seconds}' instead."
)
return seconds

View File

@ -0,0 +1,65 @@
import abc
from typing import Final, Optional
from moto.stepfunctions.parser.asl.component.eval_component import EvalComponent
from moto.stepfunctions.parser.asl.eval.environment import Environment
from moto.stepfunctions.parser.asl.utils.json_path import JSONPathUtils
class Timeout(EvalComponent, abc.ABC):
@abc.abstractmethod
def is_default_value(self) -> bool:
...
@abc.abstractmethod
def _eval_seconds(self, env: Environment) -> int:
...
def _eval_body(self, env: Environment) -> None:
seconds = self._eval_seconds(env=env)
env.stack.append(seconds)
class TimeoutSeconds(Timeout):
DEFAULT_TIMEOUT_SECONDS: Final[int] = 99999999
def __init__(self, timeout_seconds: int, is_default: Optional[bool] = None):
if not isinstance(timeout_seconds, int) and timeout_seconds <= 0:
raise ValueError(
f"Expected non-negative integer for TimeoutSeconds, got '{timeout_seconds}' instead."
)
self.timeout_seconds: Final[int] = timeout_seconds
self.is_default: Optional[bool] = is_default
def is_default_value(self) -> bool:
if self.is_default is not None:
return self.is_default
return self.timeout_seconds == self.DEFAULT_TIMEOUT_SECONDS
def _eval_seconds(self, env: Environment) -> int:
return self.timeout_seconds
class TimeoutSecondsPath(Timeout):
def __init__(self, path: str):
self.path: Final[str] = path
@classmethod
def from_raw(cls, path: str):
return cls(path=path)
def is_default_value(self) -> bool:
return False
def _eval_seconds(self, env: Environment) -> int:
inp = env.stack[-1]
seconds = JSONPathUtils.extract_json(self.path, inp)
if not isinstance(seconds, int) and seconds <= 0:
raise ValueError(
f"Expected non-negative integer for TimeoutSecondsPath, got '{seconds}' instead."
)
return seconds
class EvalTimeoutError(TimeoutError):
pass

View File

@ -0,0 +1,17 @@
from typing import Final, Set
from moto.stepfunctions.parser.asl.component.component import Component
class Version(Component):
_SUPPORTED_VERSIONS: Final[Set[str]] = {"1.0"}
version: Final[str]
def __init__(self, version: str):
if version not in self._SUPPORTED_VERSIONS:
raise ValueError(
f"Version value '{version}' is not accepted. Supported Versions: {list(self._SUPPORTED_VERSIONS)}"
)
self.version = version

View File

@ -0,0 +1,9 @@
import abc
class Component(abc.ABC):
def __str__(self):
return f"({self.__class__.__name__}| {vars(self)}"
def __repr__(self):
return str(self)

Some files were not shown because too many files have changed in this diff Show More