|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.parsec.Lexers
public final class Lexers
Provides some predefined basic lexer objects. A lexer is a character level parser that returns a token based on the recognized character range.
| Constructor Summary | |
|---|---|
Lexers()
|
|
| Method Summary | |
|---|---|
static Parser<Tok> |
allInteger()
Deprecated. Use lexLong(). |
static Parser<Tok> |
allInteger(java.lang.String name)
Deprecated. Use lexLong(String). |
static Parser<Tok> |
charLiteral()
returns the lexer that's gonna parse single quoted character literal (escaped by '\'), and then converts the character to a Character. |
static Parser<Tok> |
charLiteral(java.lang.String name)
returns the lexer that's gonna parse single quoted character literal (escaped by '\'), and then converts the character to a Character. |
static Parser<Tok> |
decimal()
returns the lexer that's gonna parse a decimal number (valid patterns are: 1, 2.3, 000, 0., .23), and convert the string to a decimal typed token. |
static Parser<Tok> |
decimal(java.lang.String name)
returns the lexer that's gonna parse a decimal number (valid patterns are: 1, 2.3, 000, 0., .23), and convert the string to a decimal typed token. |
static Parser<Tok> |
decInteger()
Deprecated. Use lexDecLong(). |
static Parser<Tok> |
decInteger(java.lang.String name)
Deprecated. Use lexDecLong(String). |
static Words |
getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case insensitively. |
static Words |
getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case insensitively. |
static Words |
getCaseInsensitive(java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case insensitively. |
static Words |
getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case sensitively. |
static Words |
getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case sensitively. |
static Words |
getCaseSensitive(java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Words object for lexing the operators with names specified in ops, and for lexing the keywords case sensitively. |
static Words |
getOperators(java.lang.String... ops)
Creates a Words object for lexing the operators with names specified in ops. |
static Parser<Tok> |
hexInteger()
Deprecated. Use lexHexLong(). |
static Parser<Tok> |
hexInteger(java.lang.String name)
Deprecated. Use lexHexLong(String). |
static Parser<Tok> |
integer()
returns the lexer that's gonna parse a integer number (valid patterns are: 0, 00, 1, 10), and convert the string to an integer typed token. |
static Parser<Tok> |
integer(java.lang.String name)
returns the lexer that's gonna parse a integer number (valid patterns are: 0, 00, 1, 10), and convert the string to an integer typed token. |
static Parser<Tok> |
lexDecLong()
returns the lexer that's gonna parse a decimal integer number (valid patterns are: 1, 10, 123), and convert the string to a Long token. |
static Parser<Tok> |
lexDecLong(java.lang.String name)
returns the lexer that's gonna parse a decimal integer number (valid patterns are: 1, 10, 123), and convert the string to a Long token. |
static Parser<Tok[]> |
lexeme(Parser<?> delim,
Parser<Tok> s)
Greedily runs Parser s repeatedly, and ignores the pattern recognized by Parser delim before and after each s. |
static Parser<Tok[]> |
lexeme(java.lang.String name,
Parser<?> delim,
Parser<Tok> s)
Greedily runs Parser s repeatedly, and ignores the pattern recognized by Parser delim before and after each s. |
static Parser<Tok> |
lexer(Parser<?> s,
Tokenizer tn)
Transform the recognized character range of scanner s to a token object with a Tokenizer. |
static Parser<Tok> |
lexer(Parser<?> s,
Tokenizer tn,
java.lang.String err)
Transform the recognized character range of scanner s to a token object with a Tokenizer. |
static Parser<Tok> |
lexer(java.lang.String name,
Parser<?> s,
Tokenizer tn)
Transform the recognized character range of scanner s to a token object with a Tokenizer. |
static Parser<Tok> |
lexer(java.lang.String name,
Parser<?> s,
Tokenizer tn,
java.lang.String err)
Transform the recognized character range of scanner s to a token object with a Tokenizer. |
static Parser<Tok> |
lexHexLong()
returns the lexer that's gonna parse a hex integer number (valid patterns are: 0x1, 0Xff, 0xFe1 etc.), and convert the string to a Long token. |
static Parser<Tok> |
lexHexLong(java.lang.String name)
returns the lexer that's gonna parse a hex integer number (valid patterns are: 0x1, 0Xff, 0xFe1 etc.), and convert the string to a Long token. |
static Parser<Tok> |
lexLong()
returns the lexer that's gonna parse decimal, hex, and octal numbers and convert the string to a Long token. |
static Parser<Tok> |
lexLong(java.lang.String name)
returns the lexer that's gonna parse decimal, hex, and octal numbers and convert the string to a Long token. |
static Parser<Tok> |
lexOctLong()
returns the lexer that's gonna parse a octal integer number (valid patterns are: 0, 07, 017, 0371 etc.), and convert the string to a Long token. |
static Parser<Tok> |
lexOctLong(java.lang.String name)
returns the lexer that's gonna parse a octal integer number (valid patterns are: 0, 07, 017, 0371 etc.), and convert the string to a Long token. |
static Parser<Tok> |
lexSimpleStringLiteral()
returns the lexer that's gonna parse double quoted string literal (escaped by '\'), and convert the string to a String token. |
static Parser<Tok> |
lexSimpleStringLiteral(java.lang.String name)
returns the lexer that's gonna parse double quoted string literal (escaped by '\'), and convert the string to a String token. |
static Parser<Tok> |
octInteger()
Deprecated. Use lexOctLong(). |
static Parser<Tok> |
octInteger(java.lang.String name)
Deprecated. Use lexOctLong(String). |
static Parser<Tok> |
quoted(char open,
char close)
Create a lexer that parsers a string literal quoted by open and close, and then converts it to a TokenQuoted token instance. |
static Parser<Tok> |
quoted(java.lang.String name,
char open,
char close)
Create a lexer that parsers a string literal quoted by open and close, and then converts it to a TokenQuoted token instance. |
static Parser<Tok> |
sqlStringLiteral()
returns the lexer that's gonna parse single quoted string literal (single quote is escaped with another single quote), and convert the string to a String token. |
static Parser<Tok> |
sqlStringLiteral(java.lang.String name)
returns the lexer that's gonna parse single quoted string literal (single quote is escaped with another single quote), and convert the string to a String token. |
static Parser<Tok> |
stringLiteral()
Deprecated. Use lexSimpleStringLiteral() |
static Parser<Tok> |
stringLiteral(java.lang.String name)
Deprecated. Use lexSimpleStringLiteral(String) |
static Parser<Tok> |
word()
returns the lexer that's gonna parse any word. |
static Parser<Tok> |
word(java.lang.String name)
returns the lexer that's gonna parse any word. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Lexers()
| Method Detail |
|---|
public static Parser<Tok> charLiteral()
public static Parser<Tok> charLiteral(java.lang.String name)
name - the lexer name.
public static Parser<Tok> stringLiteral()
lexSimpleStringLiteral()
public static Parser<Tok> lexSimpleStringLiteral()
public static Parser<Tok> stringLiteral(java.lang.String name)
lexSimpleStringLiteral(String)
name - the lexer name.
public static Parser<Tok> lexSimpleStringLiteral(java.lang.String name)
name - the lexer name.
public static Parser<Tok> sqlStringLiteral()
public static Parser<Tok> sqlStringLiteral(java.lang.String name)
name - the lexer name.
public static Parser<Tok> decimal()
public static Parser<Tok> decimal(java.lang.String name)
name - the lexer name.
public static Parser<Tok> integer()
public static Parser<Tok> integer(java.lang.String name)
name - the lexer name.
public static Parser<Tok> decInteger()
lexDecLong().
public static Parser<Tok> decInteger(java.lang.String name)
lexDecLong(String).
name - the lexer name.
public static Parser<Tok> octInteger()
lexOctLong().
public static Parser<Tok> octInteger(java.lang.String name)
lexOctLong(String).
name - the lexer name.
public static Parser<Tok> hexInteger()
lexHexLong().
public static Parser<Tok> hexInteger(java.lang.String name)
lexHexLong(String).
name - the lexer name.
public static Parser<Tok> allInteger()
lexLong().
public static Parser<Tok> allInteger(java.lang.String name)
lexLong(String).
name - the lexer name.
public static Parser<Tok> lexDecLong()
public static Parser<Tok> lexDecLong(java.lang.String name)
name - the lexer name.
public static Parser<Tok> lexOctLong()
public static Parser<Tok> lexOctLong(java.lang.String name)
name - the lexer name.
public static Parser<Tok> lexHexLong()
public static Parser<Tok> lexHexLong(java.lang.String name)
name - the lexer name.
public static Parser<Tok> lexLong()
public static Parser<Tok> lexLong(java.lang.String name)
name - the lexer name.
public static Parser<Tok> word()
public static Parser<Tok> word(java.lang.String name)
name - the lexer name.
public static Parser<Tok> quoted(java.lang.String name,
char open,
char close)
name - the lexer name.open - the opening character.close - the closing character.
public static Parser<Tok> quoted(char open,
char close)
open - the opening character.close - the closing character.
public static Words getOperators(java.lang.String... ops)
ops - the operator names.
public static Words getCaseInsensitive(java.lang.String[] ops,
java.lang.String[] keywords)
ops - the operator names.keywords - the keyword names.
public static Words getCaseSensitive(java.lang.String[] ops,
java.lang.String[] keywords)
ops - the operator names.keywords - the keyword names.
public static Words getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
wscanner - the scanner for a word in the language.ops - the operator names.keywords - the keyword names.
public static Words getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
wscanner - the scanner for a word in the language.ops - the operator names.keywords - the keyword names.
public static Words getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
wscanner - the scanner for a word in the language.ops - the operator names.keywords - the keyword names.toWord - the FromString object used to create a token for non-key words recognized by wscanner.
public static Words getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
wscanner - the scanner for a word in the language.ops - the operator names.keywords - the keyword names.toWord - the FromString object used to create a token for non-key words recognized by wscanner.
public static Parser<Tok> lexer(java.lang.String name,
Parser<?> s,
Tokenizer tn)
name - the name of the new Scanner.tn - the Tokenizer object.s - the scanner to transform.
public static Parser<Tok> lexer(Parser<?> s,
Tokenizer tn)
s - the scanner to transform.tn - the Tokenizer object.
public static Parser<Tok> lexer(Parser<?> s,
Tokenizer tn,
java.lang.String err)
s - the scanner to transform.tn - the Tokenizer object.err - the error message when the tokenizer returns null.
public static Parser<Tok> lexer(java.lang.String name,
Parser<?> s,
Tokenizer tn,
java.lang.String err)
name - the name of the new Scanner.s - the scanner to transform.tn - the Tokenizer object.err - the error message when the tokenizer returns null.
public static Parser<Tok[]> lexeme(java.lang.String name,
Parser<?> delim,
Parser<Tok> s)
name - the name of the new Parser object.delim - the delimiter Parser object.s - the Parser object.
public static Parser<Tok[]> lexeme(Parser<?> delim,
Parser<Tok> s)
delim - the delimiter Parser object.s - the Parser object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||