Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 1 | #ifndef Py_TOKEN_H |
| 2 | #define Py_TOKEN_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 7 | /*********************************************************** |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 8 | Copyright (c) 2000, BeOpen.com. |
| 9 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
| 10 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
| 11 | All rights reserved. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 12 | |
Guido van Rossum | fd71b9e | 2000-06-30 23:50:40 +0000 | [diff] [blame] | 13 | See the file "Misc/COPYRIGHT" for information on usage and |
| 14 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 15 | ******************************************************************/ |
| 16 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 17 | /* Token types */ |
| 18 | |
| 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 |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 56 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ |
Guido van Rossum | 3d1f095 | 1996-01-12 00:51:44 +0000 | [diff] [blame] | 57 | #define OP 37 |
| 58 | #define ERRORTOKEN 38 |
| 59 | #define N_TOKENS 39 |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 60 | |
| 61 | /* Special definitions for cooperation with parser */ |
| 62 | |
| 63 | #define NT_OFFSET 256 |
| 64 | |
| 65 | #define ISTERMINAL(x) ((x) < NT_OFFSET) |
| 66 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) |
| 67 | #define ISEOF(x) ((x) == ENDMARKER) |
| 68 | |
| 69 | |
Guido van Rossum | 43466ec | 1998-12-04 18:48:25 +0000 | [diff] [blame] | 70 | extern DL_IMPORT(char *) _PyParser_TokenNames[]; /* Token names */ |
| 71 | extern DL_IMPORT(int) PyToken_OneChar Py_PROTO((int)); |
| 72 | extern DL_IMPORT(int) PyToken_TwoChars Py_PROTO((int, int)); |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 73 | |
| 74 | #ifdef __cplusplus |
| 75 | } |
| 76 | #endif |
| 77 | #endif /* !Py_TOKEN_H */ |