diff options
author | Mark Reay <mark@reay.net.au> | 2020-01-03 23:08:28 +0000 |
---|---|---|
committer | Mark Reay <mark@reay.net.au> | 2020-01-03 23:08:28 +0000 |
commit | 7f43e72c8ca4555105cd0b97863d3907f7fc62a5 (patch) | |
tree | 2f4e8c73c2dc1b1e54bedda8f54fb3b4d0a3b938 /lexilla/test/examples/raku/x.p6 | |
parent | b5623cb722b4ba7607979f52d4cf26e8be86f385 (diff) | |
download | scintilla-mirror-7f43e72c8ca4555105cd0b97863d3907f7fc62a5.tar.gz |
Added Raku lexer and style properties and example files
Diffstat (limited to 'lexilla/test/examples/raku/x.p6')
-rw-r--r-- | lexilla/test/examples/raku/x.p6 | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lexilla/test/examples/raku/x.p6 b/lexilla/test/examples/raku/x.p6 new file mode 100644 index 000000000..0cbdb6a57 --- /dev/null +++ b/lexilla/test/examples/raku/x.p6 @@ -0,0 +1,54 @@ +use v6; + +# Normal single line comment +my Int $i = 0; +my Rat $r = 3.142; +my Str $s = "Hello, world! \$i == $i and \$r == $r"; +say $s; + +#`{{ +*** This is a multi-line comment *** +}} + +my @array = #`[[ inline comment ]] <f fo foo food>; +my %hash = ( AAA => 1, BBB => 2 ); + +say q[This back\slash stays]; +say q[This back\\slash stays]; # Identical output +say Q:q!Just a literal "\n" here!; + +=begin pod +POD Documentation... +=end pod + +say qq:to/END/; +A multi-line +string with interpolated vars: $i, $r +END + +sub function { + return q:to/END/; +Here is +some multi-line +string +END +} + +my $func = &function; +say $func(); + +grammar Calculator { + token TOP { <calc-op> } + proto rule calc-op {*} + rule calc-op:sym<add> { <num> '+' <num> } + rule calc-op:sym<sub> { <num> '-' <num> } + token num { \d+ } +} + +class Calculations { + method TOP ($/) { make $<calc-op>.made; } + method calc-op:sym<add> ($/) { make [+] $<num>; } + method calc-op:sym<sub> ($/) { make [-] $<num>; } +} + +say Calculator.parse('2 + 3', actions => Calculations).made; |