diff --git a/ChangeLog b/ChangeLog index dfe8445..6d7e3d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018.10.29, Version 1.3.2 (Stable) + + * Replace / with _ in function name. + 2018.10.25, Version 1.3.1 (Stable) * Fixed exporting `Repeat` element to C. (issue #9) diff --git a/pyleri/__init__.py b/pyleri/__init__.py index 90a9b72..88afa25 100644 --- a/pyleri/__init__.py +++ b/pyleri/__init__.py @@ -41,4 +41,4 @@ __author__ = 'Jeroen van der Heijden' __maintainer__ = 'Jeroen van der Heijden' __email__ = 'jeroen@transceptor.technology' -__version__ = '1.3.1' +__version__ = '1.3.2' diff --git a/pyleri/grammar.py b/pyleri/grammar.py index fa88eab..e798274 100644 --- a/pyleri/grammar.py +++ b/pyleri/grammar.py @@ -233,7 +233,7 @@ class {name}(Grammar): #define CLERI_FIRST_MATCH 0 #define CLERI_MOST_GREEDY 1 -cleri_grammar_t * compile_{target}(void) +cleri_grammar_t * compile_{fun}(void) {{ {language} @@ -258,7 +258,7 @@ class {name}(Grammar): #include -cleri_grammar_t * compile_{target}(void); +cleri_grammar_t * compile_{fun}(void); enum cleri_grammar_ids {{ CLERI_NONE, // used for objects with no name @@ -489,10 +489,13 @@ def export_c(self, target=C_TARGET, c_indent=C_INDENTATION, headerf=None): header_file = '"{}.h"'.format(target) if headerf is None else headerf + fun = target.strip('/').replace('/', '_') + return (self.__class__.C_TEMPLATE_C.format( name=self.__class__.__name__, target=target, header_file=header_file, + fun=fun, indent=c_indent, datetime=time.strftime( '%Y-%m-%d %H:%M:%S', @@ -502,6 +505,7 @@ def export_c(self, target=C_TARGET, c_indent=C_INDENTATION, headerf=None): self.__class__.C_TEMPLATE_H.format( name=self.__class__.__name__, target=target, + fun=fun, guard=target.upper().replace('/', '_').replace('\\', '_'), datetime=time.strftime( '%Y-%m-%d %H:%M:%S',