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
$n with n zero or negative is allowed for reference to tokens and groupings on the stack before those that match the current rule. This is a very risky practice, and to use it reliably you must be certain of the context in which the rule is applied. Here is a case in which you can use this reliably:
foo:
expr bar '+' expr { … }
| expr bar '-' expr { … }
;
bar:
%empty { previous_expr = $0; }
;
As long as bar is used only in the fashion shown here, $0 always refers to the expr which precedes bar in the definition of foo.
As bison/jison/jison-gho support location references as well, format @n or @label, the above implies @-1 is a legal location ref.
…lon rule (which has no location info); add / introduce the `lexer::deriveLocationInfo()` API to help you & us to construct a more-or-less useful/sane location info object from the context surrounding it when the requested location info itself is not available.
bison+jison-gho support
$n
for n <= 0:Quoting the bison manual at https://www.gnu.org/software/bison/manual/html_node/Actions.html (bold emphasis mine):
As bison/jison/jison-gho support location references as well, format
@n
or@label
, the above implies@-1
is a legal location ref.That FAILS since 0.6.0-??? when we switched to parsing / validating action code chunks via a patched recast library: https://github.com/GerHobbelt/recast :: https://www.npmjs.com/package/@gerhobbelt/recast which recognizes all jison-gho supported reference types:
$n
,@n
,#n
,##n
,#label#
... but still barfs on@-1
.Note
Given this, I expect my patched recast/esprima also barfs on
#-1
and##-1
...The text was updated successfully, but these errors were encountered: