New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<!after <token>> (mis)matching backwards #1659

Open
ronaldxs opened this Issue Mar 27, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@ronaldxs
Contributor

ronaldxs commented Mar 27, 2018

The Problem

<!after > on a token is matching backwards

Discussed on #perl6 March 27

Steps to Reproduce

#use Grammar::Tracer;

grammar g {
    token keywords { 'or' }

    token BASEIDENT {\w+<!after <keywords>>}
    token BASEIDENT_SIMPLER {\w+<!after 'or'>}

    token TOP { <BASEIDENT> }
}

say so g.parse('a');
say so g.parse('ro'); # this should match - looks wrong
say so g.parse('ro', :rule<BASEIDENT>); # same as above as expected
say so g.parse('ro', :rule<BASEIDENT_SIMPLER>); # different from above

my token keywordz {
  'or'
}
say so "a" ~~ /\w+<!after <keywordz>>/;
say so "ro" ~~ /\w+<!after <keywordz>>/;

# Grammar::Tracer shows ro matching or
# TOP
# |  BASEIDENT
# |  |  keywords
# |  |  * MATCH "or"
# |  * FAIL
# * FAIL

Environment

  • Operating system: Ubuntu 14.04.5 LTS
  • Compiler version (perl6 -v): Rakudo version 2018.03 built on MoarVM version 2018.03

Related RT

Related RT 131964

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment