more cythonisation in the scanner/parser
authorStefan Behnel <scoder@users.berlios.de>
Tue, 16 Nov 2010 20:54:46 +0000 (21:54 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Tue, 16 Nov 2010 20:54:46 +0000 (21:54 +0100)
Cython/Compiler/Parsing.pxd
Cython/Compiler/Scanning.pxd
Cython/Plex/Scanners.pxd

index 1e39a34acbafb10156d511b1b41cd7f9710a86f0..486f758f049a570367c991e21816dd3b42d9b6dc 100644 (file)
@@ -68,7 +68,7 @@ cdef p_comp_if(PyrexScanner s, body)
 cdef p_dict_or_set_maker(PyrexScanner s)
 cdef p_backquote_expr(PyrexScanner s)
 cpdef p_simple_expr_list(PyrexScanner s, expr=*)
-cdef p_test_or_starred_expr_list(s, expr=*)
+cdef p_test_or_starred_expr_list(PyrexScanner s, expr=*)
 cdef p_testlist(PyrexScanner s)
 cdef p_testlist_star_expr(PyrexScanner s)
 cdef p_testlist_comp(PyrexScanner s)
@@ -111,6 +111,7 @@ cdef p_try_statement(PyrexScanner s)
 cdef p_except_clause(PyrexScanner s)
 cdef p_include_statement(PyrexScanner s, ctx)
 cdef p_with_statement(PyrexScanner s)
+cdef p_with_items(PyrexScanner s)
 cpdef p_simple_statement(PyrexScanner s, bint first_statement = *)
 cpdef p_simple_statement_list(PyrexScanner s, ctx, bint first_statement = *)
 cdef p_compile_time_expr(PyrexScanner s)
index abcc5eeaa04ff7f5467fc45c1e43ff8c2c15a88d..b560c1ec806e58d8830b747ce2571ed7c313f4e1 100644 (file)
@@ -2,14 +2,21 @@ import cython
 
 from Cython.Plex.Scanners cimport Scanner
 
+cdef class Method:
+    cdef object name
+    cdef object __name__
+
 cdef class CompileTimeScope:
-    cdef public entries
-    cdef public outer
+    cdef public dict entries
+    cdef public CompileTimeScope outer
+    cdef declare(self, name, value)
+    cdef lookup_here(self, name)
+    cpdef lookup(self, name)
 
 cdef class PyrexScanner(Scanner):
     cdef public context
     cdef public list included_files
-    cdef public compile_time_env
+    cdef public CompileTimeScope compile_time_env
     cdef public bint compile_time_eval
     cdef public bint compile_time_expr
     cdef public bint parse_comments
@@ -23,9 +30,23 @@ cdef class PyrexScanner(Scanner):
     cdef public systring
 
     cdef long current_level(self)
-    cpdef begin(self, state)
-    cpdef next(self)
-    cpdef bint expect(self, what, message = *) except -2
-    
+    #cpdef commentline(self, text)
+    #cpdef open_bracket_action(self, text)
+    #cpdef close_bracket_action(self, text)
+    #cpdef newline_action(self, text)
+    #cpdef begin_string_action(self, text)
+    #cpdef end_string_action(self, text)
+    #cpdef unclosed_string_action(self, text)
     @cython.locals(current_level=cython.long, new_level=cython.long)
     cpdef indentation_action(self, text)
+    #cpdef eof_action(self, text)
+    cdef next(self)
+    cdef peek(self)
+    #cpdef put_back(self, sy, systring)
+    #cdef unread(self, token, value)
+    cdef bint expect(self, what, message = *) except -2
+    cdef expect_keyword(self, what, message = *)
+    cdef expected(self, what, message = *)
+    cdef expect_indent(self)
+    cdef expect_dedent(self)
+    cdef expect_newline(self, message = *)
index 4ecdba6812a4391eacf7471236e7575cfa6bacbb..c746cc5a38bddac91a82d2b443ac759adc0d0df8 100644 (file)
@@ -25,10 +25,10 @@ cdef class Scanner:
     cdef public level
 
     @cython.locals(input_state=long)
-    cpdef next_char(self)
-    cpdef tuple read(self)
+    cdef next_char(self)
+    cdef tuple read(self)
     cdef tuple scan_a_token(self)
-    cpdef tuple position(self)
+    cdef tuple position(self)
 
     @cython.locals(cur_pos=long, cur_line=long, cur_line_start=long,
                    input_state=long, next_pos=long, state=dict,
@@ -36,5 +36,5 @@ cdef class Scanner:
                    trace=bint, discard=long, data=unicode, buffer=unicode)
     cdef run_machine_inlined(self)
     
-    cpdef begin(self, state)
-    cpdef produce(self, value, text = *)
+    cdef begin(self, state)
+    cdef produce(self, value, text = *)