Commits

Gigih Aji Ibrahim committed 3033228

use python3 syntax

  • Participants
  • Parent commits 0f505c1

Comments (0)

Files changed (6)

File src/parser4.py

 #!/usr/bin/env python
 
-from collections import namedtuple
 
 from lexer4 import TegalLexer
 from exception import ParseError
 from ast3 import *
 
+from collections import namedtuple
+
 
 Infix  = namedtuple('Infix',  'precedence parse')
 Prefix = namedtuple('Prefix', 'parse')

File src/pygen/generator.py

 
             #try: shutil.rmtree(self.TEMPDIR)
             #except OSError: pass
-        except CodeGenError, e:
+        except CodeGenError as e:
             report.error(e)
 
 

File src/report.py

 
 def _print(obj):
     """ print the message in nice way"""
-    print obj
+    print(obj)
     if hasattr(obj, 'loc') and  obj.loc is not None: _printContent(obj.loc)
     
 
     endOffset   = loc.end.index.pos + 1
     while endOffset < len(data) and data[endOffset] != '\n': endOffset += 1
 
-    print "\t", loc.begin.index.data[beginOffset:endOffset]
+    print("\t" + loc.begin.index.data[beginOffset:endOffset])
 
     ## print ~~~ to mark the error
     mark  = " " * (loc.begin.index.pos - beginOffset)
     if loc.end.index.pos - loc.begin.index.pos + 1 <= 0:
         mark += "~"
 
-    print "\t", mark
+    print("\t" + mark)

File src/step/resolver.py

         for mod in self.modules:
             self.modul = mod
             try: self.visit(mod)
-            except SemanticError, ex: report.error(ex)
+            except SemanticError as ex: report.error(ex)
             self._visitedMods.append(mod)
 
         ## visit all delayed node

File src/step/typechecker.py

             self.modul = mod
 
             try:self.visit(mod)
-            except SemanticError, ex: report.error(ex)
+            except SemanticError as ex: report.error(ex)
 
         ## visit all delayed node
         for (node,stack) in self._delayedNodes:

File src/visitor.py

 
         try:
             self.visit(self.modul.parseTree)
-        except SemanticError, ex:
+        except SemanticError as ex:
             report.error(ex)
             return False