Rationalize PYACC.Text so it occurs only once inside containers like PYACC.Char,...
authorNick Downing <downing.nick@gmail.com>
Thu, 19 Jul 2018 13:27:11 +0000 (23:27 +1000)
committerNick Downing <downing.nick@gmail.com>
Thu, 19 Jul 2018 13:27:11 +0000 (23:27 +1000)
src/parse-gram.c
src/parse-gram.y
src/scan-code.c
src/scan-code.l
src/scan-gram.c
src/scan-gram.l

index 71531a0..10c0939 100644 (file)
@@ -2114,11 +2114,11 @@ yyreduce:
 #line 302 "src/parse-gram.y" /* yacc.c:1648  */
     {
  /* inserting %{...%} below is a hack as we may lose some whitespace near it */
- code_piece_append("<PYACC_Section1_Prologue>%{");
+ code_piece_append("<PYACC_Section1_Prologue>%{<PYACC_Text>");
       muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue",
                         translate_code ((yyvsp[0].code), (yylsp[0]), true), (yylsp[0]));
       code_scanner_last_string_free ();
- code_piece_append("%}</PYACC_Section1_Prologue>");
+ code_piece_append("</PYACC_Text>%}</PYACC_Section1_Prologue>");
  code_piece_pack();
  free(gram_piece[gram_piece2]);
  gram_piece[gram_piece2] = strdup(code_piece[code_piece0 - 1]);
