1 
2 /* Parser-tokenizer link interface */
3 #ifndef Py_LIMITED_API
4 #ifndef Py_PARSETOK_H
5 #define Py_PARSETOK_H
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef struct {
11     int error;
12 #ifndef PGEN
13     /* The filename is useless for pgen, see comment in tok_state structure */
14     PyObject *filename;
15 #endif
16     int lineno;
17     int offset;
18     char *text;                 /* UTF-8-encoded string */
19     int token;
20     int expected;
21 } perrdetail;
22 
23 #if 0
24 #define PyPARSE_YIELD_IS_KEYWORD	0x0001
25 #endif
26 
27 #define PyPARSE_DONT_IMPLY_DEDENT	0x0002
28 
29 #if 0
30 #define PyPARSE_WITH_IS_KEYWORD		0x0003
31 #define PyPARSE_PRINT_IS_FUNCTION       0x0004
32 #define PyPARSE_UNICODE_LITERALS        0x0008
33 #endif
34 
35 #define PyPARSE_IGNORE_COOKIE 0x0010
36 #define PyPARSE_BARRY_AS_BDFL 0x0020
37 
38 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
39                                               perrdetail *);
40 PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
41                                              const char *, const char *,
42                                              perrdetail *);
43 
44 PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
45                                               perrdetail *, int);
46 PyAPI_FUNC(node *) PyParser_ParseFileFlags(
47     FILE *fp,
48     const char *filename,       /* decoded from the filesystem encoding */
49     const char *enc,
50     grammar *g,
51     int start,
52     const char *ps1,
53     const char *ps2,
54     perrdetail *err_ret,
55     int flags);
56 PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
57     FILE *fp,
58     const char *filename,       /* decoded from the filesystem encoding */
59     const char *enc,
60     grammar *g,
61     int start,
62     const char *ps1,
63     const char *ps2,
64     perrdetail *err_ret,
65     int *flags);
66 PyAPI_FUNC(node *) PyParser_ParseFileObject(
67     FILE *fp,
68     PyObject *filename,
69     const char *enc,
70     grammar *g,
71     int start,
72     const char *ps1,
73     const char *ps2,
74     perrdetail *err_ret,
75     int *flags);
76 
77 PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(
78     const char *s,
79     const char *filename,       /* decoded from the filesystem encoding */
80     grammar *g,
81     int start,
82     perrdetail *err_ret,
83     int flags);
84 PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(
85     const char *s,
86     const char *filename,       /* decoded from the filesystem encoding */
87     grammar *g,
88     int start,
89     perrdetail *err_ret,
90     int *flags);
91 PyAPI_FUNC(node *) PyParser_ParseStringObject(
92     const char *s,
93     PyObject *filename,
94     grammar *g,
95     int start,
96     perrdetail *err_ret,
97     int *flags);
98 
99 /* Note that the following functions are defined in pythonrun.c,
100    not in parsetok.c */
101 PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
102 PyAPI_FUNC(void) PyParser_ClearError(perrdetail *);
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 #endif /* !Py_PARSETOK_H */
108 #endif /* !Py_LIMITED_API */
109