MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxTryStatement

Function fxTryStatement

xs/sources/xsSyntaxical.c:1738–1774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1736}
1737
1738void fxTryStatement(txParser* parser)
1739{
1740 txInteger aLine = parser->states[0].line;
1741 txBoolean ok = 0;
1742 fxMatchToken(parser, XS_TOKEN_TRY);
1743 fxBlock(parser);
1744 if (parser->states[0].token == XS_TOKEN_CATCH) {
1745 txInteger aCatchLine = parser->states[0].line;
1746 fxMatchToken(parser, XS_TOKEN_CATCH);
1747 if (parser->states[0].token == XS_TOKEN_LEFT_PARENTHESIS) {
1748 fxMatchToken(parser, XS_TOKEN_LEFT_PARENTHESIS);
1749 fxBinding(parser, XS_TOKEN_LET, 1);
1750 fxMatchToken(parser, XS_TOKEN_RIGHT_PARENTHESIS);
1751 }
1752 else
1753 fxPushNULL(parser);
1754 fxMatchToken(parser, XS_TOKEN_LEFT_BRACE);
1755 fxStatements(parser);
1756 fxMatchToken(parser, XS_TOKEN_RIGHT_BRACE);
1757 fxPushNodeStruct(parser, 2, XS_TOKEN_CATCH, aCatchLine);
1758 ok = 1;
1759 }
1760 else {
1761 fxPushNULL(parser);
1762 }
1763 if (parser->states[0].token == XS_TOKEN_FINALLY) {
1764 fxMatchToken(parser, XS_TOKEN_FINALLY);
1765 fxBlock(parser);
1766 ok = 1;
1767 }
1768 else {
1769 fxPushNULL(parser);
1770 }
1771 if (!ok)
1772 fxReportParserError(parser, parser->states[0].line, "missing catch or finally");
1773 fxPushNodeStruct(parser, 3, XS_TOKEN_TRY, aLine);
1774}
1775
1776void fxVariableStatement(txParser* parser, txToken theToken, txUnsigned flags)
1777{

Callers 1

fxStatementFunction · 0.85

Calls 7

fxMatchTokenFunction · 0.85
fxBlockFunction · 0.85
fxBindingFunction · 0.85
fxPushNULLFunction · 0.85
fxStatementsFunction · 0.85
fxPushNodeStructFunction · 0.85
fxReportParserErrorFunction · 0.85

Tested by

no test coverage detected