Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2022-07-21T01:15:33.507932Z

Updated

2022-07-21T01:15:33.507932Z

grammar G {
    token TOP { <sentRefEnd> }
    token word { \w+ }
    token sentence { <word>+ % <.ws> <endPunc> }
    token sentRefEnd { <sentence>+ <ref> }
    # token sentRefEnd { <char>+? <endPunc> <ref> }
    token endPunc { \. }
    token ref { \(\d+\) }
}

class GActions {
  method sentRefEnd($/) {
    say $/.Str;
  }
}

my $book = "Hello how are you.(1)";
my $match = G.parse($book, :actions(GActions.new()));
say $match;
INFO