Tidy scan-code.l, fix bug in scan-gram.l not setting yylval for element groups
authorNick Downing <nick@ndcode.org>
Mon, 21 Jan 2019 00:31:51 +0000 (11:31 +1100)
committerNick Downing <nick@ndcode.org>
Mon, 21 Jan 2019 00:31:51 +0000 (11:31 +1100)
bootstrap/n.sh
bootstrap/scan-code.l
bootstrap/scan-gram.l

index 9aac315..ef00587 100755 (executable)
@@ -9,10 +9,10 @@ then
   rm parse-gram.output parse-gram.tab.c parse-gram.tab.h
 fi
 ./markup.py <../tests/cal.y >out/cal.y.xml
-diff --unified out/cal.y.xml.ok out/cal.y.xml
+diff -q out/cal.y.xml.ok out/cal.y.xml
 ./markup.py <../tests_ast/cal_py.y >out/cal_py.y.xml
-diff --unified out/cal_py.y.xml.ok out/cal_py.y.xml
+diff -q out/cal_py.y.xml.ok out/cal_py.y.xml
 ./markup.py <../../bootstrap_flex.git/src/parse.y >out/parse.y.xml
-diff --unified out/parse.y.xml.ok out/parse.y.xml
+diff -q out/parse.y.xml.ok out/parse.y.xml
 ./markup.py <../../bootstrap_bison.git/src/parse-gram.y >out/parse-gram.y.xml
-diff --unified out/parse-gram.y.xml.ok out/parse-gram.y.xml
+diff -q out/parse-gram.y.xml.ok out/parse-gram.y.xml
index fe8d657..294d7e6 100644 (file)
 %option prefix="code_" outfile="lex_yy_code.py"
 
 %{
-  #ref_tail_fields = ''
-  #the_location = 0
-  #loc = &the_location
-  #code_last_string = ''
-  #untyped_var_seen = 0
-
   code_piece = []
   code_piece0 = 0
   code_piece1 = 0
-  #no_handle_action = 0
-  sc_context = -1 # usually an argument to code_lex()
+  sc_context = -1
 %}
 
 %x SC_COMMENT SC_LINE_COMMENT
@@ -57,119 +50,64 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
 
 %%
 
-
 %{
   assert sc_context == SC_SYMBOL_ACTION or sc_context == SC_RULE_ACTION or sc_context == INITIAL
   BEGIN(sc_context)
 %}
 
-
-
 <SC_COMMENT>
 {
-  "*"{splice}"/" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(sc_context)
-  }
+  "*"{splice}"/"               BEGIN(sc_context)
 }
 
-
   /*--------------------------------------------------------------.
   | Scanning a line comment.  The initial '//' is already eaten.  |
   `--------------------------------------------------------------*/
 
 <SC_LINE_COMMENT>
 {
-  "\n" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(sc_context)
-  }
-  {splice}                     #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
+  "\n"                         BEGIN(sc_context)
+  {splice}
 }
 
-
   /*--------------------------------------------.
   | Scanning user-code characters and strings.  |
   `--------------------------------------------*/
 
 <SC_CHARACTER,SC_STRING>
 {
-  {splice}|\\{splice}.         #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
+  {splice}|\\{splice}.
 }
 
 <SC_CHARACTER>
 {
-  "'" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(sc_context)
-  }
+  "'"                          BEGIN(sc_context)
 }
 
 <SC_STRING>
 {
-  "\"" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(sc_context)
-  }
+  "\""                         BEGIN(sc_context)
 }
 
