Parsing.pxd 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # We declare all of these here to type the first argument.
  2. from __future__ import absolute_import
  3. cimport cython
  4. from .Scanning cimport PyrexScanner
  5. ctypedef object (*p_sub_expr_func)(PyrexScanner obj)
  6. # entry points
  7. cpdef p_module(PyrexScanner s, pxd, full_module_name, ctx=*)
  8. cpdef p_code(PyrexScanner s, level= *, ctx=*)
  9. # internal parser states
  10. cdef p_ident(PyrexScanner s, message =*)
  11. cdef p_ident_list(PyrexScanner s)
  12. cdef tuple p_binop_operator(PyrexScanner s)
  13. cdef p_binop_expr(PyrexScanner s, ops, p_sub_expr_func p_sub_expr)
  14. cdef p_lambdef(PyrexScanner s, bint allow_conditional=*)
  15. cdef p_lambdef_nocond(PyrexScanner s)
  16. cdef p_test(PyrexScanner s)
  17. cdef p_test_nocond(PyrexScanner s)
  18. cdef p_or_test(PyrexScanner s)
  19. cdef p_rassoc_binop_expr(PyrexScanner s, ops, p_sub_expr_func p_subexpr)
  20. cdef p_and_test(PyrexScanner s)
  21. cdef p_not_test(PyrexScanner s)
  22. cdef p_comparison(PyrexScanner s)
  23. cdef p_test_or_starred_expr(PyrexScanner s)
  24. cdef p_starred_expr(PyrexScanner s)
  25. cdef p_cascaded_cmp(PyrexScanner s)
  26. cdef p_cmp_op(PyrexScanner s)
  27. cdef p_bit_expr(PyrexScanner s)
  28. cdef p_xor_expr(PyrexScanner s)
  29. cdef p_and_expr(PyrexScanner s)
  30. cdef p_shift_expr(PyrexScanner s)
  31. cdef p_arith_expr(PyrexScanner s)
  32. cdef p_term(PyrexScanner s)
  33. cdef p_factor(PyrexScanner s)
  34. cdef _p_factor(PyrexScanner s)
  35. cdef p_typecast(PyrexScanner s)
  36. cdef p_sizeof(PyrexScanner s)
  37. cdef p_yield_expression(PyrexScanner s)
  38. cdef p_yield_statement(PyrexScanner s)
  39. cdef p_async_statement(PyrexScanner s, ctx, decorators)
  40. cdef p_power(PyrexScanner s)
  41. cdef p_new_expr(PyrexScanner s)
  42. cdef p_trailer(PyrexScanner s, node1)
  43. cdef p_call_parse_args(PyrexScanner s, bint allow_genexp = *)
  44. cdef p_call_build_packed_args(pos, positional_args, keyword_args)
  45. cdef p_call(PyrexScanner s, function)
  46. cdef p_index(PyrexScanner s, base)
  47. cdef tuple p_subscript_list(PyrexScanner s)
  48. cdef p_subscript(PyrexScanner s)
  49. cdef p_slice_element(PyrexScanner s, follow_set)
  50. cdef expect_ellipsis(PyrexScanner s)
  51. cdef make_slice_nodes(pos, subscripts)
  52. cpdef make_slice_node(pos, start, stop = *, step = *)
  53. cdef p_atom(PyrexScanner s)
  54. @cython.locals(value=unicode)
  55. cdef p_int_literal(PyrexScanner s)
  56. cdef p_name(PyrexScanner s, name)
  57. cdef wrap_compile_time_constant(pos, value)
  58. cdef p_cat_string_literal(PyrexScanner s)
  59. cdef p_opt_string_literal(PyrexScanner s, required_type=*)
  60. cdef bint check_for_non_ascii_characters(unicode string)
  61. @cython.locals(systr=unicode, is_python3_source=bint, is_raw=bint)
  62. cdef p_string_literal(PyrexScanner s, kind_override=*)
  63. cdef _append_escape_sequence(kind, builder, unicode escape_sequence, PyrexScanner s)
  64. cdef tuple _f_string_error_pos(pos, string, Py_ssize_t i)
  65. @cython.locals(i=Py_ssize_t, size=Py_ssize_t, c=Py_UCS4, next_start=Py_ssize_t)
  66. cdef list p_f_string(PyrexScanner s, unicode_value, pos, bint is_raw)
  67. @cython.locals(i=Py_ssize_t, size=Py_ssize_t, c=Py_UCS4, quote_char=Py_UCS4, NO_CHAR=Py_UCS4)
  68. cdef tuple p_f_string_expr(PyrexScanner s, unicode_value, pos, Py_ssize_t starting_index, bint is_raw)
  69. cdef p_list_maker(PyrexScanner s)
  70. cdef p_comp_iter(PyrexScanner s, body)
  71. cdef p_comp_for(PyrexScanner s, body)
  72. cdef p_comp_if(PyrexScanner s, body)
  73. cdef p_dict_or_set_maker(PyrexScanner s)
  74. cdef p_backquote_expr(PyrexScanner s)
  75. cdef p_simple_expr_list(PyrexScanner s, expr=*)
  76. cdef p_test_or_starred_expr_list(PyrexScanner s, expr=*)
  77. cdef p_testlist(PyrexScanner s)
  78. cdef p_testlist_star_expr(PyrexScanner s)
  79. cdef p_testlist_comp(PyrexScanner s)
  80. cdef p_genexp(PyrexScanner s, expr)
  81. #-------------------------------------------------------
  82. #
  83. # Statements
  84. #
  85. #-------------------------------------------------------
  86. cdef p_global_statement(PyrexScanner s)
  87. cdef p_nonlocal_statement(PyrexScanner s)
  88. cdef p_expression_or_assignment(PyrexScanner s)
  89. cdef p_print_statement(PyrexScanner s)
  90. cdef p_exec_statement(PyrexScanner s)
  91. cdef p_del_statement(PyrexScanner s)
  92. cdef p_pass_statement(PyrexScanner s, bint with_newline = *)
  93. cdef p_break_statement(PyrexScanner s)
  94. cdef p_continue_statement(PyrexScanner s)
  95. cdef p_return_statement(PyrexScanner s)
  96. cdef p_raise_statement(PyrexScanner s)
  97. cdef p_import_statement(PyrexScanner s)
  98. cdef p_from_import_statement(PyrexScanner s, bint first_statement = *)
  99. cdef p_imported_name(PyrexScanner s, bint is_cimport)
  100. cdef p_dotted_name(PyrexScanner s, bint as_allowed)
  101. cdef p_as_name(PyrexScanner s)
  102. cdef p_assert_statement(PyrexScanner s)
  103. cdef p_if_statement(PyrexScanner s)
  104. cdef p_if_clause(PyrexScanner s)
  105. cdef p_else_clause(PyrexScanner s)
  106. cdef p_while_statement(PyrexScanner s)
  107. cdef p_for_statement(PyrexScanner s, bint is_async=*)
  108. cdef dict p_for_bounds(PyrexScanner s, bint allow_testlist=*, bint is_async=*)
  109. cdef p_for_from_relation(PyrexScanner s)
  110. cdef p_for_from_step(PyrexScanner s)
  111. cdef p_target(PyrexScanner s, terminator)
  112. cdef p_for_target(PyrexScanner s)
  113. cdef p_for_iterator(PyrexScanner s, bint allow_testlist=*, bint is_async=*)
  114. cdef p_try_statement(PyrexScanner s)
  115. cdef p_except_clause(PyrexScanner s)
  116. cdef p_include_statement(PyrexScanner s, ctx)
  117. cdef p_with_statement(PyrexScanner s)
  118. cdef p_with_items(PyrexScanner s, bint is_async=*)
  119. cdef p_with_template(PyrexScanner s)
  120. cdef p_simple_statement(PyrexScanner s, bint first_statement = *)
  121. cdef p_simple_statement_list(PyrexScanner s, ctx, bint first_statement = *)
  122. cdef p_compile_time_expr(PyrexScanner s)
  123. cdef p_DEF_statement(PyrexScanner s)
  124. cdef p_IF_statement(PyrexScanner s, ctx)
  125. cdef p_statement(PyrexScanner s, ctx, bint first_statement = *)
  126. cdef p_statement_list(PyrexScanner s, ctx, bint first_statement = *)
  127. cdef p_suite(PyrexScanner s, ctx = *)
  128. cdef tuple p_suite_with_docstring(PyrexScanner s, ctx, bint with_doc_only=*)
  129. cdef tuple _extract_docstring(node)
  130. cdef p_positional_and_keyword_args(PyrexScanner s, end_sy_set, templates = *)
  131. cpdef p_c_base_type(PyrexScanner s, bint self_flag = *, bint nonempty = *, templates = *)
  132. cdef p_calling_convention(PyrexScanner s)
  133. cdef p_c_complex_base_type(PyrexScanner s, templates = *)
  134. cdef p_c_simple_base_type(PyrexScanner s, bint self_flag, bint nonempty, templates = *)
  135. cdef p_buffer_or_template(PyrexScanner s, base_type_node, templates)
  136. cdef p_bracketed_base_type(PyrexScanner s, base_type_node, nonempty, empty)
  137. cdef is_memoryviewslice_access(PyrexScanner s)
  138. cdef p_memoryviewslice_access(PyrexScanner s, base_type_node)
  139. cdef bint looking_at_name(PyrexScanner s) except -2
  140. cdef object looking_at_expr(PyrexScanner s)# except -2
  141. cdef bint looking_at_base_type(PyrexScanner s) except -2
  142. cdef bint looking_at_dotted_name(PyrexScanner s) except -2
  143. cdef bint looking_at_call(PyrexScanner s) except -2
  144. cdef p_sign_and_longness(PyrexScanner s)
  145. cdef p_opt_cname(PyrexScanner s)
  146. cpdef p_c_declarator(PyrexScanner s, ctx = *, bint empty = *, bint is_type = *, bint cmethod_flag = *,
  147. bint assignable = *, bint nonempty = *,
  148. bint calling_convention_allowed = *)
  149. cdef p_c_array_declarator(PyrexScanner s, base)
  150. cdef p_c_func_declarator(PyrexScanner s, pos, ctx, base, bint cmethod_flag)
  151. cdef p_c_simple_declarator(PyrexScanner s, ctx, bint empty, bint is_type, bint cmethod_flag,
  152. bint assignable, bint nonempty)
  153. cdef p_nogil(PyrexScanner s)
  154. cdef p_with_gil(PyrexScanner s)
  155. cdef p_exception_value_clause(PyrexScanner s)
  156. cpdef p_c_arg_list(PyrexScanner s, ctx = *, bint in_pyfunc = *, bint cmethod_flag = *,
  157. bint nonempty_declarators = *, bint kw_only = *, bint annotated = *)
  158. cdef p_optional_ellipsis(PyrexScanner s)
  159. cdef p_c_arg_decl(PyrexScanner s, ctx, in_pyfunc, bint cmethod_flag = *, bint nonempty = *, bint kw_only = *, bint annotated = *)
  160. cdef p_api(PyrexScanner s)
  161. cdef p_cdef_statement(PyrexScanner s, ctx)
  162. cdef p_cdef_block(PyrexScanner s, ctx)
  163. cdef p_cdef_extern_block(PyrexScanner s, pos, ctx)
  164. cdef p_c_enum_definition(PyrexScanner s, pos, ctx)
  165. cdef p_c_enum_line(PyrexScanner s, ctx, list items)
  166. cdef p_c_enum_item(PyrexScanner s, ctx, list items)
  167. cdef p_c_struct_or_union_definition(PyrexScanner s, pos, ctx)
  168. cdef p_fused_definition(PyrexScanner s, pos, ctx)
  169. cdef p_struct_enum(PyrexScanner s, pos, ctx)
  170. cdef p_visibility(PyrexScanner s, prev_visibility)
  171. cdef p_c_modifiers(PyrexScanner s)
  172. cdef p_c_func_or_var_declaration(PyrexScanner s, pos, ctx)
  173. cdef p_ctypedef_statement(PyrexScanner s, ctx)
  174. cdef p_decorators(PyrexScanner s)
  175. cdef _reject_cdef_modifier_in_py(PyrexScanner s, name)
  176. cdef p_def_statement(PyrexScanner s, list decorators=*, bint is_async_def=*)
  177. cdef p_varargslist(PyrexScanner s, terminator=*, bint annotated = *)
  178. cdef p_py_arg_decl(PyrexScanner s, bint annotated = *)
  179. cdef p_class_statement(PyrexScanner s, decorators)
  180. cdef p_c_class_definition(PyrexScanner s, pos, ctx)
  181. cdef tuple p_c_class_options(PyrexScanner s)
  182. cdef p_property_decl(PyrexScanner s)
  183. cdef p_doc_string(PyrexScanner s)
  184. cdef p_ignorable_statement(PyrexScanner s)
  185. cdef dict p_compiler_directive_comments(PyrexScanner s)
  186. cdef p_template_definition(PyrexScanner s)
  187. cdef p_cpp_class_definition(PyrexScanner s, pos, ctx)
  188. cdef p_cpp_class_attribute(PyrexScanner s, ctx)