jfun.parsec

Class Scanners

public final class Scanners extends Object

Scanners class provides basic character level parsers and the combinators that only work on scanners.

All scanners return null. "_" is used as type parameter to indicate this.

Author: Ben Yu Dec 17, 2004

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.

Method Detail

among

public static Parser<_> among(String name, char[] chars, String err)
succeed and consume the current character if it equals to one of the given characters.

Parameters: name the scanner name. chars the characters. err the error message when the character is not among the given values.

Returns: the scanner.

among

public static Parser<_> among(String name, char[] chars)
succeed and consume the current character if it equals to one of the given characters.

Parameters: name the scanner name. chars the characters.

Returns: the scanner.

among

public static Parser<_> among(char[] chars, String err)
succeed and consume the current character if it equals to one of the given characters.

Parameters: chars the characters. err the error message when the character is not among the given values.

Returns: the scanner.

among

public static Parser<_> among(char[] chars)
succeed and consume the current character if it equals to one of the given characters.

Parameters: chars the characters.

Returns: the scanner.

anyChar

public static Parser<_> anyChar()
matches any character in the input. Different from one(), it fails on EOF. Also it consumes the current character in the input.

Returns: the scanner.

anyChar

public static Parser<_> anyChar(String err)
matches any character in the input. Different from one(), it fails on EOF. Also it consumes the current character in the input.

Parameters: err the error message if fails.

Returns: the scanner.

anyChar

public static Parser<_> anyChar(String name, String err)
matches any character in the input. Different from one(), it fails on EOF. Also it consumes the current character in the input.

Parameters: name the scanner name. err the error message if fails.

Returns: the scanner.

delimited

public 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.

Parameters: s the scanner for the to-be-delimited pattern. err the error message if it is not delimited.

Returns: the new scanner.

delimited

public 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.

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.

delimited

public 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.

Parameters: s the scanner for the to-be-delimited pattern.

Returns: the new scanner.

delimited

public 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.

Parameters: name the new scanner name. s the scanner for the to-be-delimited pattern.

Returns: the new scanner.

haskellBlockComment

public static Parser<_> haskellBlockComment()
scanner for haskell style block comment. ({- -})

Returns: the scanner.

haskellDelimiter

public static Parser<_> haskellDelimiter()
the haskell style delimiter of tokens. whitespace, line comment, block comment.

Returns: the scanner.

haskellDelimiter

public static Parser<_> haskellDelimiter(String name)
the haskell style delimiter of tokens. whitespace, line comment, block comment.

Parameters: name the scanner name.

Returns: the scanner.

haskellLineComment

public static Parser<_> haskellLineComment()
scanner for haskell style line comment. (--)

Returns: the scanner.

isBlockComment

public static Parser<_> isBlockComment(String start, String end)
scanner for non-nested block comment.

Parameters: start the start string of a block comment. end the end string of a block comment.

Returns: the scanner.

isBlockComment

public static Parser<_> isBlockComment(String name, String start, String end)
scanner for non-nested block comment.

Parameters: name the scanner name. start the start string of a block comment. end the end string of a block comment.

Returns: the scanner.

isBlockComment

public static Parser<_> isBlockComment(String open, String close, Pattern commented)
Scans a non-nestable block comment.

Parameters: open the opening string. close the closing string. commented the commented pattern.

Returns: the Scanner for the block comment.

isBlockComment

public static Parser<_> isBlockComment(Parser<_> open, Parser<_> close, Parser<?> commented)
Scans a non-nestable block comment.

Parameters: open the opening pattern. close the closing pattern. commented the commented pattern.

Returns: the Scanner for the block comment.

isBlockComment

public static Parser<_> isBlockComment(String name, Parser<_> open, Parser<_> close, Parser<?> commented)
Scans a non-nestable 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.

isChar

public static Parser<_> isChar(CharPredicate cp)
succeed and consume the current character if it satisfies the given CharPredicate.

Parameters: cp the predicate.

Returns: the scanner.

isChar

public static Parser<_> isChar(String name, CharPredicate cp)
succeed and consume the current character if it satisfies the given CharPredicate.

Parameters: name the scanner name. cp the predicate.

Returns: the scanner.

isChar

public static Parser<_> isChar(CharPredicate cp, String err)
succeed and consume the current character if it satisfies the given CharPredicate.

Parameters: cp the predicate. err the error message.

Returns: the scanner.

isChar

public static Parser<_> isChar(String name, CharPredicate cp, String err)
succeed and consume the current character if it satisfies the given CharPredicate.

Parameters: name the scanner name. cp the predicate. err the error message.

Returns: the scanner.

isChar

public static Parser<_> isChar(char ch, String err)
succeed and consume the current character if it is equal to ch.

Parameters: ch the expected character. err the error message.

Returns: the scanner.

isChar

public static Parser<_> isChar(String name, char ch, String err)
succeed and consume the current character if it is equal to ch.

Parameters: name the scanner name. ch the expected character. err the error message.

Returns: the scanner.

isChar

public static Parser<_> isChar(char ch)
succeed and consume the current character if it is equal to ch.

