summaryrefslogtreecommitdiffhomepage
path: root/parser.y
AgeCommit message (Collapse)Author
2020-10-05ast: add helpers to set error token bitsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-10-02treewide: rework handling of memory allocation failuresJo-Philipp Wich
Instead of propagating failures to the caller, print a generic error message and terminate program execution through abort(). Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-24syntax: add regular expression supportJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-22syntax: allow empty switch statementsJo-Philipp Wich
Also add testcases for switch/case blocks. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-22syntax: introduce case statement supportJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-21syntax: introduce try/catch blocksJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-21treewide: ensure to properly propagate exceptionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-13syntax: fix for() loop quirks and variable scopingJo-Philipp Wich
- Support `for (var x in ...)` syntax - Support `for (var i = 0; i < ...; i++)` syntax - Properly handle "for" loops without condition and increment expression - Reject for-in loops with invalid lhs Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-11syntax: introduce !== and === operatorsJo-Philipp Wich
Also treat "in" as relational operator. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-08parser, eval: use an ut_op flag to denote postfix accessJo-Philipp Wich
The current code still abused the JSON value pointer to denote postfix access for certain operations which led to a crash when freeing the parser state due to an attempt to put a (void *)1 pointer. Since we do have the ability to set flags on operations since the AST rework, use this much cleaner approach and avoid the invalid pointer hackery. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-06parser: do not reallocate function opcodesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-06parser: make final semicolon optionalJo-Philipp Wich
Modify the grammar to allow omitting the last semicolon after the last statement of a compound statement. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-06treewide: refactor internal AST structuresJo-Philipp Wich
- unify operand and value tag structures - use a contiguous array for storing opcodes - use relative offsets for next and children ops - defer function creation to runtime - rework "this" context handling by storing context pointer in scope tags Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25treewide: add proper null value handlingJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-25treewide: introduce this keywordJo-Philipp Wich
Support a new keyword `this` which allows functions to access the context they're called upon. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-21Initial commitJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>