diff options
-rw-r--r-- | src/vhdl/Makefile | 9 | ||||
-rwxr-xr-x | src/vhdl/python/pnodespy.py | 19 | ||||
-rw-r--r-- | src/vhdl/tokens.ads | 4 |
3 files changed, 27 insertions, 5 deletions
diff --git a/src/vhdl/Makefile b/src/vhdl/Makefile index df65960a0..62428107d 100644 --- a/src/vhdl/Makefile +++ b/src/vhdl/Makefile @@ -27,7 +27,7 @@ DEPS=iirs.ads nodes.ads $(PNODES) GEN_FILES=iirs.adb nodes_meta.ads nodes_meta.adb \ python/libghdl/iirs.py python/libghdl/nodes_meta.py \ - python/libghdl/std_names.py + python/libghdl/std_names.py python/libghdl/tokens.py all: $(GEN_FILES) @@ -56,10 +56,15 @@ python/libghdl/nodes_meta.py: $(DEPS) $(PNODESPY) $(PNODESPY) libghdl-meta > $@ chmod -w $@ -python/libghdl/std_names.py: $(PNODESPY) +python/libghdl/std_names.py: $(PNODESPY) ../std_names.ads $(RM) $@ $(PNODESPY) libghdl-names > $@ chmod -w $@ +python/libghdl/tokens.py: $(PNODESPY) tokens.ads + $(RM) $@ + $(PNODESPY) libghdl-tokens > $@ + chmod -w $@ + clean: $(RM) -f $(GEN_FILES) 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() diff --git a/src/vhdl/tokens.ads b/src/vhdl/tokens.ads index ada8c899a..42def9f3d 100644 --- a/src/vhdl/tokens.ads +++ b/src/vhdl/tokens.ads @@ -276,7 +276,9 @@ package Tokens is Tok_Next_Event_E ); - -- subtype Token_Relation_Type is Token_Type range Tok_And .. Tok_Xnor; + -- To ease interfacing + pragma Convention (C, Token_Type); + subtype Token_Relational_Operator_Type is Token_Type range Tok_Equal .. Tok_Match_Greater_Equal; subtype Token_Shift_Operator_Type is Token_Type range |