aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/compiler/Parser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/compiler/Parser.java')
-rw-r--r--src/main/javassist/compiler/Parser.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/javassist/compiler/Parser.java b/src/main/javassist/compiler/Parser.java
index ed6e9dd3..e1a0d5b2 100644
--- a/src/main/javassist/compiler/Parser.java
+++ b/src/main/javassist/compiler/Parser.java
@@ -852,6 +852,23 @@ public final class Parser implements TokenId {
case '!' :
case '~' :
t = lex.get();
+ if (t == '-') {
+ int t2 = lex.lookAhead();
+ switch (t2) {
+ case LongConstant :
+ case IntConstant :
+ case CharConstant :
+ lex.get();
+ return new IntConst(-lex.getLong(), t2);
+ case DoubleConstant :
+ case FloatConstant :
+ lex.get();
+ return new DoubleConst(-lex.getDouble(), t2);
+ default :
+ break;
+ }
+ }
+
return Expr.make(t, parseUnaryExpr(tbl));
case '(' :
return parseCast(tbl);
@@ -977,12 +994,12 @@ public final class Parser implements TokenId {
* a class name and a member name in an expression for static member
* access. For example,
* java.lang.Integer.toString(3) in regular Java
- * must be written like this:
+ * can be written like this:
* java.lang.Integer#toString(3) for this compiler.
*/
private ASTree parsePostfix(SymbolTable tbl) throws CompileError {
int token = lex.lookAhead();
- switch (token) {
+ switch (token) { // see also parseUnaryExpr()
case LongConstant :
case IntConstant :
case CharConstant :