org.codehaus.jparsec
Class Tokens

java.lang.Object
  extended by org.codehaus.jparsec.Tokens

public final class Tokens
extends Object

Provides common token values.

Author:
Ben Yu

Nested Class Summary
static class Tokens.Fragment
          Represents a fragment tagged according to its semantics.
static class Tokens.ScientificNotation
          Represents a scientific notation with a significand (mantissa) and an exponent.
static class Tokens.Tag
          Pre-built Tokens.Fragment token tags.
 
Method Summary
static Tokens.Fragment decimalLiteral(String s)
          Returns a Tokens.Fragment tagged as Tokens.Tag.DECIMAL.
static Tokens.Fragment fragment(String text, Object tag)
          Returns a Tokens.Fragment tagged with tag.
static Tokens.Fragment identifier(String name)
          Returns a Tokens.Fragment tagged as Tokens.Tag.IDENTIFIER.
static Tokens.Fragment integerLiteral(String s)
          Returns a Tokens.Fragment tagged as Tokens.Tag.INTEGER.
static Tokens.Fragment reserved(String name)
          Returns a Tokens.Fragment tagged as Tokens.Tag.RESERVED.
static Tokens.ScientificNotation scientificNotation(String significand, String exponent)
          Returns a Tokens.ScientificNotation with significand before the 'e' or 'E' and exponent after.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fragment

public static Tokens.Fragment fragment(String text,
                                       Object tag)
Returns a Tokens.Fragment tagged with tag.

Parameters:
text - the fragment text.
tag - the tag representing the fragment's semantics.
Returns:
the TypedToken object.

reserved

public static Tokens.Fragment reserved(String name)
Returns a Tokens.Fragment tagged as Tokens.Tag.RESERVED.

Parameters:
name - the reserved word.
Returns:
the token value.

identifier

public static Tokens.Fragment identifier(String name)
Returns a Tokens.Fragment tagged as Tokens.Tag.IDENTIFIER.

Parameters:
name - the identifier.
Returns:
the token value.

decimalLiteral

public static Tokens.Fragment decimalLiteral(String s)
Returns a Tokens.Fragment tagged as Tokens.Tag.DECIMAL.

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

integerLiteral

public static Tokens.Fragment integerLiteral(String s)
Returns a Tokens.Fragment tagged as Tokens.Tag.INTEGER.

Parameters:
s - the integer string representation.
Returns:
the token value.

scientificNotation

public static Tokens.ScientificNotation scientificNotation(String significand,
                                                           String exponent)
Returns a Tokens.ScientificNotation with significand before the 'e' or 'E' and exponent after.



Copyright © 2014. All rights reserved.