Commit 698b502d authored by Stefan Behnel's avatar Stefan Behnel

more cythonisation in the scanner/parser

parent 423e2c0d
......@@ -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)
......
......@@ -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 = *)
......@@ -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 = *)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment