grammar.py: Add support for --irrelevant-symbols

Arguments to --irrelevant-symbols are not meant to be represented in the
AST resulting from parsing.

Also, add pad() to misc.py.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-10-30 10:00:25 +01:00
commit 8c5934725c
4 changed files with 43 additions and 19 deletions

View file

@ -6,3 +6,12 @@ def silentremove(filename): #export
except OSError as e:
if e.errno != errno.ENOENT:
raise # re-raise exception if a different error occurred
def pad(token, total_size, right_align = False):
add = total_size - len(token)
if add <= 0:
return token
space = ' ' * add
if right_align:
return space + token
return token + space