Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv23228/F:/nice/src/bossa/syntax
Modified Files:
Pattern.java StringConstantExp.java
Log Message:
Fixed a bug in escaping string literal patterns and some little improvements in pattern.java.
Index: Pattern.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** Pattern.java 23 Jul 2003 18:41:15 -0000 1.65
--- Pattern.java 24 Jul 2003 17:52:08 -0000 1.66
***************
*** 563,566 ****
--- 563,576 ----
/**
* Returns a string used to recognize this pattern in the bytecode.
+ * for the different patterns the following signatures are used:
+ * any : `@_`
+ * null : `@NULL`
+ * type : `@` + type where `.` in type are replaced by `$`
+ * exactly at type : `#` + type idem
+ * integer literal : `@-` / `@+` + int_literal
+ * char literal : `@'c'` where c is an unescaped char
+ * string literal : `@"string"` where string is an escaped string
+ * reference : `@` + globalconstantname
+ * int comparison : `@>` / `@>=` / `@<` / `@<=` + int_literal
*
* This is usefull to distinguish alternatives of a method.
***************
*** 593,596 ****
--- 603,609 ----
return "@=" + name;
+ if (atString())
+ return "@\"" + ((StringConstantExp)atValue).escapedValue + "\"";
+
return "@" + atValue;
}
***************
*** 623,634 ****
if (rep.charAt(pos[0]) == '\'')
! { //we need to skip possible '@' or '#' content of the char literal
pos[0] += 3;
- while(pos[0] < len &&
- rep.charAt(pos[0]) != '@' && rep.charAt(pos[0]) != '#')
- pos[0]++;
}
else if (rep.charAt(pos[0]) == '\"')
! { //idem for string literal
pos[0] += 2;
while(pos[0] < len &&
--- 636,644 ----
if (rep.charAt(pos[0]) == '\'')
! { //char literal patterns are 3 chars
pos[0] += 3;
}
else if (rep.charAt(pos[0]) == '\"')
! { //we need to skip possible '@' or '#' content of the string literal
pos[0] += 2;
while(pos[0] < len &&
Index: StringConstantExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/StringConstantExp.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** StringConstantExp.java 28 May 2003 12:57:26 -0000 1.7
--- StringConstantExp.java 24 Jul 2003 17:52:09 -0000 1.8
***************
*** 26,29 ****
--- 26,30 ----
{
className = stringName;
+ this.escapedValue = value;
this.value=unescape(value);
}
***************
*** 91,93 ****
--- 92,96 ----
return "\""+value+"\"";
}
+
+ String escapedValue;
}
|