Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ─> cat test
- grammar Foo {
- token TOP { <bottom> }
- token bottom { <?> }
- }
- class Foo::Actions {
- method TOP($/) {
- my $grmr := Metamodel::GrammarHOW.new_type(name => 'BNFGrammar');
- $grmr.^add_method('TOP', token { <foo> });
- $grmr.^add_method('foo', $<bottom>.ast);
- $grmr.^compose;
- {
- my $/;
- say $grmr.new.parse('bar');
- }
- }
- method bottom($/) {
- make token { "bar" }
- }
- }
- Foo.new.parse('', :actions(Foo::Actions.new))
- ─> perl6 test
- 「bar」
- foo => 「bar」
- ─> diff -uN test test.fail
- --- test 2015-04-19 16:13:23.475552957 +0200
- +++ test.fail 2015-04-19 16:13:47.147928163 +0200
- @@ -7,7 +7,7 @@
- method TOP($/) {
- my $grmr := Metamodel::GrammarHOW.new_type(name => 'BNFGrammar');
- $grmr.^add_method('TOP', token { <foo> });
- - $grmr.^add_method('foo', $<bottom>.ast);
- + $grmr.^add_method('foo', $<bottom>.ast[0]);
- $grmr.^compose;
- {
- my $/;
- @@ -16,7 +16,7 @@
- }
- method bottom($/) {
- - make token { "bar" }
- + make [token { "bar" }]
- }
- }
- ─> perl6 test.fail
- Cannot find method 'postcircumfix:<( )>'
- in regex at test.fail:9
- in method parse at src/gen/m-CORE.setting:16692
- in method TOP at test.fail:14
- in regex TOP at test.fail:2
- in method parse at src/gen/m-CORE.setting:16692
- in block <unit> at test.fail:23
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement