Howard Lewis Ship, Richard Jones, Marjan Sterjev,
Bruce McDonald, Mark Brennan, Vlad Skarzhevskyy,
Brett Randall, Tsuyoshi Murakami, Nathan Meyers, Yoshiyuki Usui
-Yutaka Sunaga, Arjan van der Meer, and Bruce Eckel
-for their contributions.
+Yutaka Sunaga, Arjan van der Meer, Bruce Eckel, Guillaume Pothier,
+and Kumar Matcha for their contributions.
<p><br>
return readSeparator('.');
}
}
- else if ('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || c == '_'
- || c == '$')
+ else if (Character.isJavaIdentifierStart((char)c))
return readIdentifier(c, token);
else
return readSeparator(c);
do {
tbuf.append((char)c);
c = getc();
- } while ('A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || c == '_'
- || c == '$' || '0' <= c && c <= '9');
+ } while (Character.isJavaIdentifierPart((char)c));
ungetc(c);
ktable.append("return", RETURN);
ktable.append("short", SHORT);
ktable.append("static", STATIC);
- ktable.append("strict", STRICT);
+ ktable.append("strictfp", STRICT);
ktable.append("super", SUPER);
ktable.append("switch", SWITCH);
ktable.append("synchronized", SYNCHRONIZED);
lastChar = c;
}
+ public String getTextAround() {
+ int begin = position - 10;
+ if (begin < 0)
+ begin = 0;
+
+ int end = position + 10;
+ if (end > maxlen)
+ end = maxlen;
+
+ return input.substring(begin, end);
+ }
+
private int getc() {
if (lastChar < 0)
if (position < maxlen)
package javassist.compiler;
public class SyntaxError extends CompileError {
- public SyntaxError(Lex l) {
- super("syntax error", l);
+ public SyntaxError(Lex lexer) {
+ super("syntax error near \"" + lexer.getTextAround() + "\"", lexer);
}
}