Support `onShift` hook
DmitrySoshnikov opened this issue · 1 comments
DmitrySoshnikov commented
Currently we have a semantic action per the whole production, which is called onReduce
action. For a better parser-lexer communication we could build a semantic action per each symbol on RHS ("before", and "after" hooks). Alternatively we can provide a generic onShift
hook which can receive a production, symbol, lexer/parser instance, etc, and do some action (e.g. set a lexer state).
function onBeforeShift(grammarSymbol, production, lexer, parser, ...) {
// do actions on shift
}
function onShift(...) { ... }
Object : "{" Props "}" { $$ = $1 + $2 }
Here onBeforeShift
, and onShift
is called for {
and }
.
DmitrySoshnikov commented
Fixed in 8b63df8.