Author: scabanovich
Date: 2009-03-12 13:08:12 -0400 (Thu, 12 Mar 2009)
New Revision: 14196
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/SyntaxError.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java
Log:
JBIDE-3951
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/SyntaxError.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/SyntaxError.java 2009-03-12
17:00:00 UTC (rev 14195)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/parser/SyntaxError.java 2009-03-12
17:08:12 UTC (rev 14196)
@@ -37,7 +37,7 @@
return problem;
}
- void setProblem(String problem) {
+ public void setProblem(String problem) {
this.problem = problem;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java 2009-03-12
17:00:00 UTC (rev 14195)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java 2009-03-12
17:08:12 UTC (rev 14196)
@@ -11,7 +11,9 @@
package org.jboss.tools.common.el.internal.core.parser.token;
import org.jboss.tools.common.el.core.parser.ITokenDescription;
+import org.jboss.tools.common.el.core.parser.SyntaxError;
import org.jboss.tools.common.el.core.parser.Tokenizer;
+import org.jboss.tools.common.el.internal.core.parser.rule.BasicStates;
/**
*
@@ -81,6 +83,7 @@
private boolean readNumber(Tokenizer tokenizer, int offset) {
int i = offset;
int dotCount = 1;
+ int dotOffset = -1;
if(tokenizer.startsWith("0x")) {
i += 2;
dotCount = 0;
@@ -94,6 +97,8 @@
if(dotCount < 0) {
lastCharIsWrong = true;
break;
+ } else {
+ dotOffset = tokenizer.getCurrentIndex() - 1;
}
} else if(!Character.isDigit(ch)) {
if(inE) {
@@ -131,6 +136,13 @@
if(lastCharIsWrong) {
tokenizer.releaseChar();
}
+ if(tokenizer.getLastToken() != null
+ && tokenizer.getLastToken().getType() == ArgStartTokenDescription.ARG_START
+ && dotCount < 1) {
+ SyntaxError error = new SyntaxError(dotOffset, BasicStates.STATE_EXPECTING_ARG);
+ error.setProblem("Argument must resolve to integer or string.");
+ tokenizer.getErrors().add(error);
+ }
tokenizer.addToken(getType(), offset, i);
return true;
}
Show replies by date