token.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Token types */
  2. #ifndef Py_TOKEN_H
  3. #define Py_TOKEN_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */
  8. #define ENDMARKER 0
  9. #define NAME 1
  10. #define NUMBER 2
  11. #define STRING 3
  12. #define NEWLINE 4
  13. #define INDENT 5
  14. #define DEDENT 6
  15. #define LPAR 7
  16. #define RPAR 8
  17. #define LSQB 9
  18. #define RSQB 10
  19. #define COLON 11
  20. #define COMMA 12
  21. #define SEMI 13
  22. #define PLUS 14
  23. #define MINUS 15
  24. #define STAR 16
  25. #define SLASH 17
  26. #define VBAR 18
  27. #define AMPER 19
  28. #define LESS 20
  29. #define GREATER 21
  30. #define EQUAL 22
  31. #define DOT 23
  32. #define PERCENT 24
  33. #define BACKQUOTE 25
  34. #define LBRACE 26
  35. #define RBRACE 27
  36. #define EQEQUAL 28
  37. #define NOTEQUAL 29
  38. #define LESSEQUAL 30
  39. #define GREATEREQUAL 31
  40. #define TILDE 32
  41. #define CIRCUMFLEX 33
  42. #define LEFTSHIFT 34
  43. #define RIGHTSHIFT 35
  44. #define DOUBLESTAR 36
  45. #define PLUSEQUAL 37
  46. #define MINEQUAL 38
  47. #define STAREQUAL 39
  48. #define SLASHEQUAL 40
  49. #define PERCENTEQUAL 41
  50. #define AMPEREQUAL 42
  51. #define VBAREQUAL 43
  52. #define CIRCUMFLEXEQUAL 44
  53. #define LEFTSHIFTEQUAL 45
  54. #define RIGHTSHIFTEQUAL 46
  55. #define DOUBLESTAREQUAL 47
  56. #define DOUBLESLASH 48
  57. #define DOUBLESLASHEQUAL 49
  58. #define AT 50
  59. /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
  60. #define OP 51
  61. #define ERRORTOKEN 52
  62. #define N_TOKENS 53
  63. /* Special definitions for cooperation with parser */
  64. #define NT_OFFSET 256
  65. #define ISTERMINAL(x) ((x) < NT_OFFSET)
  66. #define ISNONTERMINAL(x) ((x) >= NT_OFFSET)
  67. #define ISEOF(x) ((x) == ENDMARKER)
  68. PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */
  69. PyAPI_FUNC(int) PyToken_OneChar(int);
  70. PyAPI_FUNC(int) PyToken_TwoChars(int, int);
  71. PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int);
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif /* !Py_TOKEN_H */