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

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