src/javacodegen.c

changeset 28
1be8ea902ef4
parent 26
05c3c6842aef
child 29
ec6e97454e64
equal deleted inserted replaced
27:53fd8595378c 28:1be8ea902ef4
57 } 57 }
58 58
59 memset(hltr->word, 0, WORDBUF_SIZE); 59 memset(hltr->word, 0, WORDBUF_SIZE);
60 size_t wp = 0; 60 size_t wp = 0;
61 int isstring = 0, iscomment = 0, isimport = 0; 61 int isstring = 0, iscomment = 0, isimport = 0;
62 char quote = '\0';
62 int isescaping = 0; 63 int isescaping = 0;
63 64
64 if (hltr->iscommentml) { 65 if (hltr->iscommentml) {
65 iscomment = 1; 66 iscomment = 1;
66 memcpy(&(dest[dp]), "<span class=\"c2html-comment\">", 29); 67 memcpy(&(dest[dp]), "<span class=\"c2html-comment\">", 29);
93 } else if (isimport) { 94 } else if (isimport) {
94 // TODO: local imports 95 // TODO: local imports
95 } else { 96 } else {
96 /* strings */ 97 /* strings */
97 if (!isescaping && (c == '\'' || c == '\"')) { 98 if (!isescaping && (c == '\'' || c == '\"')) {
98 isstring ^= 1;
99 if (isstring) { 99 if (isstring) {
100 memcpy(&(dest[dp]), "<span class=\"c2html-string\">", 28); 100 if (c == quote) {
101 dp += 28; 101 isstring = 0;
102 dp = writeescapedchar(dest, dp, c); 102 memcpy(&(dest[dp]), "<span class=\"c2html-string\">", 28);
103 dp += 28;
104 dp = writeescapedchar(dest, dp, c);
105 } else {
106 dp = writeescapedchar(dest, dp, c);
107 }
103 } else { 108 } else {
109 isstring = 1;
110 quote = c;
104 dp = writeescapedchar(dest, dp, c); 111 dp = writeescapedchar(dest, dp, c);
105 memcpy(&(dest[dp]), "</span>", 7); 112 memcpy(&(dest[dp]), "</span>", 7);
106 dp += 7; 113 dp += 7;
107 } 114 }
108 } else { 115 } else {

mercurial