Advertisement
Guest User

Untitled

a guest
Jan 10th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.26 KB | None | 0 0
  1. grammar Number { token TOP { <scalar> }; token scalar { 'one' | 'two' } }; class Actions { method TOP($/) { make $<scalar>.made; }; method scalar($/) { with $/.Str { when 'one' { make 1 }; when 'two' { make 2 }; } } }; Number.parse('one', actions => Actions).made.say;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement