Beispiel #1
0
 def __init__(self, file, filename, parent_scanner = None, 
              scope = None, context = None, source_encoding=None, parse_comments=True, initial_pos=None):
     Scanner.__init__(self, get_lexicon(), file, filename, initial_pos)
     if parent_scanner:
         self.context = parent_scanner.context
         self.included_files = parent_scanner.included_files
         self.compile_time_env = parent_scanner.compile_time_env
         self.compile_time_eval = parent_scanner.compile_time_eval
         self.compile_time_expr = parent_scanner.compile_time_expr
     else:
         self.context = context
         self.included_files = scope.included_files
         self.compile_time_env = initial_compile_time_env()
         self.compile_time_eval = 1
         self.compile_time_expr = 0
     self.parse_comments = parse_comments
     self.source_encoding = source_encoding
     if filename.is_python_file():
         self.in_python_file = True
         self.keywords = cython.set(py_reserved_words)
     else:
         self.in_python_file = False
         self.keywords = cython.set(pyx_reserved_words)
     self.trace = trace_scanner
     self.indentation_stack = [0]
     self.indentation_char = None
     self.bracket_nesting_level = 0
     self.begin('INDENT')
     self.sy = ''
     self.next()
Beispiel #2
0
 def __init__(self, file, filename, parent_scanner = None,
              scope = None, context = None, source_encoding=None, parse_comments=True, initial_pos=None):
     Scanner.__init__(self, get_lexicon(), file, filename, initial_pos)
     if parent_scanner:
         self.context = parent_scanner.context
         self.included_files = parent_scanner.included_files
         self.compile_time_env = parent_scanner.compile_time_env
         self.compile_time_eval = parent_scanner.compile_time_eval
         self.compile_time_expr = parent_scanner.compile_time_expr
     else:
         self.context = context
         self.included_files = scope.included_files
         self.compile_time_env = initial_compile_time_env()
         self.compile_time_eval = 1
         self.compile_time_expr = 0
     self.parse_comments = parse_comments
     self.source_encoding = source_encoding
     if filename.is_python_file():
         self.in_python_file = True
         self.keywords = cython.set(py_reserved_words)
     else:
         self.in_python_file = False
         self.keywords = cython.set(pyx_reserved_words)
     self.trace = trace_scanner
     self.indentation_stack = [0]
     self.indentation_char = None
     self.bracket_nesting_level = 0
     self.begin('INDENT')
     self.sy = ''
     self.next()