You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many use cases where you want to inspect which operators are currently registered and/or look up their precedences.
E.g. Assume you want to add and as a synonym for &&. Currently one has to look at the code to find the precedence of && and use the same. And of course, that means it cannot be done dynamically, on runtime.
Or you may just need to look up whether an operator is registered. Currently the only way to do that is to try and parse a test expression.
This could be done in a number of ways:
Just expose unary_ops and binary_ops on jsep.
Add functions that accept an operator and return its precedence (we already have that for binary operators in binaryPrecedence(), we just need to expose it.
@EricSmekens Once I know how you'd rather proceed, I can implement it and send a PR.
And while we're at it, we could also expose isDecimalDigit, isIdentifierStart etc so they can be overridden, to create an even more extensible parser 😁
The text was updated successfully, but these errors were encountered:
There are many use cases where you want to inspect which operators are currently registered and/or look up their precedences.
E.g. Assume you want to add
and
as a synonym for&&
. Currently one has to look at the code to find the precedence of&&
and use the same. And of course, that means it cannot be done dynamically, on runtime.Or you may just need to look up whether an operator is registered. Currently the only way to do that is to try and parse a test expression.
This could be done in a number of ways:
unary_ops
andbinary_ops
onjsep
.binaryPrecedence()
, we just need to expose it.@EricSmekens Once I know how you'd rather proceed, I can implement it and send a PR.
And while we're at it, we could also expose
isDecimalDigit
,isIdentifierStart
etc so they can be overridden, to create an even more extensible parser 😁The text was updated successfully, but these errors were encountered: