public java_cup.runtime.Symbol nextToken() throws java.io.IOException {
java_cup.runtime.Symbol sym =
- lookahead==null ? _nextToken() : lookahead.get();
+ lookahead==null?_nextToken():lookahead.get();
last = sym;
return sym;
}
switch (line.charAt(line_pos)) {
- // White space:
+ // White space:
case ' ': // ASCII SP
case '\t': // ASCII HT
case '\f': // ASCII FF
case '\n': // LineTerminator
return new WhiteSpace(consume());
- // EOF character:
+ // EOF character:
case '\020': // ASCII SUB
consume();
return new EOF();
- // Comment prefix:
+ // Comment prefix:
case '/':
return getComment();
- // else, a Token
+ // else, a Token
default:
return getToken();
}
Token getToken() throws java.io.IOException {
// Tokens are: Identifiers, Keywords, Literals, Separators, Operators.
switch (line.charAt(line_pos)) {
- // Separators: (period is a special case)
+ // Separators: (period is a special case)
case '(':
case ')':
case '{':
case '@':
return new Separator(consume());
- // Operators:
+ // Operators:
case '=':
case '>':
case '<':
case '\"':
return getStringLiteral();
- // a period is a special case:
+ // a period is a special case:
case '.':
if (Character.digit(line.charAt(line_pos+1),10)!=-1)
return getNumericLiteral();
"import", "instanceof", "int",
"interface",
"isavailable",
- "locdef", "long",
- "native", "new", "newflag", "optional", "package", "private", "protected", "public",
+ "locdef", "long",
+ "native", "new", "newflag", "optional", "package", "private", "protected", "public",
"rblock", "return",
"scratch", "sese", "short", "static", "strictfp", "super", "switch", "synchronized",
"tag", "task", "taskexit", //keywords for failure aware computation
// use binary search.
for (int l=0, r=keywords.length; r > l; ) {
int x = (l+r)/2, cmp = s.compareTo(keywords[x]);
- if (cmp < 0) r=x;else l=x+1;
+ if (cmp < 0) r=x; else l=x+1;
if (cmp== 0) return new Keyword(s);
}
// not a keyword.
case 'D':
consume();
- /* falls through */
+ /* falls through */
default:
return new DoubleLiteral(Double.valueOf(rep).doubleValue());
}
char second= line.charAt(line_pos);
switch(first) {
- // single-character operators.
+ // single-character operators.
case '~':
case '?':
case ':':
return new Operator(new String(new char[] {first}));
- // doubled operators
+ // doubled operators
case '+':
case '-':
case '&':