Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 2 | /* Token types */ |
| 3 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 4 | #ifndef Py_TOKEN_H |
| 5 | #define Py_TOKEN_H |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 10 | #define ENDMARKER 0 |
| 11 | #define NAME 1 |
| 12 | #define NUMBER 2 |
| 13 | #define STRING 3 |
| 14 | #define NEWLINE 4 |
| 15 | #define INDENT 5 |
| 16 | #define DEDENT 6 |
| 17 | #define LPAR 7 |
| 18 | #define RPAR 8 |
| 19 | #define LSQB 9 |
| 20 | #define RSQB 10 |
| 21 | #define COLON 11 |
| 22 | #define COMMA 12 |
| 23 | #define SEMI 13 |
| 24 | #define PLUS 14 |
| 25 | #define MINUS 15 |
| 26 | #define STAR 16 |
| 27 | #define SLASH 17 |
| 28 | #define VBAR 18 |
| 29 | #define AMPER 19 |
| 30 | #define LESS 20 |
| 31 | #define GREATER 21 |
| 32 | #define EQUAL 22 |
| 33 | #define DOT 23 |
| 34 | #define PERCENT 24 |
Neal Norwitz | 2eca440 | 2006-08-29 04:40:24 +0000 | [diff] [blame] | 35 | /* #define BACKQUOTE 25 */ |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 36 | #define LBRACE 26 |
| 37 | #define RBRACE 27 |
Guido van Rossum | 8883aaa | 1991-10-20 20:24:45 +0000 | [diff] [blame] | 38 | #define EQEQUAL 28 |
| 39 | #define NOTEQUAL 29 |
| 40 | #define LESSEQUAL 30 |
| 41 | #define GREATEREQUAL 31 |
Guido van Rossum | 7928cd7 | 1991-10-24 14:59:31 +0000 | [diff] [blame] | 42 | #define TILDE 32 |
| 43 | #define CIRCUMFLEX 33 |
| 44 | #define LEFTSHIFT 34 |
| 45 | #define RIGHTSHIFT 35 |
Guido van Rossum | 3d1f095 | 1996-01-12 00:51:44 +0000 | [diff] [blame] | 46 | #define DOUBLESTAR 36 |
Thomas Wouters | dd8dbdb | 2000-08-24 20:09:45 +0000 | [diff] [blame] | 47 | #define PLUSEQUAL 37 |
| 48 | #define MINEQUAL 38 |
| 49 | #define STAREQUAL 39 |
| 50 | #define SLASHEQUAL 40 |
| 51 | #define PERCENTEQUAL 41 |
| 52 | #define AMPEREQUAL 42 |
| 53 | #define VBAREQUAL 43 |
| 54 | #define CIRCUMFLEXEQUAL 44 |
| 55 | #define LEFTSHIFTEQUAL 45 |
| 56 | #define RIGHTSHIFTEQUAL 46 |
| 57 | #define DOUBLESTAREQUAL 47 |
Guido van Rossum | 4668b00 | 2001-08-08 05:00:18 +0000 | [diff] [blame] | 58 | #define DOUBLESLASH 48 |
| 59 | #define DOUBLESLASHEQUAL 49 |
Anthony Baxter | c2a5a63 | 2004-08-02 06:10:11 +0000 | [diff] [blame] | 60 | #define AT 50 |
Neal Norwitz | c150536 | 2006-12-28 06:47:50 +0000 | [diff] [blame] | 61 | #define RARROW 51 |
Georg Brandl | dde0028 | 2007-03-18 19:01:53 +0000 | [diff] [blame] | 62 | #define ELLIPSIS 52 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 63 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ |
Georg Brandl | dde0028 | 2007-03-18 19:01:53 +0000 | [diff] [blame] | 64 | #define OP 53 |
| 65 | #define ERRORTOKEN 54 |
| 66 | #define N_TOKENS 55 |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 67 | |
| 68 | /* Special definitions for cooperation with parser */ |
| 69 | |
| 70 | #define NT_OFFSET 256 |
| 71 | |
| 72 | #define ISTERMINAL(x) ((x) < NT_OFFSET) |
| 73 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) |
| 74 | #define ISEOF(x) ((x) == ENDMARKER) |
| 75 | |
| 76 | |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 77 | PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ |
| 78 | PyAPI_FUNC(int) PyToken_OneChar(int); |
| 79 | PyAPI_FUNC(int) PyToken_TwoChars(int, int); |
| 80 | PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 81 | |
| 82 | #ifdef __cplusplus |
| 83 | } |
| 84 | #endif |
| 85 | #endif /* !Py_TOKEN_H */ |