jfun.parsec.tokens
Class Tokens

java.lang.Object
  extended by jfun.parsec.tokens.Tokens

public final class Tokens
extends java.lang.Object

This class create some basic tokens.

Author:
Ben Yu 2004-11-15

Constructor Summary
Tokens()
           
 
Method Summary
static java.lang.Character char_literal(char c)
          create a character literal token.
static
<T> TypedToken<T>
createTypedToken(java.lang.String text, T type)
          Create a typed token.
static TokenDecimal decimal_literal(java.lang.String s)
          create a decimal literal token object.
static jfun.parsec.tokens.TokenEof eof()
          Get a token instance for eof.
static java.lang.Long int_literal(long n)
          Deprecated. use long_literal(long) instead.
static java.lang.Long long_literal(long n)
          Create a integer literal token whose value is within the range of a long integer.
static MyToken my(java.lang.String text, int kind)
          Deprecated. 
static TokenQuoted quoted_string(java.lang.String open, java.lang.String close, java.lang.String s)
          Create a quoted string token.
static TokenReserved reserved(java.lang.String n)
          create a TokenReserved object.
static java.lang.String str_literal(java.lang.String s)
          Create a string literal token.
static TokenWord word(java.lang.String n)
          create a TokenWord object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tokens

public Tokens()
Method Detail

createTypedToken

public static <T> TypedToken<T> createTypedToken(java.lang.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

reserved

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

Parameters:
n - the reserved word.
Returns:
the token object.

word

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

Parameters:
n - the word.
Returns:
the token object.

my

@Deprecated
public static MyToken my(java.lang.String text,
                                    int kind)
Deprecated. 

Create a MyToken object.

Parameters:
text - the text.
kind - the kind.
Returns:
the token object.

decimal_literal

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

Parameters:
s - the decimal string representation.
Returns:
the token object.

char_literal

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

Parameters:
c - the character.
Returns:
the token object.

int_literal

public static java.lang.Long int_literal(long n)
Deprecated. use long_literal(long) instead.

Create a integer litgeral token

Parameters:
n - the number
Returns:
the token object.

long_literal

public static java.lang.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(java.lang.String open,
                                        java.lang.String close,
                                        java.lang.String s)
Create a quoted string token.

Parameters:
open - the open quote
close - the close quote
s - the quoted string
Returns:
the token object.

str_literal

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

Parameters:
s - the string literal.
Returns:
the token object.

eof

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

Since:
version 1.1