Fixed CS_UNICODE_ESCAPE = true;

This commit is contained in:
2023-05-14 20:33:04 +02:00
parent 21b8c43ceb
commit 7d6e9e9a29
4 changed files with 31 additions and 31 deletions

View File

@@ -184,7 +184,7 @@ public class CSJavaFiles
ostr.println(" case 'e' : case 'E' : return 14;");
ostr.println(" case 'f' : case 'F' : return 15;");
ostr.println(" }\n");
ostr.println(" throw Exception(); // Should never come here");
ostr.println(" throw new Exception(); // Should never come here");
ostr.println(" }");
ostr.println("");
ostr.println(prefix + "public int bufpos = -1;");
@@ -193,8 +193,8 @@ public class CSJavaFiles
ostr.println(prefix + "int tokenBegin;");
if (OtherFilesGen.keepLineCol){
ostr.println(prefix + "protected int bufline[];");
ostr.println(prefix + "protected int bufcolumn[];");
ostr.println(prefix + "protected int[] bufline;");
ostr.println(prefix + "protected int[] bufcolumn;");
ostr.println("");
ostr.println(prefix + "protected int column = 0;");
ostr.println(prefix + "protected int line = 1;");
@@ -221,8 +221,8 @@ public class CSJavaFiles
ostr.println(" char[] newbuffer = new char[bufsize + 2048];");
if (OtherFilesGen.keepLineCol){
ostr.println(" int newbufline[] = new int[bufsize + 2048];");
ostr.println(" int newbufcolumn[] = new int[bufsize + 2048];");
ostr.println(" int[] newbufline = new int[bufsize + 2048];");
ostr.println(" int[] newbufcolumn = new int[bufsize + 2048];");
}
ostr.println("");
@@ -263,7 +263,7 @@ public class CSJavaFiles
ostr.println(" }");
ostr.println(" }");
ostr.println(" catch (System.Exception t){");
ostr.println(" throw e;");
ostr.println(" throw t;");
ostr.println(" }");
ostr.println("");
ostr.println(" available = (bufsize += 2048);");
@@ -586,10 +586,10 @@ public class CSJavaFiles
ostr.println(" nextCharBuf = new char[4096];");
ostr.println(" }");
ostr.println("");
ostr.println(" public JavaCharStream(System.IO.TextReader dstream, int startline, int startcolumn)");
ostr.println(" public CSCharStream(System.IO.TextReader dstream, int startline, int startcolumn)");
ostr.println(" : this(dstream, startline, startcolumn, 4096){}");
ostr.println("");
ostr.println(" public JavaCharStream(System.IO.TextReader dstream)");
ostr.println(" public CSCharStream(System.IO.TextReader dstream)");
ostr.println(" : this(dstream, 1, 1, 4096){}");
ostr.println("");
ostr.println(" public void ReInit(System.IO.TextReader dstream, int startline, int startcolumn, int buffersize){");
@@ -632,19 +632,19 @@ public class CSJavaFiles
//ostr.println(" : this(encoding == null ? new System.IO.StreamReader(dstream) : ");
//ostr.println(" new System.IO.StreamReader(dstream, encoding), startline, startcolumn, buffersize){}");
//ostr.println("");
ostr.println(" public JavaCharStream(System.IO.Stream dstream, int startline, int startcolumn, int buffersize)");
ostr.println(" public CSCharStream(System.IO.Stream dstream, int startline, int startcolumn, int buffersize)");
ostr.println(" : this(new System.IO.StreamReader(dstream), startline, startcolumn, 4096){}");
ostr.println("");
//ostr.println(" public JavaCharStream(System.IO.Stream dstream, String encoding, int startline, int startcolumn)");
//ostr.println(" : this(dstream, encoding, startline, startcolumn, 4096){}");
//ostr.println("");
ostr.println(" public JavaCharStream(System.IO.Stream dstream, int startline, int startcolumn)");
ostr.println(" public CSCharStream(System.IO.Stream dstream, int startline, int startcolumn)");
ostr.println(" : this(dstream, startline, startcolumn, 4096){}");
ostr.println("");
//ostr.println(" public JavaCharStream(System.IO.Stream dstream, String encoding)");
//ostr.println(" : this(dstream, encoding, 1, 1, 4096){}");
//ostr.println("");
ostr.println(" public JavaCharStream(System.IO.Stream dstream)");
ostr.println(" public CSCharStream(System.IO.Stream dstream)");
ostr.println(" : this(dstream, 1, 1, 4096){}");
ostr.println("");
//ostr.println(" public void ReInit(System.IO.Stream dstream, String encoding, int startline, int startcolumn, int buffersize){");

View File

@@ -712,7 +712,7 @@ public class LexGen extends CSJavaCCGlobals implements CSJavaCCParserConstants{
else
{
if (Options.getCSUnicodeEscape())
charStreamName = "JavaCharStream";
charStreamName = "CSCharStream";
else
charStreamName = "SimpleCharStream";
}
@@ -748,7 +748,7 @@ public class LexGen extends CSJavaCCGlobals implements CSJavaCCParserConstants{
else if (!Options.getUserCharStream())
{
if (Options.getCSUnicodeEscape())
ostr.println(" if (JavaCharStream.staticFlag)");
ostr.println(" if (CSCharStream.staticFlag)");
else
ostr.println(" if (SimpleCharStream.staticFlag)");

View File

@@ -942,31 +942,31 @@ public class NfaState
Integer ind;
String tmp;
tmp = "{\n 0x" + Long.toHexString(common[0]) + "L, " +
"0x" + Long.toHexString(common[1]) + "L, " +
"0x" + Long.toHexString(common[2]) + "L, " +
"0x" + Long.toHexString(common[3]) + "L\n};";
tmp = "{\n unchecked((long)0x" + Long.toHexString(common[0]) + "L), " +
"unchecked((long)0x" + Long.toHexString(common[1]) + "L), " +
"unchecked((long)0x" + Long.toHexString(common[2]) + "L), " +
"unchecked((long)0x" + Long.toHexString(common[3]) + "L)\n};";
if ((ind = (Integer)lohiByteTab.get(tmp)) == null)
{
allBitVectors.addElement(tmp);
if (!AllBitsSet(tmp))
ostr.println("static ulong[] jjbitVec" + lohiByteCnt + " = " + tmp);
ostr.println("static long[] jjbitVec" + lohiByteCnt + " = " + tmp);
lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++));
}
tmpIndices[cnt++] = ind.intValue();
tmp = "{\n 0x" + Long.toHexString(loBytes[i][0]) + "L, " +
"0x" + Long.toHexString(loBytes[i][1]) + "L, " +
"0x" + Long.toHexString(loBytes[i][2]) + "L, " +
"0x" + Long.toHexString(loBytes[i][3]) + "L\n};";
tmp = "{\n unchecked((long)0x" + Long.toHexString(loBytes[i][0]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][1]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][2]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][3]) + "L)\n};";
if ((ind = (Integer)lohiByteTab.get(tmp)) == null)
{
allBitVectors.addElement(tmp);
if (!AllBitsSet(tmp))
ostr.println("static ulong[] jjbitVec" + lohiByteCnt + " = " + tmp);
ostr.println("static long[] jjbitVec" + lohiByteCnt + " = " + tmp);
lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++));
}
@@ -999,17 +999,17 @@ public class NfaState
String tmp;
Integer ind;
tmp = "{\n 0x" + Long.toHexString(loBytes[i][0]) + "L, " +
"0x" + Long.toHexString(loBytes[i][1]) + "L, " +
"0x" + Long.toHexString(loBytes[i][2]) + "L, " +
"0x" + Long.toHexString(loBytes[i][3]) + "L\n};";
tmp = "{\n unchecked((long)0x" + Long.toHexString(loBytes[i][0]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][1]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][2]) + "L), " +
"unchecked((long)0x" + Long.toHexString(loBytes[i][3]) + "L)\n};";
if ((ind = (Integer)lohiByteTab.get(tmp)) == null)
{
allBitVectors.addElement(tmp);
if (!AllBitsSet(tmp))
ostr.println("static ulong[] jjbitVec" + lohiByteCnt + " = " + tmp);
ostr.println("static long[] jjbitVec" + lohiByteCnt + " = " + tmp);
lohiByteTab.put(tmp, ind = new Integer(lohiByteCnt++));
}
@@ -1608,11 +1608,11 @@ public class NfaState
{
ostr.println(" int hiByte = (int)(curChar >> 8);");
ostr.println(" int i1 = hiByte >> 6;");
ostr.println(" ulong l1 = 1UL << (hiByte & 0x3F);");
ostr.println(" long l1 = (long)(1UL << (hiByte & 0x3F));");
}
ostr.println(" int i2 = (curChar & 0xff) >> 6;");
ostr.println(" ulong l2 = 1UL << (curChar & 0x3F);");
ostr.println(" long l2 = (long)(1UL << (curChar & 0x3F));");
}
ostr.println(" MatchLoop: do");

View File

@@ -272,7 +272,7 @@ public class ParseGen extends CSJavaCCGlobals implements CSJavaCCParserConstants
ostr.println(" jj_initialized_once = true;");
}
if (Options.getCSUnicodeEscape()) {
ostr.println(" jj_input_stream = new JavaCharStream(stream, 1, 1);");
ostr.println(" jj_input_stream = new CSCharStream(stream, 1, 1);");
} else {
ostr.println(" jj_input_stream = new SimpleCharStream(stream, 1, 1);");
}