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

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