Talk language extensions

Run Settings
LanguageRaku
Language Version
Run Command
my $file = slurp 'data.sm'; my @Extensions = []; sub Parse-Extension(\file, $ext is copy) { my $out = ""; my $replace = ($ext ~~ m:g/^^Replace': '(\N+)/)[0][0].Str; my $structure = ($ext ~~ m:g/^^Captures': '(\N+)/)[0][0].Int; my @l; for $ext.lines { given .trim-leading() { when /^'$'(\d)': '(\N+)$/ { my @m = $/.list; push @l, @m>>.Str; } } } for (file ~~ m:g/(<$(@l[0][1])>)(<$(@l[1][1])>)(<$(@l[2][1])>)/).list { my @match = $_>>.Str; my $rep = $replace.subst(/'$'0/, @match[0]).subst(/'$'1/, @match[1]).subst(/'$'2/, @match[2]); file ~~ s:g/$(@match.join.Str)/$rep/; } } for $file.lines -> $line { given $line { when /^'#:'Extend\swith\s(\N+?)$/ { push @Extensions, slurp "$0" } } } for @Extensions -> $ext { Parse-Extension $file, $ext; } say $file;
#:Extend with extension.sme make a be 5 if a is in <1 2 3> or a is in <4 5 6> say true end
#Importance and Captures don't actually do anything yet Importance: Normal Captures: 3 Find: $0: <|w>is\s+in\s+ $1: .+? $2: and||or||$$ Replace: ~~ one $1 $2
Editor Settings
Theme
Key bindings
Full width
Lines