Parser
that always succeeds.CharPredicate
that always returns true.Pattern
that always matches with match length 0
.CharPredicate
that returns true if the character is equal to any character in
chars
.Pattern
object that matches if the current character in the input is equal to any character in
chars
, in which case 1
is returned as match length.Patterns.among(chars).toScanner(name)
.chars
.Pattern
that matches if all of patterns
matches, in which case, the maximum match length
is returned.Pattern
that matches any character and only mismatches for an empty string.Parser
that consumes a token.Parser
that sequentially runs parsers
one by one and collects the return
values in an array.p.asOptional()
is equivalent to p?
in EBNF.Pattern
object that matches this pattern for at least min
times.Pattern
object that matches if the input starts with min
or more characters and all
satisfy predicate
.Pattern
object that matches this pattern for up to max
times.Parser
that undoes any partial match if this
fails.Parser.between(Parser, Parser)
.BinaryOperator
instead.begin
and ends with
end
.begin
and ends with
end
.begin
and ends with
end
.Parser
based on information in this OperatorTable
.Terminals
instance that recognizes words defined in this builder.operators(ops)
.words(Scanners.IDENTIFIER)
.caseInsensitiveKeywords(keywords)
.build()
instead.operators(ops)
.words(wordScanner)
.caseInsensitiveKeywords(keywords)
.build()
instead.operators(ops)
.words(wordScanner)
.tokenizeWordsWith(wordMap)
.caseInsensitiveKeywords(keywords)
.build()
instead.operators(ops)
.words(Scanners.IDENTIFIER)
.keywords(keywords)
.build()
instead.operators(ops)
.words(wordScanner)
.keywords(keywords)
.build()
instead.operators(ops)
.words(wordScanner)
.tokenizeWordsWith(wordMap)
.keywords(keywords)
.build()
instead.CharPredicate
implementations.from -> to
directly.Parser
that always returns v
regardless of input.Pattern
object that matches a decimal integer, which starts with a non-zero digit and is followed by 0 or
more digits.1, 10, 123
),
and converts the string to a Long
value.Pattern
object that matches a decimal number that could start with a decimal point or a digit.Tokens.Fragment
tagged as Tokens.Tag.DECIMAL
.'\'
),
and transforms the quoted content by applying escape characters.Parser
that succeeds only if EOF is met.Pattern
object that matches if the input has no character left.Pattern
object that succeeds with match length 2
if there are at least 2 characters in the input
and the first character is '\'
.Parser
that fails and reports that name
is logically expected.Parser
that always fails with message
.Pattern
object that matches a decimal point and one or more digits after it.Tokens.Fragment
tagged with tag
.Tokens.fragment()
instead.Parser
that takes as input the tokens returned by tokenizer
delimited by
delim
, and runs this
to parse the tokens.labeled
parsers syntactically enclosed inside parent parser.null
if none.Parsers.fail(String)
,
or null
if none.ParserException.getLine()
and ParserException.getColumn()
instead.Parser.label(java.lang.String)
.parseTree()
was invoked.null
if none.null
if it's a failed node.Pattern
object that matches if the input has at least n
characters left.Pattern
object that matches if the input has exactly n
characters left.Pattern
object that matches a hex integer, which starts with a 0x
or 0X
, and is followed
by one or more hex digits.0x1, 0Xff, 0xFe1
etc.), and converts the string to a Long
value.Parser
that recognizes identifiers (a.k.a words, variable names etc).Tokens.Fragment
tagged as Tokens.Tag.IDENTIFIER
.Function.identity()
instead.Pattern
object that, if this pattern matches,
matches the remaining input against consequence
pattern, or otherwise matches against
alternative
pattern.Parser
that recognizes the generated indent
token.Indentation
object that uses indent
and outdent
as the
token values for indentation and outdentation.Indentation
object that generates default indent and outdent tokens.Parsers.SOURCE_LOCATION
instead.Parser
for left-associative infix operator.Parser
that parses non-associative infix operator.Parser
for right-associative infix operator.Pattern
object that matches an integer.Tokens.Fragment
tagged as Tokens.Tag.INTEGER
.CharPredicate
that returns true if the character is an alpha character.CharPredicate
that returns true if it is an alpha character or the underscore
character _
.CharPredicate
that returns true if it is an alphanumeric character, or an
underscore character.CharPredicate
that returns true if it is an alphanumeric character, or an
underscore character.CharPredicate
that returns true if the character is a digit.CharPredicate
that returns true if the character is a digit or within the range
of [a-f]
or [A-F]
.CharPredicate
that returns true if Character.isLetter(char)
returns
true.CharPredicate
that returns true if Character.isLowerCase(char)
returns
true.CharPredicate
that returns true if Character.isUpperCase(char)
returns
true.CharPredicate
that returns true if Character.isWhitespace(char)
returns true.c
satisfies the predicate.CharPredicate
that returns true if the character is equal to c
.Pattern
object that matches if the current character in the input is equal to character c
, in which case 1
is returned as match length.Pattern
object that matches if the current character in the input satisfies predicate
, in
which case 1
is returned as match length.CharPredicate
.Object.toString()
in the CharPredicate
,
or use Patterns.isChar(predicate).toScanner(name)
.Scanners.isChar(char)
instead
or use Patterns.isChar(ch).toScanner(name)
.ch
.Parser
that delegates to the parser object referenced by this
during parsing time.Parser
that greedily runs tokenizer
, and translates line feed characters
('\n'
) to indent
and outdent
tokens.Parser
that greedily runs this
repeatedly, and ignores the pattern recognized by delim
before and after each occurrence.Pattern
object that matches a line comment started by begin
and ended by EOF
or
LF
(the line feed character).'\n'
character
if the current input starts with the string literal begin
.SourceLocation
instead.Location
instance.Parser
that runs every element of parsers
and selects the longest match.Parser
that runs every element of parsers
and selects the longest match.Pattern
that tries all of patterns
, and picks the one with the
longest match length.p.many()
is equivalent to p*
in EBNF.Pattern
object that matches this pattern for 0 or more times.Pattern.atLeast(int)
instead.Patterns.atLeast(int, CharPredicate)
instead.Pattern
that matches 0 or more characters satisfying predicate
.pattern.many().toScanner(name)
.p.many1()
is equivalent to p+
in EBNF.Pattern
object that matches this pattern for 1 or more times.Pattern
that matches 1 or more characters satisfying predicate
.pattern.many1().toScanner(name)
.Function
instead.from
to the target object.a
and b
to the target object.a
, b
and c
to the target object.a
, b
, c
and d
to the target object.a
, b
, c
, d
and e
to the target object.Map::get
instead.token
to an instance of T
.BiFunction
instead.A
, B
and C
respectively to an object of type
T
.A
, B
, C
and D
respectively
to an object of type T
.A
, B
, C
, D
and E
respectively
to an object of type T
.T
.T
.T
.Map
interface and the variants.String::valueOf
directly.Pattern.match(CharSequence, int, int)
method when match fails.begin
and ends with
end
.begin
and ends with
end
.begin
and ends with
end
.outer
succeeds,
subsequently feeds the recognized characters to inner
for a nested scanning.Parser
that always fails.CharPredicate
that always returns false.Pattern
that always returns Pattern.MISMATCH
.Parser.Reference
.Parser
that executes this
, maps the result using map
to another Parser
object
to be executed as the next step.Parser
that fails if this
succeeds.Parser
that fails if this
succeeds.CharPredicate
that returns true if predicate
evaluates to false.Pattern
object that only matches if this pattern mismatches, 0 is returned
otherwise.CharPredicate
that returns true if the character is not equal to any character
in chars
.Patterns.among(chars).not().toScanner(name)
,
or isChar(CharPredicates.notAmong(chars), name)
.chars
.CharPredicate
that returns true if the character is not equal to c
.ch
.CharPredicate
that returns true if the character is not within the range of
[a, b]
.Pattern
object that matches if the input has at least 1 character and doesn't match string
.Pattern
object that matches if the input has at least 1 character and doesn't match string
case insensitively.Pattern
object that matches an octal integer that starts with a 0
and is followed by 0 or more
[0 - 7]
characters.0, 07, 017, 0371
etc.), and converts the string to a Long
value.Terminals
object for lexing the operators with names specified in
ops
.Terminals
object for lexing the operators with names specified in
ops
.Parser
to parse expressions with operator-precedence grammar.#optional(null)
or Parser.asOptional()
instead.Pattern
object that matches with 0 length even if this
mismatches.p1.or(p2)
is equivalent to p1 | p2
in EBNF.Parser
that tries 2 alternative parser objects.Parser
that tries 3 alternative parser objects.Parser
that tries 4 alternative parser objects.Parser
that tries 5 alternative parser objects.Parser
that tries 6 alternative parser objects.Parser
that tries 7 alternative parser objects.Parser
that tries 8 alternative parser objects.Parser
that tries 9 alternative parser objects.Parser
that tries each alternative parser in alternatives
.Parser
that tries each alternative parser in alternatives
.Pattern
that matches if any of patterns
matches, in which case, the first match length is
returned.a.otherwise(fallback)
runs fallback
when a
matches zero input.Parser
that recognizes the generated outdent
token.Pair
of 2 objects.source
.readable
.source
under the given mode
.Parser.parse(CharSequence)
instead.Parser.parse(Readable)
instead.Parser
that recognizes identifier tokens.Parser
that recognies Tokens.ScientificNotation
tokens.Parser
used in recursive grammars.ParserException
object.Parser
implementations.source
and returns a ParseTree
corresponding to the syntactical
structure of the input.pattern.toScanner(name)
.Pattern
implementations.Parser
that runs this
and undoes any input consumption if succeeds.Pattern
object that matches with match length 0 if this Pattern object matches.begin
and ends with character
end
.Parsers.sequence(begin, quoted.skipMany(), end).source()
.CharPredicate
that returns true if the character is within the range of
[a, b]
.Pattern
object that matches if the current character in the input is between character c1
and c2
, in which case 1
is returned as match length.Pattern
.Pattern
.Pattern
object that matches regular expression modifiers, which is a list of alpha characters.Pattern
object that matches any regular expression pattern string in the form of /some pattern
here/
.Pattern.times(int)
instead.Pattern
object that matches if the input has at least n
characters and the first n
characters all satisfy predicate
.Parser
that recognizes reserved word tokens.Tokens.Fragment
tagged as Tokens.Tag.RESERVED
.Parser
implementations that scan the source and match certain string
patterns.Tokens.scientificNotation()
instead.Parser
that runs 2 parser objects sequentially.Parser
that runs 3 parser objects sequentially.Parser
that runs 4 parser objects sequentially.Parser
that runs 5 parser objects sequentially.Parser
that runs 3 parser objects sequentially and transforms the return values
using map
.Parser
that runs 4 parser objects sequentially and transforms the return values
using map
.Parser
that runs 5 parser objects sequentially and transforms the return values
using map
.Parser
that runs 6 parser objects sequentially and transforms the return values
using map
.Parser
that runs 7 parser objects sequentially and transforms the return values
using map
.Parser
that runs 7 parser objects sequentially and transforms the return values
using map
.Parser
that runs parsers
sequentially and discards the return values.Parser
that runs parsers
sequentially and discards the return values.Pattern
object that matches the input against patterns
sequentially.Parser
that runs every element of parsers
and selects the shortest match.Parser
that runs every element of parsers
and selects the shortest match.Pattern
that tries all of patterns
, and picks the one with the shortest match length.'\'
),
and then converts the character to a Character
token.p.skipMany()
is equivalent to p*
in EBNF.p.skipMany1()
is equivalent to p+
in EBNF.Parser
that runs this
parser for at least min
times and up to max
times, with
all the return values ignored.Pattern.atMost(int)
instead.Pattern.times(int, int)
instead.Patterns.times(int, int, CharPredicate)
instead.Patterns.atMost(int, CharPredicate)
instead.Parser
that returns the matched string in the original source.Parser
that returns the current location in the source.Pattern
object that matches a decimal number that has at least one digit before the decimal point.Pattern
object that matches string
literally.Patterns.string(str).toScanner(name)
.Pattern
object that matches string
case insensitively.Patterns.stringCaseInsensitive(str).toScanner(name)
.Terminals
instance by defining the words and keywords recognized.String
.String
.Long
.Pattern
object that matches the input against this pattern for n
times.Pattern
that matches at least min
and up to max
number of characters satisfying
predicate
,Integer::valueOf
directly.Map
that maps the string representation of an enum
to the corresponding enum value by calling Enum.valueOf(Class, String)
.fromToken
object.1, 2.3, 00, 0., .23
)
and returns a Tokens.Fragment
token tagged as Tokens.Tag.DECIMAL
.Tokens.Fragment
token tagged as
Tokens.Tag.IDENTIFIER
.0, 00, 1, 10
)
and returns a Tokens.Fragment
token tagged as Tokens.Tag.INTEGER
.Long
value.Tokens.ScientificNotation
value.Token
to a an object of type T
, or null if the token isn't recognized.Tokens.Fragment
token tags.type
, in which case, the token value is
returned and parse succeeds.this
pattern.Pair
of 2 objects.Tuple3
of 3 objects.Tuple4
of 4 objects.Tuple5
of 5 objects.UnaryOperator
instead.Parser
that fails and reports that name
is logically unexpected.Parser
that matches this parser zero or many times
until the given parser succeeds.Parser
that recognizes 1 or more whitespace characters on the same line.Parser
that returns both parsed object and matched string.Pattern
object that matches a standard english word, which starts with either an underscore or an alpha
character, followed by 0 or more alphanumeric characters.Terminals
instance that recognizes words not already recognized
by this
Terminals
instance (typically operators).Copyright © 2013–2018 jparsec. All rights reserved.