home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_327 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  1.1 KB  |  32 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from compiler import ast, walk
  5.  
  6. def check(tree, multi = None):
  7.     v = SyntaxErrorChecker(multi)
  8.     walk(tree, v)
  9.     return v.errors
  10.  
  11.  
  12. class SyntaxErrorChecker:
  13.     
  14.     def __init__(self, multi = None):
  15.         self.multi = multi
  16.         self.errors = 0
  17.  
  18.     
  19.     def error(self, node, msg):
  20.         self.errors = self.errors + 1
  21.         if self.multi is not None:
  22.             print '%s:%s: %s' % (node.filename, node.lineno, msg)
  23.         else:
  24.             raise SyntaxError, '%s (%s:%s)' % (msg, node.filename, node.lineno)
  25.         return self.multi is not None
  26.  
  27.     
  28.     def visitAssign(self, node):
  29.         pass
  30.  
  31.  
  32.