Author: scabanovich
Date: 2008-09-30 11:23:04 -0400 (Tue, 30 Sep 2008)
New Revision: 10568
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java
Log:
JBIDE-1497.
Minor improvements
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java 2008-09-30
13:35:05 UTC (rev 10567)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/OperationTokenDescription.java 2008-09-30
15:23:04 UTC (rev 10568)
@@ -55,7 +55,7 @@
}
if(end < 0) return false;
char ch = tokenizer.lookUpChar(end);
- if(Character.isWhitespace(ch) || ch == '\0' || ch == '('
+ if(Character.isWhitespace(ch) || ch == '\0' ||
!Character.isJavaIdentifierPart(ch)
|| (canBeFollowedByOperand && Character.isJavaIdentifierPart(ch)
|| ch == '\'' || ch == '"' || ch == '-')) {
return true;
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 2008-09-30
13:35:05 UTC (rev 10567)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/token/PrimitiveValueTokenDescription.java 2008-09-30
15:23:04 UTC (rev 10568)
@@ -56,9 +56,11 @@
}
private boolean isNumber(Tokenizer tokenizer, int offset) {
- //TODO improve
char ch = tokenizer.lookUpChar(offset);
- return Character.isDigit(ch);
+ if(ch == '.') {
+ ch = tokenizer.lookUpChar(offset + 1);
+ }
+ return ch != '\0' && Character.isDigit(ch);
}
public boolean read(Tokenizer tokenizer, int offset) {
@@ -75,20 +77,31 @@
return true;
}
+ static String TYPE_CHAR = "lLfFdD";
private boolean readNumber(Tokenizer tokenizer, int offset) {
int i = offset;
+ int dotCount = 1;
+ if(tokenizer.startsWith("0x")) {
+ i += 2;
+ dotCount = 0;
+ }
char ch = '\0';
boolean lastCharIsWrong = false;
- int dotCount = 0;
while((ch = tokenizer.readNextChar()) != '\0') {
if(ch == '.') {
- dotCount++;
- if(dotCount > 1) {
+ dotCount--;
+ if(dotCount < 0) {
lastCharIsWrong = true;
break;
}
} else if(!Character.isDigit(ch)) {
- //TODO improve: 0x1, 1d, .f, etc
+ if(TYPE_CHAR.indexOf(ch) >= 0) {
+ char ch1 = tokenizer.lookUpChar(i + 1);
+ if(ch1 == '\0' || !Character.isJavaIdentifierPart(ch1)) {
+ i++;
+ break;
+ }
+ }
lastCharIsWrong = true;
break;
}
Show replies by date