-
 <SC_RULE_ACTION,SC_SYMBOL_ACTION>
 {
-  "'" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(SC_CHARACTER)
-  }
-  "\"" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(SC_STRING)
-  }
-  "/"{splice}"*" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(SC_COMMENT)
-  }
-  "/"{splice}"/" {
-    #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    BEGIN(SC_LINE_COMMENT)
-  }
+  "'"                          BEGIN(SC_CHARACTER)
+  "\""                         BEGIN(SC_STRING)
+  "/"{splice}"*"               BEGIN(SC_COMMENT)
+  "/"{splice}"/"               BEGIN(SC_LINE_COMMENT)
 
   [$@] {
     state.complain(yylloc, state.Wother, 'stray \'{0:s}\''.format(yytext))
-    #p__ = None
-    #p__ = yytext
-    #while *p__:
-    #  if *p__ == ord('$'):
-    #    (&obstack_for_string)->temp.i = len('$]['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '$][', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord('@'):
-    #    (&obstack_for_string)->temp.i = len('@@'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@@', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord('['):
-    #    (&obstack_for_string)->temp.i = len('@{'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@{', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord(']'):
-    #    (&obstack_for_string)->temp.i = len('@}'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@}', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  else:
-    #    (_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = *p__)
-    #    break
-    #  p__ += 1
   }
 }
 
 <SC_RULE_ACTION>
 {
   "$"("<"{tag}">")?{ref} {
-    #ref_tail_fields = None
     handle_action_dollar(yytext) #(self->rule, yytext, *loc)
-    #if ref_tail_fields:
-    #  (&obstack_for_string)->temp.i = len(ref_tail_fields), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ref_tail_fields, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
   }
   "@"{ref} {
-    #ref_tail_fields = None
     handle_action_at(yytext) #(self->rule, yytext, *loc)
-    #if ref_tail_fields:
-    #  (&obstack_for_string)->temp.i = len(ref_tail_fields), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ref_tail_fields, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
   }
 }
 
@@ -181,196 +119,24 @@ ref      -?[0-9]+|{id}|"["{id}"]"|"$"
       i -= 1
     i += 1
     code_piece_append('<AST_Text_ValueReference tag_name="{0:s}">'.format(yytext[2:i]))
-    code_piece_flush(len(yytext)) #escape(yytext)
+    code_piece_flush(len(yytext))
     code_piece_append('</AST_Text_ValueReference>')
-    #type_name = None
-    #fetch_type_name(yytext + 1, &type_name, *loc)[-1] = 0
-    #(&obstack_for_string)->temp.i = len(']b4_dollar_dollar('), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']b4_dollar_dollar(', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #obstack_quote_p = type_name
-    #if obstack_quote_p and obstack_quote_p[0]:
-    #  (&obstack_for_string)->temp.i = len('[['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #  p__ = None
-    #  p__ = obstack_quote_p
-    #  while *p__:
-    #    if *p__ == ord('$'):
-    #      (&obstack_for_string)->temp.i = len('$]['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '$][', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #      break
-    #    elif *p__ == ord('@'):
-    #      (&obstack_for_string)->temp.i = len('@@'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@@', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #      break
-    #    elif *p__ == ord('['):
-    #      (&obstack_for_string)->temp.i = len('@{'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@{', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #      break
-    #    elif *p__ == ord(']'):
-    #      (&obstack_for_string)->temp.i = len('@}'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@}', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #      break
-    #    else:
-    #      (_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = *p__)
-    #      break
-    #    p__ += 1
-    #  (&obstack_for_string)->temp.i = len(']]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #else:
-    #  (&obstack_for_string)->temp.i = len('[]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    ##(&obstack_for_string)->temp.i = len(')['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ')[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #self->is_value_used = True
-    #yytext += i
   }
   "@$" {
-    #(&obstack_for_string)->temp.i = len(']b4_at_dollar['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']b4_at_dollar[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #muscle_percent_define_ensure('locations', the_location, True)
     code_piece_append('<AST_Text_ValueLocation>')
     code_piece_flush(len(yytext))
     code_piece_append('</AST_Text_ValueLocation>')
   }
 }
 
