piece_pack();
#if 1
piece_esc(yytext, strlen(yytext));
- ++piece0;
#else
size_t n = strlen(yytext);
if (n) {
piece[piece1++] = strdup(piece_temp);
piece_esc(yytext, n);
piece[piece1++] = strdup("</token>");
- piece_pack();
}
else {
sprintf(piece_temp, "<token value=\"%d\" />", result);
piece[piece1++] = strdup(piece_temp);
- ++piece0;
}
#endif
+ piece_pack();
return result;
}
static int real_yylex(GRAM_STYPE *val, location *loc)
---- scan-gram.c.orig 2018-06-15 08:25:26.973570952 +1000
-+++ scan-gram.c 2018-06-15 08:47:59.977542692 +1000
+--- scan-gram.c.orig 2018-06-15 15:35:57.635168211 +1000
++++ scan-gram.c 2018-06-23 10:48:16.772600940 +1000
@@ -66,6 +66,17 @@
/* %endif */
/* end standard C headers. */
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
-@@ -1395,8 +1420,90 @@
+@@ -1395,8 +1420,88 @@
/** The main scanner function which does all the work.
*/
+ if (result < 0)
+ return ~result;
+ piece_pack();
-+#if 0
-+ piece[piece1++] = strdup(piece_temp);
-+ ++piece0;
++#if 1
++ piece_esc(yytext, strlen(yytext));
+#else
+ size_t n = strlen(yytext);
+ if (n) {
+ piece[piece1++] = strdup(piece_temp);
+ piece_esc(yytext, n);
+ piece[piece1++] = strdup("</token>");
-+ piece_pack();
+ }
+ else {
+ sprintf(piece_temp, "<token value=\"%d\" />", result);
+ piece[piece1++] = strdup(piece_temp);
-+ ++piece0;
+ }
+#endif
++ piece_pack();
+ return result;
+}
+static int real_yylex(GRAM_STYPE *val, location *loc)
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-@@ -1475,7 +1582,12 @@
+@@ -1475,7 +1580,12 @@
gram__load_buffer_state( );
}