offset = 0
for t, s, e in createtable.scanString(text):
    print('(***', t, ',', s, ',', e, '**)')
print('||\n', text[s:e], '\n||')
print('s: %d, e: %d' % (s, e))
text_list.insert(e + offset, ';')
offset += 1
print('******************************')
print(''.join(text_list))
Correct comment scanning with pyparsing