Parameters: ch the expected character.

Returns: the scanner.

isChar

public static Parser<_> isChar(String name, char ch)
succeed and consume the current character if it is equal to ch.

Parameters: name the scanner name. ch the expected character.

Returns: the scanner.

isLineComment

public 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. It does not consume the end of line character.

Parameters: start the start string.

Returns: the scanner.

isLineComment

public 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. It does not consume the end of line character.

Parameters: name the scanner name. start the start string.

Returns: the scanner.

isNestableBlockComment

public static Parser<_> isNestableBlockComment(String open, String close)
Scans a nestable block comment. Nested comments and any other characters can be in the comment body.

Parameters: open the opening pattern. close the closing pattern.

Returns: the block comment scanner.

isNestableBlockComment

public static Parser<_> isNestableBlockComment(String open, String close, Parser<?> commented)
Scans a nestable block comment. Nested comments and some commented pattern can be in the comment body.

Parameters: open the opening string. close the closing string. commented the commented pattern except for nested comments.

Returns: the block comment scanner.

isNestableBlockComment

public static Parser<_> isNestableBlockComment(Parser<?> open, Parser<?> close, Parser<?> commented)
Scans a nestable block comment. Nested comments and some commented pattern can be in the comment body.

Parameters: open the opening pattern. close the closing pattern. commented the commented pattern except for nested comments.

Returns: the block comment scanner.

isNestableBlockComment

public static Parser<_> isNestableBlockComment(String name, Parser<?> open, Parser<?> close, Parser<?> commented)
Scans a nestable block comment. Nested comments and some commented pattern can be in the comment body.

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.

isPattern

public static Parser<_> isPattern(Pattern pp, String err)
Scans the input for an occurrence of a string pattern.

Parameters: pp the pattern object. err the expected message when fails.

Returns: the Parser object.

isPattern

public static Parser<_> isPattern(String name, Pattern pp, String err)
Scans the input for an occurrence of a string pattern.

Parameters: name the Parser object name. pp the pattern object. err the expected message when fails.

Returns: the Parser object.

isQuotedChar

public static Parser<_> isQuotedChar(String name)
scanner for a c/c++/java style character literal. such as 'a' or '\\'.

Parameters: name the name of the scanner.

Returns: the scanner.

isQuotedChar

public static Parser<_> isQuotedChar()
scanner for a c/c++/java style character literal. such as 'a' or '\\'.

Returns: the scanner.

isQuotedString

public static Parser<_> isQuotedString(String name)
a scanner with a pattern for double quoted string literal. backslash '\' is used as escape character.

Parameters: name the name of the scanner.

Returns: the scanner.

isQuotedString

public static Parser<_> isQuotedString()
a scanner with a pattern for double quoted string literal. backslash '\' is used as escape character.

Returns: the scanner.

isSqlString

public 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.

Returns: the scanner.

isSqlString

public 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.

Parameters: name the name of the scanner.

Returns: the scanner.

isString

public static Parser<_> isString(String str)
matches the input against the specified string.

Parameters: str the string to match

Returns: the scanner.

isString

public static Parser<_> isString(String str, String err)
matches the input against the specified string.

Parameters: str the string to match err the error message if fails.

Returns: the scanner.

isString

public static Parser<_> isString(String name, String str, String err)
matches the input against the specified string.

Parameters: name the scanner name. str the string to match err the error message if fails.

Returns: the scanner.

isStringCI

public static Parser<_> isStringCI(String str, String err)
matches the input against the specified string case insensitively.

Parameters: str the string to match err the error message if fails.

Returns: the scanner.

isStringCI

public static Parser<_> isStringCI(String name, String str, String err)
matches the input against the specified string case insensitively.

Parameters: name the scanner name. str the string to match err the error message if fails.

Returns: the scanner.

isStringCI

public static Parser<_> isStringCI(String str)
matches the input against the specified string case insensitively.

Parameters: str the string to match

Returns: the scanner.

isWhitespaces

public static Parser<_> isWhitespaces()
Scans greedily for 1 or more whitespace characters.

Returns: the Parser object.

isWhitespaces

public static Parser<_> isWhitespaces(String name)
Scans greedily for 1 or more whitespace characters.

Parameters: name the Parser object name.

Returns: the Parser object.

isWhitespaces

public static Parser<_> isWhitespaces(String name, String err)
Scans greedily for 1 or more whitespace characters.

Parameters: name the Parser object name. err the expected message when fails.

Returns: the Parser object.

javaBlockComment

public static Parser<_> javaBlockComment()
scanner for c++/java style block comment.

Returns: the scanner.

javaDelimiter

public static Parser<_> javaDelimiter()
the c++/java style delimiter of tokens. whitespace, line comment, block comment.

Returns: the scanner.

javaDelimiter

public static Parser<_> javaDelimiter(String name)
the c++/java style delimiter of tokens. whitespace, line comment, block comment.

Parameters: name the scanner name.

Returns: the scanner.

javaLineComment

public static Parser<_> javaLineComment()
scanner for c++/java style line comment.

