diff python/ppci/c3/parser.py @ 362:c05ab629976a

Added CPUID for arm
author Windel Bouwman
date Sat, 15 Mar 2014 10:56:34 +0100
parents 5477e499b039
children 6ae782a085e0
line wrap: on
line diff
--- a/python/ppci/c3/parser.py	Fri Mar 14 16:18:54 2014 +0100
+++ b/python/ppci/c3/parser.py	Sat Mar 15 10:56:34 2014 +0100
@@ -80,7 +80,7 @@
 
     def parseTopLevel(self):
         if self.Peak == 'function':
-            self.parseFunctionDef()
+            self.parse_function_def()
         elif self.Peak == 'var':
             self.parseVarDef()
             # TODO handle variable initialization
@@ -188,7 +188,7 @@
                 break
         self.Consume(';')
 
-    def parseFunctionDef(self):
+    def parse_function_def(self):
         loc = self.Consume('function').loc
         returntype = self.parse_type_spec()
         fname = self.Consume('ID').val
@@ -211,7 +211,11 @@
             self.Consume(')')
         paramtypes = [p.typ for p in parameters]
         f.typ = FunctionType(paramtypes, returntype)
-        f.body = self.parseCompound()
+        if self.Peak == ';':
+            self.Consume(';')
+            f.body = None
+        else:
+            f.body = self.parseCompound()
         self.currentPart = savePart
 
     def parse_if(self):