org.sc3d.apt.sss.v3
Class SSSChar

java.lang.Object
  extended by org.sc3d.apt.sss.v3.Token
      extended by org.sc3d.apt.sss.v3.SSSChar

public class SSSChar
extends Token

A subclass of Token that represents a literal character. The 'type' field is always 'Token.TYPE_CHAR'. This class adds a 'value' field that gives the unicode character value of this literal character.


Field Summary
 boolean isOkay
          'true' if this literal character is syntactically correct, otherwise 'false'.
 int value
          The unicode character value of this literal character.
 
Fields inherited from class org.sc3d.apt.sss.v3.Token
length, sentence, start, type, TYPE_BRACE, TYPE_CHAR, TYPE_COMMENT, TYPE_CONSTANT, TYPE_IDENTIFIER, TYPE_NUMBER, TYPE_ROUND, TYPE_SQUARE, TYPE_STRING, TYPE_WORD
 
Constructor Summary
SSSChar(Sentence sentence, int start, int length, int value, boolean isOkay)
          Constructs an SSSChar given values for its fields.
 
Method Summary
static SSSChar lex(Sentence sentence, int start)
          Lexes a single SSSChar from 'sentence' starting at 'start'.
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.sc3d.apt.sss.v3.Token
addError, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public final int value
The unicode character value of this literal character. This value is undefined unless 'isOkay'.


isOkay

public final boolean isOkay
'true' if this literal character is syntactically correct, otherwise 'false'.

Constructor Detail

SSSChar

public SSSChar(Sentence sentence,
               int start,
               int length,
               int value,
               boolean isOkay)
Constructs an SSSChar given values for its fields.

Method Detail

lex

public static SSSChar lex(Sentence sentence,
                          int start)
Lexes a single SSSChar from 'sentence' starting at 'start'. This method always returns an SSSChar. If there is a syntax error, this method returns an SSSChar representing the correct part, and attaches error messages to 'sentence'.

Parameters:
sentence - the sentence from which to pluck an SSSChar.
start - the index of the opening ' character.
Returns:
a fresh SSSChar.
Throws:
java.lang.IllegalArgumentException - if there isn't a ' character at 'start'.

main

public static void main(java.lang.String[] args)