1 2/* Token types */ 3 4#ifndef Py_TOKEN_H 5#define Py_TOKEN_H 6#ifdef __cplusplus 7extern "C" { 8#endif 9 10#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ 11 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 BACKQUOTE 25 38#define LBRACE 26 39#define RBRACE 27 40#define EQEQUAL 28 41#define NOTEQUAL 29 42#define LESSEQUAL 30 43#define GREATEREQUAL 31 44#define TILDE 32 45#define CIRCUMFLEX 33 46#define LEFTSHIFT 34 47#define RIGHTSHIFT 35 48#define DOUBLESTAR 36 49#define PLUSEQUAL 37 50#define MINEQUAL 38 51#define STAREQUAL 39 52#define SLASHEQUAL 40 53#define PERCENTEQUAL 41 54#define AMPEREQUAL 42 55#define VBAREQUAL 43 56#define CIRCUMFLEXEQUAL 44 57#define LEFTSHIFTEQUAL 45 58#define RIGHTSHIFTEQUAL 46 59#define DOUBLESTAREQUAL 47 60#define DOUBLESLASH 48 61#define DOUBLESLASHEQUAL 49 62#define AT 50 63/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ 64#define OP 51 65#define ERRORTOKEN 52 66#define N_TOKENS 53 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 77PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ 78PyAPI_FUNC(int) PyToken_OneChar(int); 79PyAPI_FUNC(int) PyToken_TwoChars(int, int); 80PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); 81 82#ifdef __cplusplus 83} 84#endif 85#endif /* !Py_TOKEN_H */ 86