-
 <*>
 {
-  /* Escape M4 quoting characters in C code.  */
-  [$@\[\]] {
-    #p__ = None
-    #p__ = yytext
-    #while *p__:
-    #  if *p__ == ord('$'):
-    #    (&obstack_for_string)->temp.i = len('$]['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '$][', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord('@'):
-    #    (&obstack_for_string)->temp.i = len('@@'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@@', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord('['):
-    #    (&obstack_for_string)->temp.i = len('@{'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@{', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  elif *p__ == ord(']'):
-    #    (&obstack_for_string)->temp.i = len('@}'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@}', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-    #    break
-    #  else:
-    #    (_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = *p__)
-    #    break
-    #  p__ += 1
-  }
-
-  /* By default, grow the string obstack with the input.  */
-  .|\n                         #(&obstack_for_string)->temp.i = code_leng, (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, yytext, (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-
- /* End of processing. */
-  <<EOF>> {
-    #code_last_string = ((_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = ord('\0')), str(((&obstack_for_string)->maybe_empty_object = 1, 0) if (&obstack_for_string)->next_free == (&obstack_for_string)->object_base else 0, (&obstack_for_string)->temp.p = (&obstack_for_string)->object_base, (&obstack_for_string)->next_free = ((&obstack_for_string)->object_base if sizeof ptrdiff_t < 4 else str(0)) + ((&obstack_for_string)->next_free - ((&obstack_for_string)->object_base if sizeof ptrdiff_t < 4 else str(0)) + (&obstack_for_string)->alignment_mask & ~(&obstack_for_string)->alignment_mask), ((&obstack_for_string)->next_free = (&obstack_for_string)->chunk_limit) if int((&obstack_for_string)->next_free - str((&obstack_for_string)->chunk)) > int((&obstack_for_string)->chunk_limit - str((&obstack_for_string)->chunk)) else 0, (&obstack_for_string)->object_base = (&obstack_for_string)->next_free, (&obstack_for_string)->temp.p))
-    #return code_last_string
-  }
+  .|\n
 }
 
 %%
 
