-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2c1c19
commit 89f753a
Showing
3 changed files
with
0 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +0,0 @@ | ||
from os.path import join, abspath, dirname | ||
|
||
DIR = dirname(abspath(__file__)) | ||
|
||
token_dict = {} # 创建一个空字典 | ||
|
||
with open(join(DIR, "..", "psi", "Grammar", "Token"), "r") as file: | ||
for line in file: | ||
if line := line.strip(): | ||
values = line.split() # 使用空格分割行,得到值列表 | ||
code = values[0] # 第一个值为代码 | ||
symbol = ( | ||
values[1] if len(values) > 1 else None | ||
) # 第二个值为符号,如果没有第二个值,则设置为None | ||
token_dict[code] = symbol # 将代码和符号添加到字典中 | ||
|
||
# 将字典中的键值对转换为多个变量及其对应的值 | ||
for code, symbol in token_dict.items(): | ||
globals()[code] = symbol | ||
|
||
# 打印变量及其对应的值 | ||
print(LPAR) | ||
print(RPAR) | ||
print(AWAIT) | ||
# 其他变量... | ||
This file was deleted.
Oops, something went wrong.
Empty file.