Releases: raleksandar/numenor
v0.1.6 - Lambda expression improvements
This release brings the following fixes/improvements:
- reporting of lexer state is now correct again (was broken by changes in v0.1.5)
- precedence and associativity of lambda expressions is now handled correctly
- lambda expression arguments can have default values (a.k.a optional arguments)
- lambda expression can have a variadic argument (a.k.a. rest params)
v0.1.5 - Lambda expressions
Numenor now supports lambda expressions (e.g. (x) => x * 2
, but since numenor is expression parser statement block is not supported, i.e. (x) => { doSomething(x) }
is not supported).
This release also fixes the issue with parsing of >>>
and >>=
operators.
v0.1.4 - String escapes bugfix
This release fixes the string escape sequence parsing bug.
v0.1.3 - Improved function binding
All function values in the evaluation context of a numenor expression are bound using the Function.prototype.bind
.
This always creates a new function which means that any properties which might have been added to the function which is bound are lost. From this version, numenor will copy all of the enumerable properties of a function when creating its bound version.
v0.1.2 - Shared symbols
From this release, numenor makes use of the global symbol registry for the expression and token types which makes (de)serializing of the AST object much easier.
Symbol keys for the expression types have the format of numenor:expr:<name>
. For example numenor:expr:call
for the ExpressionType.Call
symbol.
Symbol keys for the token types have the format of numenor:tok:<token>
. For example numenor:tok:+
for the TokenType.Plus
symbol.
You can obtain a correct symbol value from the string value via Symbol.for('<key>')
. For example Symbol.for('numenor:expr:await') === ExpressionType.Await
.
v0.1.1 - ValueLookup API
This release introduces ValueLookup API which can be used to dynamically provide context values.
For example:
import { ValueLookup } from 'numenor/lib/Compiler/Evaluator';
evaluator.evaluate('now', { [ValueLookup]: (name) => name === 'now' ? Date.now() : undefined });
ValueLookup is also supported in { Constants: {} }
compiler option.
v0.1.0 - Await expressions
await
expressions are now supported. If at least oneawait
expression was used in a given source, the result of evaluating that expression will be an instance ofPromise
, which resolves once that all nested promises (i.e.await
expressions) resolve.- default empty
EvaluatorContext
object is no more reused between evaluations - Fixed the associativity of the unary prefix operators
- Fixed the precedence of the sequence (comma) operator
Lexer#addScanner
has been renamed toLexer#appendScanner
, also, theLexer#prependScanner
has been added
v0.0.10 - Trailing commas
This release fixes the support for the trailing commas in an array/object literals and function calls
v0.0.9 - Parser/Lexer state breaking change
Parser#state
now returns the position of the last accepted tokenLexer#currentState
now returns the position of the last consumed token
v0.0.8 - Parser/Compiler events
- Parser now emits
scope:enter
,scope:leave
andnode
events - Compiler now emits
scope:enter
andscope:leave
events - All tokens now have
offset
andlexeme
(previously only on some token types asraw
) properties - Parsing errors now display
lexeme
of the token instead of itstype