• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Parser-tokenizer link interface */
2 
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 #include "grammar.h"      /* grammar */
11 #include "node.h"         /* node */
12 
13 typedef struct {
14     int error;
15     PyObject *filename;
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 #define PyPARSE_TYPE_COMMENTS 0x0040
38 #define PyPARSE_ASYNC_HACKS   0x0080
39 
40 PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
41                                               perrdetail *);
42 PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
43                                              const char *, const char *,
44                                              perrdetail *);
45 
46 PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
47                                               perrdetail *, int);
48 PyAPI_FUNC(node *) PyParser_ParseFileFlags(
49     FILE *fp,
50     const char *filename,       /* decoded from the filesystem encoding */
51     const char *enc,
52     grammar *g,
53     int start,
54     const char *ps1,
55     const char *ps2,
56     perrdetail *err_ret,
57     int flags);
58 PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(
59     FILE *fp,
60     const char *filename,       /* decoded from the filesystem encoding */
61     const char *enc,
62     grammar *g,
63     int start,
64     const char *ps1,
65     const char *ps2,
66     perrdetail *err_ret,
67     int *flags);
68 PyAPI_FUNC(node *) PyParser_ParseFileObject(
69     FILE *fp,
70     PyObject *filename,
71     const char *enc,
72     grammar *g,
73     int start,
74     const char *ps1,
75     const char *ps2,
76     perrdetail *err_ret,
77     int *flags);
78 
79 PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(
80     const char *s,
81     const char *filename,       /* decoded from the filesystem encoding */
82     grammar *g,
83     int start,
84     perrdetail *err_ret,
85     int flags);
86 PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(
87     const char *s,
88     const char *filename,       /* decoded from the filesystem encoding */
89     grammar *g,
90     int start,
91     perrdetail *err_ret,
92     int *flags);
93 PyAPI_FUNC(node *) PyParser_ParseStringObject(
94     const char *s,
95     PyObject *filename,
96     grammar *g,
97     int start,
98     perrdetail *err_ret,
99     int *flags);
100 
101 /* Note that the following functions are defined in pythonrun.c,
102    not in parsetok.c */
103 PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
104 PyAPI_FUNC(void) PyParser_ClearError(perrdetail *);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 #endif /* !Py_PARSETOK_H */
110 #endif /* !Py_LIMITED_API */
111