This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use v6; | |
| grammar G1 { | |
| token TOP { \w { make (2, 4, 6, 8) } } | |
| } | |
| grammar G2 { | |
| token TOP { \w { $/.make: (2, 4, 6, 8) } } | |
| } | |
| grammar G3 { | |
| token TOP { \w } | |
| } | |
| class A1 { | |
| method TOP ($/) { make (2, 4, 6, 8) } | |
| } | |
| class A2 { | |
| method TOP ($/) { $/.make: (2, 4, 6, 8) } | |
| } | |
| class A3 { | |
| method TOP ($m) { $m.make: (2, 4, 6, 8) } | |
| } | |
| say 'make in grammar: ', G1.parse("a").made.perl; | |
| say '$/.make in grammar: ', G2.parse("a").made.perl; | |
| say 'make in class: ', G3.parse("a", :actions(A1)).made.perl; | |
| say '$/.make in class: ', G3.parse("a", :actions(A2)).made.perl; | |
| say '$m.make in class: ', G3.parse("a", :actions(A3)).made.perl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| make in grammar: (2, 4, 6, 8) | |
| $/.make in grammar: (2, 4, 6, 8) | |
| make in class: (2, 4, 6, 8) | |
| $/.make in class: $(2, 4, 6, 8) | |
| $m.make in class: $(2, 4, 6, 8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment