|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.lexgen.TokenDefinition
| Field Summary | |
private String[] |
flags
An array of the token flags that are true for this token. |
private int |
id
|
static int |
KEYWORD
|
static int |
LITERAL
Token types |
private String |
name
|
static int |
OTHER
|
private int |
type
|
private String |
value
The text value of this token in pure string format (with escape codes evaluated). |
| Constructor Summary | |
TokenDefinition(int type,
String name,
String value,
List flags)
Creates a new TokenDefinition instance. |
|
| Method Summary | |
(package private) boolean |
accumKeyword(List accum,
String prefix,
List legalFlags)
Adds the token information for this to accum if
this is a keyword or literal token. |
void |
checkIdentifiers(Hashtable identifiers,
String prefix,
int id,
String sourceFile)
Check for duplicate identifiers |
private int |
flagsAsInt(List legalFlags)
|
void |
printDefinition(PrintWriter out,
String prefix)
Prints the token definition to definition file (txt) |
void |
printInterface(PrintWriter out,
String prefix)
Prints the token definition to interface file (java) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int LITERAL
public static final int KEYWORD
public static final int OTHER
private final int type
private final String name
private final String value
private final String[] flags
private int id
| Constructor Detail |
public TokenDefinition(int type,
String name,
String value,
List flags)
TokenDefinition instance.
type - the kind of token represented by this, one of
LITERAL, KEYWORD, OTHERname - an identifier for this tokenvalue - the source code text matched by this token, will match
name if this parameter is nullflags - a list of Strings giving the
flags that are true for this token| Method Detail |
public void checkIdentifiers(Hashtable identifiers,
String prefix,
int id,
String sourceFile)
throws LexgenError
identifiers - a table of all token identifiersprefix - the literal prefixid - the id of the tokensourceFile - the file where the token is defined
LexgenError
public void printDefinition(PrintWriter out,
String prefix)
out - the output streamprefix - the literal prefix
public void printInterface(PrintWriter out,
String prefix)
out - the output streamprefix - the literal prefix
boolean accumKeyword(List accum,
String prefix,
List legalFlags)
accum if
this is a keyword or literal token.
requires (\forall Object o; accum.contains(o); o instanceof DefinitionFile.KeywordTokenInfo); ensures (\forall Object o; accum.contains(o); o instanceof DefinitionFile.KeywordTokenInfo); also requires type == LITERAL || type == KEYWORD; ensures \old(accum.size() + 1) == accum.size(); also requires !(type == LITERAL || type == KEYWORD); ensures \old(accum.equals(accum)); also ensures \result != true ==> (* an error was reported to System.err *);
private int flagsAsInt(List legalFlags)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||