![]() | Description |
---|---|
The try rule is used for catching the failure of a rule (similarly to catching an exception in traditional programming languages). |
![]() | Syntax |
---|---|
TryRuleAST ::= try AsmRuleAST | try AsmRuleAST else AsmRuleAST The try rule has a mandatory (body) and an optional (else) ASM rule. |
![]() | Semantics |
---|---|
The try rule attempts to execute its body rule (the first ASM rule), and executes the else part (the second ASM rule) if the execution of the body rule fails. It is conceptually similar to exception handling in Java (but without finally block). |
Remark. A rule can fail in the following situations:
it is the fail rule itself,
it is the choose rule and no matching is found,
it is a compound rule and an executed contained rule fails.
Defined In: compound rule
See Also: fail rule, choose rule, iterate rule, if rule