|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfun.parsec.Terms
public final class Terms
This helper class provides convenient api's to build lexer and parsers for terminals.
| Method Summary | ||
|---|---|---|
static
|
charParser(FromChar<R> fc)
gets a Parser object to parse Character token. |
|
static
|
charParser(java.lang.String name,
FromChar<R> fc)
gets a Parser object to parse Character token. |
|
static
|
decimalParser(FromString<R> fc)
gets a Parser object to parse TokenDecimal. |
|
static
|
decimalParser(java.lang.String name,
FromString<R> fc)
gets a Parser object to parse TokenDecimal. |
|
static
|
fromTypedToken(T[] types,
FromString<R> f)
Get a FromToken object that only recognizes a token of certain types. |
|
static
|
fromTypedToken(T type,
FromString<R> f)
Get a FromToken object that only recognizes a token of a certain type. |
|
static Terms |
getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Deprecated. Use getCaseInsensitiveInstance(Parser, String[], String[]) instead. |
|
static Terms |
getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Deprecated. Use getCaseInsensitiveInstance(Parser, String[], String[], FromString) instead. |
|
static Terms |
getCaseInsensitive(java.lang.String[] ops,
java.lang.String[] keywords)
Deprecated. Use getCaseInsensitiveInstance(String[], String[]) instead. |
|
static Terms |
getCaseInsensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case insensitively. |
|
static Terms |
getCaseInsensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case insensitively. |
|
static Terms |
getCaseInsensitiveInstance(java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case insensitively. |
|
static Terms |
getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Deprecated. Use getCaseSensitiveInstance(Parser, String[], String[]) instead. |
|
static Terms |
getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Deprecated. Use getCaseSensitiveInstance(Parser, String[], String[], FromString) instead. |
|
static Terms |
getCaseSensitive(java.lang.String[] ops,
java.lang.String[] keywords)
Deprecated. Use getCaseSensitiveInstance(String[], String[]) instead. |
|
static Terms |
getCaseSensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case sensitively. |
|
static Terms |
getCaseSensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case sensitively. |
|
static Terms |
getCaseSensitiveInstance(java.lang.String[] ops,
java.lang.String[] keywords)
Creates a Terms object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case sensitively. |
|
Parser<Tok> |
getLexer()
gets the lexer for the terminals. |
|
static Terms |
getOperators(java.lang.String... ops)
Deprecated. Use getOperatorsInstance(String[]) instead. |
|
static Terms |
getOperatorsInstance(java.lang.String... ops)
Creates a Terms object for lexing the operators with names specified in ops. |
|
Parser<Tok> |
getParser(java.lang.String... tnames)
gets the parser for the terminals identified by tnames. |
|
Parser<Tok> |
getParser(java.lang.String tname)
gets the parser for a terminal identified by tname. |
|
Parser<Tok> |
getParser(java.lang.String[] tnames,
java.lang.String expected)
gets the parser for the terminals identified by tnames. |
|
Parser<Tok> |
getParser(java.lang.String tname,
java.lang.String expected)
gets the parser for a terminal identified by tname. |
|
Parser<Tok> |
getParser(java.lang.String name,
java.lang.String[] tnames)
gets the parser for the terminals identified by tnames. |
|
Parser<Tok> |
getParser(java.lang.String name,
java.lang.String[] tnames,
java.lang.String expected)
gets the parser for the terminals identified by tnames. |
|
Parser<Tok> |
getParser(java.lang.String name,
java.lang.String tname,
java.lang.String expected)
gets the parser for a terminal identified by tname. |
|
static
|
integerParser(FromLong<R> fc)
gets a Parser object to parse Long token. |
|
static
|
integerParser(FromString<R> fs)
gets a Parser object to parse token of arbitrary length integer. |
|
static
|
integerParser(java.lang.String name,
FromLong<R> fc)
gets a Parser object to parse Long token. |
|
static
|
integerParser(java.lang.String name,
FromString<R> fs)
gets a Parser object to parse token of arbitrary length integer. |
|
static
|
myParser(FromMyText<R> fm)
Deprecated. |
|
static
|
myParser(int kind,
FromString<R> fs)
Deprecated. |
|
static
|
myParser(java.lang.String name,
FromMyText<R> fm)
Deprecated. |
|
static
|
myParser(java.lang.String name,
int kind,
FromString<R> fs)
Deprecated. |
|
static
|
quotedWordParser(FromString3<R> fc)
gets a Parser object to parse TokenQuoted. |
|
static
|
quotedWordParser(java.lang.String name,
FromString3<R> fc)
gets a Parser object to parse TokenQuoted. |
|
static
|
stringParser(FromString<R> fc)
gets a Parser object to parse String token. |
|
static
|
stringParser(java.lang.String name,
FromString<R> fc)
gets a Parser object to parse String token. |
|
static
|
wordParser(FromString<R> fc)
gets a Parser object to parse TokenWord. |
|
static
|
wordParser(java.lang.String name,
FromString<R> fc)
gets a Parser object to parse TokenWord. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Parser<Tok> getParser(java.lang.String... tnames)
tnames - the names of the terminals.
public Parser<Tok> getParser(java.lang.String name,
java.lang.String[] tnames)
name - the name of the parser.tnames - the names of the terminals.
public Parser<Tok> getParser(java.lang.String[] tnames,
java.lang.String expected)
tnames - the names of the terminals.expected - the label when this parser fails.
public Parser<Tok> getParser(java.lang.String name,
java.lang.String[] tnames,
java.lang.String expected)
name - the name of the parser.tnames - the names of the terminals.expected - the label when this parser fails.
public Parser<Tok> getParser(java.lang.String name,
java.lang.String tname,
java.lang.String expected)
name - the name of the parser.tname - the name of the terminal.expected - the label when this parser fails.
public Parser<Tok> getParser(java.lang.String tname,
java.lang.String expected)
tname - the name of the terminal.expected - the label when this parser fails.
public Parser<Tok> getParser(java.lang.String tname)
tname - the name of the terminal.
public Parser<Tok> getLexer()
public static Terms getCaseInsensitiveInstance(java.lang.String[] ops,
java.lang.String[] keywords)
ops - the operator names.keywords - the keyword names.
public static Terms getCaseSensitiveInstance(java.lang.String[] ops,
java.lang.String[] keywords)
ops - the operator names.keywords - the keyword names.
public static Terms getCaseInsensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
wscanner - the scanner that identifies a word in the language.ops - the operator names.keywords - the keyword names.
public static Terms getCaseSensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
wscanner - the scanner that identifies a word in the language.ops - the operator names.keywords - the keyword names.
public static Terms getCaseInsensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
wscanner - the scanner that identifies 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 Terms getCaseSensitiveInstance(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
wscanner - the scanner that identifies 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 Terms getOperatorsInstance(java.lang.String... ops)
ops - the operator names.
public static Terms getCaseInsensitive(java.lang.String[] ops,
java.lang.String[] keywords)
getCaseInsensitiveInstance(String[], String[]) instead.
ops - the operator names.keywords - the keyword names.
public static Terms getCaseSensitive(java.lang.String[] ops,
java.lang.String[] keywords)
getCaseSensitiveInstance(String[], String[]) instead.
ops - the operator names.keywords - the keyword names.
public static Terms getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
getCaseInsensitiveInstance(Parser, String[], String[]) instead.
wscanner - the scanner that identifies a word in the language.ops - the operator names.keywords - the keyword names.
public static Terms getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords)
getCaseSensitiveInstance(Parser, String[], String[]) instead.
wscanner - the scanner that identifies a word in the language.ops - the operator names.keywords - the keyword names.
public static Terms getCaseInsensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
getCaseInsensitiveInstance(Parser, String[], String[], FromString) instead.
wscanner - the scanner that identifies 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 Terms getCaseSensitive(Parser<?> wscanner,
java.lang.String[] ops,
java.lang.String[] keywords,
FromString<?> toWord)
getCaseSensitiveInstance(Parser, String[], String[], FromString) instead.
wscanner - the scanner that identifies 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 Terms getOperators(java.lang.String... ops)
getOperatorsInstance(String[]) instead.
ops - the operator names.
public static <R> Parser<R> charParser(java.lang.String name,
FromChar<R> fc)
name - the parser name.fc - the mapping to map char to an object returned by the parser.
public static <R> Parser<R> stringParser(java.lang.String name,
FromString<R> fc)
name - the parser name.fc - the mapping to map String to an object returned by the parser.
public static <R> Parser<R> quotedWordParser(java.lang.String name,
FromString3<R> fc)
name - the parser name.fc - the mapping to map the quoted string to an object returned by the parser.
public static <R> Parser<R> wordParser(java.lang.String name,
FromString<R> fc)
name - the parser name.fc - the mapping to map the word to an object returned by the parser.
@Deprecated public static <R> Parser<R> myParser(FromMyText<R> fm)
fm - the FromMyText object to recognize MyToken object.
@Deprecated
public static <R> Parser<R> myParser(java.lang.String name,
FromMyText<R> fm)
name - the name of the parser object.fm - the FromMyText object to recognize MyToken object.
@Deprecated
public static <R> Parser<R> myParser(int kind,
FromString<R> fs)
kind - the token kind to recognize.fs - the FromString object to transform.
@Deprecated
public static <R> Parser<R> myParser(java.lang.String name,
int kind,
FromString<R> fs)
name - the Parser name.kind - the token kind to recognize.fs - the FromString object to transform.
public static <R> Parser<R> integerParser(java.lang.String name,
FromLong<R> fc)
name - the parser name.fc - the mapping to map the number to an object returned by the parser.
public static <R> Parser<R> integerParser(FromString<R> fs)
fs - the mapping to map the number to an object returned by the parser.
public static <R> Parser<R> integerParser(java.lang.String name,
FromString<R> fs)
name - the parser name.fs - the mapping to map the number to an object returned by the parser.
public static <R> Parser<R> decimalParser(java.lang.String name,
FromString<R> fc)
name - the parser name.fc - the mapping to map the decimal to an object returned by the parser.
public static <R> Parser<R> charParser(FromChar<R> fc)
fc - the mapping to map char to an object returned by the parser.
public static <R> Parser<R> stringParser(FromString<R> fc)
fc - the mapping to map String to an object returned by the parser.
public static <R> Parser<R> quotedWordParser(FromString3<R> fc)
fc - the mapping to map the quoted string to an object returned by the parser.
public static <R> Parser<R> wordParser(FromString<R> fc)
fc - the mapping to map the word to an object returned by the parser.
public static <R> Parser<R> integerParser(FromLong<R> fc)
fc - the mapping to map the number to an object returned by the parser.
public static <R> Parser<R> decimalParser(FromString<R> fc)
fc - the mapping to map the decimal to an object returned by the parser.
public static <T,R> FromToken<R> fromTypedToken(T type,
FromString<R> f)
type - the token type recognized.f - the FromString object used to translate the character range to
a certain object.
public static <T,R> FromToken<R> fromTypedToken(T[] types,
FromString<R> f)
types - the token types recognized.f - the FromString object used to translate the character range to
a certain object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||