-#def is_dot_or_dash(ch):
-#  return ch == ord('.') or ch == ord('-')
-#
-#def contains_dot_or_dash(p):
-#  pass
-#  while *p:
-#    if is_dot_or_dash(*p):
-#      return True
-#    p += 1
-#  return False
-#variant_table = None
-#variant_table_size = 0
-#variant_count = 0
-#
-#def variant_table_grow():
-#  variant_count += 1
-#  if variant_count > variant_table_size:
-#    while variant_count > variant_table_size:
-#      variant_table_size = 2 * variant_table_size + 3
-#    variant_table = xnrealloc(variant_table, variant_table_size, sizeof *variant_table)
-#  return &variant_table[variant_count - 1]
-#
-#def variant_table_free():
-#  free(variant_table)
-#  variant_table = None
-#  variant_table_size = variant_count = 0
-#
-#def find_prefix_end(prefix, begin, end):
-#  ptr = begin
-#  pass
-#  while *prefix and ptr != end:
-#    if *prefix != *ptr:
-#      return 0
-#    ++prefix, ++ptr
-#  if *prefix:
-#    return 0
-#  return ptr
-#
-#def variant_add(id, id_loc, symbol_index, cp, cp_end, explicit_bracketing):
-#  prefix_end = None
-#  prefix_end = find_prefix_end(id, cp, cp_end)
-#  if prefix_end and (prefix_end == cp_end or not explicit_bracketing and is_dot_or_dash(*prefix_end)):
-#    r = variant_table_grow()
-#    r->symbol_index = symbol_index
-#    r->id = id
-#    r->loc = id_loc
-#    r->hidden_by = None
-#    r->err = 0
-#    return r
-#  else:
-#    return None
-#
-#def get_at_spec(symbol_index):
-#  at_buf = [None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
-#  if symbol_index == 0:
-#    strcpy(at_buf, '$$')
-#  else:
-#    rpl_snprintf(at_buf, sizeof at_buf, '$%u', symbol_index)
-#  return at_buf
-#
-#def show_sub_message(warning, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent, var):
-#  at_spec = get_at_spec(var->symbol_index)
-#  if var->err == 0:
-#    complain_indent(&var->loc, warning, &indent, gettext('refers to: %c%s at %s'), dollar_or_at, var->id, at_spec)
-#  else:
-#    msg_buf = None
-#    tail = '' if explicit_bracketing else cp + len(var->id)
-#    id = None
-#    id_loc = None
-#    if var->hidden_by:
-#      id = var->hidden_by->id
-#      id_loc = var->hidden_by->loc
-#    else:
-#      id = var->id
-#      id_loc = var->loc
-#    _obstack_begin(&msg_buf, 0, 0, xmalloc, free)
-#    obstack_printf(&msg_buf, gettext('possibly meant: %c'), dollar_or_at)
-#    if contains_dot_or_dash(id):
-#      obstack_printf(&msg_buf, '[%s]', id)
-#    else:
-#      (&msg_buf)->temp.i = len(id), (_obstack_newchunk(&msg_buf, (&msg_buf)->temp.i), 0) if int((&msg_buf)->chunk_limit - (&msg_buf)->next_free) < (&msg_buf)->temp.i else 0, memcpy((&msg_buf)->next_free, id, (&msg_buf)->temp.i), (&msg_buf)->next_free += (&msg_buf)->temp.i, NoneType(0)
-#    (&msg_buf)->temp.i = len(tail), (_obstack_newchunk(&msg_buf, (&msg_buf)->temp.i), 0) if int((&msg_buf)->chunk_limit - (&msg_buf)->next_free) < (&msg_buf)->temp.i else 0, memcpy((&msg_buf)->next_free, tail, (&msg_buf)->temp.i), (&msg_buf)->next_free += (&msg_buf)->temp.i, NoneType(0)
-#    if var->err & 1 << 0:
-#      obstack_printf(&msg_buf, gettext(', hiding %c'), dollar_or_at)
-#      if contains_dot_or_dash(var->id):
-#        obstack_printf(&msg_buf, '[%s]', var->id)
-#      else:
-#        (&msg_buf)->temp.i = len(var->id), (_obstack_newchunk(&msg_buf, (&msg_buf)->temp.i), 0) if int((&msg_buf)->chunk_limit - (&msg_buf)->next_free) < (&msg_buf)->temp.i else 0, memcpy((&msg_buf)->next_free, var->id, (&msg_buf)->temp.i), (&msg_buf)->next_free += (&msg_buf)->temp.i, NoneType(0)
-#      (&msg_buf)->temp.i = len(tail), (_obstack_newchunk(&msg_buf, (&msg_buf)->temp.i), 0) if int((&msg_buf)->chunk_limit - (&msg_buf)->next_free) < (&msg_buf)->temp.i else 0, memcpy((&msg_buf)->next_free, tail, (&msg_buf)->temp.i), (&msg_buf)->next_free += (&msg_buf)->temp.i, NoneType(0)
-#    obstack_printf(&msg_buf, gettext(' at %s'), at_spec)
-#    if var->err & 1 << 2:
-#      obstack_printf(&msg_buf, gettext(', cannot be accessed from mid-rule action at $%d'), midrule_rhs_index)
-#    complain_indent(&id_loc, warning, &indent, '%s', ((_obstack_newchunk(&msg_buf, 1), 0) if int((&msg_buf)->chunk_limit - (&msg_buf)->next_free) < 1 else 0, NoneType(*(&msg_buf)->next_free++ = ord('\0')), str(((&msg_buf)->maybe_empty_object = 1, 0) if (&msg_buf)->next_free == (&msg_buf)->object_base else 0, (&msg_buf)->temp.p = (&msg_buf)->object_base, (&msg_buf)->next_free = ((&msg_buf)->object_base if sizeof ptrdiff_t < 4 else str(0)) + ((&msg_buf)->next_free - ((&msg_buf)->object_base if sizeof ptrdiff_t < 4 else str(0)) + (&msg_buf)->alignment_mask & ~(&msg_buf)->alignment_mask), ((&msg_buf)->next_free = (&msg_buf)->chunk_limit) if int((&msg_buf)->next_free - str((&msg_buf)->chunk)) > int((&msg_buf)->chunk_limit - str((&msg_buf)->chunk)) else 0, (&msg_buf)->object_base = (&msg_buf)->next_free, (&msg_buf)->temp.p)))
-#    (&msg_buf)->temp.p = list(0), NoneType((&msg_buf)->next_free = (&msg_buf)->object_base = str((&msg_buf)->temp.p)) if (&msg_buf)->temp.p > list((&msg_buf)->chunk) and (&msg_buf)->temp.p < list((&msg_buf)->chunk_limit) else _obstack_free(&msg_buf, (&msg_buf)->temp.p)
-#
-#def show_sub_messages(warning, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent):
-#  i = None
-#  i = 0
-#  while i < variant_count:
-#    show_sub_message(warning | silent, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent, &variant_table[i])
-#    i += 1
-
 def parse_ref(cp): #, rule, rule_length, midrule_rhs_index, text, text_loc, dollar_or_at):
