in reply to Re^2: Perl6: Dynamic Grammars
in thread Perl6: Dynamic Grammars
grammar g { rule TOP { <bang> | <at> } rule bang { 'bang' '!' [<-[!]>*] '!' } } g.^add_method('at', rx { 'at' [\s*] '@' [<-[@]>*] '@' } ); # ... then do the above for each of the sigils g.^compose; say g.parse('bang !some text!'); say g.parse('at @some text@');
|
---|