]> git.madduck.net Git - etc/vim.git/blob - src/blib2to3/pgen2/token.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Handle .COLOR_DIFF in the same way as .DIFF (#1673)
[etc/vim.git] / src / blib2to3 / pgen2 / token.py
1 """Token constants (from "token.h")."""
2
3 from typing import Dict
4 from typing_extensions import Final
5
6 #  Taken from Python (r53757) and modified to include some tokens
7 #   originally monkeypatched in by pgen2.tokenize
8
9 # --start constants--
10 ENDMARKER: Final = 0
11 NAME: Final = 1
12 NUMBER: Final = 2
13 STRING: Final = 3
14 NEWLINE: Final = 4
15 INDENT: Final = 5
16 DEDENT: Final = 6
17 LPAR: Final = 7
18 RPAR: Final = 8
19 LSQB: Final = 9
20 RSQB: Final = 10
21 COLON: Final = 11
22 COMMA: Final = 12
23 SEMI: Final = 13
24 PLUS: Final = 14
25 MINUS: Final = 15
26 STAR: Final = 16
27 SLASH: Final = 17
28 VBAR: Final = 18
29 AMPER: Final = 19
30 LESS: Final = 20
31 GREATER: Final = 21
32 EQUAL: Final = 22
33 DOT: Final = 23
34 PERCENT: Final = 24
35 BACKQUOTE: Final = 25
36 LBRACE: Final = 26
37 RBRACE: Final = 27
38 EQEQUAL: Final = 28
39 NOTEQUAL: Final = 29
40 LESSEQUAL: Final = 30
41 GREATEREQUAL: Final = 31
42 TILDE: Final = 32
43 CIRCUMFLEX: Final = 33
44 LEFTSHIFT: Final = 34
45 RIGHTSHIFT: Final = 35
46 DOUBLESTAR: Final = 36
47 PLUSEQUAL: Final = 37
48 MINEQUAL: Final = 38
49 STAREQUAL: Final = 39
50 SLASHEQUAL: Final = 40
51 PERCENTEQUAL: Final = 41
52 AMPEREQUAL: Final = 42
53 VBAREQUAL: Final = 43
54 CIRCUMFLEXEQUAL: Final = 44
55 LEFTSHIFTEQUAL: Final = 45
56 RIGHTSHIFTEQUAL: Final = 46
57 DOUBLESTAREQUAL: Final = 47
58 DOUBLESLASH: Final = 48
59 DOUBLESLASHEQUAL: Final = 49
60 AT: Final = 50
61 ATEQUAL: Final = 51
62 OP: Final = 52
63 COMMENT: Final = 53
64 NL: Final = 54
65 RARROW: Final = 55
66 AWAIT: Final = 56
67 ASYNC: Final = 57
68 ERRORTOKEN: Final = 58
69 COLONEQUAL: Final = 59
70 N_TOKENS: Final = 60
71 NT_OFFSET: Final = 256
72 # --end constants--
73
74 tok_name: Final[Dict[int, str]] = {}
75 for _name, _value in list(globals().items()):
76     if type(_value) is type(0):
77         tok_name[_value] = _name
78
79
80 def ISTERMINAL(x: int) -> bool:
81     return x < NT_OFFSET
82
83
84 def ISNONTERMINAL(x: int) -> bool:
85     return x >= NT_OFFSET
86
87
88 def ISEOF(x: int) -> bool:
89     return x == ENDMARKER