-  #l = None
-  #cp_end = None
-  #explicit_bracketing = None
-  #i = None
-  #valid_variants = 0
-  #valid_variant_index = 0
   if '$' == cp[0]:
     return 0x80000001
   if len(cp) >= 1 and cp[0] in '0123456789' or len(cp) >= 2 and cp[0] == '-' and cp[1] in '0123456789':
@@ -380,115 +146,10 @@ def parse_ref(cp): #, rule, rule_length, midrule_rhs_index, text, text_loc, doll
     #else:
     #  complain(&text_loc, complaint, gettext('integer out of range: %s'), quote(text))
     #  return 0x80000000
-  #if ord('[') == *cp:
-  #  p = None
-  #  p = ++cp
-  #  while *p != ord(']'):
-  #    p += 1
-  #    continue
-  #    p += 1
-  #  cp_end = p
-  #  explicit_bracketing = True
-  #else:
-  #  p = None
-  #  p = cp
-  #  while *p:
-  #    if is_dot_or_dash(*p):
-  #      ref_tail_fields = p
-  #      break
-  #    p += 1
-  #  p = cp
-  #  while *p:
-  #    p += 1
-  #    continue
-  #    p += 1
-  #  cp_end = p
-  #  explicit_bracketing = False
-  #symbol_index = None
-  #variant_count = 0
-  #symbol_index = 0, l = rule
-  #while not symbol_list_null(l):
-  #  var = None
-  #  if l->content_type != SYMLIST_SYMBOL:
-  #    ++symbol_index, l = l->next
-  #    continue
-  #  var = variant_add(l->content.sym->tag, l->sym_loc, symbol_index, cp, cp_end, explicit_bracketing)
-  #  if var and l->named_refXXX:
-  #    var->hidden_by = l->named_refXXX
-  #  if l->named_refXXX:
-  #    variant_add(l->named_refXXX->id, l->named_refXXX->loc, symbol_index, cp, cp_end, explicit_bracketing)
-  #  ++symbol_index, l = l->next
-  #i = 0
-  #while i < variant_count:
-  #  var = &variant_table[i]
-  #  symbol_index = var->symbol_index
-  #  if midrule_rhs_index != 0 and (symbol_index == 0 or midrule_rhs_index < symbol_index):
-  #    var->err |= 1 << 2
-  #  if not explicit_bracketing and contains_dot_or_dash(var->id):
-  #    var->err |= 1 << 1
-  #  if var->hidden_by:
-  #    var->err |= 1 << 0
-  #  if not var->err:
-  #    valid_variant_index = i
-  #    valid_variants += 1
-  #  i += 1
-  #if valid_variants == 0:
-  #  len = cp_end - cp if explicit_bracketing or not ref_tail_fields else ref_tail_fields - cp
-  #  indent = 0
-  #  complain_indent(&text_loc, complaint, &indent, gettext('invalid reference: %s'), quote(text))
-  #  indent += 4
-  #  if len == 0:
-  #    sym_loc = text_loc
-  #    sym_loc.start.column += 1
-  #    sym_loc.end = sym_loc.start
-  #    complain_indent(&sym_loc, complaint, &indent, gettext('syntax error after \'%c\', expecting integer, ' 'letter, \'_\', \'[\', or \'$\''), dollar_or_at)
-  #  else:
-  #    if midrule_rhs_index:
-  #      complain_indent(&rule->locationXXX, complaint, &indent, gettext('symbol not found in production before $%d: ' '%.*s'), midrule_rhs_index, len, cp)
-  #    else:
-  #      complain_indent(&rule->locationXXX, complaint, &indent, gettext('symbol not found in production: %.*s'), len, cp)
-  #  if variant_count > 0:
-  #    show_sub_messages(complaint, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent)
-  #  return 0x80000000
-  #elif valid_variants == 1:
-  #  indent = 0
-  #  if variant_count > 1:
-  #    complain_indent(&text_loc, Wother, &indent, gettext('misleading reference: %s'), quote(text))
-  #    show_sub_messages(Wother, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent + 4)
-  #  symbol_index = variant_table[valid_variant_index].symbol_index
-  #  return 0x80000001 if symbol_index == midrule_rhs_index else symbol_index
-  #else:
-  #  indent = 0
-  #  complain_indent(&text_loc, complaint, &indent, gettext('ambiguous reference: %s'), quote(text))
-  #  show_sub_messages(complaint, cp, explicit_bracketing, midrule_rhs_index, dollar_or_at, indent + 4)
-  #  return 0x80000000
   return 0x80000000 # Nick added, normally unreachable
 
