Add try and while statements to js grammar
This commit is contained in:
parent
e8760eee34
commit
2d0f90c7d5
2 changed files with 37 additions and 0 deletions
|
|
@ -54,6 +54,31 @@ for (var i = 1; someCondition(i); i = next()) {
|
|||
(assignment (identifier) (function_call (identifier)))
|
||||
(statement_block (expression_statement (function_call (identifier))))))
|
||||
|
||||
==========================================
|
||||
parses while loops
|
||||
==========================================
|
||||
while (someCondition(i)) {
|
||||
doSomething();
|
||||
}
|
||||
---
|
||||
(program (while_statement
|
||||
(function_call (identifier) (identifier))
|
||||
(statement_block (expression_statement (function_call (identifier))))))
|
||||
|
||||
==========================================
|
||||
parses try/catch statements
|
||||
==========================================
|
||||
try {
|
||||
doSomething();
|
||||
} catch (e) {
|
||||
logError(e);
|
||||
}
|
||||
---
|
||||
(program (try_statement
|
||||
(statement_block (expression_statement (function_call (identifier))))
|
||||
(identifier)
|
||||
(statement_block (expression_statement (function_call (identifier) (identifier))))))
|
||||
|
||||
===========================================
|
||||
parses switch statements
|
||||
===========================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue