On Wed Jan 13 14:15:22 2010, m...@kli.org wrote: > Here are two files; one works (shows a match), and one errors with > > get_attr_str() not implemented in class 'Integer' > in Main (file src/gen_setting.pm, line 324) > > > ========================================== > # This one works: > > use v6; > > grammar Simpl { > token xxx { 'x' } > token c { 'c' } > token end { '!' } > > token xc { <xxx>*<c> } > token xend { <xxx>*<end> } > } > > my $sample="cx!"; > my $answer=($sample ~~ /<Simpl::xend>/); > say $answer.perl; > > ============================================ > # This one does not: > > use v6; > > # grammar Simpl { > token xxx { 'x' } > token c { 'c' } > token end { '!' } > > token xc { <xxx>*<c> } > token xend { <xxx>*<end> } > # } > > my $sample="cx!"; > my $answer=($sample ~~ /<xend>/); > say $answer.perl; > > ============================================ = > > Note that the only difference between them is whether or not I'm using > the grammar Simpl as a namespace for the regexps or leaving them at top > level. If my understanding of grammars is correct, using a grammar in > this way should be optional; I ought to be able to use the tokens > directly. Any ideas?
Yes. The problem boils down to this: $ perl6 -e '"" ~~ /<end>/' get_attr_str() not implemented in class 'Integer' In other words: as, a workaround, rename the token you call 'end' to something else. This is a name collision of some sort. There's something called 'end' somewhere in the PGE machinery. We've had similar bugs before, notably <http://rt.perl.org/rt3/Ticket/Display.html?id=57864>. (The symptoms are different in that one, but the underlying cause is the same or similar.)