org.sc3d.apt.sss.v3
Class SSSString

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

public class SSSString
extends Token

A subclass of Token that represents a literal String. The 'type' field of SSSStrings is always 'Token.TYPE_STRING'. This class adds to Token a field 'value' which returns the value of the literal string when all escape sequences have been replaced by characters.


Field Summary
 java.lang.String value
          The value of this SSSString, or 'null' if the string literal was not syntactically correct.
 
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
SSSString(Sentence sentence, int start, int length, java.lang.String value)
          Constructs an SSSString, given values for its fields.
 
Method Summary
static SSSString lex(Sentence sentence, int start)
          Constructs an SSSString by reading from the middle of a Sentence.
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 java.lang.String value
The value of this SSSString, or 'null' if the string literal was not syntactically correct. Note that characters in this String are truncated to the 16-bit code used by Java.

Constructor Detail

SSSString

public SSSString(Sentence sentence,
                 int start,
                 int length,
                 java.lang.String value)
Constructs an SSSString, given values for its fields.

Method Detail

lex

public static SSSString lex(Sentence sentence,
                            int start)
Constructs an SSSString by reading from the middle of a Sentence. This method always returns a non-null SSSString. If there is a syntax error, this method returns an SSSString which represents the syntactically correct part, and attaches an appropriate error message to the Sentence. You can detect errors by checking whether the 'value' field is null.

Parameters:
sentence - the sentence from which to pluck a literal string.
start - the index of the opening double quote character of the literal string.
Returns:
a new SSSString.
Throws:
java.lang.IllegalArgumentException - if 'sentence.get(start)' is not a double quote character.

main

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