blob: b28830b8b40387c55ebcf3c7adaa22030ab12922 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00002/* Token types */
Martin v. Löwis4d0d4712010-12-03 20:14:31 +00003#ifndef Py_LIMITED_API
Fred Drake3cf4d2b2000-07-09 00:55:06 +00004#ifndef Py_TOKEN_H
5#define Py_TOKEN_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
R. David Murray051176f2010-10-18 00:15:31 +000010#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
11
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000012#define ENDMARKER 0
13#define NAME 1
14#define NUMBER 2
15#define STRING 3
16#define NEWLINE 4
17#define INDENT 5
18#define DEDENT 6
19#define LPAR 7
20#define RPAR 8
21#define LSQB 9
22#define RSQB 10
23#define COLON 11
24#define COMMA 12
25#define SEMI 13
26#define PLUS 14
27#define MINUS 15
28#define STAR 16
29#define SLASH 17
30#define VBAR 18
31#define AMPER 19
32#define LESS 20
33#define GREATER 21
34#define EQUAL 22
35#define DOT 23
36#define PERCENT 24
Meador Inge33880602012-01-15 19:15:36 -060037#define LBRACE 25
38#define RBRACE 26
39#define EQEQUAL 27
40#define NOTEQUAL 28
41#define LESSEQUAL 29
42#define GREATEREQUAL 30
43#define TILDE 31
44#define CIRCUMFLEX 32
45#define LEFTSHIFT 33
46#define RIGHTSHIFT 34
47#define DOUBLESTAR 35
48#define PLUSEQUAL 36
49#define MINEQUAL 37
50#define STAREQUAL 38
51#define SLASHEQUAL 39
52#define PERCENTEQUAL 40
53#define AMPEREQUAL 41
54#define VBAREQUAL 42
55#define CIRCUMFLEXEQUAL 43
56#define LEFTSHIFTEQUAL 44
57#define RIGHTSHIFTEQUAL 45
58#define DOUBLESTAREQUAL 46
59#define DOUBLESLASH 47
60#define DOUBLESLASHEQUAL 48
Benjamin Petersond51374e2014-04-09 23:55:56 -040061#define AT 49
62#define ATEQUAL 50
63#define RARROW 51
64#define ELLIPSIS 52
Guido van Rossumcaa63801995-01-12 11:45:45 +000065/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
Benjamin Petersond51374e2014-04-09 23:55:56 -040066#define OP 53
Yury Selivanov75445082015-05-11 22:57:16 -040067#define AWAIT 54
68#define ASYNC 55
69#define ERRORTOKEN 56
Albert-Jan Nijburgfc354f02017-05-31 15:00:21 +010070/* These aren't used by the C tokenizer but are needed for tokenize.py */
71#define COMMENT 57
72#define NL 58
73#define ENCODING 59
74#define N_TOKENS 60
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000075
76/* Special definitions for cooperation with parser */
77
78#define NT_OFFSET 256
79
80#define ISTERMINAL(x) ((x) < NT_OFFSET)
81#define ISNONTERMINAL(x) ((x) >= NT_OFFSET)
82#define ISEOF(x) ((x) == ENDMARKER)
83
84
Benjamin Petersond0845582012-10-24 08:21:52 -070085PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */
Mark Hammond91a681d2002-08-12 07:21:58 +000086PyAPI_FUNC(int) PyToken_OneChar(int);
87PyAPI_FUNC(int) PyToken_TwoChars(int, int);
88PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int);
Guido van Rossuma3309961993-07-28 09:05:47 +000089
90#ifdef __cplusplus
91}
92#endif
93#endif /* !Py_TOKEN_H */
Martin v. Löwis4d0d4712010-12-03 20:14:31 +000094#endif /* Py_LIMITED_API */