Matchers
Provides methods for coding character pattern matchers.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Type members
Classlikes
Represents a successful match.
Represents a successful match.
Type parameters
- R
-
type of result value
Value parameters
- next
-
next character of input
- result
-
result value of the match
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass MatcherResult[R]class Objecttrait Matchableclass AnyShow all
Abstract matcher. A matcher is a function that maps character input to a result value.
Abstract matcher. A matcher is a function that maps character input to a result value.
Type parameters
- R
-
type of result value
Attributes
- Supertypes
Represents an unsuccessful match.
Represents an unsuccessful match.
Value parameters
- next
-
character at which the mismatch occurred
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass MatcherResult[Nothing]class Objecttrait Matchableclass AnyShow all
Case class for return sequence matcher results that can be pattern matched.
Case class for return sequence matcher results that can be pattern matched.
Type parameters
- A
-
type of left result value
- B
-
type of right result value
Value parameters
- a
-
left result value
- b
-
right result value
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Returns a matcher that will match any of a list of characters.
Returns a matcher that will match any of a list of characters.
Value parameters
- cs
-
argument list of characters
Attributes
- Returns
-
a matcher that only matches a character from a list
Returns a matcher that always succeeds as long as there is input remaining, matching one character.
Returns a matcher that always succeeds as long as there is input remaining, matching one character.
Attributes
- Returns
-
a matcher with the next input character as its result value, failing if there is no more input
Clears capture groups.
Clears capture groups.
Attributes
Returns a digit character matcher.
Returns a digit character matcher.
Attributes
Returns a matcher that matches the current input character if it is a member of a class of characters.
Returns a matcher that matches the current input character if it is a member of a class of characters.
Value parameters
- pred
-
predicate that determines if the current input character matches
Attributes
- Returns
-
a matcher for matching character classes
Returns a zero-length matcher that succeeds at the end of input.
Returns a zero-length matcher that succeeds at the end of input.
Attributes
- Returns
-
a matcher that succeeds at the end of input, fails otherwise.
Returns a matcher that always fails.
Returns a matcher that always fails.
Attributes
- Returns
-
a matcher that always fails with a result containing the current point in the input stream
Returns capture group.
Returns capture group.
Value parameters
- name
-
the name of the capture group to return
Attributes
- Returns
-
a capture group with is a pair of input objects: the first is the first character in the group, the second is the next input character after the end of the group.
Returns a matcher whose result is the same as the given matcher, but without consuming any input.
Returns a matcher whose result is the same as the given matcher, but without consuming any input.
Type parameters
- S
-
the type of the result value
Value parameters
- m
-
the given matcher
Attributes
- Returns
-
the new matcher
Returns a hex digit character matcher.
Returns a hex digit character matcher.
Attributes
Returns a letter character matcher.
Returns a letter character matcher.
Attributes
Returns a letter or digit character matcher.
Returns a letter or digit character matcher.
Attributes
Returns a zero-length matcher that succeeds if the previous input character is a member of a character class.
Returns a zero-length matcher that succeeds if the previous input character is a member of a character class.
Value parameters
- pred
-
predicate that determines inclusion in a character class
Attributes
Returns a lower case character matcher.
Returns a lower case character matcher.
Attributes
Returns a matcher that will matcher any character not in a list of characters.
Returns a matcher that will matcher any character not in a list of characters.
Value parameters
- cs
-
argument list of characters
Attributes
- Returns
-
a matcher that only matches a character not on a list
Returns a matcher that negates the result of the given matcher. No input is consumed.
Returns a matcher that negates the result of the given matcher. No input is consumed.
Type parameters
- S
-
the type of the result value of the given matcher
Value parameters
- m
-
the matcher whose result is negated
Attributes
- Returns
-
the new matcher
Returns a matcher that allows a matcher to succeed optionally.
Returns a matcher that allows a matcher to succeed optionally.
Type parameters
- S
-
the type of the optional result value
Value parameters
- m
-
the matcher to apply to the input.
Attributes
- Returns
-
a matcher with an optional result value
Returns a zero-length matcher that succeeds at the start of input.
Returns a zero-length matcher that succeeds at the start of input.
Attributes
- Returns
-
a matcher that succeeds at the start of input, fails otherwise.
Returns a space character matcher.
Returns a space character matcher.
Attributes
Returns a matcher to match against a string.
Returns a matcher to match against a string.
For example
def bracketed: Matcher[List[Char]] = "[[" ~> rep(not("]]") ~> char) <~ "]]"
Value parameters
- s
-
the string to match
Attributes
- Returns
-
a matcher that matches against a string, with that string as its result value if it succeeds
Returns the substring from a capture group.
Returns the substring from a capture group.
Value parameters
- name
-
the name of the capture group
Attributes
Returns a matcher that always succeeds.
Returns a matcher that always succeeds.
Type parameters
- R
-
the type of result value
Value parameters
- r
-
the result value
Attributes
- Returns
-
a matcher that always succeeds with a result value
Returns an upper case character matcher.
Returns an upper case character matcher.
Attributes
Concrete fields
The set of delimiters
The set of delimiters
Attributes
The set of reserved identifiers
The set of reserved identifiers
Attributes
Implicits
Implicits
Returns a matcher for a specific character. This combinator is an implicit function so that character literals can be lifted to the corresponding character matcher.
Returns a matcher for a specific character. This combinator is an implicit function so that character literals can be lifted to the corresponding character matcher.
For example
def tag: Matcher[String] = '<' ~> (letter|'_') ~ rep(letter|digit|'-'|'_'|'.') <~ '>'
Value parameters
- c
-
the character to be matched
Attributes
- Returns
-
the character matcher