[Nice-commit] Nice/src/bossa/syntax Pattern.java,1.64,1.65
Brought to you by:
bonniot
From: <ar...@us...> - 2003-07-23 18:41:28
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv19453/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Fix bug that caused failure of reading of char/string literal patterns containing a '@' or '#'. And added a testcase for a new bug with escaping string. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Pattern.java 15 Jul 2003 11:11:22 -0000 1.64 --- Pattern.java 23 Jul 2003 18:41:15 -0000 1.65 *************** *** 622,628 **** int len = rep.length(); ! while(pos[0] < len && ! rep.charAt(pos[0]) != '@' && rep.charAt(pos[0]) != '#') ! pos[0]++; String name = rep.substring(start, pos[0]); --- 622,648 ---- int len = rep.length(); ! 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 && ! ( ( rep.charAt(pos[0]) != '@' && rep.charAt(pos[0]) != '#') || ! ( rep.charAt(pos[0]-1) == '\"' && ! rep.charAt(pos[0]-2) != '\\' ) ) ) ! pos[0]++; ! ! } ! else ! { ! while(pos[0] < len && ! rep.charAt(pos[0]) != '@' && rep.charAt(pos[0]) != '#') ! pos[0]++; ! } String name = rep.substring(start, pos[0]); |