jfun.parsec.tokens

Class Tokens

public final class Tokens extends Object

This class create some basic tokens.

Author: Ben Yu 2004-11-15

Method Summary
static Characterchar_literal(char c)
create a character literal token.
static <T> TypedToken<T>createTypedToken(String text, T type)
Create a typed token.
static TokenDecimaldecimal_literal(String s)
create a decimal literal token object.
static TokenEofeof()
Get a token instance for eof.
static Longint_literal(long n)
Create a integer litgeral token
static Longlong_literal(long n)
Create a integer literal token whose value is within the range of a long integer.
static TokenQuotedquoted_string(String open, String close, String s)
Create a quoted string token.
static TokenReservedreserved(String n)
create a TokenReserved object.
static Stringstr_literal(String s)
Create a string literal token.
static TokenWordword(String n)
create a TokenWord object.

Method Detail

char_literal

public static Character char_literal(char c)
create a character literal token.

Parameters: c the character.

Returns: the token object.

createTypedToken

public static <T> TypedToken<T> createTypedToken(String text, T type)
Create a typed token.

Parameters: text the token text. type the token type.

Returns: the TypedToken object.

Since: version 1.1

decimal_literal

public static TokenDecimal decimal_literal(String s)
create a decimal literal token object.

Parameters: s the decimal string representation.

Returns: the token object.

eof

public static TokenEof eof()
Get a token instance for eof.

Since: version 1.1

int_literal

public static Long int_literal(long n)

Deprecated: use Tokens instead.

Create a integer litgeral token

Parameters: n the number

Returns: the token object.

long_literal

public static Long long_literal(long n)
Create a integer literal token whose value is within the range of a long integer.

Parameters: n the number

Returns: the token object.

Since: version 0.6

quoted_string

public static TokenQuoted quoted_string(String open, String close, String s)
Create a quoted string token.

Parameters: open the open quote close the close quote s the quoted string

Returns: the token object.

reserved

public static TokenReserved reserved(String n)
create a TokenReserved object.

Parameters: n the reserved word.

Returns: the token object.

str_literal

public static String str_literal(String s)
Create a string literal token.

Parameters: s the string literal.

Returns: the token object.

word

public static TokenWord word(String n)
create a TokenWord object.

Parameters: n the word.

Returns: the token object.