From 91c0aa3eab9781f4e3a5814f0154d51d25df4de8 Mon Sep 17 00:00:00 2001 From: "eli.bendersky" Date: Sun, 16 Oct 2011 05:50:43 +0200 Subject: * Added EmptyStatement node to represent an empty statement (sole ';'), with tests and c-to-c support * Added sys.path update in _build_tables.py to enable it to run correctly from the pycparser folder --- examples/c-to-c.py | 10 +++++----- examples/tests/test_c-to-c.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/c-to-c.py b/examples/c-to-c.py index 93de0aa..e0f6af0 100644 --- a/examples/c-to-c.py +++ b/examples/c-to-c.py @@ -173,6 +173,9 @@ class CGenerator(object): s += self._make_indent() + '}\n' return s + def visit_EmptyStatement(self, n): + return ';' + def visit_ParamList(self, n): return ', '.join(self.visit(param) for param in n.params) @@ -402,11 +405,8 @@ def zz_test_translate(): int main(void) { - int a; - int b = a++; - int c = ++a; - int d = a--; - int e = --a; + ; + return 0; } ''' parser = c_parser.CParser() diff --git a/examples/tests/test_c-to-c.py b/examples/tests/test_c-to-c.py index cba62f5..8015891 100644 --- a/examples/tests/test_c-to-c.py +++ b/examples/tests/test_c-to-c.py @@ -81,6 +81,7 @@ class TestCtoC(unittest.TestCase): int main() { int a; a = 5; + ; return a; }''') -- cgit v1.2.3