Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 1 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 2 | Copyright (c) 2000, BeOpen.com. |
| 3 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 4 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 5 | All rights reserved. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 7 | See the file "Misc/COPYRIGHT" for information on usage and |
| 8 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 9 | ******************************************************************/ |
| 10 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 11 | /* Token types */ |
| 12 | |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 13 | #ifndef Py_TOKEN_H |
| 14 | #define Py_TOKEN_H |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 19 | #define ENDMARKER 0 |
| 20 | #define NAME 1 |
| 21 | #define NUMBER 2 |
| 22 | #define STRING 3 |
| 23 | #define NEWLINE 4 |
| 24 | #define INDENT 5 |
| 25 | #define DEDENT 6 |
| 26 | #define LPAR 7 |
| 27 | #define RPAR 8 |
| 28 | #define LSQB 9 |
| 29 | #define RSQB 10 |
| 30 | #define COLON 11 |
| 31 | #define COMMA 12 |
| 32 | #define SEMI 13 |
| 33 | #define PLUS 14 |
| 34 | #define MINUS 15 |
| 35 | #define STAR 16 |
| 36 | #define SLASH 17 |
| 37 | #define VBAR 18 |
| 38 | #define AMPER 19 |
| 39 | #define LESS 20 |
| 40 | #define GREATER 21 |
| 41 | #define EQUAL 22 |
| 42 | #define DOT 23 |
| 43 | #define PERCENT 24 |
| 44 | #define BACKQUOTE 25 |
| 45 | #define LBRACE 26 |
| 46 | #define RBRACE 27 |
Guido van Rossum | 8883aaa | 1991-10-20 20:24:45 +0000 | [diff] [blame] | 47 | #define EQEQUAL 28 |
| 48 | #define NOTEQUAL 29 |
| 49 | #define LESSEQUAL 30 |
| 50 | #define GREATEREQUAL 31 |
Guido van Rossum | 7928cd7 | 1991-10-24 14:59:31 +0000 | [diff] [blame] | 51 | #define TILDE 32 |
| 52 | #define CIRCUMFLEX 33 |
| 53 | #define LEFTSHIFT 34 |
| 54 | #define RIGHTSHIFT 35 |
Guido van Rossum | 3d1f095 | 1996-01-12 00:51:44 +0000 | [diff] [blame] | 55 | #define DOUBLESTAR 36 |
Thomas Wouters | dd8dbdb | 2000-08-24 20:09:45 +0000 | [diff] [blame] | 56 | #define PLUSEQUAL 37 |
| 57 | #define MINEQUAL 38 |
| 58 | #define STAREQUAL 39 |
| 59 | #define SLASHEQUAL 40 |
| 60 | #define PERCENTEQUAL 41 |
| 61 | #define AMPEREQUAL 42 |
| 62 | #define VBAREQUAL 43 |
| 63 | #define CIRCUMFLEXEQUAL 44 |
| 64 | #define LEFTSHIFTEQUAL 45 |
| 65 | #define RIGHTSHIFTEQUAL 46 |
| 66 | #define DOUBLESTAREQUAL 47 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 67 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ |
Thomas Wouters | dd8dbdb | 2000-08-24 20:09:45 +0000 | [diff] [blame] | 68 | #define OP 48 |
| 69 | #define ERRORTOKEN 49 |
| 70 | #define N_TOKENS 50 |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 71 | |
| 72 | /* Special definitions for cooperation with parser */ |
| 73 | |
| 74 | #define NT_OFFSET 256 |
| 75 | |
| 76 | #define ISTERMINAL(x) ((x) < NT_OFFSET) |
| 77 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) |
| 78 | #define ISEOF(x) ((x) == ENDMARKER) |
| 79 | |
| 80 | |
Guido van Rossum | 43466ec | 1998-12-04 18:48:25 +0000 | [diff] [blame] | 81 | extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */ |
Fred Drake | 3cf4d2b | 2000-07-09 00:55:06 +0000 | [diff] [blame] | 82 | extern DL_IMPORT(int) PyToken_OneChar(int); |
| 83 | extern DL_IMPORT(int) PyToken_TwoChars(int, int); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 84 | |
| 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | #endif /* !Py_TOKEN_H */ |