CharRecognizer
A specialized recognizer trait for character-based input streams.
This trait extends Recognizer to provide convenient patterns and utilities for working with character input, such as string matching, whitespace handling, and common character classifications.
Type parameters
- W
-
the wrapped value type
Attributes
- Graph
-
- Supertypes
Members list
Type members
Inherited classlikes
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class ChoicePointobject Fence
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Choiceclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
The core pattern type representing a pattern to match.
The core pattern type representing a pattern to match.
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Represents the execution state during pattern matching.
Represents the execution state during pattern matching.
Value parameters
- pat
-
the initial pattern to match
- pointer
-
the current input position
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Attributes
- Inherited from:
- Recognizer
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait Patternclass Objecttrait Matchableclass AnyShow all
Inherited types
Type alias for the input type used by this recognizer
Value members
Concrete methods
Creates a pattern that matches a keyword followed by a non-alphanumeric character and whitespace.
Creates a pattern that matches a keyword followed by a non-alphanumeric character and whitespace.
This is useful for matching keywords in programming languages where keywords must be followed by something other than a letter, digit, or underscore.
Value parameters
- s
-
the keyword string to match
Attributes
- Returns
-
a pattern matching the keyword followed by a non-alphanumeric and whitespace
Captures the text matched by a pattern as a string.
Captures the text matched by a pattern as a string.
Value parameters
- p
-
the pattern to match
Attributes
- Returns
-
a pattern that captures the matched input as a string
Creates a pattern that matches a symbol followed by whitespace.
Creates a pattern that matches a symbol followed by whitespace.
This is useful for matching syntactic elements like operators or punctuation in programming languages.
Value parameters
- s
-
the symbol string to match
Attributes
- Returns
-
a pattern matching the symbol followed by whitespace
Inherited methods
Cut operator - disallows backtracking past this point.
Cut operator - disallows backtracking past this point.
Attributes
- Returns
-
a pattern representing a cut point
- Inherited from:
- Recognizer
Creates a pattern that applies an action to a single value on the stack.
Creates a pattern that applies an action to a single value on the stack.
Value parameters
- f
-
the action function
Attributes
- Returns
-
a pattern that applies the action
- Inherited from:
- Recognizer
Creates a pattern that applies an action to two values on the stack.
Creates a pattern that applies an action to two values on the stack.
Value parameters
- f
-
the action function
Attributes
- Returns
-
a pattern that applies the action
- Inherited from:
- Recognizer
Creates a pattern that applies an action to three values on the stack.
Creates a pattern that applies an action to three values on the stack.
Value parameters
- f
-
the action function
Attributes
- Returns
-
a pattern that applies the action
- Inherited from:
- Recognizer
Creates a pattern that applies an action to four values on the stack.
Creates a pattern that applies an action to four values on the stack.
Value parameters
- f
-
the action function
Attributes
- Returns
-
a pattern that applies the action
- Inherited from:
- Recognizer
Creates a pattern that matches any element.
Creates a pattern that matches any element.
Attributes
- Returns
-
a pattern that matches any element
- Inherited from:
- Recognizer
Creates a pattern that matches any element in a specified set.
Creates a pattern that matches any element in a specified set.
Value parameters
- es
-
the elements to match against
Attributes
- Returns
-
a pattern that matches any element in the set
- Inherited from:
- Recognizer
Creates a pattern that captures the region matched by a pattern and applies an action.
Creates a pattern that captures the region matched by a pattern and applies an action.
Value parameters
- action
-
a function that processes the start and end positions
- p
-
the pattern to match
Attributes
- Returns
-
a pattern that captures the matched region
- Inherited from:
- Recognizer
Creates a pattern that captures the wrapped values matched by a pattern.
Creates a pattern that captures the wrapped values matched by a pattern.
Value parameters
- p
-
the pattern to match
Attributes
- Returns
-
a pattern that captures the wrapped values
- Inherited from:
- Recognizer
Creates a pattern that matches any element satisfying a predicate.
Creates a pattern that matches any element satisfying a predicate.
Value parameters
- c
-
the predicate function
Attributes
- Returns
-
a pattern that matches elements satisfying the predicate
- Inherited from:
- Recognizer
A pattern that always fails.
A pattern that always fails.
Attributes
- Returns
-
a pattern that always fails
- Inherited from:
- Recognizer
Creates a fence marker for backtracking control.
Creates a fence marker for backtracking control.
Attributes
- Returns
-
a pattern representing a fence
- Inherited from:
- Recognizer
Positive look-behind
Positive look-behind
Value parameters
- p
-
the predicate
Attributes
- Returns
-
a pattern that matches if there is a previous element that matches p
- Inherited from:
- Recognizer
Creates a pattern with lazy evaluation, useful for recursive pattern definitions.
Creates a pattern with lazy evaluation, useful for recursive pattern definitions.
Value parameters
- p
-
a function that returns a pattern when called
Attributes
- Returns
-
a non-strict pattern that evaluates p when needed
- Inherited from:
- Recognizer
Creates a pattern that matches any element not in a specified set.
Creates a pattern that matches any element not in a specified set.
Value parameters
- es
-
the elements to exclude
Attributes
- Returns
-
a pattern that matches any element not in the set
- Inherited from:
- Recognizer
A pattern that always succeeds without consuming input.
A pattern that always succeeds without consuming input.
Attributes
- Returns
-
a pattern that always succeeds
- Inherited from:
- Recognizer
Creates a negative lookahead pattern that succeeds only if the given pattern fails.
Creates a negative lookahead pattern that succeeds only if the given pattern fails.
Value parameters
- p
-
the pattern to negate
Attributes
- Returns
-
a pattern that succeeds only if p fails
- Inherited from:
- Recognizer
Negative look-behind
Negative look-behind
Value parameters
- p
-
the predicate
Attributes
- Returns
-
a pattern that matches if there is no previous element that matches p
- Inherited from:
- Recognizer
Creates an optional pattern that succeeds even if the given pattern fails.
Creates an optional pattern that succeeds even if the given pattern fails.
Value parameters
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that succeeds whether p matches or not
- Inherited from:
- Recognizer
Creates an optional pattern with action that applies a function to the matched value if the pattern succeeds, or pushes None if it fails.
Creates an optional pattern with action that applies a function to the matched value if the pattern succeeds, or pushes None if it fails.
Value parameters
- f
-
the action function
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes Some(result) or None
- Inherited from:
- Recognizer
Creates an optional pattern that preserves the matched value if the pattern succeeds, or pushes None if it fails.
Creates an optional pattern that preserves the matched value if the pattern succeeds, or pushes None if it fails.
Value parameters
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes Some(value) or None
- Inherited from:
- Recognizer
Creates a right-associative optional pattern.
Creates a right-associative optional pattern.
This is like opt() but with reversed order of alternatives, which can affect the order of backtracking.
Value parameters
- p
-
the pattern that is optional
Attributes
- Returns
-
a right-associative optional pattern
- Inherited from:
- Recognizer
Creates a right-associative optional pattern with action.
Creates a right-associative optional pattern with action.
Value parameters
- f
-
the action function
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes None or Some(result)
- Inherited from:
- Recognizer
Creates a right-associative optional pattern that preserves the matched value.
Creates a right-associative optional pattern that preserves the matched value.
Value parameters
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes None or Some(value)
- Inherited from:
- Recognizer
Creates a right-associative optional pattern with transformation.
Creates a right-associative optional pattern with transformation.
Value parameters
- arity
-
the number of values to transform
- f
-
the transformation function
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes None or Some(result)
- Inherited from:
- Recognizer
Creates an optional pattern with transformation that applies a function to matched values if the pattern succeeds, or pushes None if it fails.
Creates an optional pattern with transformation that applies a function to matched values if the pattern succeeds, or pushes None if it fails.
Value parameters
- arity
-
the number of values to transform
- f
-
the transformation function
- p
-
the pattern that is optional
Attributes
- Returns
-
a pattern that pushes Some(result) or None
- Inherited from:
- Recognizer
Creates a pattern that pushes the current input position onto the value stack.
Creates a pattern that pushes the current input position onto the value stack.
Attributes
- Returns
-
a pattern that captures the current position
- Inherited from:
- Recognizer
Creates a pattern that pushes a value onto the value stack.
Creates a pattern that pushes a value onto the value stack.
Value parameters
- v
-
the value to push
Attributes
- Returns
-
a pattern that pushes the value
- Inherited from:
- Recognizer
Creates a pattern that matches zero or more repetitions of a given pattern.
Creates a pattern that matches zero or more repetitions of a given pattern.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern matching zero or more occurrences of p
- Inherited from:
- Recognizer
Creates a pattern that matches one or more repetitions of a given pattern.
Creates a pattern that matches one or more repetitions of a given pattern.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern matching one or more occurrences of p
- Inherited from:
- Recognizer
Creates a pattern that matches one or more repetitions and collects transformed values.
Creates a pattern that matches one or more repetitions and collects transformed values.
Value parameters
- f
-
the action function to apply to each match
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a pattern that matches one or more repetitions and collects the matched values.
Creates a pattern that matches one or more repetitions and collects the matched values.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects matched values into a list
- Inherited from:
- Recognizer
Creates a pattern that matches one or more repetitions and collects transformed values.
Creates a pattern that matches one or more repetitions and collects transformed values.
Value parameters
- arity
-
the number of values to transform for each match
- f
-
the transformation function
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a pattern that matches zero or more repetitions and collects transformed values.
Creates a pattern that matches zero or more repetitions and collects transformed values.
Value parameters
- f
-
the action function to apply to each match
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a pattern that matches zero or more repetitions and collects the matched values.
Creates a pattern that matches zero or more repetitions and collects the matched values.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects matched values into a list
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches zero or more repetitions.
Creates a right-associative pattern that matches zero or more repetitions.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern matching zero or more occurrences of p
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches one or more repetitions.
Creates a right-associative pattern that matches one or more repetitions.
This is similar to rep1 but with right-associative nesting of repetitions.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern matching one or more occurrences of p
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches one or more repetitions and collects transformed values.
Creates a right-associative pattern that matches one or more repetitions and collects transformed values.
Value parameters
- f
-
the action function to apply to each match
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches one or more repetitions and collects the matched values.
Creates a right-associative pattern that matches one or more repetitions and collects the matched values.
Value parameters
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern that collects matched values into a list
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches one or more repetitions and collects transformed values.
Creates a right-associative pattern that matches one or more repetitions and collects transformed values.
Value parameters
- arity
-
the number of values to transform for each match
- f
-
the transformation function
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches zero or more repetitions and collects transformed values.
Creates a right-associative pattern that matches zero or more repetitions and collects transformed values.
Value parameters
- f
-
the action function to apply to each match
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a right-associative pattern that matches zero or more repetitions and collects transformed values.
Creates a right-associative pattern that matches zero or more repetitions and collects transformed values.
Value parameters
- arity
-
the number of values to transform for each match
- f
-
the transformation function
- p
-
the pattern to repeat
Attributes
- Returns
-
a right-associative pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Creates a pattern that matches zero or more repetitions and collects transformed values.
Creates a pattern that matches zero or more repetitions and collects transformed values.
Value parameters
- arity
-
the number of values to transform for each match
- f
-
the transformation function
- p
-
the pattern to repeat
Attributes
- Returns
-
a pattern that collects transformed values into a list
- Inherited from:
- Recognizer
Continues running from an existing runstate to find the next match.
Continues running from an existing runstate to find the next match.
Value parameters
- state
-
the current execution state
Attributes
- Returns
-
Some((value, remaining input, runstate)) if match succeeded, None if failed
- Inherited from:
- Recognizer
Core pattern matching engine that executes patterns against input.
Core pattern matching engine that executes patterns against input.
Value parameters
- state
-
the current execution state
Attributes
- Returns
-
Some((value, remaining input, runstate)) if match succeeded, None if failed
- Inherited from:
- Recognizer
Runs a pattern on input and returns the first match.
Runs a pattern on input and returns the first match.
Value parameters
- input
-
the input to match against
- pat
-
the pattern to match
Attributes
- Returns
-
Some((value, remaining input, runstate)) if match succeeded, None if failed
- Inherited from:
- Recognizer
Runs a pattern on input and returns all possible matches.
Runs a pattern on input and returns all possible matches.
Value parameters
- input
-
the input to match against
- pat
-
the pattern to match
Attributes
- Returns
-
a list of all possible matches and remaining inputs
- Inherited from:
- Recognizer
Creates a pattern that matches a sequence of elements.
Creates a pattern that matches a sequence of elements.
Value parameters
- es
-
the elements to match in sequence
Attributes
- Returns
-
a pattern matching the given sequence of elements
- Inherited from:
- Recognizer
Creates a pattern that tests the top value on the stack against a predicate.
Creates a pattern that tests the top value on the stack against a predicate.
Value parameters
- c
-
the predicate function
Attributes
- Returns
-
a pattern that succeeds if the predicate returns true
- Inherited from:
- Recognizer
Creates a pattern that tests values on the stack against a predicate.
Creates a pattern that tests values on the stack against a predicate.
Value parameters
- c
-
the predicate function
Attributes
- Returns
-
a pattern that succeeds if the predicate returns true
- Inherited from:
- Recognizer
Creates a pattern that transforms values on the stack.
Creates a pattern that transforms values on the stack.
Value parameters
- arity
-
the number of values to transform
- f
-
the transformation function
Attributes
- Returns
-
a pattern that applies the transformation
- Inherited from:
- Recognizer
Concrete fields
Pattern that matches any alphabetic character.
Pattern that matches any alphabetic character.
Attributes
Pattern that matches any alphanumeric character (letter or digit).
Pattern that matches any alphanumeric character (letter or digit).
Attributes
Pattern that matches any digit character.
Pattern that matches any digit character.
Attributes
Pattern that matches one or more digit characters.
Pattern that matches one or more digit characters.
Attributes
Pattern that matches an identifier: a letter or underscore followed by zero or more letters, digits, or underscores, followed by whitespace.
Pattern that matches an identifier: a letter or underscore followed by zero or more letters, digits, or underscores, followed by whitespace.
Attributes
Pattern that matches a numeric literal in various formats:
Pattern that matches a numeric literal in various formats:
- Integer: one or more digits
- Decimal: digits with decimal point
- Scientific notation: decimal or integer with optional exponent
Attributes
Pattern that matches any whitespace character.
Pattern that matches any whitespace character.
Attributes
Pattern that matches zero or more whitespace characters.
Pattern that matches zero or more whitespace characters.
Attributes
Inherited fields
Execution limit for pattern matching, useful for debugging infinite loops. Set to Int.MaxValue by default (effectively unlimited).
Execution limit for pattern matching, useful for debugging infinite loops. Set to Int.MaxValue by default (effectively unlimited).
Attributes
- Inherited from:
- Recognizer
Implicits
Inherited implicits
Implicitly converts an element to a pattern that matches that element.
Implicitly converts an element to a pattern that matches that element.
Value parameters
- e
-
the element to match
Attributes
- Returns
-
a pattern that matches the given element
- Inherited from:
- Recognizer