blob: af805705db8c34d281808c5e784586f942dc8761 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00002/* Parser-tokenizer link interface */
3
Fred Drake5eb6d4e2000-07-08 23:37:28 +00004#ifndef Py_PARSETOK_H
5#define Py_PARSETOK_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
Guido van Rossumb6775db1994-08-01 11:34:53 +000010typedef struct {
Fred Drake5eb6d4e2000-07-08 23:37:28 +000011 int error;
Martin v. Löwis95292d62002-12-11 14:04:59 +000012 const char *filename;
Fred Drake5eb6d4e2000-07-08 23:37:28 +000013 int lineno;
14 int offset;
15 char *text;
Fred Drake85f36392000-07-11 17:53:00 +000016 int token;
17 int expected;
Guido van Rossumb6775db1994-08-01 11:34:53 +000018} perrdetail;
19
Neil Schemenauerc24ea082002-03-22 23:53:36 +000020#if 0
Tim Petersfe2127d2001-07-16 05:37:24 +000021#define PyPARSE_YIELD_IS_KEYWORD 0x0001
Neil Schemenauerc24ea082002-03-22 23:53:36 +000022#endif
Tim Petersfe2127d2001-07-16 05:37:24 +000023
Guido van Rossum4b499dd32003-02-13 22:07:59 +000024#define PyPARSE_DONT_IMPLY_DEDENT 0x0002
25
Guido van Rossum45aecf42006-03-15 04:58:47 +000026#if 0
Thomas Wouters34aa7ba2006-02-28 19:02:24 +000027#define PyPARSE_WITH_IS_KEYWORD 0x0003
Christian Heimes4d6ec852008-03-26 22:34:47 +000028#define PyPARSE_PRINT_IS_FUNCTION 0x0004
29#define PyPARSE_UNICODE_LITERALS 0x0008
Guido van Rossum45aecf42006-03-15 04:58:47 +000030#endif
Thomas Wouters34aa7ba2006-02-28 19:02:24 +000031
Benjamin Petersonf5b52242009-03-02 23:31:26 +000032#define PyPARSE_IGNORE_COOKIE 0x0010
Brett Cannone3944a52009-04-01 05:08:41 +000033#define PyPARSE_BARRY_AS_BDFL 0x0020
Benjamin Petersonf5b52242009-03-02 23:31:26 +000034
Martin v. Löwis95292d62002-12-11 14:04:59 +000035PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int,
Fred Drake5eb6d4e2000-07-08 23:37:28 +000036 perrdetail *);
Martin v. Löwis95292d62002-12-11 14:04:59 +000037PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int,
Fred Drake5eb6d4e2000-07-08 23:37:28 +000038 char *, char *, perrdetail *);
Guido van Rossuma3309961993-07-28 09:05:47 +000039
Martin v. Löwis95292d62002-12-11 14:04:59 +000040PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int,
Tim Petersfe2127d2001-07-16 05:37:24 +000041 perrdetail *, int);
Martin v. Löwis85bcc662007-09-04 09:18:06 +000042PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *,
43 const char*, grammar *,
Tim Petersfe2127d2001-07-16 05:37:24 +000044 int, char *, char *,
45 perrdetail *, int);
Christian Heimes4d6ec852008-03-26 22:34:47 +000046PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *,
47 const char*, grammar *,
48 int, char *, char *,
49 perrdetail *, int *);
Tim Petersfe2127d2001-07-16 05:37:24 +000050
Martin v. Löwis95292d62002-12-11 14:04:59 +000051PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *,
52 const char *,
Thomas Heller6b17abf2002-07-09 09:23:27 +000053 grammar *, int,
54 perrdetail *, int);
Christian Heimes4d6ec852008-03-26 22:34:47 +000055PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *,
56 const char *,
57 grammar *, int,
58 perrdetail *, int *);
Guido van Rossumd3ab37f2003-04-17 14:55:42 +000059
60/* Note that he following function is defined in pythonrun.c not parsetok.c. */
61PyAPI_FUNC(void) PyParser_SetError(perrdetail *);
62
Guido van Rossuma3309961993-07-28 09:05:47 +000063#ifdef __cplusplus
64}
65#endif
66#endif /* !Py_PARSETOK_H */