index 80ce37a..056f19b 100644 (file)
@@ -301,11 +301,11 @@ prologue_declaration:
 | "%{...%}"
     {
  /* inserting %{...%} below is a hack as we may lose some whitespace near it */
- code_piece_append("<PYACC_Section1_Prologue>%{");
+ code_piece_append("<PYACC_Section1_Prologue>%{<PYACC_Text>");
       muscle_code_grow (union_seen ? "post_prologue" : "pre_prologue",
                         translate_code ($1, @1, true), @1);
       code_scanner_last_string_free ();
- code_piece_append("%}</PYACC_Section1_Prologue>");
+ code_piece_append("</PYACC_Text>%}</PYACC_Section1_Prologue>");
  code_piece_pack();
  free(gram_piece[gram_piece2]);
  gram_piece[gram_piece2] = strdup(code_piece[code_piece0 - 1]);
index 27c4b40..f24439e 100644 (file)
@@ -704,8 +704,8 @@ int code__flex_debug = 1;
 
 static yyconst flex_int16_t yy_rule_linenum[18] =
     {   0,
-      122,  132,  133,  143,  148,  153,  159,  160,  161,  162,
-      164,  172,  182,  196,  208,  222,  225
+      118,  128,  129,  139,  144,  149,  155,  156,  157,  158,
+      160,  168,  177,  190,  201,  214,  217
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -786,10 +786,6 @@ static bool untyped_var_seen;
 int no_handle_action;
 const char *before_tag, *after_tag;
 
-static int in_text;
-static void start_text(void);
-static void stop_text(void);
-
 /* C and C++ comments in code. */
 
 /* Strings and characters in code. */
@@ -806,7 +802,7 @@ of $ and @.  */
 /* C style identifier. Must start with letter. Will be used for
    named symbol references. Shall be kept synchronized with
    scan-gram.l "letter" and "id". */
-#line 729 "src/scan-code.c"
+#line 725 "src/scan-code.c"
 
 #define INITIAL 0
 #define SC_COMMENT 1
@@ -1057,7 +1053,7 @@ YY_DECL
        register int yy_act;
     
 /* %% [7.0] user's declarations go here */
-#line 104 "src/scan-code.l"
+#line 100 "src/scan-code.l"
 
 
 
@@ -1074,7 +1070,7 @@ YY_DECL
   | Scanning a C comment.  The initial '/ *' is already eaten.  |
   `------------------------------------------------------------*/
 
-#line 997 "src/scan-code.c"
+#line 993 "src/scan-code.c"
 
        if ( !(yy_init) )
                {
@@ -1192,7 +1188,7 @@ do_action:        /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 122 "src/scan-code.l"
+#line 118 "src/scan-code.l"
 STRING_GROW; BEGIN sc_context;
        YY_BREAK
 
@@ -1204,13 +1200,13 @@ STRING_GROW; BEGIN sc_context;
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 132 "src/scan-code.l"
+#line 128 "src/scan-code.l"
 STRING_GROW; BEGIN sc_context;
        YY_BREAK
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 133 "src/scan-code.l"
+#line 129 "src/scan-code.l"
 STRING_GROW;
        YY_BREAK
 
@@ -1222,7 +1218,7 @@ STRING_GROW;
 case 4:
 /* rule 4 can match eol */
 YY_RULE_SETUP
-#line 143 "src/scan-code.l"
+#line 139 "src/scan-code.l"
 STRING_GROW;
        YY_BREAK
 
@@ -1230,7 +1226,7 @@ STRING_GROW;
 
 case 5:
 YY_RULE_SETUP
-#line 148 "src/scan-code.l"
+#line 144 "src/scan-code.l"
 STRING_GROW; BEGIN sc_context;
        YY_BREAK
 
@@ -1238,7 +1234,7 @@ STRING_GROW; BEGIN sc_context;
 
 case 6:
 YY_RULE_SETUP
-#line 153 "src/scan-code.l"
+#line 149 "src/scan-code.l"
 STRING_GROW; BEGIN sc_context;
        YY_BREAK
 
@@ -1246,29 +1242,29 @@ STRING_GROW; BEGIN sc_context;
 
 case 7:
 YY_RULE_SETUP
-#line 159 "src/scan-code.l"
-STRING_GROW; BEGIN SC_CHARACTER; start_text();
+#line 155 "src/scan-code.l"
+STRING_GROW; BEGIN SC_CHARACTER;
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 160 "src/scan-code.l"
-STRING_GROW; BEGIN SC_STRING; start_text();
+#line 156 "src/scan-code.l"
+STRING_GROW; BEGIN SC_STRING;
        YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 161 "src/scan-code.l"
-STRING_GROW; BEGIN SC_COMMENT; start_text();
+#line 157 "src/scan-code.l"
+STRING_GROW; BEGIN SC_COMMENT;
        YY_BREAK
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 162 "src/scan-code.l"
-STRING_GROW; BEGIN SC_LINE_COMMENT; start_text();
+#line 158 "src/scan-code.l"
+STRING_GROW; BEGIN SC_LINE_COMMENT;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 164 "src/scan-code.l"
+#line 160 "src/scan-code.l"
 {
     complain (loc, Wother, _("stray '%s'"), code_text);
     obstack_escape (&obstack_for_string, code_text);
@@ -1279,13 +1275,12 @@ YY_RULE_SETUP
 
 case 12:
 YY_RULE_SETUP
-#line 172 "src/scan-code.l"
+#line 168 "src/scan-code.l"
 {
     ref_tail_fields = NULL;
     handle_action_dollar (self->rule, code_text, *loc);
     if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
- stop_text();
  code_piece_append(before_tag);
  flush();
  code_piece_append(after_tag);
@@ -1293,13 +1288,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 182 "src/scan-code.l"
+#line 177 "src/scan-code.l"
 {
     ref_tail_fields = NULL;
     handle_action_at (self->rule, code_text, *loc);
     if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
- stop_text();
  code_piece_append(before_tag);
  flush();
  code_piece_append(after_tag);
@@ -1310,7 +1304,7 @@ YY_RULE_SETUP
 
 case 14:
 YY_RULE_SETUP
-#line 196 "src/scan-code.l"
+#line 190 "src/scan-code.l"
 {
     const char *type_name = NULL;
     fetch_type_name (code_text + 1, &type_name, *loc)[-1] = 0;
@@ -1318,22 +1312,20 @@ YY_RULE_SETUP
     obstack_quote (&obstack_for_string, type_name);
     obstack_sgrow (&obstack_for_string, ")[");
     self->is_value_used = true;
- stop_text();
- code_piece_append("<PYACC_ValueReference>");
+ code_piece_append("<PYACC_Text_ValueReference>");
  flush();
- code_piece_append("</PYACC_ValueReference>");
+ code_piece_append("</PYACC_Text_ValueReference>");
   }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 208 "src/scan-code.l"
+#line 201 "src/scan-code.l"
 {
     obstack_sgrow (&obstack_for_string, "]b4_at_dollar[");
     muscle_percent_define_ensure("locations", the_location, true);
- stop_text();
- code_piece_append("<PYACC_ValueLocation>");
+ code_piece_append("<PYACC_Text_ValueLocation>");
  flush();
- code_piece_append("</PYACC_ValueLocation>");
+ code_piece_append("</PYACC_Text_ValueLocation>");
   }
        YY_BREAK
 
@@ -1342,15 +1334,15 @@ YY_RULE_SETUP
 /* Escape M4 quoting characters in C code.  */
 case 16:
 YY_RULE_SETUP
-#line 222 "src/scan-code.l"
-obstack_escape (&obstack_for_string, code_text); start_text();
+#line 214 "src/scan-code.l"
+obstack_escape (&obstack_for_string, code_text);
        YY_BREAK
 /* By default, grow the string obstack with the input.  */
 case 17:
 /* rule 17 can match eol */
 YY_RULE_SETUP
-#line 225 "src/scan-code.l"
-STRING_GROW; start_text();
+#line 217 "src/scan-code.l"
+STRING_GROW;
        YY_BREAK
 /* End of processing. */
 case YY_STATE_EOF(INITIAL):
@@ -1360,16 +1352,16 @@ case YY_STATE_EOF(SC_STRING):
 case YY_STATE_EOF(SC_CHARACTER):
 case YY_STATE_EOF(SC_RULE_ACTION):
 case YY_STATE_EOF(SC_SYMBOL_ACTION):
-#line 228 "src/scan-code.l"
-STRING_FINISH; stop_text(); /*code_piece_pack(); --code_piece0;*/ return last_string;
+#line 220 "src/scan-code.l"
+STRING_FINISH; /*code_piece_pack(); --code_piece0;*/ return last_string;
        YY_BREAK
 
 case 18:
 YY_RULE_SETUP
-#line 231 "src/scan-code.l"
+#line 223 "src/scan-code.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 1287 "src/scan-code.c"
+#line 1279 "src/scan-code.c"
 
        case YY_END_OF_BUFFER:
                {
@@ -2456,7 +2448,7 @@ void code_free (void * ptr )
 
 /* %ok-for-header */
 
-#line 231 "src/scan-code.l"
+#line 223 "src/scan-code.l"
 
 
 
@@ -2908,13 +2900,13 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
                  rule->midrule_parent_rhs_index, text, dollar_loc, '$');
 #if 1
  if (n == LHS_REF) {
-  before_tag = "<PYACC_ValueReference>";
-  after_tag = "</PYACC_ValueReference>";
+  before_tag = "<PYACC_Text_ValueReference>";
+  after_tag = "</PYACC_Text_ValueReference>";
  }
  else {
-  sprintf(code_piece_temp, "<PYACC_StackReference index=\"%d\">", n);
+  sprintf(code_piece_temp, "<PYACC_Text_StackReference index=\"%d\">", n);
   before_tag = code_piece_temp;
-  after_tag = "</PYACC_StackReference>";
+  after_tag = "</PYACC_Text_StackReference>";
  }
  if (no_handle_action)
   return;
@@ -3015,13 +3007,13 @@ handle_action_at (symbol_list *rule, char *text, location at_loc)
                        rule->midrule_parent_rhs_index, text, at_loc, '@');
 #if 1
  if (n == LHS_REF) {
-  before_tag = "<PYACC_ValueLocation>";
-  after_tag = "</PYACC_ValueLocation>";
+  before_tag = "<PYACC_Text_ValueLocation>";
+  after_tag = "</PYACC_Text_ValueLocation>";
  }
  else {
-  sprintf(code_piece_temp, "<PYACC_StackLocation index=\"%d\">", n);
+  sprintf(code_piece_temp, "<PYACC_Text_StackLocation index=\"%d\">", n);
   before_tag = code_piece_temp;
-  after_tag = "</PYACC_StackLocation>";
+  after_tag = "</PYACC_Text_StackLocation>";
  }
  if (no_handle_action)
   return;
@@ -3151,18 +3143,3 @@ code_scanner_free (void)
   code_lex_destroy ();
 }
 
-/* Nick */
-static void start_text(void) {
- if (in_text == 0) {
-  code_piece_append("<PYACC_Text>");
-  in_text = 1;
- }
-}
-
-static void stop_text(void) {
- if (in_text) {
-  code_piece_append("</PYACC_Text>");
-  in_text = 0;
- }
-}
-
index 02ac732..7706770 100644 (file)
@@ -70,10 +70,6 @@ static bool untyped_var_seen;
 int no_handle_action;
 const char *before_tag, *after_tag;
 
-static int in_text;
-static void start_text(void);
-static void stop_text(void);
-
 %}
  /* C and C++ comments in code. */
 %x SC_COMMENT SC_LINE_COMMENT
@@ -156,10 +152,10 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
 
 <SC_RULE_ACTION,SC_SYMBOL_ACTION>
 {
-  "'"              STRING_GROW; BEGIN SC_CHARACTER; start_text();
-  "\""             STRING_GROW; BEGIN SC_STRING; start_text();
-  "/"{splice}"*"   STRING_GROW; BEGIN SC_COMMENT; start_text();
-  "/"{splice}"/"   STRING_GROW; BEGIN SC_LINE_COMMENT; start_text();
+  "'"              STRING_GROW; BEGIN SC_CHARACTER;
+  "\""             STRING_GROW; BEGIN SC_STRING;
+  "/"{splice}"*"   STRING_GROW; BEGIN SC_COMMENT;
+  "/"{splice}"/"   STRING_GROW; BEGIN SC_LINE_COMMENT;
 
   [$@]  {
     complain (loc, Wother, _("stray '%s'"), yytext);
@@ -174,7 +170,6 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
     handle_action_dollar (self->rule, yytext, *loc);
     if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
- stop_text();
  code_piece_append(before_tag);
  flush();
  code_piece_append(after_tag);
@@ -184,7 +179,6 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
     handle_action_at (self->rule, yytext, *loc);
     if (ref_tail_fields)
       obstack_sgrow (&obstack_for_string, ref_tail_fields);
- stop_text();
  code_piece_append(before_tag);
  flush();
  code_piece_append(after_tag);
@@ -200,18 +194,16 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
     obstack_quote (&obstack_for_string, type_name);
     obstack_sgrow (&obstack_for_string, ")[");
     self->is_value_used = true;
- stop_text();
- code_piece_append("<PYACC_ValueReference>");
+ code_piece_append("<PYACC_Text_ValueReference>");
  flush();
- code_piece_append("</PYACC_ValueReference>");
+ code_piece_append("</PYACC_Text_ValueReference>");
   }
   "@$" {
     obstack_sgrow (&obstack_for_string, "]b4_at_dollar[");
     muscle_percent_define_ensure("locations", the_location, true);
- stop_text();
- code_piece_append("<PYACC_ValueLocation>");
+ code_piece_append("<PYACC_Text_ValueLocation>");
  flush();
- code_piece_append("</PYACC_ValueLocation>");
+ code_piece_append("</PYACC_Text_ValueLocation>");
   }
 }
 
@@ -219,13 +211,13 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
 <*>
 {
   /* Escape M4 quoting characters in C code.  */
-  [$@\[\]]    obstack_escape (&obstack_for_string, yytext); start_text();
+  [$@\[\]]    obstack_escape (&obstack_for_string, yytext);
 
   /* By default, grow the string obstack with the input.  */
-  .|\n        STRING_GROW; start_text();
+  .|\n        STRING_GROW;
 
  /* End of processing. */
-  <<EOF>>     STRING_FINISH; stop_text(); /*code_piece_pack(); --code_piece0;*/ return last_string;
+  <<EOF>>     STRING_FINISH; /*code_piece_pack(); --code_piece0;*/ return last_string;
 }
 
 %%
@@ -678,13 +670,13 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
                  rule->midrule_parent_rhs_index, text, dollar_loc, '$');
 #if 1
  if (n == LHS_REF) {
-  before_tag = "<PYACC_ValueReference>";
-  after_tag = "</PYACC_ValueReference>";
+  before_tag = "<PYACC_Text_ValueReference>";
+  after_tag = "</PYACC_Text_ValueReference>";
  }
  else {
-  sprintf(code_piece_temp, "<PYACC_StackReference index=\"%d\">", n);
+  sprintf(code_piece_temp, "<PYACC_Text_StackReference index=\"%d\">", n);
   before_tag = code_piece_temp;
-  after_tag = "</PYACC_StackReference>";
+  after_tag = "</PYACC_Text_StackReference>";
  }
  if (no_handle_action)
   return;
@@ -785,13 +777,13 @@ handle_action_at (symbol_list *rule, char *text, location at_loc)
                        rule->midrule_parent_rhs_index, text, at_loc, '@');
 #if 1
  if (n == LHS_REF) {
-  before_tag = "<PYACC_ValueLocation>";
-  after_tag = "</PYACC_ValueLocation>";
+  before_tag = "<PYACC_Text_ValueLocation>";
+  after_tag = "</PYACC_Text_ValueLocation>";
  }
  else {
-  sprintf(code_piece_temp, "<PYACC_StackLocation index=\"%d\">", n);
+  sprintf(code_piece_temp, "<PYACC_Text_StackLocation index=\"%d\">", n);
   before_tag = code_piece_temp;
-  after_tag = "</PYACC_StackLocation>";
+  after_tag = "</PYACC_Text_StackLocation>";
  }
  if (no_handle_action)
   return;
@@ -920,18 +912,3 @@ code_scanner_free (void)
   /* Reclaim Flex's buffers.  */
   yylex_destroy ();
 }
-
-/* Nick */
-static void start_text(void) {
- if (in_text == 0) {
-  code_piece_append("<PYACC_Text>");
-  in_text = 1;
- }
-}
-
-static void stop_text(void) {
- if (in_text) {
-  code_piece_append("</PYACC_Text>");
-  in_text = 0;
- }
-}
index 12f4c71..d6d5fa7 100644 (file)
@@ -1064,20 +1064,20 @@ int gram__flex_debug = 1;
 
 static yyconst flex_int16_t yy_rule_linenum[130] =
     {   0,
-      190,  193,  194,  195,  203,  221,  222,  223,  224,  225,
-      226,  227,  228,  229,  230,  231,  232,  233,  234,  235,
-      236,  237,  238,  239,  240,  241,  242,  243,  244,  245,
-      246,  247,  248,  249,  250,  251,  252,  253,  254,  255,
-      256,  257,  258,  259,  260,  261,  262,  263,  264,  265,
-      268,  269,  270,  271,  272,  273,  274,  275,  276,  277,
-      278,  280,  284,  285,  286,  288,  300,  314,  331,  336,
-      339,  342,  345,  359,  368,  369,  370,  380,  395,  402,
-      422,  432,  447,  457,  484,  497,  513,  528,  545,  546,
-      557,  568,  569,  581,  597,  607,  634,  646,  668,  669,
-
-      680,  696,  713,  714,  715,  716,  717,  718,  719,  722,
-      724,  738,  756,  761,  762,  768,  769,  780,  787,  794,
-      801,  818,  819,  823,  830,  861,  890,  937,  938
+      185,  188,  189,  190,  198,  216,  217,  218,  219,  220,
+      221,  222,  223,  224,  225,  226,  227,  228,  229,  230,
+      231,  232,  233,  234,  235,  236,  237,  238,  239,  240,
+      241,  242,  243,  244,  245,  246,  247,  248,  249,  250,
+      251,  252,  253,  254,  255,  256,  257,  258,  259,  260,
+      263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
+      273,  275,  279,  280,  281,  283,  295,  309,  326,  331,
+      334,  337,  340,  350,  363,  364,  365,  375,  389,  396,
+      416,  426,  441,  451,  478,  491,  507,  522,  539,  540,
+      551,  562,  563,  575,  591,  601,  628,  640,  662,  663,
+
+      674,  689,  705,  706,  707,  708,  709,  710,  711,  714,
+      716,  730,  748,  753,  754,  760,  761,  772,  778,  784,
+      790,  806,  807,  811,  818,  842,  870,  916,  917
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -1189,11 +1189,6 @@ static int convert_ucn_to_byte (char const *hex_text);
 static void unexpected_eof (boundary, char const *);
 static void unexpected_newline (boundary, char const *);
 
-/* Nick */
-static int in_text;
-static void start_text(void);
-static void stop_text(void);
-
 /* A C-like comment in directives/rules. */
 
 /* Strings and characters in directives/rules. */
@@ -1223,7 +1218,7 @@ generics/template types.  */
    white space between the backslash and the newline.  */
 /* An equal sign, with optional leading whitespaces. This is used in some
    deprecated constructs. */
-#line 1146 "src/scan-gram.c"
+#line 1141 "src/scan-gram.c"
 
 #define INITIAL 0
 #define SC_YACC_COMMENT 1
@@ -1513,7 +1508,7 @@ static int real_yylex(GRAM_STYPE *val, location *loc)
        register int yy_act;
     
 /* %% [7.0] user's declarations go here */
-#line 151 "src/scan-gram.l"
+#line 146 "src/scan-gram.l"
 
 
   /* Nesting level.  Either for nested braces, or nested angle brackets
@@ -1550,7 +1545,7 @@ static int real_yylex(GRAM_STYPE *val, location *loc)
   | Scanning white space.  |
   `-----------------------*/
 
-#line 1448 "src/scan-gram.c"
+#line 1443 "src/scan-gram.c"
 
        if ( !(yy_init) )
                {
@@ -1669,23 +1664,23 @@ do_action:      /* This label is used only to access EOF actions. */
 /* Comments and white space.  */
 case 1:
 YY_RULE_SETUP
-#line 190 "src/scan-gram.l"
+#line 185 "src/scan-gram.l"
 {
      complain (loc, Wother, _("stray ',' treated as white space"));
   }
        YY_BREAK
 case 2:
 /* rule 2 can match eol */
-#line 194 "src/scan-gram.l"
+#line 189 "src/scan-gram.l"
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 194 "src/scan-gram.l"
+#line 189 "src/scan-gram.l"
 continue;
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 195 "src/scan-gram.l"
+#line 190 "src/scan-gram.l"
 {
     token_start = loc->start;
     context_state = YY_START;
@@ -1697,7 +1692,7 @@ YY_RULE_SETUP
 case 5:
 /* rule 5 can match eol */
 YY_RULE_SETUP
-#line 203 "src/scan-gram.l"
+#line 198 "src/scan-gram.l"
 {
     handle_syncline (gram_text + sizeof "#line " - 1, *loc);
   }
@@ -1715,313 +1710,313 @@ YY_RULE_SETUP
 
 case 6:
 YY_RULE_SETUP
-#line 221 "src/scan-gram.l"
+#line 216 "src/scan-gram.l"
 return PERCENT_NONASSOC;
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 222 "src/scan-gram.l"
+#line 217 "src/scan-gram.l"
 return PERCENT_CODE;
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 223 "src/scan-gram.l"
+#line 218 "src/scan-gram.l"
 RETURN_PERCENT_FLAG("parse.trace");
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 224 "src/scan-gram.l"
+#line 219 "src/scan-gram.l"
 return PERCENT_DEFAULT_PREC;
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 225 "src/scan-gram.l"
+#line 220 "src/scan-gram.l"
 return PERCENT_DEFINE;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 226 "src/scan-gram.l"
+#line 221 "src/scan-gram.l"
 return PERCENT_DEFINES;
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 227 "src/scan-gram.l"
+#line 222 "src/scan-gram.l"
 return PERCENT_DESTRUCTOR;
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 228 "src/scan-gram.l"
+#line 223 "src/scan-gram.l"
 return PERCENT_DPREC;
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 229 "src/scan-gram.l"
+#line 224 "src/scan-gram.l"
 return PERCENT_EMPTY;
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 230 "src/scan-gram.l"
+#line 225 "src/scan-gram.l"
 return PERCENT_ERROR_VERBOSE;
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 231 "src/scan-gram.l"
+#line 226 "src/scan-gram.l"
 return PERCENT_EXPECT;
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 232 "src/scan-gram.l"
+#line 227 "src/scan-gram.l"
 return PERCENT_EXPECT_RR;
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 233 "src/scan-gram.l"
+#line 228 "src/scan-gram.l"
 return PERCENT_FILE_PREFIX;
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 234 "src/scan-gram.l"
+#line 229 "src/scan-gram.l"
 return PERCENT_YACC;
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 235 "src/scan-gram.l"
+#line 230 "src/scan-gram.l"
 return PERCENT_INITIAL_ACTION;
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 236 "src/scan-gram.l"
+#line 231 "src/scan-gram.l"
 return PERCENT_GLR_PARSER;
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 237 "src/scan-gram.l"
+#line 232 "src/scan-gram.l"
 return PERCENT_LANGUAGE;
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 238 "src/scan-gram.l"
+#line 233 "src/scan-gram.l"
 return PERCENT_LEFT;
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 239 "src/scan-gram.l"
+#line 234 "src/scan-gram.l"
 RETURN_PERCENT_PARAM(lex);
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 240 "src/scan-gram.l"
+#line 235 "src/scan-gram.l"
 RETURN_PERCENT_FLAG("locations");
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 241 "src/scan-gram.l"
+#line 236 "src/scan-gram.l"
 return PERCENT_MERGE;
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 242 "src/scan-gram.l"
+#line 237 "src/scan-gram.l"
 return PERCENT_NAME_PREFIX;
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 243 "src/scan-gram.l"
+#line 238 "src/scan-gram.l"
 return PERCENT_NO_DEFAULT_PREC;
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 244 "src/scan-gram.l"
+#line 239 "src/scan-gram.l"
 return PERCENT_NO_LINES;
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 245 "src/scan-gram.l"
+#line 240 "src/scan-gram.l"
 return PERCENT_NONASSOC;
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 246 "src/scan-gram.l"
+#line 241 "src/scan-gram.l"
 return PERCENT_NONDETERMINISTIC_PARSER;
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 247 "src/scan-gram.l"
+#line 242 "src/scan-gram.l"
 return PERCENT_NTERM;
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 248 "src/scan-gram.l"
+#line 243 "src/scan-gram.l"
 return PERCENT_OUTPUT;
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 249 "src/scan-gram.l"
+#line 244 "src/scan-gram.l"
 RETURN_PERCENT_PARAM(both);
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 250 "src/scan-gram.l"
+#line 245 "src/scan-gram.l"
 RETURN_PERCENT_PARAM(parse);
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 251 "src/scan-gram.l"
+#line 246 "src/scan-gram.l"
 return PERCENT_PREC;
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 252 "src/scan-gram.l"
+#line 247 "src/scan-gram.l"
 return PERCENT_PRECEDENCE;
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 253 "src/scan-gram.l"
+#line 248 "src/scan-gram.l"
 return PERCENT_PRINTER;
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 254 "src/scan-gram.l"
+#line 249 "src/scan-gram.l"
 RETURN_PERCENT_FLAG("api.pure");
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 255 "src/scan-gram.l"
+#line 250 "src/scan-gram.l"
 return PERCENT_REQUIRE;
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 256 "src/scan-gram.l"
+#line 251 "src/scan-gram.l"
 return PERCENT_RIGHT;
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 257 "src/scan-gram.l"
+#line 252 "src/scan-gram.l"
 return PERCENT_SKELETON;
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 258 "src/scan-gram.l"
+#line 253 "src/scan-gram.l"
 return PERCENT_START;
        YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 259 "src/scan-gram.l"
+#line 254 "src/scan-gram.l"
 return PERCENT_TOKEN;
        YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 260 "src/scan-gram.l"
+#line 255 "src/scan-gram.l"
 return PERCENT_TOKEN;
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 261 "src/scan-gram.l"
+#line 256 "src/scan-gram.l"
 return PERCENT_TOKEN_TABLE;
        YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 262 "src/scan-gram.l"
+#line 257 "src/scan-gram.l"
 return PERCENT_TYPE;
        YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 263 "src/scan-gram.l"
+#line 258 "src/scan-gram.l"
 return PERCENT_UNION;
        YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 264 "src/scan-gram.l"
+#line 259 "src/scan-gram.l"
 return PERCENT_VERBOSE;
        YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 265 "src/scan-gram.l"
+#line 260 "src/scan-gram.l"
 return PERCENT_YACC;
        YY_BREAK
 /* deprecated */
 case 51:
 YY_RULE_SETUP
-#line 268 "src/scan-gram.l"
+#line 263 "src/scan-gram.l"
 DEPRECATED("%default-prec");
        YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 269 "src/scan-gram.l"
+#line 264 "src/scan-gram.l"
 DEPRECATED("%define parse.error verbose");
        YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 270 "src/scan-gram.l"
+#line 265 "src/scan-gram.l"
 DEPRECATED("%expect-rr");
        YY_BREAK
 case 54:
 /* rule 54 can match eol */
 YY_RULE_SETUP
-#line 271 "src/scan-gram.l"
+#line 266 "src/scan-gram.l"
 DEPRECATED("%file-prefix");
        YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 272 "src/scan-gram.l"
+#line 267 "src/scan-gram.l"
 DEPRECATED("%fixed-output-files");
        YY_BREAK
 case 56:
 /* rule 56 can match eol */
 YY_RULE_SETUP
-#line 273 "src/scan-gram.l"
+#line 268 "src/scan-gram.l"
 DEPRECATED("%name-prefix");
        YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 274 "src/scan-gram.l"
+#line 269 "src/scan-gram.l"
 DEPRECATED("%no-default-prec");
        YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 275 "src/scan-gram.l"
+#line 270 "src/scan-gram.l"
 DEPRECATED("%no-lines");
        YY_BREAK
 case 59:
 /* rule 59 can match eol */
 YY_RULE_SETUP
-#line 276 "src/scan-gram.l"
+#line 271 "src/scan-gram.l"
 DEPRECATED("%output");
        YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 277 "src/scan-gram.l"
+#line 272 "src/scan-gram.l"
 DEPRECATED("%pure-parser");
        YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 278 "src/scan-gram.l"
+#line 273 "src/scan-gram.l"
 DEPRECATED("%token-table");
        YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 280 "src/scan-gram.l"
+#line 275 "src/scan-gram.l"
 {
     complain (loc, complaint, _("invalid directive: %s"), quote (gram_text));
   }
        YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 284 "src/scan-gram.l"
+#line 279 "src/scan-gram.l"
 return EQUAL;
        YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 285 "src/scan-gram.l"
+#line 280 "src/scan-gram.l"
 return PIPE;
        YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 286 "src/scan-gram.l"
+#line 281 "src/scan-gram.l"
 return SEMICOLON;
        YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 288 "src/scan-gram.l"
+#line 283 "src/scan-gram.l"
 {
     val->uniqstr = uniqstr_new (gram_text);
     id_loc = *loc;
@@ -2036,7 +2031,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 300 "src/scan-gram.l"
+#line 295 "src/scan-gram.l"
 {
     val->integer = scan_integer (gram_text, 10, *loc);
 #if 0
@@ -2054,7 +2049,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 314 "src/scan-gram.l"
+#line 309 "src/scan-gram.l"
 {
     val->integer = scan_integer (gram_text, 16, *loc);
 #if 0
@@ -2074,7 +2069,7 @@ YY_RULE_SETUP
      accept "1FOO" as "1 FOO".  */
 case 69:
 YY_RULE_SETUP
-#line 331 "src/scan-gram.l"
+#line 326 "src/scan-gram.l"
 {
     complain (loc, complaint, _("invalid identifier: %s"), quote (gram_text));
   }
@@ -2082,25 +2077,25 @@ YY_RULE_SETUP
 /* Characters.  */
 case 70:
 YY_RULE_SETUP
-#line 336 "src/scan-gram.l"
-token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; gram_piece_pack(); gram_piece_append("<PYACC_Char>");
+#line 331 "src/scan-gram.l"
+token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; gram_piece_pack(); gram_piece_append("<PYACC_Char>"); flush(); gram_piece_append("<PYACC_Text>");
        YY_BREAK
 /* Strings. */
 case 71:
 YY_RULE_SETUP
-#line 339 "src/scan-gram.l"
-token_start = loc->start; BEGIN SC_ESCAPED_STRING; gram_piece_pack(); gram_piece_append("<PYACC_String>");
+#line 334 "src/scan-gram.l"
+token_start = loc->start; BEGIN SC_ESCAPED_STRING; gram_piece_pack(); gram_piece_append("<PYACC_String>"); flush(); gram_piece_append("<PYACC_Text>");
        YY_BREAK
 /* Prologue. */
 case 72:
 YY_RULE_SETUP
-#line 342 "src/scan-gram.l"
-code_start = loc->start; BEGIN SC_PROLOGUE; gram_piece_pack(); gram_piece_append("<PYACC_Section1_Prologue>"); flush(); start_text();
+#line 337 "src/scan-gram.l"
+code_start = loc->start; BEGIN SC_PROLOGUE; gram_piece_pack(); gram_piece_append("<PYACC_Section1_Prologue>"); flush(); gram_piece_append("<PYACC_Text>");
        YY_BREAK
 /* Code in between braces.  */
 case 73:
 YY_RULE_SETUP
-#line 345 "src/scan-gram.l"
+#line 340 "src/scan-gram.l"
 {
     STRING_GROW;
     nesting = 0;
@@ -2108,39 +2103,39 @@ YY_RULE_SETUP
     BEGIN SC_BRACED_CODE;
  gram_piece_pack();
  gram_piece_append("<PYACC_BracedCode>");
-#if 1 /* include the braces */
- start_text();
- flush();
-#endif
   }
        YY_BREAK
 /* Semantic predicate. */
 case 74:
 /* rule 74 can match eol */
 YY_RULE_SETUP
-#line 359 "src/scan-gram.l"
+#line 350 "src/scan-gram.l"
 {
     nesting = 0;
     code_start = loc->start;
  gram_piece_pack();
  gram_piece_append("<PYACC_BracedPredicate>");
+ /* flush all but the opening brace */
+ gram_piece_esc(gram_text, yy_c_buf_p - 1 - gram_text);
+ gram_text = yy_c_buf_p - 1;
+ gram_piece_append("<PYACC_Text>");
     BEGIN SC_PREDICATE;
   }
        YY_BREAK
 /* A type. */
 case 75:
 YY_RULE_SETUP
-#line 368 "src/scan-gram.l"
+#line 363 "src/scan-gram.l"
 gram_piece_pack(); gram_piece_append("<PYACC_Tag>&lt;<PYACC_Text>*</PYACC_Text>&gt;</PYACC_Tag>"); return ~TAG_ANY; /*return TAG_ANY;*/
        YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 369 "src/scan-gram.l"
+#line 364 "src/scan-gram.l"
 gram_piece_pack(); gram_piece_append("<PYACC_Tag>&lt;<PYACC_Text />&gt;</PYACC_Tag>"); return ~TAG_NONE; /*return TAG_NONE;*/
        YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 370 "src/scan-gram.l"
+#line 365 "src/scan-gram.l"
 {
     nesting = 0;
     token_start = loc->start;
@@ -2153,7 +2148,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 380 "src/scan-gram.l"
+#line 375 "src/scan-gram.l"
 {
     static int percent_percent_count;
     if (++percent_percent_count == 2)
@@ -2163,7 +2158,6 @@ YY_RULE_SETUP
   gram_piece_esc(gram_text, strlen(gram_text));
   gram_piece_pack();
   gram_piece_pack();
-  start_text();
   return ~PERCENT_PERCENT;
  }
     return PERCENT_PERCENT;
@@ -2171,7 +2165,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 395 "src/scan-gram.l"
+#line 389 "src/scan-gram.l"
 {
     bracketed_id_str = NULL;
     bracketed_id_start = loc->start;
@@ -2181,7 +2175,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 402 "src/scan-gram.l"
+#line 396 "src/scan-gram.l"
 {
     complain (loc, complaint, "%s: %s",
               ngettext ("invalid character", "invalid characters", gram_leng),
@@ -2189,7 +2183,7 @@ YY_RULE_SETUP
   }
        YY_BREAK
 case YY_STATE_EOF(INITIAL):
-#line 408 "src/scan-gram.l"
+#line 402 "src/scan-gram.l"
 {
     loc->start = loc->end = scanner_cursor;
     yyterminate ();
@@ -2204,7 +2198,7 @@ case YY_STATE_EOF(INITIAL):
 
 case 81:
 YY_RULE_SETUP
-#line 422 "src/scan-gram.l"
+#line 416 "src/scan-gram.l"
 complain (loc, complaint, _("invalid null character"));
        YY_BREAK
 
@@ -2215,7 +2209,7 @@ complain (loc, complaint, _("invalid null character"));
 
 case 82:
 YY_RULE_SETUP
-#line 432 "src/scan-gram.l"
+#line 426 "src/scan-gram.l"
 {
     if (bracketed_id_str)
       {
@@ -2234,7 +2228,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 447 "src/scan-gram.l"
+#line 441 "src/scan-gram.l"
 {
     BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
     *loc = id_loc;
@@ -2248,7 +2242,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 457 "src/scan-gram.l"
+#line 451 "src/scan-gram.l"
 {
     ROLLBACK_CURRENT_TOKEN;
     BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
@@ -2261,7 +2255,7 @@ YY_RULE_SETUP
   }
        YY_BREAK
 case YY_STATE_EOF(SC_AFTER_IDENTIFIER):
-#line 467 "src/scan-gram.l"
+#line 461 "src/scan-gram.l"
 {
     BEGIN (bracketed_id_str ? SC_RETURN_BRACKETED_ID : INITIAL);
     *loc = id_loc;
@@ -2280,7 +2274,7 @@ case YY_STATE_EOF(SC_AFTER_IDENTIFIER):
 
 case 85:
 YY_RULE_SETUP
-#line 484 "src/scan-gram.l"
+#line 478 "src/scan-gram.l"
 {
     if (bracketed_id_str)
       {
@@ -2297,7 +2291,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 497 "src/scan-gram.l"
+#line 491 "src/scan-gram.l"
 {
     BEGIN bracketed_id_context_state;
     if (bracketed_id_str)
@@ -2316,7 +2310,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 513 "src/scan-gram.l"
+#line 507 "src/scan-gram.l"
 {
     complain (loc, complaint, "%s: %s",
               ngettext ("invalid character in bracketed name",
@@ -2325,7 +2319,7 @@ YY_RULE_SETUP
   }
        YY_BREAK
 case YY_STATE_EOF(SC_BRACKETED_ID):
-#line 520 "src/scan-gram.l"
+#line 514 "src/scan-gram.l"
 {
     BEGIN bracketed_id_context_state;
     unexpected_eof (bracketed_id_start, "]");
@@ -2336,7 +2330,7 @@ case YY_STATE_EOF(SC_BRACKETED_ID):
 
 case 88:
 YY_RULE_SETUP
-#line 528 "src/scan-gram.l"
+#line 522 "src/scan-gram.l"
 {
     ROLLBACK_CURRENT_TOKEN;
     val->uniqstr = bracketed_id_str;
@@ -2354,17 +2348,17 @@ YY_RULE_SETUP
 
 case 89:
 YY_RULE_SETUP
-#line 545 "src/scan-gram.l"
+#line 539 "src/scan-gram.l"
 BEGIN context_state;
        YY_BREAK
 case 90:
 /* rule 90 can match eol */
 YY_RULE_SETUP
-#line 546 "src/scan-gram.l"
+#line 540 "src/scan-gram.l"
 continue;
        YY_BREAK
 case YY_STATE_EOF(SC_YACC_COMMENT):
-#line 547 "src/scan-gram.l"
+#line 541 "src/scan-gram.l"
 unexpected_eof (token_start, "*/"); BEGIN context_state;
        YY_BREAK
 
@@ -2376,11 +2370,11 @@ unexpected_eof (token_start, "*/"); BEGIN context_state;
 case 91:
 /* rule 91 can match eol */
 YY_RULE_SETUP
-#line 557 "src/scan-gram.l"
+#line 551 "src/scan-gram.l"
 STRING_GROW; BEGIN context_state;
        YY_BREAK
 case YY_STATE_EOF(SC_COMMENT):
-#line 558 "src/scan-gram.l"
+#line 552 "src/scan-gram.l"
 unexpected_eof (token_start, "*/"); BEGIN context_state;
        YY_BREAK
 
@@ -2392,17 +2386,17 @@ unexpected_eof (token_start, "*/"); BEGIN context_state;
 case 92:
 /* rule 92 can match eol */
 YY_RULE_SETUP
-#line 568 "src/scan-gram.l"
+#line 562 "src/scan-gram.l"
 STRING_GROW; BEGIN context_state;
        YY_BREAK
 case 93:
 /* rule 93 can match eol */
 YY_RULE_SETUP
-#line 569 "src/scan-gram.l"
+#line 563 "src/scan-gram.l"
 STRING_GROW;
        YY_BREAK
 case YY_STATE_EOF(SC_LINE_COMMENT):
-#line 570 "src/scan-gram.l"
+#line 564 "src/scan-gram.l"
 BEGIN context_state;
        YY_BREAK
 
@@ -2414,14 +2408,14 @@ BEGIN context_state;
 
 case 94:
 YY_RULE_SETUP
-#line 581 "src/scan-gram.l"
+#line 575 "src/scan-gram.l"
 {
     STRING_FINISH;
     loc->start = token_start;
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(gram_text, strlen(gram_text));
  gram_piece_append("</PYACC_String>");
  gram_piece_pack();
@@ -2432,13 +2426,13 @@ YY_RULE_SETUP
   }
        YY_BREAK
 case YY_STATE_EOF(SC_ESCAPED_STRING):
-#line 596 "src/scan-gram.l"
+#line 590 "src/scan-gram.l"
 unexpected_eof (token_start, "\"");
        YY_BREAK
 case 95:
 /* rule 95 can match eol */
 YY_RULE_SETUP
-#line 597 "src/scan-gram.l"
+#line 591 "src/scan-gram.l"
 unexpected_newline (token_start, "\"");
        YY_BREAK
 
@@ -2450,7 +2444,7 @@ unexpected_newline (token_start, "\"");
 
 case 96:
 YY_RULE_SETUP
-#line 607 "src/scan-gram.l"
+#line 601 "src/scan-gram.l"
 {
     STRING_FINISH;
     loc->start = token_start;
@@ -2469,7 +2463,7 @@ YY_RULE_SETUP
     STRING_FREE;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(gram_text, strlen(gram_text));
  gram_piece_append("</PYACC_Char>");
  gram_piece_pack();
@@ -2482,11 +2476,11 @@ YY_RULE_SETUP
 case 97:
 /* rule 97 can match eol */
 YY_RULE_SETUP
-#line 634 "src/scan-gram.l"
+#line 628 "src/scan-gram.l"
 unexpected_newline (token_start, "'");
        YY_BREAK
 case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
-#line 635 "src/scan-gram.l"
+#line 629 "src/scan-gram.l"
 unexpected_eof (token_start, "'");
        YY_BREAK
 
@@ -2497,7 +2491,7 @@ unexpected_eof (token_start, "'");
 
 case 98:
 YY_RULE_SETUP
-#line 646 "src/scan-gram.l"
+#line 640 "src/scan-gram.l"
 {
     --nesting;
     if (nesting < 0)
@@ -2523,16 +2517,16 @@ YY_RULE_SETUP
 case 99:
 /* rule 99 can match eol */
 YY_RULE_SETUP
-#line 668 "src/scan-gram.l"
+#line 662 "src/scan-gram.l"
 STRING_GROW;
        YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 669 "src/scan-gram.l"
+#line 663 "src/scan-gram.l"
 STRING_GROW; nesting += gram_leng;
        YY_BREAK
 case YY_STATE_EOF(SC_TAG):
-#line 671 "src/scan-gram.l"
+#line 665 "src/scan-gram.l"
 unexpected_eof (token_start, ">");
        YY_BREAK
 
@@ -2543,7 +2537,7 @@ unexpected_eof (token_start, ">");
 
 case 101:
 YY_RULE_SETUP
-#line 680 "src/scan-gram.l"
+#line 674 "src/scan-gram.l"
 {
     unsigned long int c = strtoul (gram_text + 1, NULL, 8);
     if (!c || UCHAR_MAX < c)
@@ -2552,17 +2546,16 @@ YY_RULE_SETUP
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  stop_text();
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", (int)c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", (int)c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
        YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 696 "src/scan-gram.l"
+#line 689 "src/scan-gram.l"
 {
     verify (UCHAR_MAX < ULONG_MAX);
     unsigned long int c = strtoul (gram_text + 2, NULL, 16);
@@ -2572,58 +2565,57 @@ YY_RULE_SETUP
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  stop_text();
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", (int)c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", (int)c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
        YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 713 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\a'); stop_text(); gram_piece_append("<PYACC_Escape character=\"7\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 705 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\a'); gram_piece_append("<PYACC_Text_Escape character=\"7\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 714 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\b'); stop_text(); gram_piece_append("<PYACC_Escape character=\"8\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 706 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\b'); gram_piece_append("<PYACC_Text_Escape character=\"8\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 715 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\f'); stop_text(); gram_piece_append("<PYACC_Escape character=\"12\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 707 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\f'); gram_piece_append("<PYACC_Text_Escape character=\"12\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 716 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\n'); stop_text(); gram_piece_append("<PYACC_Escape character=\"10\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 708 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\n'); gram_piece_append("<PYACC_Text_Escape character=\"10\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 717 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\r'); stop_text(); gram_piece_append("<PYACC_Escape character=\"13\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 709 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\r'); gram_piece_append("<PYACC_Text_Escape character=\"13\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 718 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\t'); stop_text(); gram_piece_append("<PYACC_Escape character=\"9\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 710 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\t'); gram_piece_append("<PYACC_Text_Escape character=\"9\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 719 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, '\v'); stop_text(); gram_piece_append("<PYACC_Escape character=\"11\">"); flush(); gram_piece_append("</PYACC_Escape>");
+#line 711 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, '\v'); gram_piece_append("<PYACC_Text_Escape character=\"11\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
        YY_BREAK
 /* \\[\"\'?\\] would be shorter, but it confuses xgettext.  */
 case 110:
 YY_RULE_SETUP
-#line 722 "src/scan-gram.l"
-obstack_1grow (&obstack_for_string, gram_text[1]); stop_text(); sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", gram_text[1]); gram_piece_append(gram_piece_temp); flush(); gram_piece_append("</PYACC_Escape>"); 
+#line 714 "src/scan-gram.l"
+obstack_1grow (&obstack_for_string, gram_text[1]); sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", gram_text[1]); gram_piece_append(gram_piece_temp); flush(); gram_piece_append("</PYACC_Text_Escape>"); 
        YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 724 "src/scan-gram.l"
+#line 716 "src/scan-gram.l"
 {
     int c = convert_ucn_to_byte (gram_text);
     if (c <= 0)
@@ -2632,17 +2624,17 @@ YY_RULE_SETUP
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
        YY_BREAK
 case 112:
 /* rule 112 can match eol */
 YY_RULE_SETUP
-#line 738 "src/scan-gram.l"
+#line 730 "src/scan-gram.l"
 {
     char const *p = gram_text + 1;
     /* Quote only if escaping won't make the character visible.  */
@@ -2663,7 +2655,7 @@ YY_RULE_SETUP
 case 113:
 /* rule 113 can match eol */
 YY_RULE_SETUP
-#line 756 "src/scan-gram.l"
+#line 748 "src/scan-gram.l"
 STRING_GROW;
        YY_BREAK
 
@@ -2671,17 +2663,17 @@ STRING_GROW;
 
 case 114:
 YY_RULE_SETUP
-#line 761 "src/scan-gram.l"
+#line 753 "src/scan-gram.l"
 STRING_GROW; BEGIN context_state;
        YY_BREAK
 case 115:
 /* rule 115 can match eol */
 YY_RULE_SETUP
-#line 762 "src/scan-gram.l"
+#line 754 "src/scan-gram.l"
 unexpected_newline (token_start, "'");
        YY_BREAK
 case YY_STATE_EOF(SC_CHARACTER):
-#line 763 "src/scan-gram.l"
+#line 755 "src/scan-gram.l"
 unexpected_eof (token_start, "'");
        YY_BREAK
 
@@ -2689,17 +2681,17 @@ unexpected_eof (token_start, "'");
 
 case 116:
 YY_RULE_SETUP
-#line 768 "src/scan-gram.l"
+#line 760 "src/scan-gram.l"
 STRING_GROW; BEGIN context_state;
        YY_BREAK
 case 117:
 /* rule 117 can match eol */
 YY_RULE_SETUP
-#line 769 "src/scan-gram.l"
+#line 761 "src/scan-gram.l"
 unexpected_newline (token_start, "\"");
        YY_BREAK
 case YY_STATE_EOF(SC_STRING):
-#line 770 "src/scan-gram.l"
+#line 762 "src/scan-gram.l"
 unexpected_eof (token_start, "\"");
        YY_BREAK
 
@@ -2710,47 +2702,43 @@ unexpected_eof (token_start, "\"");
 
 case 118:
 YY_RULE_SETUP
-#line 780 "src/scan-gram.l"
+#line 772 "src/scan-gram.l"
 {
     STRING_GROW;
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_CHARACTER;
- start_text();
   }
        YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 787 "src/scan-gram.l"
+#line 778 "src/scan-gram.l"
 {
     STRING_GROW;
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_STRING;
- start_text();
   }
        YY_BREAK
 case 120:
 /* rule 120 can match eol */
 YY_RULE_SETUP
-#line 794 "src/scan-gram.l"
+#line 784 "src/scan-gram.l"
 {
     STRING_GROW;
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_COMMENT;
- start_text();
   }
        YY_BREAK
 case 121:
 /* rule 121 can match eol */
 YY_RULE_SETUP
-#line 801 "src/scan-gram.l"
+#line 790 "src/scan-gram.l"
 {
     STRING_GROW;
     context_state = YY_START;
     BEGIN SC_LINE_COMMENT;
- start_text();
   }
        YY_BREAK
 
@@ -2763,26 +2751,26 @@ YY_RULE_SETUP
 case 122:
 /* rule 122 can match eol */
 YY_RULE_SETUP
-#line 818 "src/scan-gram.l"
-STRING_GROW; nesting++; start_text();
+#line 806 "src/scan-gram.l"
+STRING_GROW; nesting++;
        YY_BREAK
 case 123:
 /* rule 123 can match eol */
 YY_RULE_SETUP
-#line 819 "src/scan-gram.l"
-STRING_GROW; nesting--; start_text();
+#line 807 "src/scan-gram.l"
+STRING_GROW; nesting--;
        YY_BREAK
 /* Tokenize '<<%' correctly (as '<<' '%') rather than incorrrectly
      (as '<' '<%').  */
 case 124:
 /* rule 124 can match eol */
 YY_RULE_SETUP
-#line 823 "src/scan-gram.l"
-STRING_GROW; start_text();
+#line 811 "src/scan-gram.l"
+STRING_GROW;
        YY_BREAK
 case YY_STATE_EOF(SC_BRACED_CODE):
 case YY_STATE_EOF(SC_PREDICATE):
-#line 825 "src/scan-gram.l"
+#line 813 "src/scan-gram.l"
 unexpected_eof (code_start, "}");
        YY_BREAK
 
@@ -2790,7 +2778,7 @@ unexpected_eof (code_start, "}");
 
 case 125:
 YY_RULE_SETUP
-#line 830 "src/scan-gram.l"
+#line 818 "src/scan-gram.l"
 {
     obstack_1grow (&obstack_for_string, '}');
 
@@ -2802,15 +2790,8 @@ YY_RULE_SETUP
         val->code = last_string;
         BEGIN INITIAL;
 #if 1
-#if 1 /* include the braces */
- start_text();
  gram_piece_esc(gram_text, strlen(gram_text));
-#endif
- stop_text();
  gram_piece_append("</PYACC_BracedCode>");
-#if 0 /* don't include the braces */
- gram_piece_esc(gram_text, strlen(gram_text));
-#endif
  gram_piece_pack();
  return ~BRACED_CODE;
 #else
@@ -2824,7 +2805,7 @@ YY_RULE_SETUP
 
 case 126:
 YY_RULE_SETUP
-#line 861 "src/scan-gram.l"
+#line 842 "src/scan-gram.l"
 {
     --nesting;
     if (nesting < 0)
@@ -2834,9 +2815,8 @@ YY_RULE_SETUP
         val->code = last_string;
         BEGIN INITIAL;
 #if 1
- stop_text();
  gram_piece_esc(gram_text, strlen(gram_text));
- gram_piece_append("</PYACC_BracedPredicate>");
+ gram_piece_append("</PYACC_Text></PYACC_BracedPredicate>");
  gram_piece_pack();
  return ~BRACED_PREDICATE;
 #else
@@ -2855,14 +2835,14 @@ YY_RULE_SETUP
 
 case 127:
 YY_RULE_SETUP
-#line 890 "src/scan-gram.l"
+#line 870 "src/scan-gram.l"
 {
     STRING_FINISH;
     loc->start = code_start;
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(gram_text, strlen(gram_text));
  gram_piece_append("</PYACC_Section1_Prologue>");
  gram_piece_pack();
@@ -2873,7 +2853,7 @@ YY_RULE_SETUP
   }
        YY_BREAK
 case YY_STATE_EOF(SC_PROLOGUE):
-#line 906 "src/scan-gram.l"
+#line 886 "src/scan-gram.l"
 unexpected_eof (code_start, "%}");
        YY_BREAK
 
@@ -2884,14 +2864,13 @@ unexpected_eof (code_start, "%}");
 
 
 case YY_STATE_EOF(SC_EPILOGUE):
-#line 917 "src/scan-gram.l"
+#line 897 "src/scan-gram.l"
 {
     STRING_FINISH;
     loc->start = code_start;
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
- stop_text();
  gram_piece_pack();
  return ~EPILOGUE;
 #else
@@ -2904,19 +2883,19 @@ case YY_STATE_EOF(SC_EPILOGUE):
   | By default, grow the string obstack with the input.  |
   `-----------------------------------------------------*/
 case 128:
-#line 938 "src/scan-gram.l"
+#line 917 "src/scan-gram.l"
 case 129:
 /* rule 129 can match eol */
 YY_RULE_SETUP
-#line 938 "src/scan-gram.l"
-STRING_GROW; start_text();
+#line 917 "src/scan-gram.l"
+STRING_GROW;
        YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 941 "src/scan-gram.l"
+#line 920 "src/scan-gram.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 2809 "src/scan-gram.c"
+#line 2788 "src/scan-gram.c"
 case YY_STATE_EOF(SC_RETURN_BRACKETED_ID):
        yyterminate();
 
@@ -4050,7 +4029,7 @@ void gram_free (void * ptr )
 
 /* %ok-for-header */
 
-#line 941 "src/scan-gram.l"
+#line 920 "src/scan-gram.l"
 
 
 
@@ -4281,18 +4260,3 @@ gram_scanner_free (void)
   gram_lex_destroy ();
 }
 
-/* Nick */
-static void start_text(void) {
- if (in_text == 0) {
-  gram_piece_append("<PYACC_Text>");
-  in_text = 1;
- }
-}
-
-static void stop_text(void) {
- if (in_text) {
-  gram_piece_append("</PYACC_Text>");
-  in_text = 0;
- }
-}
-
index 4e63391..daf76e9 100644 (file)
@@ -101,11 +101,6 @@ static int convert_ucn_to_byte (char const *hex_text);
 static void unexpected_eof (boundary, char const *);
 static void unexpected_newline (boundary, char const *);
 
-/* Nick */
-static int in_text;
-static void start_text(void);
-static void stop_text(void);
-
 %}
  /* A C-like comment in directives/rules. */
 %x SC_YACC_COMMENT
@@ -333,13 +328,13 @@ eqopt    ([[:space:]]*=)?
   }
 
   /* Characters.  */
-  "'"         token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; gram_piece_pack(); gram_piece_append("<PYACC_Char>");
+  "'"         token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER; gram_piece_pack(); gram_piece_append("<PYACC_Char>"); flush(); gram_piece_append("<PYACC_Text>");
 
   /* Strings. */
-  "\""        token_start = loc->start; BEGIN SC_ESCAPED_STRING; gram_piece_pack(); gram_piece_append("<PYACC_String>");
+  "\""        token_start = loc->start; BEGIN SC_ESCAPED_STRING; gram_piece_pack(); gram_piece_append("<PYACC_String>"); flush(); gram_piece_append("<PYACC_Text>");
 
   /* Prologue. */
-  "%{"        code_start = loc->start; BEGIN SC_PROLOGUE; gram_piece_pack(); gram_piece_append("<PYACC_Section1_Prologue>"); flush(); start_text();
+  "%{"        code_start = loc->start; BEGIN SC_PROLOGUE; gram_piece_pack(); gram_piece_append("<PYACC_Section1_Prologue>"); flush(); gram_piece_append("<PYACC_Text>");
 
   /* Code in between braces.  */
   "{" {
@@ -349,10 +344,6 @@ eqopt    ([[:space:]]*=)?
     BEGIN SC_BRACED_CODE;
  gram_piece_pack();
  gram_piece_append("<PYACC_BracedCode>");
-#if 1 /* include the braces */
- start_text();
- flush();
-#endif
   }
 
   /* Semantic predicate. */
@@ -361,6 +352,10 @@ eqopt    ([[:space:]]*=)?
     code_start = loc->start;
  gram_piece_pack();
  gram_piece_append("<PYACC_BracedPredicate>");
+ /* flush all but the opening brace */
+ gram_piece_esc(yytext, yy_c_buf_p - 1 - yytext);
+ yytext = yy_c_buf_p - 1;
+ gram_piece_append("<PYACC_Text>");
     BEGIN SC_PREDICATE;
   }
 
@@ -386,7 +381,6 @@ eqopt    ([[:space:]]*=)?
   gram_piece_esc(yytext, strlen(yytext));
   gram_piece_pack();
   gram_piece_pack();
-  start_text();
   return ~PERCENT_PERCENT;
  }
     return PERCENT_PERCENT;
@@ -584,7 +578,7 @@ eqopt    ([[:space:]]*=)?
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(yytext, strlen(yytext));
  gram_piece_append("</PYACC_String>");
  gram_piece_pack();
@@ -622,7 +616,7 @@ eqopt    ([[:space:]]*=)?
     STRING_FREE;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(yytext, strlen(yytext));
  gram_piece_append("</PYACC_Char>");
  gram_piece_pack();
@@ -685,11 +679,10 @@ eqopt    ([[:space:]]*=)?
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  stop_text();
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", (int)c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", (int)c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
 
@@ -702,24 +695,23 @@ eqopt    ([[:space:]]*=)?
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  stop_text();
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", (int)c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", (int)c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
 
-  \\a   obstack_1grow (&obstack_for_string, '\a'); stop_text(); gram_piece_append("<PYACC_Escape character=\"7\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\b   obstack_1grow (&obstack_for_string, '\b'); stop_text(); gram_piece_append("<PYACC_Escape character=\"8\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\f   obstack_1grow (&obstack_for_string, '\f'); stop_text(); gram_piece_append("<PYACC_Escape character=\"12\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\n   obstack_1grow (&obstack_for_string, '\n'); stop_text(); gram_piece_append("<PYACC_Escape character=\"10\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\r   obstack_1grow (&obstack_for_string, '\r'); stop_text(); gram_piece_append("<PYACC_Escape character=\"13\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\t   obstack_1grow (&obstack_for_string, '\t'); stop_text(); gram_piece_append("<PYACC_Escape character=\"9\">"); flush(); gram_piece_append("</PYACC_Escape>");
-  \\v   obstack_1grow (&obstack_for_string, '\v'); stop_text(); gram_piece_append("<PYACC_Escape character=\"11\">"); flush(); gram_piece_append("</PYACC_Escape>");
+  \\a   obstack_1grow (&obstack_for_string, '\a'); gram_piece_append("<PYACC_Text_Escape character=\"7\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\b   obstack_1grow (&obstack_for_string, '\b'); gram_piece_append("<PYACC_Text_Escape character=\"8\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\f   obstack_1grow (&obstack_for_string, '\f'); gram_piece_append("<PYACC_Text_Escape character=\"12\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\n   obstack_1grow (&obstack_for_string, '\n'); gram_piece_append("<PYACC_Text_Escape character=\"10\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\r   obstack_1grow (&obstack_for_string, '\r'); gram_piece_append("<PYACC_Text_Escape character=\"13\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\t   obstack_1grow (&obstack_for_string, '\t'); gram_piece_append("<PYACC_Text_Escape character=\"9\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
+  \\v   obstack_1grow (&obstack_for_string, '\v'); gram_piece_append("<PYACC_Text_Escape character=\"11\">"); flush(); gram_piece_append("</PYACC_Text_Escape>");
 
   /* \\[\"\'?\\] would be shorter, but it confuses xgettext.  */
-  \\("\""|"'"|"?"|"\\")  obstack_1grow (&obstack_for_string, yytext[1]); stop_text(); sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", yytext[1]); gram_piece_append(gram_piece_temp); flush(); gram_piece_append("</PYACC_Escape>"); 
+  \\("\""|"'"|"?"|"\\")  obstack_1grow (&obstack_for_string, yytext[1]); sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", yytext[1]); gram_piece_append(gram_piece_temp); flush(); gram_piece_append("</PYACC_Text_Escape>"); 
  
   \\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} {
     int c = convert_ucn_to_byte (yytext);
@@ -729,10 +721,10 @@ eqopt    ([[:space:]]*=)?
     else
  {
       obstack_1grow (&obstack_for_string, c);
-  sprintf(gram_piece_temp, "<PYACC_Escape character=\"%d\">", c);
+  sprintf(gram_piece_temp, "<PYACC_Text_Escape character=\"%d\">", c);
   gram_piece_append(gram_piece_temp);
   flush();
-  gram_piece_append("</PYACC_Escape>"); 
+  gram_piece_append("</PYACC_Text_Escape>"); 
  }
   }
   \\(.|\n)      {
@@ -782,27 +774,23 @@ eqopt    ([[:space:]]*=)?
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_CHARACTER;
- start_text();
   }
   "\"" {
     STRING_GROW;
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_STRING;
- start_text();
   }
   "/"{splice}"*" {
     STRING_GROW;
     context_state = YY_START;
     token_start = loc->start;
     BEGIN SC_COMMENT;
- start_text();
   }
   "/"{splice}"/" {
     STRING_GROW;
     context_state = YY_START;
     BEGIN SC_LINE_COMMENT;
- start_text();
   }
 }
 
@@ -815,12 +803,12 @@ eqopt    ([[:space:]]*=)?
 
 <SC_BRACED_CODE,SC_PREDICATE>
 {
-  "{"|"<"{splice}"%"  STRING_GROW; nesting++; start_text();
-  "%"{splice}">"      STRING_GROW; nesting--; start_text();
+  "{"|"<"{splice}"%"  STRING_GROW; nesting++;
+  "%"{splice}">"      STRING_GROW; nesting--;
 
   /* Tokenize '<<%' correctly (as '<<' '%') rather than incorrrectly
      (as '<' '<%').  */
-  "<"{splice}"<"  STRING_GROW; start_text();
+  "<"{splice}"<"  STRING_GROW;
 
   <<EOF>>   unexpected_eof (code_start, "}");
 }
@@ -838,15 +826,8 @@ eqopt    ([[:space:]]*=)?
         val->code = last_string;
         BEGIN INITIAL;
 #if 1
-#if 1 /* include the braces */
- start_text();
  gram_piece_esc(yytext, strlen(yytext));
-#endif
- stop_text();
  gram_piece_append("</PYACC_BracedCode>");
-#if 0 /* don't include the braces */
- gram_piece_esc(yytext, strlen(yytext));
-#endif
  gram_piece_pack();
  return ~BRACED_CODE;
 #else
@@ -867,9 +848,8 @@ eqopt    ([[:space:]]*=)?
         val->code = last_string;
         BEGIN INITIAL;
 #if 1
- stop_text();
  gram_piece_esc(yytext, strlen(yytext));
- gram_piece_append("</PYACC_BracedPredicate>");
+ gram_piece_append("</PYACC_Text></PYACC_BracedPredicate>");
  gram_piece_pack();
  return ~BRACED_PREDICATE;
 #else
@@ -893,7 +873,7 @@ eqopt    ([[:space:]]*=)?
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
stop_text();
gram_piece_append("</PYACC_Text>");
  gram_piece_esc(yytext, strlen(yytext));
  gram_piece_append("</PYACC_Section1_Prologue>");
  gram_piece_pack();
@@ -920,7 +900,6 @@ eqopt    ([[:space:]]*=)?
     val->code = last_string;
     BEGIN INITIAL;
 #if 1
- stop_text();
  gram_piece_pack();
  return ~EPILOGUE;
 #else
@@ -935,7 +914,7 @@ eqopt    ([[:space:]]*=)?
   `-----------------------------------------------------*/
 
 <SC_COMMENT,SC_LINE_COMMENT,SC_BRACED_CODE,SC_PREDICATE,SC_PROLOGUE,SC_EPILOGUE,SC_STRING,SC_CHARACTER,SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>. |
-  <SC_COMMENT,SC_LINE_COMMENT,SC_BRACED_CODE,SC_PREDICATE,SC_PROLOGUE,SC_EPILOGUE>\n    STRING_GROW; start_text();
+  <SC_COMMENT,SC_LINE_COMMENT,SC_BRACED_CODE,SC_PREDICATE,SC_PROLOGUE,SC_EPILOGUE>\n    STRING_GROW;
 
 
 %%
@@ -1166,18 +1145,3 @@ gram_scanner_free (void)
   /* Reclaim Flex's buffers.  */
   yylex_destroy ();
 }
-
-/* Nick */
-static void start_text(void) {
- if (in_text == 0) {
-  gram_piece_append("<PYACC_Text>");
-  in_text = 1;
- }
-}
-
-static void stop_text(void) {
- if (in_text) {
-  gram_piece_append("</PYACC_Text>");
-  in_text = 0;
- }
-}