neotomex
neotomex copied to clipboard
Labelled Matches
neotoma has a neat facility for labelling matches:
string <- '"' chars:(!'"' ("\\\\" / '\\"' / .))* '"'
It then labels the match using a tuple, for example {:chars, ...}
. This is awesome when there is a sequence of matches since it turns it into a keyword list. Even if only some elements are labelled, e.g. [{:chars, "1"}, "2]
the keyword functions still work.
This serves a similar purpose as #4, throwaway matches.