]> 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:

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