Returns: the scanner.

many

public static Parser<_> many(CharPredicate cp)
Scans greedily for 0 or more characters that satisfies the given CharPredicate.

Parameters: cp the predicate object.

Returns: the Parser object.

many

public static Parser<_> many(Pattern pp)
Scans greedily for 0 or more occurrences of the given pattern.

Parameters: pp the pattern object.

Returns: the Parser object.

many

public static Parser<_> many(String name, CharPredicate cp)
Scans greedily for 0 or more characters that satisfies the given CharPredicate.

Parameters: name the name of the Parser object. cp the predicate object.

Returns: the Parser object.

many

public static Parser<_> many(String name, Pattern pp)
Scans greedily for 0 or more occurrences of the given pattern.

Parameters: name the name of the Parser object. pp the pattern object.

Returns: the Parser object.

many1

public static Parser<_> many1(CharPredicate cp)
Scans greedily for 1 or more characters that satisfies the given CharPredicate.

Parameters: cp the predicate object.

Returns: the Parser object.

many1

public static Parser<_> many1(Pattern pp)
Scans greedily for 1 or more occurrences of the given pattern.

Parameters: pp the pattern object.

Returns: the Parser object.

many1

public static Parser<_> many1(String name, CharPredicate cp)
Scans greedily for 1 or more characters that satisfies the given CharPredicate.

Parameters: name the name of the Parser object. cp the predicate object.

Returns: the Parser object.

many1

public static Parser<_> many1(String name, Pattern pp)
Scans greedily for 1 or more occurrences of the given pattern.

Parameters: name the name of the Parser object. pp the pattern object.

Returns: the Parser object.

notAmong

public 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.

Parameters: name the scanner name. chars the characters. err the error message when the character is among the given values.

Returns: the scanner.

notAmong

public static Parser<_> notAmong(String name, char[] chars)
succeed and consume the current character if it is not equal to any of the given characters.

Parameters: name the scanner name. chars the characters.

Returns: the scanner.

notAmong

public static Parser<_> notAmong(char[] chars, String err)
succeed and consume the current character if it is not equal to any of the given characters.

Parameters: chars the characters. err the error message when the character is not among the given values.

Returns: the scanner.

notAmong

public static Parser<_> notAmong(char[] chars)
succeed and consume the current character if it is not equal to any of the given characters.

Parameters: chars the characters.

Returns: the scanner.

notChar

public static Parser<_> notChar(char ch, String err)
succeed and consume the current character if it is equal to ch.

Parameters: ch the expected character. err the error message.

Returns: the scanner.

notChar

public static Parser<_> notChar(String name, char ch, String err)
succeed and consume the current character if it is not equal to ch.

Parameters: name the scanner name. ch the expected character. err the error message.

Returns: the scanner.

notChar

public static Parser<_> notChar(char ch)
succeed and consume the current character if it is not equal to ch.

Parameters: ch the expected character.

Returns: the scanner.

notChar

public static Parser<_> notChar(String name, char ch)
succeed and consume the current character if it is not equal to ch.

Parameters: name the scanner name. ch the expected character.

Returns: the scanner.

quoted

public static Parser<_> quoted(char c1, char c2)
scans a quoted string that is opened by c1 and closed by c2.

Parameters: c1 the opening character. c2 the closing character.

Returns: the scanner.

quoted

public static Parser<_> quoted(String name, char c1, char c2)
scans a quoted string that is opened by c1 and closed by c2.

Parameters: name the scanner name. c1 the opening character. c2 the closing character.

Returns: the scanner.

quoted

public static Parser<_> quoted(Parser<_> open, Parser<_> close, Parser<?> s)
scans a quoted string that is opened by c1 and closed by c2.

Parameters: open the opening character. close the closing character.

Returns: the scanner.

quoted

public 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.

Parameters: name the scanner name. open the scanner for the opening pattern. close the scanner for the closing pattern.

Returns: the scanner.

scanChars

public 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.

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.

scanChars

public 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.

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.

sqlDelimiter

public static Parser<_> sqlDelimiter()
the T-SQL style delimiter of tokens. whitespace and line comment.

Returns: the scanner.

sqlDelimiter

public static Parser<_> sqlDelimiter(String name)
the T-SQL style delimiter of tokens. whitespace and line comment.

Parameters: name the scanner name.

Returns: the scanner.

sqlLineComment

public static Parser<_> sqlLineComment()
scanner for T-SQL style line comment.

Returns: the scanner.

stdDelimiter

public static Parser<_> stdDelimiter(String name, String lcomment, String openc, String closec)
Any delimiter with whitespace, non-nested block comment and line comment.

Parameters: name the scanner name. lcomment line comment starting string. openc block comment opening string. closec block comment closing string.

Returns: the scanner.

stdDelimiter

public static Parser<_> stdDelimiter(String lcomment, String openc, String closec)
Any delimiter with whitespace, non-nested block comment and line comment.

Parameters: lcomment line comment starting string. openc block comment opening string. closec block comment closing string.

Returns: the scanner.