Update to pitree.git commit 350e5a9 (first cut)
authorNick Downing <nick@ndcode.org>
Tue, 29 Jan 2019 04:22:05 +0000 (15:22 +1100)
committerNick Downing <nick@ndcode.org>
Tue, 29 Jan 2019 04:39:31 +0000 (15:39 +1100)
generate_py.py
pilex.t
regex.t
scan.l
skel/skel_py_element.py
skel_lex_yy.py

index 6623f85..0ad3707 100644 (file)
@@ -105,7 +105,7 @@ yy_action = yy_action{1:d}
     group_actions_text.extend(
       [
         (
-          groups[j][0]
+          groups[j].children[0]
         if isinstance(groups[j], regex.RegexGroupAction) else
           regex.Text(
             text = '''yy_groups[{0:d}] = yy_group_text[yy_group_stack[-1]:yy_group_stack[-2]]
@@ -121,7 +121,7 @@ yy_element_stack[-1].append(
 del yy_group_stack[-2:]
 '''.format(
               j + 1,
-              groups[j][0].get_text()
+              groups[j].children[0].get_text()
             )
           )
         if isinstance(groups[j], regex.RegexGroupElement) else
@@ -132,7 +132,7 @@ yy_groups_by_name['{1:s}'] = yy_temp
 del yy_group_stack[-2:]
 '''.format(
               j + 1,
-              groups[j][0].get_text()
+              groups[j].children[0].get_text()
             )
           )
         if isinstance(groups[j], regex.RegexGroupName) else
@@ -176,9 +176,9 @@ yy_action = yy_action{0:d}
     )
   if out_file is None:
     out_file = (
-      _ast[0].outfile
-    if len(_ast[0].outfile) else
-      'lex_{0:s}.py'.format(_ast[0].prefix)
+      _ast.children[0].outfile
+    if len(_ast.children[0].outfile) else
+      'lex_{0:s}.py'.format(_ast.children[0].prefix)
     )
   with open(skel_file, 'r') as fin:
     with open(out_file, 'w+') as fout:
@@ -192,7 +192,7 @@ yy_action = yy_action{0:d}
               ''.join(
                 [
                   ast_text_to_python(i, '')
-                  for i in _ast[0].code_blocks_text
+                  for i in _ast.children[0].code_blocks_text
                 ]
               )
             )
@@ -292,7 +292,7 @@ yy_action = yy_action{0:d}
               ''.join(
                 [
                   ast_text_to_python(i, '  ')
-                  for i in _ast[1].code_blocks_text
+                  for i in _ast.children[1].code_blocks_text
                 ]
               )
             )
@@ -302,11 +302,11 @@ yy_action = yy_action{0:d}
             '''# GENERATE SECTION3 BEGIN
 {0:s}# GENERATE END
 '''.format(
-              '' if len(_ast) < 3 else ast_text_to_python(_ast[2], '')
+              '' if len(_ast.children) < 3 else ast_text_to_python(_ast.children[2], '')
             )
           )
         else:
-          #if _ast[0].prefix != 'yy':
-          #  line = line.replace('yywrap', '{0:s}wrap'.format(_ast[0].prefix))
+          #if _ast.children[0].prefix != 'yy':
+          #  line = line.replace('yywrap', '{0:s}wrap'.format(_ast.children[0].prefix))
           fout.write(line)
         line = fin.readline()
diff --git a/pilex.t b/pilex.t
index b723c63..cbfe7b8 100644 (file)
--- a/pilex.t
+++ b/pilex.t
@@ -245,7 +245,7 @@ def post_process(
   parent_start_conditions,
   continued_action
 ):
-  section.code_blocks_text.append(self[0])
+  section.code_blocks_text.append(self.children[0])
   return continued_action
 @method(AST.Section1Or2)
 def post_process(
@@ -257,7 +257,7 @@ def post_process(
 ):
   parent_start_conditions = set()
   continued_action = False
-  for i in self:
+  for i in self.children:
     continued_action = i.post_process(
       _ast,
       self,
@@ -306,7 +306,7 @@ def post_process(self, section):
   section.ecs = self.value
 @method(AST.Section1.Options.ExtraType)
 def post_process(self, section):
-  section.extra_type = self[0][0].get_text()
+  section.extra_type = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.Fast)
 def post_process(self, section):
   section.fast = self.value
@@ -315,7 +315,7 @@ def post_process(self, section):
   section.full = self.value
 @method(AST.Section1.Options.HeaderFile)
 def post_process(self, section):
-  section.header_file = self[0][0].get_text()
+  section.header_file = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.Input)
 def post_process(self, section):
   section.input = self.value
@@ -339,7 +339,7 @@ def post_process(self, section):
   section.never_interactive = self.value
 @method(AST.Section1.Options.OutFile)
 def post_process(self, section):
-  section.outfile = self[0][0].get_text()
+  section.outfile = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.PerfReport)
 def post_process(self, section):
   section.perf_report = self.value
@@ -348,7 +348,7 @@ def post_process(self, section):
   section.posix_compat = self.value
 @method(AST.Section1.Options.Prefix)
 def post_process(self, section):
-  section.prefix = self[0][0].get_text()
+  section.prefix = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.Read)
 def post_process(self, section):
   section.read = self.value
@@ -372,7 +372,7 @@ def post_process(self, section):
   section.stdout = self.value
 @method(AST.Section1.Options.TablesFile)
 def post_process(self, section):
-  section.tables_file = self[0][0].get_text()
+  section.tables_file = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.TablesVerify)
 def post_process(self, section):
   section.tables_verify = self.value
@@ -393,7 +393,7 @@ def post_process(self, section):
   section.yyalloc = self.value
 @method(AST.Section1.Options.YYClass)
 def post_process(self, section):
-  section.yyclass = self[0][0].get_text()
+  section.yyclass = self.children[0].children[0].get_text()
 @method(AST.Section1.Options.YYFree)
 def post_process(self, section):
   section.yyfree = self.value
@@ -486,7 +486,7 @@ def post_process(
   parent_start_conditions,
   continued_action
 ):
-  for i in self:
+  for i in self.children:
     i.post_process(section)
   return continued_action
 @method(AST.Section1.StartConditions)
@@ -500,7 +500,7 @@ def post_process(
   parent_start_conditions,
   continued_action
 ):
-  for i in self:
+  for i in self.children:
     name = i.get_text()
     assert name not in name_to_start_condition
     name_to_start_condition[name] = len(_ast.start_conditions)
@@ -748,15 +748,15 @@ def post_process(
   continued_action
 ):
   assert not continued_action
-  if self[0].wildcard:
+  if self.children[0].wildcard:
     start_conditions = all_start_conditions
   else:
     start_conditions = set(parent_start_conditions)
-    for i in self[0]:
+    for i in self.children[0].children:
       start_conditions.add(
         name_to_start_condition[i.get_text()]
       )
-  for i in self[1:]:
+  for i in self.children[1:]:
     continued_action = i.post_process(
       _ast,
       section,
@@ -795,7 +795,7 @@ def post_process(
         len(_ast.eof_actions_text)
       )
   assert not action.continued
-  _ast.eof_actions_text.append(action[0])
+  _ast.eof_actions_text.append(action.children[0])
   return False # continued_action
 @method(AST.Section2.Rule.FLexRule)
 def post_process(
@@ -819,20 +819,20 @@ def post_process(
       _ast.start_conditions[i].rules.append(self)
     _ast.start_conditions[i].bol_rules.append(self)
   self.groups0 = []
-  self[0].post_process(
+  self.children[0].post_process(
     self.groups0,
-    caseless = _ast[0].caseless
+    caseless = _ast.children[0].caseless
   ) # regex
   self.groups1 = []
-  self[1].post_process(
+  self.children[1].post_process(
     self.groups1,
-    caseless = _ast[0].caseless
+    caseless = _ast.children[0].caseless
   ) # trailing context regex
   self.action = len(_ast.actions_text)
   if action.continued:
     continued_action = True
   else:
-    _ast.actions_text.append(action[0])
+    _ast.actions_text.append(action.children[0])
     continued_action = False
     #def to_text(node):
     #  return ''.join(
@@ -843,7 +843,7 @@ def post_process(
     #    ] +
     #    [element.get_text(node, len(node))]
     #  )
-    #text = '{0:s}/{1:s}'.format(to_text(self[0]), to_text(self[1]))
+    #text = '{0:s}/{1:s}'.format(to_text(self.children[0]), to_text(self.children[1]))
     #element.set_text(
     #  _ast.actions_text[-1],
     #  0,
@@ -867,15 +867,15 @@ def post_process(
   parent_start_conditions,
   continued_action
 ):
-  if self[0].wildcard:
+  if self.children[0].wildcard:
     start_conditions = all_start_conditions
   else:
     start_conditions = set(parent_start_conditions)
-    for i in self[0]:
+    for i in self.children[0].children:
       start_conditions.add(
         name_to_start_condition[i.get_text()]
       )
-  return self[1].post_process(
+  return self.children[1].post_process(
     _ast,
     section,
     name_to_start_condition,
@@ -884,7 +884,7 @@ def post_process(
     parent_start_conditions,
     continued_action,
     start_conditions,
-    self[2] # action
+    self.children[2] # action
   )
 @method(AST)
 def post_process(self):
@@ -909,13 +909,13 @@ def post_process(self):
   all_start_conditions = set([0])
   inclusive_start_conditions = set([0])
   # perform the semantic analysis pass
-  self[0].post_process(
+  self.children[0].post_process(
     self,
     name_to_start_condition,
     all_start_conditions,
     inclusive_start_conditions
   )
-  self[1].post_process(
+  self.children[1].post_process(
     self,
     name_to_start_condition,
     all_start_conditions,
@@ -926,7 +926,7 @@ def post_process(self):
     AST.Text(
       text = (
         'ECHO;\n'
-      if self[0].default else
+      if self.children[0].default else
         'YY_FATAL_ERROR( "flex scanner jammed" );\n'
       )
     )
@@ -949,17 +949,17 @@ def to_nfa(self, group_ref_data):
       regex_group_ref_data = []
       for k in j:
         ng = _regex.n_groups
-        ng0 = k[0].n_groups
-        ng1 = k[1].n_groups
+        ng0 = k.children[0].n_groups
+        ng1 = k.children[1].n_groups
         _regex = regex.RegexOr(
           children = [
             _regex,
             regex.RegexSequence(
               children = [
-                k[0],
+                k.children[0],
                 regex.RegexGroup(
                   children = [
-                    k[1]
+                    k.children[1]
                   ],
                   n_groups = 1 + ng1
                 )
diff --git a/regex.t b/regex.t
index 542e63e..06a4244 100644 (file)
--- a/regex.t
+++ b/regex.t
@@ -69,7 +69,7 @@ def factory(tag, *args, **kwargs):
 @method(Regex)
 def post_process(self, groups, caseless = False):
   self.n_groups = 0
-  for i in self:
+  for i in self.children:
     i.post_process(groups, caseless)
     self.n_groups += i.n_groups
 @method(RegexCharacter)
@@ -101,7 +101,7 @@ def post_process(self, groups, caseless = False):
 @method(RegexCharacterRange)
 def post_process(self, groups, caseless = False):
   RegexCharacter.post_process(self, groups, False)
-  self.character_set = [self[0].character_set[0], self[1].character_set[-1]]
+  self.character_set = [self.children[0].character_set[0], self.children[1].character_set[-1]]
   if caseless:
     temp = bisect_set.bisect_set_and(
       self.character_set,
@@ -116,40 +116,40 @@ def post_process(self, groups, caseless = False):
 def post_process(self, groups, caseless = False):
   RegexCharacter.post_process(self, groups, caseless)
   self.character_set = bisect_set.bisect_set_or(
-    self[0].character_set,
-    self[1].character_set
+    self.children[0].character_set,
+    self.children[1].character_set
   )
 @method(RegexCharacterAnd)
 def post_process(self, groups, caseless = False):
   RegexCharacter.post_process(self, groups, caseless)
   self.character_set = bisect_set.bisect_set_and(
-    self[0].character_set,
-    self[1].character_set
+    self.children[0].character_set,
+    self.children[1].character_set
   )
 @method(RegexCharacterNot)
 def post_process(self, groups, caseless = False):
   RegexCharacter.post_process(self, groups, caseless)
-  self.character_set = bisect_set.bisect_set_not(self[0].character_set)
+  self.character_set = bisect_set.bisect_set_not(self.children[0].character_set)
 @method(RegexRepeat)
 def post_process(self, groups, caseless = False):
   # total hack which will be done in a Python action in future
-  if len(self) >= 2:
-    assert self[1].tag == 'Number'
-    self.count0 = int(self[1].text)
-    if len(self) >= 3:
-      assert self[2].tag == 'Number'
-      self.count1 = int(self[2].text)
+  if len(self.children) >= 2:
+    assert self.children[1].tag == 'Number'
+    self.count0 = int(self.children[1].text)
+    if len(self.children) >= 3:
+      assert self.children[2].tag == 'Number'
+      self.count1 = int(self.children[2].text)
     else:
       self.count1 = self.count0
-    del self[1:]
+    del self.children[1:]
   # end total hack
   Regex.post_process(self, groups, caseless)
 @method(RegexGroup)
 def post_process(self, groups, caseless = False):
-  # we use -1 here because named or action groups use self[0] for text
+  # we use -1 here because named or action groups use self.children[0] for text
   groups.append(self)
-  self[-1].post_process(groups, caseless)
-  self.n_groups = self[-1].n_groups + 1
+  self.children[-1].post_process(groups, caseless)
+  self.n_groups = self.children[-1].n_groups + 1
 del post_process
 
 @method(Regex)
@@ -170,16 +170,16 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   return new_state
 @method(RegexOr)
 def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
-  child0_state = self[0].to_nfa_state(
+  child0_state = self.children[0].to_nfa_state(
     _nfa,
     group_ref_data,
     group_index,
     next_state
   )
-  child1_state = self[1].to_nfa_state(
+  child1_state = self.children[1].to_nfa_state(
     _nfa,
     group_ref_data,
-    group_index + self[0].n_groups,
+    group_index + self.children[0].n_groups,
     next_state
   )
   if child0_state == -1:
@@ -195,7 +195,7 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   _nfa.states.append(nfa.NFA.join0_state) # no arguments so use static one
   join1_state = len(_nfa.states)
   _nfa.states.append((nfa.NFA.STATE_JOIN1, next_state))
-  child0_state = self[0].to_nfa_state(
+  child0_state = self.children[0].to_nfa_state(
     _nfa,
     group_ref_data,
     group_index,
@@ -203,10 +203,10 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   )
   if child0_state == -1:
     return -1
-  child1_state = self[1].to_nfa_state(
+  child1_state = self.children[1].to_nfa_state(
     _nfa,
     group_ref_data,
-    group_index + self[0].n_groups,
+    group_index + self.children[0].n_groups,
     join1_state
   )
   if child1_state == -1:
@@ -216,15 +216,15 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   return new_state
 @method(RegexSequence)
 def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
-  next_state = self[1].to_nfa_state(
+  next_state = self.children[1].to_nfa_state(
     _nfa,
     group_ref_data,
-    group_index + self[0].n_groups,
+    group_index + self.children[0].n_groups,
     next_state
   )
   if next_state == -1:
     return -1
-  return self[0].to_nfa_state(
+  return self.children[0].to_nfa_state(
     _nfa,
     group_ref_data,
     group_index,
@@ -237,7 +237,7 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   if count1 == -1:
     new_state = len(_nfa.states)
     _nfa.states.append(None)
-    child_state = self[0].to_nfa_state(
+    child_state = self.children[0].to_nfa_state(
       _nfa,
       group_ref_data,
       group_index,
@@ -253,7 +253,7 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
   else:
     done_state = next_state
     for i in range(count1 - count0):
-      child_state = self[0].to_nfa_state(
+      child_state = self.children[0].to_nfa_state(
         _nfa,
         group_ref_data,
         group_index,
@@ -269,7 +269,7 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
       )
       next_state = new_state
   for i in range(count0):
-    next_state = self[0].to_nfa_state(
+    next_state = self.children[0].to_nfa_state(
       _nfa,
       group_ref_data,
       group_index,
@@ -285,7 +285,7 @@ def to_nfa_state(self, _nfa, group_ref_data, group_index, next_state):
     (nfa.NFA.STATE_MARK, group_ref_data[group_index][1], next_state)
   )
   next_state = new_state
-  next_state = self[-1].to_nfa_state(
+  next_state = self.children[-1].to_nfa_state(
     _nfa,
     group_ref_data,
     group_index + 1,
diff --git a/scan.l b/scan.l
index 06c0cc8..f8c1d59 100644 (file)
--- a/scan.l
+++ b/scan.l
@@ -315,20 +315,20 @@ M4QEND      "]""]"
   (?E{t_def.AST.Section1.Options.SevenBit}("no"*)7bit) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #csize = 128 if option_sense else 256
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.SevenBit}("no"*)8bit) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #csize = 256 if option_sense else 128
-    yy_element_token[0].value = not option_sense
+    yy_element_token.children[0].value = not option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
   (?E{t_def.AST.Section1.Options.Align}("no"*)align) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #long_align = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.AlwaysInteractive}("no"*)always-interactive) {
@@ -338,44 +338,44 @@ M4QEND      "]""]"
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_ALWAYS_INTERACTIVE')
     #interactive = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Array}("no"*)array) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #yytext_is_array = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Backup}("no"*)backup) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #backing_up_report = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Interactive}("no"*)batch) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #interactive = not option_sense
-    yy_element_token[0].value = not option_sense
+    yy_element_token.children[0].value = not option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.BisonBridge}("no"*)bison-bridge) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #bison_bridge_lval = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.BisonLocations}("no"*)bison-locations) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #if bison_bridge_lloc = option_sense:
     #  bison_bridge_lval = True
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.CPlusPlus}("no"*)"c++") {
     option_sense = (len(yy_groups[1]) & 2) == 0
     #C_plus_plus = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Caseless}("no"*)caseful|case-sensitive) {
@@ -384,7 +384,7 @@ M4QEND      "]""]"
       state._sf_stk[-1] |= 1
     else:
       state._sf_stk[-1] &= ~1
-    yy_element_token[0].value = not option_sense
+    yy_element_token.children[0].value = not option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Caseless}("no"*)caseless|case-insensitive) {
@@ -393,70 +393,70 @@ M4QEND      "]""]"
       state._sf_stk[-1] |= 1
     else:
       state._sf_stk[-1] &= ~1
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Debug}("no"*)debug) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #ddebug = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Default}("no"*)default) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #spprdflt = not option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.ECS}("no"*)ecs) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #useecs = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Fast}("no"*)fast) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #useecs = usemecs = False
     #use_read = fullspd = True
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Full}("no"*)full) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #useecs = usemecs = False
     #use_read = fulltbl = True
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Input}("no"*)input) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #if not option_sense:
     #  action_define('YY_NO_INPUT', 1)
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Interactive}("no"*)interactive) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #interactive = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.LexCompat}("no"*)lex-compat) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     state.lex_compat = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.PosixCompat}("no"*)posix-compat) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     state.posix_compat = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Line}("no"*)line) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #gen_line_dirs = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Main}("no"*)main) {
@@ -467,13 +467,13 @@ M4QEND      "]""]"
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_MAIN')
     #if option_sense:
     #  do_yywrap = False
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.MetaECS}("no"*)meta-ecs) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #usemecs = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.NeverInteractive}("no"*)never-interactive) {
@@ -483,37 +483,37 @@ M4QEND      "]""]"
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NEVER_INTERACTIVE')
     #interactive = not option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.PerfReport}("no"*)perf-report) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #performance_report += 1 if option_sense else -1
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Array}("no"*)pointer) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #yytext_is_array = not option_sense
-    yy_element_token[0].value = not option_sense
+    yy_element_token.children[0].value = not option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Read}("no"*)read) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #use_read = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Reentrant}("no"*)reentrant) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #reentrant = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Reject}("no"*)reject) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #reject_really_used = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Stack}("no"*)stack) {
@@ -522,26 +522,26 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_STACK_USED', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_STACK_USED')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.StdInit}("no"*)stdinit) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #do_stdinit = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.StdOut}("no"*)stdout) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #use_stdout = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.UniStd}("no"*)unistd) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #if not option_sense:
     #  action_define('YY_NO_UNISTD_H', 1)
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Unput}("no"*)unput) {
@@ -550,19 +550,19 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_UNPUT', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_UNPUT')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Verbose}("no"*)verbose) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #printstats = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.Warn}("no"*)warn) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #nowarn = not option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYLineNo}("no"*)yylineno) {
@@ -572,19 +572,19 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_USE_LINENO', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_USE_LINENO')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYMore}("no"*)yymore) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #yymore_really_used = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYWrap}("no"*)yywrap) {
     option_sense = (len(yy_groups[2]) & 2) == 0
     #do_yywrap = option_sense
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -594,7 +594,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_PUSH_STATE', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_PUSH_STATE')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYPopState}("no"*)yy_pop_state) {
@@ -603,7 +603,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_POP_STATE', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_POP_STATE')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYTopState}("no"*)yy_top_state) {
@@ -612,7 +612,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_TOP_STATE', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_TOP_STATE')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -622,7 +622,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SCAN_BUFFER', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SCAN_BUFFER')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYScanBytes}("no"*)yy_scan_bytes) {
@@ -631,7 +631,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SCAN_BYTES', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SCAN_BYTES')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYScanString}("no"*)yy_scan_string) {
@@ -640,7 +640,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SCAN_STRING', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SCAN_STRING')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -650,7 +650,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_FLEX_ALLOC', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_FLEX_ALLOC')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYRealloc}("no"*)yyrealloc) {
@@ -659,7 +659,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_FLEX_REALLOC', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_FLEX_REALLOC')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYFree}("no"*)yyfree) {
@@ -668,7 +668,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_FLEX_FREE', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_FLEX_FREE')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -678,7 +678,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_DEBUG', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_DEBUG')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetDebug}("no"*)yyset_debug) {
@@ -687,7 +687,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_DEBUG', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_DEBUG')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetExtra}("no"*)yyget_extra) {
@@ -696,7 +696,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_EXTRA', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_EXTRA')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetExtra}("no"*)yyset_extra) {
@@ -705,7 +705,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_EXTRA', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_EXTRA')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetLeng}("no"*)yyget_leng) {
@@ -714,7 +714,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_LENG', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_LENG')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetText}("no"*)yyget_text) {
@@ -723,7 +723,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_TEXT', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_TEXT')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetLineNo}("no"*)yyget_lineno) {
@@ -732,7 +732,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_LINENO', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_LINENO')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetLineNo}("no"*)yyset_lineno) {
@@ -741,7 +741,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_LINENO', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_LINENO')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetIn}("no"*)yyget_in) {
@@ -750,7 +750,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_IN', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_IN')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetIn}("no"*)yyset_in) {
@@ -759,7 +759,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_IN', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_IN')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetOut}("no"*)yyget_out) {
@@ -768,7 +768,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_OUT', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_OUT')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetOut}("no"*)yyset_out) {
@@ -777,7 +777,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_OUT', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_OUT')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetLVal}("no"*)yyget_lval) {
@@ -786,7 +786,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_LVAL', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_LVAL')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetLVal}("no"*)yyset_lval) {
@@ -795,7 +795,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_LVAL', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_LVAL')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYGetLLoc}("no"*)yyget_lloc) {
@@ -804,7 +804,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_GET_LLOC', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_GET_LLOC')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
   (?E{t_def.AST.Section1.Options.YYSetLLoc}("no"*)yyset_lloc) {
@@ -813,7 +813,7 @@ M4QEND      "]""]"
     #  buf_m4_define(&m4defs_buf, 'M4' '_YY_NO_SET_LLOC', None)
     #else:
     #  buf_m4_undefine(&m4defs_buf, 'M4' '_YY_NO_SET_LLOC')
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -828,7 +828,7 @@ M4QEND      "]""]"
     #tablesverify = option_sense
     #if not tablesext and option_sense:
     #  tablesext = True
-    yy_element_token[0].value = option_sense
+    yy_element_token.children[0].value = option_sense
     return y_tab.TOK_OPTION_OTHER # Nick
   }
 
@@ -1601,29 +1601,29 @@ M4QEND      "]""]"
 # try to use more complex regular expressions to match all in one go:
 
 def markup_flush(n):
-  assert len(yy_element_space.text) == len(yy_element_space) + 1
-  assert len(yy_element_token.text) == len(yy_element_token) + 1
+  assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+  assert len(yy_element_token.text) == len(yy_element_token.children) + 1
   yy_element_space.text[-1] += yy_element_token.text[0][:n]
   yy_element_token.text[0] = yy_element_token.text[0][n:]
 
 def markup_yyless(n):
-  assert len(yy_element_space.text) == len(yy_element_space) + 1
-  assert len(yy_element_token.text) == len(yy_element_token) + 1
+  assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+  assert len(yy_element_token.text) == len(yy_element_token.children) + 1
   yyless(n)
   yy_element_token.text[0] = yy_element_token.text[0][:n]
 
 def markup_push(factory, *args, **kwargs):
   global yy_element_space
-  assert len(yy_element_space.text) == len(yy_element_space) + 1
-  assert len(yy_element_token.text) == len(yy_element_token) + 1
+  assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+  assert len(yy_element_token.text) == len(yy_element_token.children) + 1
   markup_stack.append(yy_element_space)
   yy_element_space = factory(*args, **kwargs)
 
 def markup_pop():
   global yy_element_space
-  assert len(yy_element_space.text) == len(yy_element_space) + 1
-  assert len(yy_element_token.text) == len(yy_element_token) + 1
+  assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+  assert len(yy_element_token.text) == len(yy_element_token.children) + 1
   _element = yy_element_space
   yy_element_space = markup_stack.pop()
-  yy_element_space.append(_element)
+  yy_element_space.children.append(_element)
   yy_element_space.text.append('')
index 4ec8675..2c19629 100644 (file)
@@ -136,7 +136,7 @@ def yy_group_element(pos0, pos1, stack, factory, *args, **kwargs):
   del _element.text[:]
   for pos2, pos3, i in reversed(stack):
     _element.text.append(yy_group_text[pos0:pos2])
-    _element.append(i)
+    _element.children.append(i)
     pos0 = pos3
   _element.text.append(yy_group_text[pos0:pos1])
   return _element
@@ -343,14 +343,14 @@ def yylex(factory = element.Element, *args, **kwargs):
       raise Exception('scanner jammed')
 
     # append yy_element_token contents onto yy_element_space
-    assert len(yy_element_space.text) == len(yy_element_space) + 1
-    assert len(yy_element_token.text) == len(yy_element_token) + 1
+    assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+    assert len(yy_element_token.text) == len(yy_element_token.children) + 1
     yy_element_space.text[-1] += yy_element_token.text[0]
-    yy_element_space.extend(yy_element_token[:])
+    yy_element_space.children.extend(yy_element_token.children)
     yy_element_space.text.extend(yy_element_token.text[1:])
  
     # clear yy_element_token for next yytext or EOF action
     del yy_element_token.text[1:]
-    del yy_element_token[:]
+    del yy_element_token.children[:]
 
 # GENERATE SECTION3
index 4ec8675..2c19629 100644 (file)
@@ -136,7 +136,7 @@ def yy_group_element(pos0, pos1, stack, factory, *args, **kwargs):
   del _element.text[:]
   for pos2, pos3, i in reversed(stack):
     _element.text.append(yy_group_text[pos0:pos2])
-    _element.append(i)
+    _element.children.append(i)
     pos0 = pos3
   _element.text.append(yy_group_text[pos0:pos1])
   return _element
@@ -343,14 +343,14 @@ def yylex(factory = element.Element, *args, **kwargs):
       raise Exception('scanner jammed')
 
     # append yy_element_token contents onto yy_element_space
-    assert len(yy_element_space.text) == len(yy_element_space) + 1
-    assert len(yy_element_token.text) == len(yy_element_token) + 1
+    assert len(yy_element_space.text) == len(yy_element_space.children) + 1
+    assert len(yy_element_token.text) == len(yy_element_token.children) + 1
     yy_element_space.text[-1] += yy_element_token.text[0]
-    yy_element_space.extend(yy_element_token[:])
+    yy_element_space.children.extend(yy_element_token.children)
     yy_element_space.text.extend(yy_element_token.text[1:])
  
     # clear yy_element_token for next yytext or EOF action
     del yy_element_token.text[1:]
-    del yy_element_token[:]
+    del yy_element_token.children[:]
 
 # GENERATE SECTION3