diff --git a/src/ARE/Actions.pm b/src/ARE/Actions.pm index 5cbf1d2..a82db2f 100644 --- a/src/ARE/Actions.pm +++ b/src/ARE/Actions.pm @@ -50,7 +50,9 @@ method quantified_atom($/) { } method atom($/) { - my $past := PAST::Regex.new( ~$/, :pasttype, :node($/) ); + my $past := $ + ?? $.ast + !! PAST::Regex.new( ~$/, :pasttype, :node($/) ); make $past; } @@ -64,6 +66,10 @@ method quantifier:sym($/) { make PAST::Regex.new( :pasttype, :min(0), :max(1), :node($/) ); } +method metachar:sym<.>($/) { + make PAST::Regex.new( :pasttype, :subtype<.>, :node($/) ); +} + sub buildsub($rpast, $block = PAST::Block.new() ) { $rpast := PAST::Regex.new( diff --git a/src/ARE/Grammar.pm b/src/ARE/Grammar.pm index d9e60ac..3678142 100644 --- a/src/ARE/Grammar.pm +++ b/src/ARE/Grammar.pm @@ -20,7 +20,7 @@ token quantified_atom { token atom { [ | \w [ \w+! ]? -# | + | ] } @@ -29,4 +29,10 @@ token quantifier:sym<*> { } token quantifier:sym<+> { } token quantifier:sym { } +proto token metachar { <...> } +token metachar:sym<.> { } +token metachar:sym { \\ } + +proto token backslash { <...> } +token backslash:sym { $=[<[dswnDSWN]>] }