Skip to content
Kare Morstol edited this page Jul 1, 2020 · 9 revisions

Types

  • Link: Matches one line, not including newline characters.
  • Line.Start: Matches the start of a line, including the start of input.
  • Line.End: Matches the end of a line, including the end of input.
  • Literal: Matches a sequence of elements.
  • OneOf: Matches and consumes a single element.
  • Word
  • Word.Boundary: Detects boundaries between words.
  • Parser.Match.MatchDecoder
  • Grammar: Allows for recursive patterns, also indirectly.
  • Grammar.CallPattern: Calls another subpattern in a grammar.
  • AndPattern: A pattern which matches the wrapped pattern, without consuming any input.
  • AnyPattern: A type erased wrapper around a pattern. Can be used to store patterns in arrays and non-generic variables.
  • AnyPattern.StringInterpolation
  • Capture: Captures the current position as a range.
  • NoPattern: A pattern that does absolutely nothing.
  • OrPattern: A pattern which first tries the first pattern, if that fails it tries the second pattern from the same position.
  • Concat: A pattern which first tries the first pattern, if that succeeds it continues with the second pattern.
  • NotPattern: A pattern which only succeeds if the wrapped pattern fails. The next pattern will continue from where wrapped started.
  • RepeatPattern: Repeats the wrapped pattern min times, then repeats it optionally max-min times. Or an unlimited number of times if max is nil.
  • Skip: Skips 0 or more elements until a match for the next patterns are found.
  • Parser: Takes a pattern, optimises it and tries to match it over an input.
  • Parser.PatternError: Indicates a problem with a malformed pattern.
  • Parser.Match: Contains information about a patterns successfully completed match.
  • Instruction: The instructions used by patterns in createInstructions.

Protocols

Operators

  • •(lhs:rhs:)
  • •(lhs:rhs:)
  • •(lhs:rhs:)
  • •(lhs:rhs:)
  • /(lhs:rhs:)
  • /(lhs:rhs:)
  • <-(call:pattern:): Used by grammars to define subpatterns with g.a <- ....
  • <-(call:capture:): In case of g.name <- Capture(...), names the nameless Capture "name".
  • /(p1:p2:): First tries the pattern to the left, if that fails it tries the pattern to the right from the same position.
  • /(p1:p2:): First tries the pattern to the left, if that fails it tries the pattern to the right from the same position.
  • /(p1:p2:): First tries the pattern to the left, if that fails it tries the pattern to the right from the same position.
  • /(p1:p2:): First tries the pattern to the left, if that fails it tries the pattern to the right from the same position.
  • •(lhs:rhs:): First tries the pattern to the left, if that succeeds it tries the pattern to the right.
  • •(lhs:rhs:): First tries the pattern to the left, if that succeeds it tries the pattern to the right.
  • •(lhs:rhs:): First tries the pattern to the left, if that succeeds it tries the pattern to the right.
  • •(lhs:rhs:): First tries the pattern to the left, if that succeeds it tries the pattern to the right.
  • !(pattern:): Will only succeed if the following pattern fails. Does not consume any input.
  • !(pattern:): Will only succeed if the following pattern fails. Does not consume any input.
  • *(me:): Repeats the preceding pattern 0 or more times.
  • *(me:): Repeats the preceding pattern 0 or more times.
  • +(me:): Repeats the preceding pattern 1 or more times.
  • +(me:): Repeats the preceding pattern 1 or more times.
  • ¿(me:): Tries the preceding pattern, and continues even if it fails.
  • ¿(me:): Tries the preceding pattern, and continues even if it fails.

Global Functions

Global Variables

Clone this wiki locally