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

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