Add finally, instance of, typeof, in to js grammar
This commit is contained in:
parent
c91c5cb730
commit
4ad6278334
8 changed files with 47167 additions and 21103 deletions
|
|
@ -73,11 +73,22 @@ try {
|
|||
} catch (e) {
|
||||
logError(e);
|
||||
}
|
||||
|
||||
try {
|
||||
doSomething();
|
||||
} finally {
|
||||
logError();
|
||||
}
|
||||
---
|
||||
(program (try_statement
|
||||
(statement_block (expression_statement (function_call (identifier))))
|
||||
(identifier)
|
||||
(statement_block (expression_statement (function_call (identifier) (identifier))))))
|
||||
(program
|
||||
(try_statement
|
||||
(statement_block (expression_statement (function_call (identifier))))
|
||||
(catch_clause (identifier)
|
||||
(statement_block (expression_statement (function_call (identifier) (identifier))))))
|
||||
(try_statement
|
||||
(statement_block (expression_statement (function_call (identifier))))
|
||||
(finally_clause
|
||||
(statement_block (expression_statement (function_call (identifier)))))))
|
||||
|
||||
===========================================
|
||||
parses indented code after blocks
|
||||
|
|
|
|||
|
|
@ -29,4 +29,21 @@ parses boolean operators
|
|||
(bool_op
|
||||
(bool_op (identifier))
|
||||
(bool_op
|
||||
(expression (bool_op (identifier) (identifier)))))))
|
||||
(expression (bool_op (identifier) (identifier)))))))
|
||||
|
||||
===========================================
|
||||
parses the type operators
|
||||
===========================================
|
||||
print((x instanceof Array) || (typeof x == "string"))
|
||||
---
|
||||
(program (expression_statement (function_call (identifier)
|
||||
(bool_op
|
||||
(expression (instanceof_expression (identifier) (identifier)))
|
||||
(expression (typeof_expression (bool_op (identifier) (string))))))))
|
||||
|
||||
============================================
|
||||
parses the 'in' operator
|
||||
===========================================
|
||||
print(x in y)
|
||||
---
|
||||
(program (expression_statement (function_call (identifier) (in_expression (identifier) (identifier)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue