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