aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/python
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-10-06 20:53:15 +0200
committerTristan Gingold <tgingold@free.fr>2017-10-06 20:53:15 +0200
commite00401d23ea9e9e2866ae18889aa0956aaf9ec86 (patch)
tree1e6bb2f3355585ed5d706d1d387edba5dcb71778 /src/vhdl/python
parent09733cedabdaef6c1adba4473ce4abd863defa89 (diff)
downloadghdl-e00401d23ea9e9e2866ae18889aa0956aaf9ec86.tar.gz
ghdl-e00401d23ea9e9e2866ae18889aa0956aaf9ec86.tar.bz2
ghdl-e00401d23ea9e9e2866ae18889aa0956aaf9ec86.zip
python: generate tokens.py
Diffstat (limited to 'src/vhdl/python')
-rwxr-xr-xsrc/vhdl/python/pnodespy.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/vhdl/python/pnodespy.py b/src/vhdl/python/pnodespy.py
index ced4931f6..c7f23f73f 100755
--- a/src/vhdl/python/pnodespy.py
+++ b/src/vhdl/python/pnodespy.py
@@ -134,13 +134,28 @@ def do_libghdl_names():
res.append((name_def, val))
print 'class Name:'
for n, v in res:
- print ' {0} = {1}'.format(n, v)
+ print ' {0} = {1}'.format(n, v)
+
+
+def do_libghdl_tokens():
+ pat_token = re.compile(' Tok_(\w+),?\s*(--.*)?$')
+ lr = pnodes.linereader('tokens.ads')
+ toks = []
+ while True:
+ line = lr.get()
+ if line == ' );\n':
+ break
+ m = pat_token.match(line)
+ if m:
+ toks.append(m.group(1))
+ print_enum("Tok", toks)
pnodes.actions.update({'class-kinds': do_class_kinds,
'libghdl-iirs': do_libghdl_iirs,
'libghdl-meta': do_libghdl_meta,
- 'libghdl-names': do_libghdl_names})
+ 'libghdl-names': do_libghdl_names,
+ 'libghdl-tokens': do_libghdl_tokens})
pnodes.main()