private int getKeyword(String name) throws IOException {
//#switch(name)
case "if": return IF;
+ case "lt": return LT;
+ case "gt": return GT;
case "in": return IN;
case "do": return DO;
case "and": return AND;
+ case "or": return OR;
case "for": return FOR;
case "int": return RESERVED;
case "new": return RESERVED;
case ')': return RP;
case ',': return COMMA;
case '?': return HOOK;
- case ':': return COLON;
+ case ':': return !in.match(':') ? COLON : in.match('=') ? GRAMMAR : le(":: is not a valid token");
case '.': return DOT;
case '|': return in.match('|') ? OR : (in.match('=') ? ASSIGN_BITOR : BITOR);
case '^': return in.match('=') ? ASSIGN_BITXOR : BITXOR;
case '!': return !in.match('=') ? BANG : in.match('=') ? SHNE : NE;
case '%': return in.match('=') ? ASSIGN_MOD : MOD;
case '~': return BITNOT;
- case '+': return in.match('=') ? ASSIGN_ADD : in.match('+') ? INC : ADD;
- case '-': return in.match('=') ? ASSIGN_SUB: in.match('-') ? DEC : SUB;
+ case '+': return in.match('=') ? ASSIGN_ADD : in.match('+') ? (in.match('=') ? ADD_TRAP : INC) : ADD;
+ case '-': return in.match('=') ? ASSIGN_SUB: in.match('-') ? (in.match('=') ? DEL_TRAP : DEC) : SUB;
case '*': return in.match('=') ? ASSIGN_MUL : MUL;
case '<': return !in.match('<') ? (in.match('=') ? LE : LT) : in.match('=') ? ASSIGN_LSH : LSH;
case '>': return !in.match('>') ? (in.match('=') ? GE : GT) :
}
}
+ private int le(String s) throws LexerException { if (true) throw new LexerException(s); return 0; }
// SmartReader ////////////////////////////////////////////////////////////////