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
{{ message }}
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.
%pragma parser.lookahead 0
%skip space \s
%token int \d+
%token div / -> div
%token div:int [1-9]\d* -> __shift__ * 1
%token mul \* -> mul
%token mul:int \d+ -> __shift__ * 1
#root:
<int> ( ::mul:: <int> #multiply | ::div:: <int> #divide )*
// this line is superfluous
%token mul:mul \*
Source
1**1
Results
Parsing above scenario leads to expected exception, since lexeme * is not allowed in rules. In thrown UnexpectedToken
the namespace of the corresponding token could be mentioned (helpful when having multiple namespaces using same token identifiers)
Hoa\Compiler\Exception\UnexpectedToken: Unexpected token "*" (mul) at line 1 and column 3:
1**1
↑ in /Users/olly/Development/Packages/fluid-compiler/vendor/hoa/compiler/Llk/Parser.php on line 1
With adjustments
Hoa\Compiler\Exception\UnexpectedToken: Unexpected token "*" (mul:mul) at line 1 and column 3:
1**1
↑ in /Users/olly/Development/Packages/fluid-compiler/vendor/hoa/compiler/Llk/Parser.php on line 1
The text was updated successfully, but these errors were encountered:
ohader
changed the title
Enhance context output of UnexpectedToken
Enhance context output of UnexpectedToken exception
Oct 6, 2020
ohader
added a commit
to ohader/Compiler
that referenced
this issue
Oct 6, 2020
Grammar
Source
Results
Parsing above scenario leads to expected exception, since lexeme
*
is not allowed in rules. In thrownUnexpectedToken
With adjustments
The text was updated successfully, but these errors were encountered: