jfun.parsec
public final class Scanners extends Object
All scanners return null. "_" is used as type parameter to indicate this.
Method Summary | |
---|---|
static Parser<_> | among(String name, char[] chars, String err)
succeed and consume the current character if it equals to one of the given characters.
|
static Parser<_> | among(String name, char[] chars)
succeed and consume the current character if it equals to one of the given characters.
|
static Parser<_> | among(char[] chars, String err)
succeed and consume the current character if it equals to one of the given characters.
|
static Parser<_> | among(char[] chars)
succeed and consume the current character if it equals to one of the given characters.
|
static Parser<_> | anyChar()
matches any character in the input.
|
static Parser<_> | anyChar(String err)
matches any character in the input.
|
static Parser<_> | anyChar(String name, String err)
matches any character in the input.
|
static <R> Parser<R> | delimited(Parser<R> s, String err)
If a string is not followed by a alphanumeric character, it is well-delimited.
delimited() make sure the pattern represented by scanner s is delimited. |
static <R> Parser<R> | delimited(String name, Parser<R> s, String err)
If a string is not followed by a alphanumeric character, it is well-delimited.
delimited() make sure the pattern represented by scanner s is delimited. |
static <R> Parser<R> | delimited(Parser<R> s)
If a string is not followed by a alphanumeric character, it is well-delimited.
delimited() make sure the pattern represented by scanner s is delimited. |
static <R> Parser<R> | delimited(String name, Parser<R> s)
If a string is not followed by a alphanumeric character, it is well-delimited.
delimited() make sure the pattern represented by scanner s is delimited. |
static Parser<_> | haskellBlockComment()
scanner for haskell style block comment. |
static Parser<_> | haskellDelimiter()
the haskell style delimiter of tokens.
whitespace, line comment, block comment. |
static Parser<_> | haskellDelimiter(String name)
the haskell style delimiter of tokens.
whitespace, line comment, block comment. |
static Parser<_> | haskellLineComment()
scanner for haskell style line comment. |
static Parser<_> | isBlockComment(String start, String end)
scanner for non-nested block comment. |
static Parser<_> | isBlockComment(String name, String start, String end)
scanner for non-nested block comment. |
static Parser<_> | isBlockComment(String open, String close, Pattern commented)
Scans a non-nestable block comment. |
static Parser<_> | isBlockComment(Parser<_> open, Parser<_> close, Parser<?> commented)
Scans a non-nestable block comment. |
static Parser<_> | isBlockComment(String name, Parser<_> open, Parser<_> close, Parser<?> commented)
Scans a non-nestable block comment. |
static Parser<_> | isChar(CharPredicate cp)
succeed and consume the current character if it satisfies the given CharPredicate. |
static Parser<_> | isChar(String name, CharPredicate cp)
succeed and consume the current character if it satisfies the given CharPredicate. |
static Parser<_> | isChar(CharPredicate cp, String err)
succeed and consume the current character if it satisfies the given CharPredicate. |
static Parser<_> | isChar(String name, CharPredicate cp, String err)
succeed and consume the current character if it satisfies the given CharPredicate. |
static Parser<_> | isChar(char ch, String err)
succeed and consume the current character if it is equal to ch. |
static Parser<_> | isChar(String name, char ch, String err)
succeed and consume the current character if it is equal to ch. |
static Parser<_> | isChar(char ch)
succeed and consume the current character if it is equal to ch. |
static Parser<_> | isChar(String name, char ch)
succeed and consume the current character if it is equal to ch. |
static Parser<_> | isLineComment(String start)
if the current input starts with the given string, succeed and consumes all the characters until the end of line '\n character.
|
static Parser<_> | isLineComment(String name, String start)
if the current input starts with the given string, succeed and consumes all the characters until the end of line '\n character.
|
static Parser<_> | isNestableBlockComment(String open, String close)
Scans a nestable block comment.
|
static Parser<_> | isNestableBlockComment(String open, String close, Parser<?> commented)
Scans a nestable block comment.
|
static Parser<_> | isNestableBlockComment(Parser<?> open, Parser<?> close, Parser<?> commented)
Scans a nestable block comment.
|
static Parser<_> | isNestableBlockComment(String name, Parser<?> open, Parser<?> close, Parser<?> commented)
Scans a nestable block comment.
|
static Parser<_> | isPattern(Pattern pp, String err)
Scans the input for an occurrence of a string pattern. |
static Parser<_> | isPattern(String name, Pattern pp, String err)
Scans the input for an occurrence of a string pattern. |
static Parser<_> | isQuotedChar(String name)
scanner for a c/c++/java style character literal. such as 'a' or '\\'. |
static Parser<_> | isQuotedChar()
scanner for a c/c++/java style character literal. such as 'a' or '\\'. |
static Parser<_> | isQuotedString(String name)
a scanner with a pattern for double quoted string literal.
backslash '\' is used as escape character. |
static Parser<_> | isQuotedString()
a scanner with a pattern for double quoted string literal.
backslash '\' is used as escape character. |
static Parser<_> | isSqlString()
a scanner with a pattern for sql server string literal.
a sql server string literal is a string quoted by single quote,
a single quote character is escaped by 2 single quotes. |
static Parser<_> | isSqlString(String name)
a scanner with a pattern for sql server string literal.
a sql server string literal is a string quoted by single quote,
a single quote character is escaped by 2 single quotes. |
static Parser<_> | isString(String str)
matches the input against the specified string. |
static Parser<_> | isString(String str, String err)
matches the input against the specified string. |
static Parser<_> | isString(String name, String str, String err)
matches the input against the specified string. |
static Parser<_> | isStringCI(String str, String err)
matches the input against the specified string case insensitively. |
static Parser<_> | isStringCI(String name, String str, String err)
matches the input against the specified string case insensitively. |
static Parser<_> | isStringCI(String str)
matches the input against the specified string case insensitively. |
static Parser<_> | isWhitespaces()
Scans greedily for 1 or more whitespace characters. |
static Parser<_> | isWhitespaces(String name)
Scans greedily for 1 or more whitespace characters. |
static Parser<_> | isWhitespaces(String name, String err)
Scans greedily for 1 or more whitespace characters. |
static Parser<_> | javaBlockComment()
scanner for c++/java style block comment. |
static Parser<_> | javaDelimiter()
the c++/java style delimiter of tokens.
whitespace, line comment, block comment. |
static Parser<_> | javaDelimiter(String name)
the c++/java style delimiter of tokens.
whitespace, line comment, block comment. |
static Parser<_> | javaLineComment()
scanner for c++/java style line comment. |
static Parser<_> | many(CharPredicate cp)
Scans greedily for 0 or more characters
that satisfies the given CharPredicate. |
static Parser<_> | many(Pattern pp)
Scans greedily for 0 or more occurrences of the given pattern. |
static Parser<_> | many(String name, CharPredicate cp)
Scans greedily for 0 or more characters
that satisfies the given CharPredicate. |
static Parser<_> | many(String name, Pattern pp)
Scans greedily for 0 or more occurrences of the given pattern. |
static Parser<_> | many1(CharPredicate cp)
Scans greedily for 1 or more characters
that satisfies the given CharPredicate. |
static Parser<_> | many1(Pattern pp)
Scans greedily for 1 or more occurrences of the given pattern. |
static Parser<_> | many1(String name, CharPredicate cp)
Scans greedily for 1 or more characters
that satisfies the given CharPredicate. |
static Parser<_> | many1(String name, Pattern pp)
Scans greedily for 1 or more occurrences of the given pattern. |
static Parser<_> | notAmong(String name, char[] chars, String err)
succeed and consume the current character if it is not equal to any of the given characters.
|
static Parser<_> | notAmong(String name, char[] chars)
succeed and consume the current character if it is not equal to any of the given characters.
|
static Parser<_> | notAmong(char[] chars, String err)
succeed and consume the current character if it is not equal to any of the given characters.
|
static Parser<_> | notAmong(char[] chars)
succeed and consume the current character if it is not equal to any of the given characters.
|
static Parser<_> | notChar(char ch, String err)
succeed and consume the current character if it is equal to ch. |
static Parser<_> | notChar(String name, char ch, String err)
succeed and consume the current character if it is not equal to ch. |
static Parser<_> | notChar(char ch)
succeed and consume the current character if it is not equal to ch. |
static Parser<_> | notChar(String name, char ch)
succeed and consume the current character if it is not equal to ch. |
static Parser<_> | quoted(char c1, char c2)
scans a quoted string that is opened by c1 and closed by c2. |
static Parser<_> | quoted(String name, char c1, char c2)
scans a quoted string that is opened by c1 and closed by c2. |
static Parser<_> | quoted(Parser<_> open, Parser<_> close, Parser<?> s)
scans a quoted string that is opened by c1 and closed by c2. |
static Parser<_> | quoted(String name, Parser<_> open, Parser<_> close, Parser<?> s)
scans a quoted string that is opened by pattern represented by Scanner open and closed by pattern represented by Scanner close. |
static Parser<_> | scanChars(Parser<?> p, Parser<_> scanner, String module)
After character level parser p succeeds,
subsequently feed the recognized characters to the Parser scanner
for a nested scanning. |
static Parser<_> | scanChars(String name, Parser<?> p, Parser<_> scanner, String module)
After character level parser p succeeds,
subsequently feed the recognized characters to the Parser scanner
for a nested scanning. |
static Parser<_> | sqlDelimiter()
the T-SQL style delimiter of tokens.
whitespace and line comment. |
static Parser<_> | sqlDelimiter(String name)
the T-SQL style delimiter of tokens.
whitespace and line comment. |
static Parser<_> | sqlLineComment()
scanner for T-SQL style line comment. |
static Parser<_> | stdDelimiter(String name, String lcomment, String openc, String closec)
Any delimiter with whitespace, non-nested block comment and line comment. |
static Parser<_> | stdDelimiter(String lcomment, String openc, String closec)
Any delimiter with whitespace, non-nested block comment and line comment. |
Parameters: name the scanner name. chars the characters. err the error message when the character is not among the given values.
Returns: the scanner.
Parameters: name the scanner name. chars the characters.
Returns: the scanner.
Parameters: chars the characters. err the error message when the character is not among the given values.
Returns: the scanner.
Parameters: chars the characters.
Returns: the scanner.
Returns: the scanner.
Parameters: err the error message if fails.
Returns: the scanner.
Parameters: name the scanner name. err the error message if fails.
Returns: the scanner.
Parameters: s the scanner for the to-be-delimited pattern. err the error message if it is not delimited.
Returns: the new scanner.
Parameters: name the new scanner name. s the scanner for the to-be-delimited pattern. err the error message if it is not delimited.
Returns: the new scanner.
Parameters: s the scanner for the to-be-delimited pattern.
Returns: the new scanner.
Parameters: name the new scanner name. s the scanner for the to-be-delimited pattern.
Returns: the new scanner.
Returns: the scanner.
Returns: the scanner.
Parameters: name the scanner name.
Returns: the scanner.
Returns: the scanner.
Parameters: start the start string of a block comment. end the end string of a block comment.
Returns: the scanner.
Parameters: name the scanner name. start the start string of a block comment. end the end string of a block comment.
Returns: the scanner.
Parameters: open the opening string. close the closing string. commented the commented pattern.
Returns: the Scanner for the block comment.
Parameters: open the opening pattern. close the closing pattern. commented the commented pattern.
Returns: the Scanner for the block comment.
Parameters: name the name of the block comment scanner. open the opening pattern. close the closing pattern. commented the commented pattern.
Returns: the Scanner for the block comment.
Parameters: cp the predicate.
Returns: the scanner.
Parameters: name the scanner name. cp the predicate.
Returns: the scanner.
Parameters: cp the predicate. err the error message.
Returns: the scanner.
Parameters: name the scanner name. cp the predicate. err the error message.
Returns: the scanner.
Parameters: ch the expected character. err the error message.
Returns: the scanner.
Parameters: name the scanner name. ch the expected character. err the error message.
Returns: the scanner.
Parameters: ch the expected character.
Returns: the scanner.
Parameters: name the scanner name. ch the expected character.
Returns: the scanner.
Parameters: start the start string.
Returns: the scanner.
Parameters: name the scanner name. start the start string.
Returns: the scanner.
Parameters: open the opening pattern. close the closing pattern.
Returns: the block comment scanner.
Parameters: open the opening string. close the closing string. commented the commented pattern except for nested comments.
Returns: the block comment scanner.
Parameters: open the opening pattern. close the closing pattern. commented the commented pattern except for nested comments.
Returns: the block comment scanner.
Parameters: name the name of the block comment scanner. open the opening pattern. close the closing pattern. commented the commented pattern except for nested comments.
Returns: the block comment scanner.
Parameters: pp the pattern object. err the expected message when fails.
Returns: the Parser object.
Parameters: name the Parser object name. pp the pattern object. err the expected message when fails.
Returns: the Parser object.
Parameters: name the name of the scanner.
Returns: the scanner.
Returns: the scanner.
Parameters: name the name of the scanner.
Returns: the scanner.
Returns: the scanner.
Returns: the scanner.
Parameters: name the name of the scanner.
Returns: the scanner.
Parameters: str the string to match
Returns: the scanner.
Parameters: str the string to match err the error message if fails.
Returns: the scanner.
Parameters: name the scanner name. str the string to match err the error message if fails.
Returns: the scanner.
Parameters: str the string to match err the error message if fails.
Returns: the scanner.
Parameters: name the scanner name. str the string to match err the error message if fails.
Returns: the scanner.
Parameters: str the string to match
Returns: the scanner.
Returns: the Parser object.
Parameters: name the Parser object name.
Returns: the Parser object.
Parameters: name the Parser object name. err the expected message when fails.
Returns: the Parser object.
Returns: the scanner.
Returns: the scanner.
Parameters: name the scanner name.
Returns: the scanner.
Returns: the scanner.
Parameters: cp the predicate object.
Returns: the Parser object.
Parameters: pp the pattern object.
Returns: the Parser object.
Parameters: name the name of the Parser object. cp the predicate object.
Returns: the Parser object.
Parameters: name the name of the Parser object. pp the pattern object.
Returns: the Parser object.
Parameters: cp the predicate object.
Returns: the Parser object.
Parameters: pp the pattern object.
Returns: the Parser object.
Parameters: name the name of the Parser object. cp the predicate object.
Returns: the Parser object.
Parameters: name the name of the Parser object. pp the pattern object.
Returns: the Parser object.
Parameters: name the scanner name. chars the characters. err the error message when the character is among the given values.
Returns: the scanner.
Parameters: name the scanner name. chars the characters.
Returns: the scanner.
Parameters: chars the characters. err the error message when the character is not among the given values.
Returns: the scanner.
Parameters: chars the characters.
Returns: the scanner.
Parameters: ch the expected character. err the error message.
Returns: the scanner.
Parameters: name the scanner name. ch the expected character. err the error message.
Returns: the scanner.
Parameters: ch the expected character.
Returns: the scanner.
Parameters: name the scanner name. ch the expected character.
Returns: the scanner.
Parameters: c1 the opening character. c2 the closing character.
Returns: the scanner.
Parameters: name the scanner name. c1 the opening character. c2 the closing character.
Returns: the scanner.
Parameters: open the opening character. close the closing character.
Returns: the scanner.
Parameters: name the scanner name. open the scanner for the opening pattern. close the scanner for the closing pattern.
Returns: the scanner.
Parameters: p the first parser object to identify the characters. scanner the second parser object to scan the characters again. module the module name.
Returns: the new Parser object.
Parameters: name the name of the new Parser object. p the first parser object to identify the characters. scanner the second parser object to scan the characters again. module the module name.
Returns: the new Parser object.
Returns: the scanner.
Parameters: name the scanner name.
Returns: the scanner.
Returns: the scanner.
Parameters: name the scanner name. lcomment line comment starting string. openc block comment opening string. closec block comment closing string.
Returns: the scanner.
Parameters: lcomment line comment starting string. openc block comment opening string. closec block comment closing string.
Returns: the scanner.