• R/O
  • SSH
  • HTTPS

nina: Commit


Commit MetaInfo

Revision666 (tree)
Time2017-07-16 10:38:10
Authory-moriguchi

Log Message

fixed bugs about quotation in JavaScript

Change Summary

Incremental Difference

--- nina/java/src-morilib-cpp/net/morilib/c/pre/CPreprocessorReader.java (revision 665)
+++ nina/java/src-morilib-cpp/net/morilib/c/pre/CPreprocessorReader.java (revision 666)
@@ -142,7 +142,7 @@
142142 StringBuffer b0, b1 = null, b2 = null;
143143 String s, nm = null, s1;
144144 S0 st = S0.INI;
145- int c, l = 0;
145+ int c, l = 0, qch = -1;
146146
147147 b0 = new StringBuffer();
148148 while(true) {
@@ -154,8 +154,10 @@
154154 st = S0.EX1;
155155 } else if(c == '#') {
156156 st = S0.SH1;
157- } else if(c == '"') {
158- b0.append('"'); st = S0.DQ1;
157+ } else if(c == '"' || c == '\'') {
158+ b0.appendCodePoint(c);
159+ qch = c;
160+ st = S0.DQ1;
159161 } else if(c < 0) {
160162 return b0.toString();
161163 } else {
@@ -333,7 +335,7 @@
333335 case DQ1:
334336 if(c < 0) return b0.toString();
335337 b0.appendCodePoint(c);
336- if(c == '"') {
338+ if(c == qch) {
337339 st = S0.INI;
338340 } else if(c == '\\') {
339341 st = S0.DQ2;
--- nina/java/src-morilib-cpp/net/morilib/c/pre/CpreMacros.java (revision 665)
+++ nina/java/src-morilib-cpp/net/morilib/c/pre/CpreMacros.java (revision 666)
@@ -52,7 +52,7 @@
5252 StringBuffer b0, b1 = null;
5353 S2 st = S2.INI;
5454 String t;
55- int c;
55+ int c, qch = -1;
5656
5757 b0 = new StringBuffer();
5858 while(true) {
@@ -62,8 +62,9 @@
6262 if(CpreUtils.isCMacroIdentifierStart(c)) {
6363 b1 = new StringBuffer().appendCodePoint(c);
6464 st = S2.EX1;
65- } else if(c == '"') {
65+ } else if(c == '"' || c == '\'') {
6666 b0.appendCodePoint(c);
67+ qch = c;
6768 st = S2.DQ1;
6869 } else if(c == '#') {
6970 b1 = new StringBuffer();
@@ -81,8 +82,9 @@
8182 t = args.get(b1.toString().trim());
8283 b0.append(t != null ? t : b1);
8384 if(c < 0) return b0.toString();
84- if(c == '"') {
85+ if(c == '"' || c == '\'') {
8586 b0.appendCodePoint(c);
87+ qch = c;
8688 st = S2.DQ1;
8789 } else if(c == '#') {
8890 b1 = new StringBuffer();
@@ -111,8 +113,9 @@
111113 b0.append(t);
112114 b0.append('"');
113115 if(c < 0) return b0.toString();
114- if(c == '"') {
116+ if(c == '"' || c == '\'') {
115117 b0.appendCodePoint(c);
118+ qch = c;
116119 st = S2.DQ1;
117120 } else if(c == '#') {
118121 b1 = new StringBuffer();
@@ -124,8 +127,9 @@
124127 } else {
125128 b0.append('#');
126129 if(c < 0) return b0.toString();
127- if(c == '"') {
130+ if(c == '"' || c == '\'') {
128131 b0.appendCodePoint(c);
132+ qch = c;
129133 st = S2.DQ1;
130134 } else if(c == '#') {
131135 b1 = new StringBuffer();
@@ -137,7 +141,7 @@
137141 }
138142 break;
139143 case DQ1:
140- if(c == '"') {
144+ if(c == qch) {
141145 st = S2.INI;
142146 } else if(c == '\\') {
143147 st = S2.DQ2;
Show on old repository browser