Created
November 16, 2023 18:15
-
-
Save hythm7/e47e868bc4b3be776b38125679b935cd to your computer and use it in GitHub Desktop.
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 raku | |
use experimental :rakuast; | |
my $token1 = RakuAST::TokenDeclaration.new( | |
scope => "my", | |
name => RakuAST::Name.from-identifier("token1"), | |
body => RakuAST::Regex::Alternation.new( | |
RakuAST::Regex::Literal.new("a"), | |
RakuAST::Regex::Literal.new("b") | |
) | |
).EVAL; | |
say 'a' ~~ $token1; # 「a」 | |
my $token2 = RakuAST::TokenDeclaration.new( | |
scope => "my", | |
name => RakuAST::Name.from-identifier("token2"), | |
body => RakuAST::Regex::Alternation.new( | |
<a b>.map({ RakuAST::Regex::Literal.new($_) }) | |
) | |
).EVAL; # No such method 'visit-children' for invocant of type 'Seq' | |
say 'a' ~~ $token2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment