aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authoreli.bendersky <devnull@localhost>2011-10-16 05:50:43 +0200
committereli.bendersky <devnull@localhost>2011-10-16 05:50:43 +0200
commit91c0aa3eab9781f4e3a5814f0154d51d25df4de8 (patch)
treec35163fff8c5a1a6103895c2371bbcaadd7550ab /examples
parent4afc9f28d90b3e437fcbf1c038f7a7544c8903aa (diff)
downloadplatform_external_python_pycparser-91c0aa3eab9781f4e3a5814f0154d51d25df4de8.tar.gz
platform_external_python_pycparser-91c0aa3eab9781f4e3a5814f0154d51d25df4de8.tar.bz2
platform_external_python_pycparser-91c0aa3eab9781f4e3a5814f0154d51d25df4de8.zip
* 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
Diffstat (limited to 'examples')
-rw-r--r--examples/c-to-c.py10
-rw-r--r--examples/tests/test_c-to-c.py1
2 files changed, 6 insertions, 5 deletions
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;
}''')