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 */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 3 | #ifndef Py_LIMITED_API |
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 | |
R. David Murray | 051176f | 2010-10-18 00:15:31 +0000 | [diff] [blame] | 10 | #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ |
| 11 | |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 12 | #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 |
| 37 | #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 |
Meador Inge | 3388060 | 2012-01-15 19:15:36 -0600 | [diff] [blame] | 60 | #define DOUBLESLASHEQUAL 48 |
Benjamin Peterson | d51374e | 2014-04-09 23:55:56 -0400 | [diff] [blame] | 61 | #define AT 49 |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 62 | #define ATEQUAL 50 |
Benjamin Peterson | d51374e | 2014-04-09 23:55:56 -0400 | [diff] [blame] | 63 | #define RARROW 51 |
| 64 | #define ELLIPSIS 52 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 65 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 66 | #define OP 53 |
| 67 | #define ERRORTOKEN 54 |
Albert-Jan Nijburg | fc354f0 | 2017-05-31 15:00:21 +0100 | [diff] [blame] | 68 | /* These aren't used by the C tokenizer but are needed for tokenize.py */ |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 69 | #define COMMENT 55 |
| 70 | #define NL 56 |
| 71 | #define ENCODING 57 |
| 72 | #define N_TOKENS 58 |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 73 | |
| 74 | /* Special definitions for cooperation with parser */ |
| 75 | |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 76 | #define NT_OFFSET 256 |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 77 | |
Jelle Zijlstra | ac31770 | 2017-10-05 20:24:46 -0700 | [diff] [blame] | 78 | #define ISTERMINAL(x) ((x) < NT_OFFSET) |
| 79 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) |
| 80 | #define ISEOF(x) ((x) == ENDMARKER) |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 81 | |
| 82 | |
Benjamin Peterson | d084558 | 2012-10-24 08:21:52 -0700 | [diff] [blame] | 83 | PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */ |
Mark Hammond | 91a681d | 2002-08-12 07:21:58 +0000 | [diff] [blame] | 84 | PyAPI_FUNC(int) PyToken_OneChar(int); |
| 85 | PyAPI_FUNC(int) PyToken_TwoChars(int, int); |
| 86 | PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 87 | |
| 88 | #ifdef __cplusplus |
| 89 | } |
| 90 | #endif |
| 91 | #endif /* !Py_TOKEN_H */ |
Martin v. Löwis | 4d0d471 | 2010-12-03 20:14:31 +0000 | [diff] [blame] | 92 | #endif /* Py_LIMITED_API */ |