boolean parseEnum()
throws Exception {
try {
// check whether the next token is a 'enum'
TextToken t = nextToken();
if (!t.isIdentifier(ENUM)) {
throw new SyntaxException(ENUM, t.debugString());
}
t = nextToken();
if (!t.isIdentifier()) {
throw new SyntaxException("enum name", t.debugString());
}
//System.out.println("parsing enum " + t.getString());
DataModelTypeEnum e = new DataModelTypeEnum(t.getString());
t = nextToken();
if (!t.isChar(OCURLY)) {
throw new SyntaxException(OCURLY, t.debugString());
}
t = nextToken();
while (true) {
if (t.isChar(CCURLY)) {
break;
}
if (!t.isString()) {
throw new SyntaxException("enum value (string literal)", t.debugString());
}
e.addValue(t.getString());
t = nextToken();
}
types.add(e);