Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Raku

Visibility

unlisted

Author

legacy-anonymous

Created

2022-07-21T01:06:28.093665Z

Updated

2022-07-21T01:06:28.093665Z

grammar G {
    token TOP { <sentRefEnd> }
    token sentFrag { <char>+ }
    token sentRefEnd { <sentFrag> <endPunc> <ref> }
    # token sentRefEnd { <char>+? <endPunc> <ref> }
    token endPunc { \. }
    token char { \w || \s | \.}
    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