| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | #ifndef PEGEN_H
 | 
					
						
							|  |  |  | #define PEGEN_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PY_SSIZE_T_CLEAN
 | 
					
						
							|  |  |  | #include <Python.h>
 | 
					
						
							|  |  |  | #include <token.h>
 | 
					
						
							| 
									
										
										
										
											2021-03-23 20:47:40 +01:00
										 |  |  | #include <pycore_ast.h>
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-27 18:02:07 +01:00
										 |  |  | #if 0
 | 
					
						
							|  |  |  | #define PyPARSE_YIELD_IS_KEYWORD        0x0001
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PyPARSE_DONT_IMPLY_DEDENT       0x0002
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if 0
 | 
					
						
							|  |  |  | #define PyPARSE_WITH_IS_KEYWORD         0x0003
 | 
					
						
							|  |  |  | #define PyPARSE_PRINT_IS_FUNCTION       0x0004
 | 
					
						
							|  |  |  | #define PyPARSE_UNICODE_LITERALS        0x0008
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PyPARSE_IGNORE_COOKIE 0x0010
 | 
					
						
							|  |  |  | #define PyPARSE_BARRY_AS_BDFL 0x0020
 | 
					
						
							|  |  |  | #define PyPARSE_TYPE_COMMENTS 0x0040
 | 
					
						
							|  |  |  | #define PyPARSE_ASYNC_HACKS   0x0080
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | typedef struct _memo { | 
					
						
							|  |  |  |     int type; | 
					
						
							|  |  |  |     void *node; | 
					
						
							|  |  |  |     int mark; | 
					
						
							|  |  |  |     struct _memo *next; | 
					
						
							|  |  |  | } Memo; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     int type; | 
					
						
							|  |  |  |     PyObject *bytes; | 
					
						
							| 
									
										
										
										
											2020-06-20 15:57:27 +03:00
										 |  |  |     int lineno, col_offset, end_lineno, end_col_offset; | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  |     Memo *memo; | 
					
						
							|  |  |  | } Token; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     char *str; | 
					
						
							|  |  |  |     int type; | 
					
						
							|  |  |  | } KeywordToken; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     struct { | 
					
						
							|  |  |  |         int lineno; | 
					
						
							|  |  |  |         char *comment;  // The " <tag>" in "# type: ignore <tag>"
 | 
					
						
							|  |  |  |     } *items; | 
					
						
							|  |  |  |     size_t size; | 
					
						
							|  |  |  |     size_t num_items; | 
					
						
							|  |  |  | } growable_comment_array; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | typedef struct { | 
					
						
							|  |  |  |     struct tok_state *tok; | 
					
						
							|  |  |  |     Token **tokens; | 
					
						
							|  |  |  |     int mark; | 
					
						
							|  |  |  |     int fill, size; | 
					
						
							|  |  |  |     PyArena *arena; | 
					
						
							|  |  |  |     KeywordToken **keywords; | 
					
						
							| 
									
										
										
										
											2021-04-15 21:38:45 +01:00
										 |  |  |     char **soft_keywords; | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  |     int n_keyword_lists; | 
					
						
							|  |  |  |     int start_rule; | 
					
						
							|  |  |  |     int *errcode; | 
					
						
							|  |  |  |     int parsing_started; | 
					
						
							|  |  |  |     PyObject* normalize; | 
					
						
							|  |  |  |     int starting_lineno; | 
					
						
							|  |  |  |     int starting_col_offset; | 
					
						
							|  |  |  |     int error_indicator; | 
					
						
							| 
									
										
										
										
											2020-04-27 18:02:07 +01:00
										 |  |  |     int flags; | 
					
						
							| 
									
										
										
										
											2020-05-01 06:27:52 +03:00
										 |  |  |     int feature_version; | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  |     growable_comment_array type_ignore_comments; | 
					
						
							| 
									
										
										
										
											2020-05-07 13:37:51 +03:00
										 |  |  |     Token *known_err_token; | 
					
						
							| 
									
										
										
										
											2020-05-25 18:38:45 +01:00
										 |  |  |     int level; | 
					
						
							| 
									
										
										
										
											2020-10-27 00:42:04 +02:00
										 |  |  |     int call_invalid_rules; | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | } Parser; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     cmpop_ty cmpop; | 
					
						
							|  |  |  |     expr_ty expr; | 
					
						
							|  |  |  | } CmpopExprPair; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     expr_ty key; | 
					
						
							|  |  |  |     expr_ty value; | 
					
						
							|  |  |  | } KeyValuePair; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     arg_ty arg; | 
					
						
							|  |  |  |     expr_ty value; | 
					
						
							|  |  |  | } NameDefaultPair; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  |     asdl_arg_seq *plain_names; | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  |     asdl_seq *names_with_defaults; // asdl_seq* of NameDefaultsPair's
 | 
					
						
							|  |  |  | } SlashWithDefault; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  |     arg_ty vararg; | 
					
						
							|  |  |  |     asdl_seq *kwonlyargs; // asdl_seq* of NameDefaultsPair's
 | 
					
						
							|  |  |  |     arg_ty kwarg; | 
					
						
							|  |  |  | } StarEtc; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-23 20:47:40 +01:00
										 |  |  | typedef struct { operator_ty kind; } AugOperator; | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | typedef struct { | 
					
						
							|  |  |  |     void *element; | 
					
						
							|  |  |  |     int is_keyword; | 
					
						
							|  |  |  | } KeywordOrStarred; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-09 01:17:31 +01:00
										 |  |  | #if defined(Py_DEBUG)
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | void _PyPegen_clear_memo_statistics(void); | 
					
						
							|  |  |  | PyObject *_PyPegen_get_memo_statistics(void); | 
					
						
							| 
									
										
										
										
											2021-04-09 01:17:31 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | int _PyPegen_insert_memo(Parser *p, int mark, int type, void *node); | 
					
						
							|  |  |  | int _PyPegen_update_memo(Parser *p, int mark, int type, void *node); | 
					
						
							|  |  |  | int _PyPegen_is_memoized(Parser *p, int type, void *pres); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-02 19:54:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-23 12:42:13 +01:00
										 |  |  | int _PyPegen_lookahead_with_name(int, expr_ty (func)(Parser *), Parser *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | int _PyPegen_lookahead_with_int(int, Token *(func)(Parser *, int), Parser *, int); | 
					
						
							| 
									
										
										
										
											2020-05-27 00:15:52 +01:00
										 |  |  | int _PyPegen_lookahead_with_string(int , expr_ty (func)(Parser *, const char*), Parser *, const char*); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | int _PyPegen_lookahead(int, void *(func)(Parser *), Parser *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Token *_PyPegen_expect_token(Parser *p, int type); | 
					
						
							| 
									
										
										
										
											2021-02-02 19:54:22 +00:00
										 |  |  | Token *_PyPegen_expect_forced_token(Parser *p, int type, const char* expected); | 
					
						
							| 
									
										
										
										
											2020-05-26 10:58:44 -07:00
										 |  |  | expr_ty _PyPegen_expect_soft_keyword(Parser *p, const char *keyword); | 
					
						
							| 
									
										
										
										
											2021-04-15 21:38:45 +01:00
										 |  |  | expr_ty _PyPegen_soft_keyword_token(Parser *p); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | Token *_PyPegen_get_last_nonnwhitespace_token(Parser *); | 
					
						
							|  |  |  | int _PyPegen_fill_token(Parser *p); | 
					
						
							|  |  |  | expr_ty _PyPegen_name_token(Parser *p); | 
					
						
							|  |  |  | expr_ty _PyPegen_number_token(Parser *p); | 
					
						
							|  |  |  | void *_PyPegen_string_token(Parser *p); | 
					
						
							|  |  |  | const char *_PyPegen_get_expr_name(expr_ty); | 
					
						
							| 
									
										
										
										
											2020-05-13 22:36:27 +03:00
										 |  |  | void *_PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...); | 
					
						
							|  |  |  | void *_PyPegen_raise_error_known_location(Parser *p, PyObject *errtype, | 
					
						
							| 
									
										
										
										
											2020-06-16 16:49:43 +01:00
										 |  |  |                                           Py_ssize_t lineno, Py_ssize_t col_offset, | 
					
						
							| 
									
										
										
										
											2020-05-13 22:36:27 +03:00
										 |  |  |                                           const char *errmsg, va_list va); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | void *_PyPegen_dummy_name(Parser *p, ...); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-13 22:36:27 +03:00
										 |  |  | Py_LOCAL_INLINE(void *) | 
					
						
							| 
									
										
										
										
											2021-03-22 17:28:11 +00:00
										 |  |  | RAISE_ERROR_KNOWN_LOCATION(Parser *p, PyObject *errtype, | 
					
						
							|  |  |  |                            Py_ssize_t lineno, Py_ssize_t col_offset, | 
					
						
							|  |  |  |                            const char *errmsg, ...) | 
					
						
							| 
									
										
										
										
											2020-05-13 22:36:27 +03:00
										 |  |  | { | 
					
						
							|  |  |  |     va_list va; | 
					
						
							|  |  |  |     va_start(va, errmsg); | 
					
						
							|  |  |  |     _PyPegen_raise_error_known_location(p, errtype, lineno, col_offset + 1, | 
					
						
							|  |  |  |                                         errmsg, va); | 
					
						
							|  |  |  |     va_end(va); | 
					
						
							|  |  |  |     return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | #define UNUSED(expr) do { (void)(expr); } while (0)
 | 
					
						
							| 
									
										
										
										
											2021-04-09 01:17:31 +01:00
										 |  |  | #define EXTRA_EXPR(head, tail) head->lineno, (head)->col_offset, (tail)->end_lineno, (tail)->end_col_offset, p->arena
 | 
					
						
							| 
									
										
										
										
											2020-05-10 05:34:50 +01:00
										 |  |  | #define EXTRA _start_lineno, _start_col_offset, _end_lineno, _end_col_offset, p->arena
 | 
					
						
							| 
									
										
										
										
											2020-05-13 22:36:27 +03:00
										 |  |  | #define RAISE_SYNTAX_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_SyntaxError, msg, ##__VA_ARGS__)
 | 
					
						
							|  |  |  | #define RAISE_INDENTATION_ERROR(msg, ...) _PyPegen_raise_error(p, PyExc_IndentationError, msg, ##__VA_ARGS__)
 | 
					
						
							|  |  |  | #define RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, msg, ...) \
 | 
					
						
							| 
									
										
										
										
											2020-05-22 03:56:52 +03:00
										 |  |  |     RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, (a)->lineno, (a)->col_offset, msg, ##__VA_ARGS__) | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Py_LOCAL_INLINE(void *) | 
					
						
							|  |  |  | CHECK_CALL(Parser *p, void *result) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (result == NULL) { | 
					
						
							|  |  |  |         assert(PyErr_Occurred()); | 
					
						
							|  |  |  |         p->error_indicator = 1; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* This is needed for helper functions that are allowed to
 | 
					
						
							|  |  |  |    return NULL without an error. Example: _PyPegen_seq_extract_starred_exprs */ | 
					
						
							|  |  |  | Py_LOCAL_INLINE(void *) | 
					
						
							|  |  |  | CHECK_CALL_NULL_ALLOWED(Parser *p, void *result) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (result == NULL && PyErr_Occurred()) { | 
					
						
							|  |  |  |         p->error_indicator = 1; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return result; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-21 22:53:14 +03:00
										 |  |  | #define CHECK(type, result) ((type) CHECK_CALL(p, result))
 | 
					
						
							|  |  |  | #define CHECK_NULL_ALLOWED(type, result) ((type) CHECK_CALL_NULL_ALLOWED(p, result))
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  | PyObject *_PyPegen_new_type_comment(Parser *, char *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Py_LOCAL_INLINE(PyObject *) | 
					
						
							|  |  |  | NEW_TYPE_COMMENT(Parser *p, Token *tc) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (tc == NULL) { | 
					
						
							|  |  |  |         return NULL; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     char *bytes = PyBytes_AsString(tc->bytes); | 
					
						
							|  |  |  |     if (bytes == NULL) { | 
					
						
							|  |  |  |         goto error; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     PyObject *tco = _PyPegen_new_type_comment(p, bytes); | 
					
						
							|  |  |  |     if (tco == NULL) { | 
					
						
							|  |  |  |         goto error; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return tco; | 
					
						
							|  |  |  |  error: | 
					
						
							|  |  |  |     p->error_indicator = 1;  // Inline CHECK_CALL
 | 
					
						
							|  |  |  |     return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 06:27:52 +03:00
										 |  |  | Py_LOCAL_INLINE(void *) | 
					
						
							|  |  |  | INVALID_VERSION_CHECK(Parser *p, int version, char *msg, void *node) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (node == NULL) { | 
					
						
							|  |  |  |         p->error_indicator = 1;  // Inline CHECK_CALL
 | 
					
						
							|  |  |  |         return NULL; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (p->feature_version < version) { | 
					
						
							|  |  |  |         p->error_indicator = 1; | 
					
						
							| 
									
										
										
										
											2020-05-01 16:13:43 +03:00
										 |  |  |         return RAISE_SYNTAX_ERROR("%s only supported in Python 3.%i and greater", | 
					
						
							|  |  |  |                                   msg, version); | 
					
						
							| 
									
										
										
										
											2020-05-01 06:27:52 +03:00
										 |  |  |     } | 
					
						
							|  |  |  |     return node; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-21 22:53:14 +03:00
										 |  |  | #define CHECK_VERSION(type, version, msg, node) ((type) INVALID_VERSION_CHECK(p, version, msg, node))
 | 
					
						
							| 
									
										
										
										
											2020-05-01 06:27:52 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  | arg_ty _PyPegen_add_type_comment_to_arg(Parser *, arg_ty, Token *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | PyObject *_PyPegen_new_identifier(Parser *, char *); | 
					
						
							| 
									
										
										
										
											2020-05-01 06:27:52 +03:00
										 |  |  | Parser *_PyPegen_Parser_New(struct tok_state *, int, int, int, int *, PyArena *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | void _PyPegen_Parser_Free(Parser *); | 
					
						
							|  |  |  | mod_ty _PyPegen_run_parser_from_file_pointer(FILE *, int, PyObject *, const char *, | 
					
						
							| 
									
										
										
										
											2020-04-27 18:02:07 +01:00
										 |  |  |                                     const char *, const char *, PyCompilerFlags *, int *, PyArena *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | void *_PyPegen_run_parser(Parser *); | 
					
						
							| 
									
										
										
										
											2020-04-27 18:02:07 +01:00
										 |  |  | mod_ty _PyPegen_run_parser_from_string(const char *, int, PyObject *, PyCompilerFlags *, PyArena *); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | asdl_stmt_seq *_PyPegen_interactive_exit(Parser *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | asdl_seq *_PyPegen_singleton_seq(Parser *, void *); | 
					
						
							|  |  |  | asdl_seq *_PyPegen_seq_insert_in_front(Parser *, void *, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  | asdl_seq *_PyPegen_seq_append_to_end(Parser *, asdl_seq *, void *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | asdl_seq *_PyPegen_seq_flatten(Parser *, asdl_seq *); | 
					
						
							|  |  |  | expr_ty _PyPegen_join_names_with_dot(Parser *, expr_ty, expr_ty); | 
					
						
							|  |  |  | int _PyPegen_seq_count_dots(asdl_seq *); | 
					
						
							| 
									
										
										
										
											2021-04-10 16:56:28 -04:00
										 |  |  | alias_ty _PyPegen_alias_for_star(Parser *, int, int, int, int, PyArena *); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | asdl_identifier_seq *_PyPegen_map_names_to_ids(Parser *, asdl_expr_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | CmpopExprPair *_PyPegen_cmpop_expr_pair(Parser *, cmpop_ty, expr_ty); | 
					
						
							|  |  |  | asdl_int_seq *_PyPegen_get_cmpops(Parser *p, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | asdl_expr_seq *_PyPegen_get_exprs(Parser *, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | expr_ty _PyPegen_set_expr_context(Parser *, expr_ty, expr_context_ty); | 
					
						
							|  |  |  | KeyValuePair *_PyPegen_key_value_pair(Parser *, expr_ty, expr_ty); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | asdl_expr_seq *_PyPegen_get_keys(Parser *, asdl_seq *); | 
					
						
							|  |  |  | asdl_expr_seq *_PyPegen_get_values(Parser *, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-30 12:12:19 -07:00
										 |  |  | NameDefaultPair *_PyPegen_name_default_pair(Parser *, arg_ty, expr_ty, Token *); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | SlashWithDefault *_PyPegen_slash_with_default(Parser *, asdl_arg_seq *, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | StarEtc *_PyPegen_star_etc(Parser *, arg_ty, asdl_seq *, arg_ty); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | arguments_ty _PyPegen_make_arguments(Parser *, asdl_arg_seq *, SlashWithDefault *, | 
					
						
							|  |  |  |                                      asdl_arg_seq *, asdl_seq *, StarEtc *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | arguments_ty _PyPegen_empty_arguments(Parser *); | 
					
						
							|  |  |  | AugOperator *_PyPegen_augoperator(Parser*, operator_ty type); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | stmt_ty _PyPegen_function_def_decorators(Parser *, asdl_expr_seq *, stmt_ty); | 
					
						
							|  |  |  | stmt_ty _PyPegen_class_def_decorators(Parser *, asdl_expr_seq *, stmt_ty); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | KeywordOrStarred *_PyPegen_keyword_or_starred(Parser *, void *, int); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | asdl_expr_seq *_PyPegen_seq_extract_starred_exprs(Parser *, asdl_seq *); | 
					
						
							|  |  |  | asdl_keyword_seq *_PyPegen_seq_delete_starred_exprs(Parser *, asdl_seq *); | 
					
						
							|  |  |  | expr_ty _PyPegen_collect_call_seqs(Parser *, asdl_expr_seq *, asdl_seq *, | 
					
						
							| 
									
										
										
										
											2020-09-03 15:29:32 +01:00
										 |  |  |                      int lineno, int col_offset, int end_lineno, | 
					
						
							|  |  |  |                      int end_col_offset, PyArena *arena); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | expr_ty _PyPegen_concatenate_strings(Parser *p, asdl_seq *); | 
					
						
							|  |  |  | asdl_seq *_PyPegen_join_sequences(Parser *, asdl_seq *, asdl_seq *); | 
					
						
							| 
									
										
										
										
											2020-10-30 23:48:42 +00:00
										 |  |  | int _PyPegen_check_barry_as_flufl(Parser *, Token *); | 
					
						
							| 
									
										
										
										
											2020-09-16 19:42:00 +01:00
										 |  |  | mod_ty _PyPegen_make_module(Parser *, asdl_stmt_seq *); | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-15 02:04:52 +01:00
										 |  |  | // Error reporting helpers
 | 
					
						
							| 
									
										
										
										
											2020-06-19 02:10:43 +03:00
										 |  |  | typedef enum { | 
					
						
							|  |  |  |     STAR_TARGETS, | 
					
						
							|  |  |  |     DEL_TARGETS, | 
					
						
							|  |  |  |     FOR_TARGETS | 
					
						
							|  |  |  | } TARGETS_TYPE; | 
					
						
							|  |  |  | expr_ty _PyPegen_get_invalid_target(expr_ty e, TARGETS_TYPE targets_type); | 
					
						
							| 
									
										
										
										
											2020-06-21 05:18:01 +03:00
										 |  |  | #define RAISE_SYNTAX_ERROR_INVALID_TARGET(type, e) _RAISE_SYNTAX_ERROR_INVALID_TARGET(p, type, e)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Py_LOCAL_INLINE(void *) | 
					
						
							|  |  |  | _RAISE_SYNTAX_ERROR_INVALID_TARGET(Parser *p, TARGETS_TYPE type, void *e) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-10-21 22:53:14 +03:00
										 |  |  |     expr_ty invalid_target = CHECK_NULL_ALLOWED(expr_ty, _PyPegen_get_invalid_target(e, type)); | 
					
						
							| 
									
										
										
										
											2020-06-21 05:18:01 +03:00
										 |  |  |     if (invalid_target != NULL) { | 
					
						
							|  |  |  |         const char *msg; | 
					
						
							|  |  |  |         if (type == STAR_TARGETS || type == FOR_TARGETS) { | 
					
						
							|  |  |  |             msg = "cannot assign to %s"; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |             msg = "cannot delete %s"; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return RAISE_SYNTAX_ERROR_KNOWN_LOCATION( | 
					
						
							|  |  |  |             invalid_target, | 
					
						
							|  |  |  |             msg, | 
					
						
							|  |  |  |             _PyPegen_get_expr_name(invalid_target) | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return RAISE_SYNTAX_ERROR("invalid syntax"); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-06-19 02:10:43 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-18 22:14:47 +03:00
										 |  |  | void *_PyPegen_arguments_parsing_error(Parser *, expr_ty); | 
					
						
							| 
									
										
										
										
											2020-05-22 03:56:52 +03:00
										 |  |  | void *_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args); | 
					
						
							| 
									
										
										
										
											2020-05-18 22:14:47 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-15 02:04:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-19 02:10:43 +03:00
										 |  |  | // Generated function in parse.c - function definition in python.gram
 | 
					
						
							| 
									
										
										
										
											2020-04-22 23:29:27 +01:00
										 |  |  | void *_PyPegen_parse(Parser *); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |