Age | Commit message (Collapse) | Author |
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
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>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Also add testcases for switch/case blocks.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- 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>
|
|
Also treat "in" as relational operator.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
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>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
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>
|
|
- 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>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
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>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|