Pegmatite::Pattern::Choice
Inherits Pegmatite::Pattern < Pegmatite::DSL::Methods < Reference < Object
Pattern::Choice is used to specify an ordered choice of patterns.
Returns the result of the first child pattern that matched. Returns the longest-length failure of all child patterns fail.
Constructors
Instance methods
_match(source, offset, state) : MatchResult
Sourcedescription
Sourcedsl_name
Sourceinspect(io)
Sourcematch(source, offset, state) : MatchResult
Explicitly memoize Choice patterns, which happens to have a significant speedup on otherwise troublesome grammars with a lot of backtracking. We don't do this for other patterns.