-#max_left_semantic_context = 0
-#def fetch_type_name(cp, type_name, dollar_loc):
-#  if *cp == ord('<'):
-#    *type_name = ++cp
-#    while *cp != ord('>') or cp[-1] == ord('-'):
-#      cp += 1
-#    cp += 1
-#    if untyped_var_seen:
-#      complain(&dollar_loc, complaint, gettext('explicit type given in untyped grammar'))
-#    tag_seen = True
-#  return cp
-
 def handle_action_dollar(text): #(rule, text, dollar_loc):
-  #type_name = None
   cp = text[1:]
-  #effective_rule = None
-  #effective_rule_length = None
-  #n = None
-  #if rule->midrule_parent_rule:
-  #  effective_rule = rule->midrule_parent_rule
-  #  effective_rule_length = rule->midrule_parent_rhs_index - 1
-  #else:
-  #  effective_rule = rule
-  #  effective_rule_length = symbol_list_length(rule->next)
-  #cp = fetch_type_name(cp, &type_name, dollar_loc)
   n = parse_ref(cp) #, effective_rule, effective_rule_length, rule->midrule_parent_rhs_index, text, dollar_loc, ord('$'))
   if n == 0x80000001:
     i = len(yytext) - 1
@@ -506,105 +167,9 @@ def handle_action_dollar(text): #(rule, text, dollar_loc):
     code_piece_append('<AST_Text_StackReference tag_name="{0:s}" index="{1:d}">'.format(yytext[2:i], n))
     code_piece_flush(len(yytext))
     code_piece_append('</AST_Text_StackReference>')
