Minor change for consistency with latest bootstrap_flex.git (slower but easier)
authorNick Downing <downing.nick@gmail.com>
Sat, 23 Jun 2018 01:00:57 +0000 (11:00 +1000)
committerNick Downing <downing.nick@gmail.com>
Sat, 23 Jun 2018 01:00:57 +0000 (11:00 +1000)
src/scan-gram.c
src/scan-gram.c.patch

index 0155676..edd01e4 100644 (file)
@@ -1484,7 +1484,6 @@ YY_DECL
  piece_pack();
 #if 1
  piece_esc(yytext, strlen(yytext));
- ++piece0;
 #else
  size_t n = strlen(yytext);
  if (n) {
@@ -1492,14 +1491,13 @@ YY_DECL
   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)
index 6870e35..122276b 100644 (file)
@@ -1,5 +1,5 @@
---- 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. */
@@ -40,7 +40,7 @@
  
  #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( );
                }