edu.stanford.slac.aida.lib.util.common
Class AQSToken

java.lang.Object
  extended by edu.stanford.slac.aida.lib.util.common.AQSToken

public class AQSToken
extends java.lang.Object

Token object. This class encapsulates an AQS token. It defines all terminal symbols and allows representation of the token by integer identifier as well as giving access to the actual string token.

Version:
29-Sep-2004, Greg White: Added exception logging.
Author:
George McIntyre

Nested Class Summary
static class AQSToken.Token
          Token codes: This table gives numeric codes to the terminal lexical elements
 
Field Summary
static java.lang.String ARRAY_CLOSE
          User defined array close specifier
static java.lang.String ARRAY_OPEN
          User defined array open specifier
static java.lang.String CLOSE_PAREN
          Close paretheses.
static java.lang.String MINUS
          Minus sign.
static java.lang.String NAMED_ELEMENT
          Operator for assigning a name to an element in a user defined structure
static java.lang.String OPEN_PAREN
          Open paretheses.
static java.lang.String PLUS
          Plus sign.
static java.lang.String SEPARATOR
          Separator between Instance and Attribute
static java.lang.String STRUCT_CLOSE
          User defined block scope delimiter close
static java.lang.String STRUCT_OPEN
          User defined block scope delimiter open
static java.lang.String STRUCT_SEPARATOR
          Lexical element for separating adjacent elements in a user defined structure
static java.lang.String[] Symbols
          Array of keyword/symbol strings for translation between code & string representations NB: Strings MUST be ordered such that entries that are prefixes of other entries follow the prefixed string (not necessarily adjacent).
 int token
          This token's actual token code
static int[] Tokens
          Array of keyword/symbol codes for translation between code & string representations Very important: This table must match exactly the previous table containing the strings corsponding to these codes.
 java.lang.String value
          This token's actual string value
 
Constructor Summary
AQSToken()
          Creates a new instance of ASQToken
 
Method Summary
 int getToken(java.lang.String theBuffer)
          Gets the next token from the given string buffer.
 java.lang.String getValue()
          Get the string value of a this token
static java.lang.String getValue(int theToken)
          Get the string value of given particular token code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

public static java.lang.String SEPARATOR
Separator between Instance and Attribute


ARRAY_OPEN

public static java.lang.String ARRAY_OPEN
User defined array open specifier


ARRAY_CLOSE

public static java.lang.String ARRAY_CLOSE
User defined array close specifier


STRUCT_OPEN

public static java.lang.String STRUCT_OPEN
User defined block scope delimiter open


STRUCT_CLOSE

public static java.lang.String STRUCT_CLOSE
User defined block scope delimiter close


NAMED_ELEMENT

public static java.lang.String NAMED_ELEMENT
Operator for assigning a name to an element in a user defined structure


STRUCT_SEPARATOR

public static java.lang.String STRUCT_SEPARATOR
Lexical element for separating adjacent elements in a user defined structure


MINUS

public static java.lang.String MINUS
Minus sign. Used for ranges and for simple expressions involving subtraction


PLUS

public static java.lang.String PLUS
Plus sign. Used for simple expressions involving addition


OPEN_PAREN

public static java.lang.String OPEN_PAREN
Open paretheses. Used in simple expressions to force evaluation precedence


CLOSE_PAREN

public static java.lang.String CLOSE_PAREN
Close paretheses. Used in simple expressions to force evaluation precedence


Symbols

public static java.lang.String[] Symbols
Array of keyword/symbol strings for translation between code & string representations NB: Strings MUST be ordered such that entries that are prefixes of other entries follow the prefixed string (not necessarily adjacent). This is because of the way that the efficient matcher in getToken() works Very important: This table must match exactly the following table containing the token codes. Adding to this table requires an obligatory addition to the tokens table


Tokens

public static int[] Tokens
Array of keyword/symbol codes for translation between code & string representations Very important: This table must match exactly the previous table containing the strings corsponding to these codes. Adding to this table requires an obligatory addition to the strings table


token

public int token
This token's actual token code


value

public java.lang.String value
This token's actual string value

Constructor Detail

AQSToken

public AQSToken()
Creates a new instance of ASQToken

Method Detail

getToken

public int getToken(java.lang.String theBuffer)
Gets the next token from the given string buffer.

Parameters:
theBuffer - The string buffer to tokenize
Returns:
Token.EOF: The buffer has been exhausted Token.code: The token code corresponding to the first recognised token in the given buffer Token.STRING: Othewise the initial portion of the given buffer is returned up to the first recognised token or the end of the buffer

getValue

public static java.lang.String getValue(int theToken)
Get the string value of given particular token code

Parameters:
theToken - A valid Token code
Returns:
String value of this token. The fixed string value of the AIDA lexical symbol.

getValue

public java.lang.String getValue()
Get the string value of a this token

Returns:
String value of this token. Either the fixed string value of the AIDA lexical symbol or the string found in the input stream corresponding to the Token.STRING.