-  #if no_handle_action:
-  #  return True
-  #if type_name:
-  #  cp[-1] = ord('\0')
-  #if n == 0x80000000:
-  #  break
-  #elif n == 0x80000001:
-  #  if not type_name:
-  #    type_name = symbol_list_n_type_name_get(rule, 0)
-  #  if not type_name:
-  #    if union_seen | tag_seen:
-  #      if rule->midrule_parent_rule:
-  #        complain(&dollar_loc, complaint, gettext('$$ for the midrule at $%d of %s' ' has no declared type'), rule->midrule_parent_rhs_index, quote(effective_rule->content.sym->tag))
-  #      else:
-  #        complain(&dollar_loc, complaint, gettext('$$ of %s has no declared type'), quote(rule->content.sym->tag))
-  #    else:
-  #      untyped_var_seen = True
-  #  (&obstack_for_string)->temp.i = len(']b4_lhs_value('), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']b4_lhs_value(', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  obstack_quote_p = type_name
-  #  if obstack_quote_p and obstack_quote_p[0]:
-  #    (&obstack_for_string)->temp.i = len('[['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #    p__ = None
-  #    p__ = obstack_quote_p
-  #    while *p__:
-  #      if *p__ == ord('$'):
-  #        (&obstack_for_string)->temp.i = len('$]['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '$][', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord('@'):
-  #        (&obstack_for_string)->temp.i = len('@@'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@@', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord('['):
-  #        (&obstack_for_string)->temp.i = len('@{'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@{', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord(']'):
-  #        (&obstack_for_string)->temp.i = len('@}'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@}', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      else:
-  #        (_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = *p__)
-  #        break
-  #      p__ += 1
-  #    (&obstack_for_string)->temp.i = len(']]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  else:
-  #    (&obstack_for_string)->temp.i = len('[]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  (&obstack_for_string)->temp.i = len(')['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ')[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  rule->action_props.is_value_used = True
-  #  break
-  #else:
-  #  if max_left_semantic_context < 1 - n:
-  #    max_left_semantic_context = 1 - n
-  #  if not type_name and 0 < n:
-  #    type_name = symbol_list_n_type_name_get(effective_rule, n)
-  #  if not type_name:
-  #    if union_seen | tag_seen:
-  #      complain(&dollar_loc, complaint, gettext('$%s of %s has no declared type'), cp, quote(effective_rule->content.sym->tag))
-  #    else:
-  #      untyped_var_seen = True
-  #  obstack_printf(&obstack_for_string, ']b4_rhs_value(%d, %d, ', effective_rule_length, n)
-  #  obstack_quote_p = type_name
-  #  if obstack_quote_p and obstack_quote_p[0]:
-  #    (&obstack_for_string)->temp.i = len('[['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #    p__ = None
-  #    p__ = obstack_quote_p
-  #    while *p__:
-  #      if *p__ == ord('$'):
-  #        (&obstack_for_string)->temp.i = len('$]['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '$][', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord('@'):
-  #        (&obstack_for_string)->temp.i = len('@@'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@@', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord('['):
-  #        (&obstack_for_string)->temp.i = len('@{'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@{', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      elif *p__ == ord(']'):
-  #        (&obstack_for_string)->temp.i = len('@}'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '@}', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #        break
-  #      else:
-  #        (_obstack_newchunk(&obstack_for_string, 1), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < 1 else 0, NoneType(*(&obstack_for_string)->next_free++ = *p__)
-  #        break
-  #      p__ += 1
-  #    (&obstack_for_string)->temp.i = len(']]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  else:
-  #    (&obstack_for_string)->temp.i = len('[]'), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, '[]', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  (&obstack_for_string)->temp.i = len(')['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ')[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  if 0 < n:
-  #    symbol_list_n_get(effective_rule, n)->action_props.is_value_used = True
-  #  break
 
 def handle_action_at(text): #(rule, text, at_loc):
   cp = text[1:]
-  #effective_rule = None
-  #effective_rule_length = None
-  #n = None
-  #if rule->midrule_parent_rule:
-  #  effective_rule = rule->midrule_parent_rule
-  #  effective_rule_length = rule->midrule_parent_rhs_index - 1
-  #else:
-  #  effective_rule = rule
-  #  effective_rule_length = symbol_list_length(rule->next)
-  #muscle_percent_define_ensure('locations', at_loc, True)
   n = parse_ref(cp) #, effective_rule, effective_rule_length, rule->midrule_parent_rhs_index, text, at_loc, ord('@'))
   if n == 0x80000001:
     code_piece_append('<AST_Text_ValueLocation>')
@@ -614,75 +179,6 @@ def handle_action_at(text): #(rule, text, at_loc):
     code_piece_append('<AST_Text_StackLocation index="{0:d}">'.format(n))
     code_piece_flush(len(yytext))
     code_piece_append('</AST_Text_StackLocation>')
