Parser implementations that scan the source and match certain string
patterns.
Some scanners like IDENTIFIER and INTEGER return the matched string,
while others like WHITESPACES return nothing, as indicated by the Void
type parameter. In case the matched string is still needed nonetheless,
use the Parser#source() method.
| Modifier and Type | Field and Description |
|---|---|
| public static final Parser | ANY_CHAR
Matches any character in the input. |
| public static final Parser | DEC_INTEGER
Scanner for a decimal number. |
| public static final Parser | DECIMAL
Scanner for a decimal number. |
| public static final Parser | DOUBLE_QUOTE_STRING
Scanner with a pattern for double quoted string literal. |
| public static final Parser | HASKELL_BLOCK_COMMENT
Scanner for haskell style block comment. |
| public static final Parser | HASKELL_DELIMITER
Scanner for the haskell style delimiter of tokens. |
| public static final Parser | HASKELL_LINE_COMMENT
Scanner for haskell style line comment. |
| public static final Parser | HEX_INTEGER
Scanner for a hexadecimal number. |
| public static final Parser | IDENTIFIER
Scanner for a regular identifier, that starts with either an underscore or an alpha character, followed by 0 or more alphanumeric characters. |
| public static final Parser | INTEGER
Scanner for an integer. |
| public static final Parser | JAVA_BLOCK_COMMENT
Scanner for c++/java style block comment. |
| private static final Parser | |
| public static final Parser | JAVA_DELIMITER
Scanner for the c++/java style delimiter of tokens. |
| public static final Parser | JAVA_LINE_COMMENT
Scanner for c++/java style line comment. |
| public static final Parser | OCT_INTEGER
Scanner for a octal number. |
| public static final Parser | SCIENTIFIC_NOTATION
Scanner for a scientific notation. |
| public static final Parser | SINGLE_QUOTE_CHAR
Scanner for a c/c++/java style character literal. |
| public static final Parser | SINGLE_QUOTE_STRING
Scanner with a pattern for SQL style string literal. |
| public static final Parser | SQL_BLOCK_COMMENT
Scanner for SQL style block comment. |
| public static final Parser | SQL_DELIMITER
Scanner for the SQL style delimiter of tokens. |
| public static final Parser | SQL_LINE_COMMENT
Scanner for SQL style line comment. |
| public static final Parser | WHITESPACES
A scanner that scans greedily for 1 or more whitespace characters. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Parser | |
| public static Parser | |
| public static Parser | blockComment(String begin, String end)
A scanner for non-nested block comment that starts with |
| public static Parser | Returns: the Scanner for the block comment.begins a block comment begin, String ends a block comment end, Pattern the commented pattern. commented)A scanner for a non-nestable block comment that starts with |
| public static Parser | |
| private static Pattern | |
| public static Parser | Returns: the scanner.the predicate. predicate)A scanner that succeeds and consumes the current character if it satisfies the given
|
| public static Parser | Returns: the scanner.the predicate. predicate, String the name of what's expected logically. Is used in error message. name)
Deprecated
Implement
Object#toString in the CharPredicate,
or use Patterns.isChar(predicate).toScanner(name).
A scanner that succeeds and consumes the current character if it satisfies the given
|
| public static Parser | Returns: the scanner.the expected character. ch, String the name of what's expected logically. Is used in error message. name)
Deprecated
Use
isChar(char) instead
or use Patterns.isChar(ch).toScanner(name).
A scanner that succeeds and consumes the current character if it is equal to |
| public static Parser | Returns: the scanner.the expected character. ch)A scanner that succeeds and consumes the current character if it is equal to |
| public static Parser | lineComment(String begin)
A scanner that succeeds and consumes all the characters until the |
| public static Parser | Returns: the Parser object.the predicate object. predicate)A scanner that scans greedily for 0 or more characters that satisfies the given CharPredicate. |
| public static Parser | |
| public static Parser | Returns: the Parser object.the predicate object. predicate)A scanner that scans greedily for 1 or more characters that satisfies the given CharPredicate. |
| public static Parser | |
| public static Parser | Returns: the block comment scanner.begins a block comment begin, String ends a block comment end)A scanner for a nestable block comment that starts with |
| public static Parser | Returns: the block comment scanner.begins a block comment begin, String ends a block comment end, Pattern the commented pattern except for nested comments. commented)A scanner for a nestable block comment that starts with |
| public static Parser | Returns: the block comment scanner.starts a block comment begin, Parser<?> ends a block comment end, Parser<?> the commented pattern except for nested comments. commented)A scanner for a nestable block comment that starts with |
| public static Parser | nestedScanner(final Parser<?> outer, final Parser<Void> inner)
A scanner that after character level |
| public static Parser | Returns: the scanner.the characters. chars, String the name of what's expected logically. Is used in error message. name)
Deprecated
Use
Patterns.among(chars).not().toScanner(name),
or isChar(CharPredicates.notAmong(chars), name).
A scanner that succeeds and consumes the current character if it is not equal to any character
in |
| public static Parser | |
| public static Parser | Returns: the scanner.the expected character. ch, String the name of what's expected logically. Is used in error message. name)
Deprecated
Use
notChar(char).
A scanner that succeeds and consumes the current character if it is equal to |
| public static Parser | Returns: the scanner.the expected character. ch)A scanner that succeeds and consumes the current character if it is not equal to |
| private static Pattern | Returns: the Pattern object.Matches a character if the input has at least 1 character, or if the input has at least 2
characters with the first 2 characters not being |
| public static Parser | |
| public static Parser | quoted(char begin, char end)
A scanner for a quoted string that starts with character |
| public static Parser | Returns: the scanner.begins a quote begin, Parser<Void> ends a quote end, Parser<?> the parser that recognizes the quoted pattern. quoted)
Deprecated
Use
Parsers.sequence(begin, quoted.skipMany(), end).source().
A scanner for a quoted string that starts with |
| private static Parser | |
| public static Parser | |
| public static Parser | |
| public static Parser | Returns: the scanner.the string to match str, String the name of what's expected logically. Is used in error message. name)
Deprecated
Use
Patterns.stringCaseInsensitive(str).toScanner(name).
A scanner that matches the input against the specified string case insensitively. |
| public static Parser | Returns: the scanner.the string to match str)A scanner that matches the input against the specified string case insensitively. |
| ANY_CHAR | back to summary |
|---|---|
| public static final Parser<Void> ANY_CHAR Matches any character in the input. Different from | |
| DEC_INTEGER | back to summary |
|---|---|
| public static final Parser<String> DEC_INTEGER Scanner for a decimal number. 0 is not allowed as the leading digit. | |
| DECIMAL | back to summary |
|---|---|
| public static final Parser<String> DECIMAL Scanner for a decimal number. | |
| DOUBLE_QUOTE_STRING | back to summary |
|---|---|
| public static final Parser<String> DOUBLE_QUOTE_STRING Scanner with a pattern for double quoted string literal. Backslash '\' is used as escape character. | |
| HASKELL_BLOCK_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> HASKELL_BLOCK_COMMENT Scanner for haskell style block comment. {- -} | |
| HASKELL_DELIMITER | back to summary |
|---|---|
| public static final Parser<Void> HASKELL_DELIMITER Scanner for the haskell style delimiter of tokens. For example, whitespaces, line comment and block comment. | |
| HASKELL_LINE_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> HASKELL_LINE_COMMENT Scanner for haskell style line comment. ( | |
| HEX_INTEGER | back to summary |
|---|---|
| public static final Parser<String> HEX_INTEGER Scanner for a hexadecimal number. Has to start with | |
| IDENTIFIER | back to summary |
|---|---|
| public static final Parser<String> IDENTIFIER Scanner for a regular identifier, that starts with either an underscore or an alpha character, followed by 0 or more alphanumeric characters. | |
| INTEGER | back to summary |
|---|---|
| public static final Parser<String> INTEGER Scanner for an integer. | |
| JAVA_BLOCK_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> JAVA_BLOCK_COMMENT Scanner for c++/java style block comment. | |
| JAVA_BLOCK_COMMENTED | back to summary |
|---|---|
| private static final Parser<Void> JAVA_BLOCK_COMMENTED | |
| JAVA_DELIMITER | back to summary |
|---|---|
| public static final Parser<Void> JAVA_DELIMITER Scanner for the c++/java style delimiter of tokens. For example, whitespaces, line comment and block comment. | |
| JAVA_LINE_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> JAVA_LINE_COMMENT Scanner for c++/java style line comment. | |
| OCT_INTEGER | back to summary |
|---|---|
| public static final Parser<String> OCT_INTEGER Scanner for a octal number. 0 is the leading digit. | |
| SCIENTIFIC_NOTATION | back to summary |
|---|---|
| public static final Parser<String> SCIENTIFIC_NOTATION Scanner for a scientific notation. | |
| SINGLE_QUOTE_CHAR | back to summary |
|---|---|
| public static final Parser<String> SINGLE_QUOTE_CHAR Scanner for a c/c++/java style character literal. such as 'a' or '\\'. | |
| SINGLE_QUOTE_STRING | back to summary |
|---|---|
| public static final Parser<String> SINGLE_QUOTE_STRING Scanner with a pattern for SQL style string literal. A SQL string literal is a string quoted by single quote, a single quote character is escaped by 2 single quotes. | |
| SQL_BLOCK_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> SQL_BLOCK_COMMENT Scanner for SQL style block comment. | |
| SQL_DELIMITER | back to summary |
|---|---|
| public static final Parser<Void> SQL_DELIMITER Scanner for the SQL style delimiter of tokens. For example, whitespaces and line comment. | |
| SQL_LINE_COMMENT | back to summary |
|---|---|
| public static final Parser<Void> SQL_LINE_COMMENT Scanner for SQL style line comment. | |
| WHITESPACES | back to summary |
|---|---|
| public static final Parser<Void> WHITESPACES A scanner that scans greedily for 1 or more whitespace characters. | |
| Scanners | back to summary |
|---|---|
| private Scanners() | |
| among | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that succeeds and consumes the current character if it equals to any character in
| |
| among | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes the current character if it equals to any character in
| |
| blockComment | back to summary |
|---|---|
| public static Parser A scanner for non-nested block comment that starts with | |
| blockComment | back to summary |
|---|---|
| public static Parser A scanner for a non-nestable block comment that starts with | |
| blockComment | back to summary |
|---|---|
| public static Parser A scanner for a non-nestable block comment that starts with | |
| escapedChar | back to summary |
|---|---|
| private static Pattern escapedChar(char escape) | |
| isChar | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes the current character if it satisfies the given
| |
| isChar | back to summary |
|---|---|
| public static Parser Deprecated Implement A scanner that succeeds and consumes the current character if it satisfies the given
| |
| isChar | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that succeeds and consumes the current character if it is equal to | |
| isChar | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes the current character if it is equal to | |
| lineComment | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes all the characters until the | |
| many | back to summary |
|---|---|
| public static Parser A scanner that scans greedily for 0 or more characters that satisfies the given CharPredicate.
| |
| many | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that scans greedily for 0 or more occurrences of the given pattern. | |
| many1 | back to summary |
|---|---|
| public static Parser A scanner that scans greedily for 1 or more characters that satisfies the given CharPredicate.
| |
| many1 | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that scans greedily for 1 or more occurrences of the given pattern. | |
| nestableBlockComment | back to summary |
|---|---|
| public static Parser A scanner for a nestable block comment that starts with | |
| nestableBlockComment | back to summary |
|---|---|
| public static Parser A scanner for a nestable block comment that starts with | |
| nestableBlockComment | back to summary |
|---|---|
| public static Parser A scanner for a nestable block comment that starts with | |
| nestedScanner | back to summary |
|---|---|
| public static Parser A scanner that after character level Is useful for scenarios like parsing string interpolation grammar, with parsing errors correctly pointing to the right location in the original source. | |
| notAmong | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that succeeds and consumes the current character if it is not equal to any character
in | |
| notAmong | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes the current character if it is not equal to any character
in | |
| notChar | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that succeeds and consumes the current character if it is equal to | |
| notChar | back to summary |
|---|---|
| public static Parser A scanner that succeeds and consumes the current character if it is not equal to | |
| notChar2 | back to summary |
|---|---|
| private static Pattern notChar2(final char c1, final char c2) Matches a character if the input has at least 1 character, or if the input has at least 2
characters with the first 2 characters not being
| |
| pattern | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that scans the input for an occurrence of a string pattern. | |
| quoted | back to summary |
|---|---|
| public static Parser A scanner for a quoted string that starts with character | |
| quoted | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner for a quoted string that starts with | |
| quotedBy | back to summary |
|---|---|
| private static Parser | |
| string | back to summary |
|---|---|
| public static Parser Matches the input against the specified string. | |
| string | back to summary |
|---|---|
| public static Parser Deprecated Use Matches the input against the specified string. | |
| stringCaseInsensitive | back to summary |
|---|---|
| public static Parser Deprecated Use A scanner that matches the input against the specified string case insensitively. | |
| stringCaseInsensitive | back to summary |
|---|---|
| public static Parser A scanner that matches the input against the specified string case insensitively. | |