Skip to content
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

Potential missing error text #3766

Closed
p6rt opened this issue Mar 31, 2015 · 5 comments
Closed

Potential missing error text #3766

p6rt opened this issue Mar 31, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 31, 2015

Migrated from rt.perl.org#124219 (status was 'resolved')

Searchable as RT124219$

@p6rt
Copy link
Author

p6rt commented Mar 31, 2015

From @drforr

OS​: Ubuntu Linux 14.04 LTS in VirtualBox
Host​: Windows 8
Rakudo version​: git pull from 25/3/2015

Issue 1​: Are we missing the line​:

------> token TOP { <term>⏏ % \n }

in the error message?

Issue 2​: Should the quantifier be required?

Assume you're debugging this grammar fragment​: " token top-level {
<list>* % \, } token list { [ <list> | <term> ]* % \, } " - A fairly
simple (albeit left-recursive) fragment of a common grammar pattern.
If you're allowed to temporarily delete the quantifiers, $/<top-level>
is an array reference to a single $/<list> match, and your actions get
what they're expecting, an array.
If you're not allowed to delete the quantifiers, you get " token
top-level { <list> } token list { [ <list> | <term> ] } " and
$/&lt;top-level&gt; is simply a $/<list>, and not $/<top-level>[0] as your
actions expect. So you have to change the actions as well.

Error​:
--cut here--
perl6 ~/bug.t
===SORRY!=== Error while compiling /home/jgoff/bug.t
Missing quantifier on the left argument of %
at /home/jgoff/bug.t​:3
--cut here--

--cut here--
grammar Bug {
  token term { a }
  token TOP { <term> % \n }
}
Bug.parse( 'a' );
--cut here--

@p6rt
Copy link
Author

p6rt commented Aug 19, 2016

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 19, 2016

From @coke

On Tue Mar 31 12​:50​:50 2015, drforr@​pobox.com wrote​:

OS​: Ubuntu Linux 14.04 LTS in VirtualBox
Host​: Windows 8
Rakudo version​: git pull from 25/3/2015

Issue 1​: Are we missing the line​:

------> token TOP { <term>⏏ % \n }

in the error message?

Issue 2​: Should the quantifier be required?

Assume you're debugging this grammar fragment​: " token top-level {
<list>* % \, } token list { [ <list> | <term> ]* % \, } " - A fairly
simple (albeit left-recursive) fragment of a common grammar pattern.
If you're allowed to temporarily delete the quantifiers, $/<top-level>
is an array reference to a single $/<list> match, and your actions get
what they're expecting, an array.
If you're not allowed to delete the quantifiers, you get " token
top-level { <list> } token list { [ <list> | <term> ] } " and
$/&lt;top-level&gt; is simply a $/<list>, and not $/<top-level>[0] as your
actions expect. So you have to change the actions as well.

Error​:
--cut here--
perl6 ~/bug.t
===SORRY!=== Error while compiling /home/jgoff/bug.t
Missing quantifier on the left argument of %
at /home/jgoff/bug.t​:3
--cut here--

--cut here--
grammar Bug {
token term { a }
token TOP { <term> % \n }
}
Bug.parse( 'a' );
--cut here--

This is fixed, and closable with tests.

$ perl6 /tmp/a.p6
===SORRY!=== Error while compiling /tmp/a.p6
Missing quantifier on the left argument of %
at /tmp/a.p6​:3
------> token TOP { <term> %⏏ \n }

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 10, 2016

From @zoffixznet

Tests added in Raku/roast@d633c0411c

@p6rt
Copy link
Author

p6rt commented Sep 10, 2016

@zoffixznet - Status changed from 'open' to 'resolved'

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

No branches or pull requests

1 participant