Minor reorganization and documentation of a section.

This commit is contained in:
Sei Lisa 2017-10-25 18:04:27 +02:00
parent d5f5ab8b88
commit 2580248c17

View file

@ -1207,23 +1207,28 @@ class foldconst(object):
if nt == '||':
parent[index] = node = {'nt':'!', 't':'integer', 'ch':[
{'nt':'!', 't':'integer', 'ch':[
{'nt':'|', 't':'integer', 'ch':[child[0], child[1]]}
{'nt':'|', 't':'integer', 'ch':[child[0], child[1]]}
]}]}
if SEF:
node['SEF'] = node['ch'][0]['SEF'] = node['ch'][0]['ch'][0]['SEF'] = True
# propagate SEF to the two ! and the OR
node['SEF'] = node['ch'][0]['SEF'] = True
node['ch'][0]['ch'][0]['SEF'] = True
else:
parent[index] = node = {'nt':'!', 't':'integer', 'ch':[
{'nt':'|', 't':'integer', 'ch':[
orchildren = [
{'nt':'!', 't':'integer', 'ch':[child[0]]}
,
{'nt':'!', 't':'integer', 'ch':[child[1]]}
]}]}
]
parent[index] = node = {'nt':'!', 't':'integer', 'ch':[
{'nt':'|', 't':'integer', 'ch':orchildren}]}
if SEF:
# propagate SEF to the the OR and parent !
node['SEF'] = node['ch'][0]['SEF'] = True
if 'SEF' in node['ch'][0]['ch'][0]['ch'][0]:
node['ch'][0]['ch'][0]['SEF'] = True
if 'SEF' in node['ch'][0]['ch'][1]['ch'][0]:
node['ch'][0]['ch'][1]['SEF'] = True
# propagate SEF to the ! that are children of the OR
if 'SEF' in orchildren[0]['ch'][0]:
orchildren[0]['SEF'] = True
if 'SEF' in orchildren[1]['ch'][0]:
orchildren[1]['SEF'] = True
# Make another pass with the substitution
self.FoldTree(parent, index)
return