-  #if no_handle_action:
-  #  return True
-  #if n == 0x80000000:
-  #  break
-  #elif n == 0x80000001:
-  #  (&obstack_for_string)->temp.i = len(']b4_lhs_location['), (_obstack_newchunk(&obstack_for_string, (&obstack_for_string)->temp.i), 0) if int((&obstack_for_string)->chunk_limit - (&obstack_for_string)->next_free) < (&obstack_for_string)->temp.i else 0, memcpy((&obstack_for_string)->next_free, ']b4_lhs_location[', (&obstack_for_string)->temp.i), (&obstack_for_string)->next_free += (&obstack_for_string)->temp.i, NoneType(0)
-  #  break
-  #else:
-  #  obstack_printf(&obstack_for_string, ']b4_rhs_location(%d, %d)[', effective_rule_length, n)
-  #  break
-
-#def translate_action(self, sc_context):
-#  res = None
-#  initialized = False
-#  if not initialized:
-#    _obstack_begin(&obstack_for_string, 0, 0, xmalloc, free)
-#    yy_flex_debug = 0
-#    initialized = True
-#  loc->start = loc->end = self->locationXXX.start
-#  yy_switch_to_buffer(yy_scan_string(self->code))
-#  res = code_lex(self, sc_context)
-#  yy_delete_buffer(YY_CURRENT_BUFFER)
-#  return res
-#
-#def code_props_none_init(self):
-#  *self = code_props_none
-#code_props_none = [CODE_PROPS_NONE, None, [[None, 0, 0], [None, 0, 0]], False, False, False, None, None]
-#
-#def code_props_plain_init(self, code, code_loc):
-#  code_props_none_init(self)
-#  self->kind = CODE_PROPS_PLAIN
-#  self->code = code
-#  self->locationXXX = code_loc
-#
-#def code_props_symbol_action_init(self, code, code_loc):
-#  code_props_none_init(self)
-#  self->kind = CODE_PROPS_SYMBOL_ACTION
-#  self->code = code
-#  self->locationXXX = code_loc
-#
-#def code_props_rule_action_init(self, code, code_loc, rule, name, is_predicate):
-#  code_props_none_init(self)
-#  self->kind = CODE_PROPS_RULE_ACTION
-#  self->code = code
-#  self->locationXXX = code_loc
-#  self->rule = rule
-#  self->named_refXXX = name
-#  self->is_predicate = is_predicate
-#
-#def code_props_translate_code(self):
-#  if self->kind == CODE_PROPS_NONE:
-#    break
-#  elif self->kind == CODE_PROPS_PLAIN:
-#    self->code = translate_action(self, INITIAL)
-#    break
-#  elif self->kind == CODE_PROPS_SYMBOL_ACTION:
-#    self->code = translate_action(self, SC_SYMBOL_ACTION)
-#    break
-#  elif self->kind == CODE_PROPS_RULE_ACTION:
-#    self->code = translate_action(self, SC_RULE_ACTION)
-#    break
-#
-#def code_scanner_last_string_free():
-#  (&obstack_for_string)->temp.p = list(code_last_string), NoneType((&obstack_for_string)->next_free = (&obstack_for_string)->object_base = str((&obstack_for_string)->temp.p)) if (&obstack_for_string)->temp.p > list((&obstack_for_string)->chunk) and (&obstack_for_string)->temp.p < list((&obstack_for_string)->chunk_limit) else _obstack_free(&obstack_for_string, (&obstack_for_string)->temp.p)
-#
-#def code_scanner_free():
-#  (&obstack_for_string)->temp.p = list(0), NoneType((&obstack_for_string)->next_free = (&obstack_for_string)->object_base = str((&obstack_for_string)->temp.p)) if (&obstack_for_string)->temp.p > list((&obstack_for_string)->chunk) and (&obstack_for_string)->temp.p < list((&obstack_for_string)->chunk_limit) else _obstack_free(&obstack_for_string, (&obstack_for_string)->temp.p)
-#  variant_table_free()
-#  yy_delete_buffer(YY_CURRENT_BUFFER)
 
 def code_piece_append(str):
   code_piece.append(str)
index 84aee8a..5f1ba6b 100644 (file)
@@ -891,6 +891,7 @@ eqopt    ([[:space:]]*=)?
       gram_last_string = ''.join(obstack_for_string)
       del obstack_for_string[:] # not strictly correct
       y_tab.yylloc.start = code_start
+      y_tab.yylval = gram_last_string
       #del obstack_for_string[:]
       BEGIN(INITIAL)
       gram_piece_append('</AST_Text>')