Franck Pommereau

cosmetic changes

...@@ -448,7 +448,6 @@ precedence = ( ...@@ -448,7 +448,6 @@ precedence = (
448 448
449 class ParseError(Exception): 449 class ParseError(Exception):
450 "Exception raised whenever a parsing error occurs." 450 "Exception raised whenever a parsing error occurs."
451 -
452 pass 451 pass
453 452
454 def p_translation_unit_01(t): 453 def p_translation_unit_01(t):
......
...@@ -178,14 +178,21 @@ class CodeGenVisitor (Visitor) : ...@@ -178,14 +178,21 @@ class CodeGenVisitor (Visitor) :
178 "# Franck Pommereau (2018)\n" 178 "# Franck Pommereau (2018)\n"
179 "# Adapted from Atul Varma's c.py (Spring 2004)\n") 179 "# Adapted from Atul Varma's c.py (Spring 2004)\n")
180 for c in chunks : 180 for c in chunks :
181 - outfile.write("\n# code from file %r\n" % c.path) 181 + s = c.curr_str.getvalue()
182 - outfile.write(c.curr_str.getvalue()) 182 + if s.strip() :
183 + outfile.write("\n###\n### code from file %r\n###\n" % c.path)
184 + outfile.write(s)
183 for c in chunks : 185 for c in chunks :
184 - outfile.write("\n# globals from file %r\n\n" % c.path) 186 + s = c.globals_str.getvalue()
185 - outfile.write(c.globals_str.getvalue()) 187 + if s.strip() :
188 + outfile.write("\n###\n### globals from file %r\n###\n\n" % c.path)
189 + outfile.write(s)
186 for c in chunks : 190 for c in chunks :
187 - outfile.write("\n# string literals from file %r\n\n" % c.path) 191 + s = c.str_literal_str.getvalue()
188 - outfile.write(c.str_literal_str.getvalue()) 192 + if s.strip() :
193 + outfile.write("\n###\n### string literals from file %r\n###\n\n"
194 + % c.path)
195 + outfile.write(s)
189 196
190 def _calc_function_var_addrs(self, symtab, last_fp_loc): 197 def _calc_function_var_addrs(self, symtab, last_fp_loc):
191 self._calc_function_arg_addrs(symtab) 198 self._calc_function_arg_addrs(symtab)
......
This diff is collapsed. Click to expand it.