Skip to content

Commit 706a74a

Browse files
committed
---
yaml --- r: 177774 b: refs/heads/snap-stage3 c: 888a149 h: refs/heads/master v: v3
1 parent c9afdba commit 706a74a

File tree

2 files changed

+69
-69
lines changed

2 files changed

+69
-69
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 474b324eda10440d6568ef872a7307d38e7de95b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7faffbef68faf268bd310d07df1c24368379dfb9
4+
refs/heads/snap-stage3: 888a14908806d8f0fc60ff4df44aad6e761d3d00
55
refs/heads/try: fde4472848b662a4d1236388c4cf15e2450237e6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/etc/extract_grammar.py

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
import fileinput
1616

17-
collections = { "gram": [],
18-
"keyword": [],
19-
"reserved": [],
20-
"binop": [],
21-
"unop": [] }
17+
collections = {"gram": [],
18+
"keyword": [],
19+
"reserved": [],
20+
"binop": [],
21+
"unop": []}
2222

2323

2424
in_coll = False
@@ -47,66 +47,66 @@
4747
# Define operator symbol-names here
4848

4949
tokens = ["non_star", "non_slash", "non_eol",
50-
"non_single_quote", "non_double_quote", "ident" ]
50+
"non_single_quote", "non_double_quote", "ident"]
5151

5252
symnames = {
53-
".": "dot",
54-
"+": "plus",
55-
"-": "minus",
56-
"/": "slash",
57-
"*": "star",
58-
"%": "percent",
59-
60-
"~": "tilde",
61-
"@": "at",
62-
63-
"!": "not",
64-
"&": "and",
65-
"|": "or",
66-
"^": "xor",
67-
68-
"<<": "lsl",
69-
">>": "lsr",
70-
">>>": "asr",
71-
72-
"&&": "andand",
73-
"||": "oror",
74-
75-
"<" : "lt",
76-
"<=" : "le",
77-
"==" : "eqeq",
78-
">=" : "ge",
79-
">" : "gt",
80-
81-
"=": "eq",
82-
83-
"+=": "plusequal",
84-
"-=": "minusequal",
85-
"/=": "divequal",
86-
"*=": "starequal",
87-
"%=": "percentequal",
88-
89-
"&=": "andequal",
90-
"|=": "orequal",
91-
"^=": "xorequal",
92-
93-
">>=": "lsrequal",
94-
">>>=": "asrequal",
95-
"<<=": "lslequal",
96-
97-
"::": "coloncolon",
98-
99-
"->": "rightarrow",
100-
"<-": "leftarrow",
101-
"<->": "swaparrow",
102-
103-
"//": "linecomment",
104-
"/*": "openblockcomment",
105-
"*/": "closeblockcomment",
106-
"macro_rules": "macro_rules",
107-
"=>" : "eg",
108-
".." : "dotdot",
109-
"," : "comma"
53+
".": "dot",
54+
"+": "plus",
55+
"-": "minus",
56+
"/": "slash",
57+
"*": "star",
58+
"%": "percent",
59+
60+
"~": "tilde",
61+
"@": "at",
62+
63+
"!": "not",
64+
"&": "and",
65+
"|": "or",
66+
"^": "xor",
67+
68+
"<<": "lsl",
69+
">>": "lsr",
70+
">>>": "asr",
71+
72+
"&&": "andand",
73+
"||": "oror",
74+
75+
"<": "lt",
76+
"<=": "le",
77+
"==": "eqeq",
78+
">=": "ge",
79+
">": "gt",
80+
81+
"=": "eq",
82+
83+
"+=": "plusequal",
84+
"-=": "minusequal",
85+
"/=": "divequal",
86+
"*=": "starequal",
87+
"%=": "percentequal",
88+
89+
"&=": "andequal",
90+
"|=": "orequal",
91+
"^=": "xorequal",
92+
93+
">>=": "lsrequal",
94+
">>>=": "asrequal",
95+
"<<=": "lslequal",
96+
97+
"::": "coloncolon",
98+
99+
"->": "rightarrow",
100+
"<-": "leftarrow",
101+
"<->": "swaparrow",
102+
103+
"//": "linecomment",
104+
"/*": "openblockcomment",
105+
"*/": "closeblockcomment",
106+
"macro_rules": "macro_rules",
107+
"=>": "eg",
108+
"..": "dotdot",
109+
",": "comma"
110110
}
111111

112112
lines = []
@@ -126,8 +126,8 @@
126126
+ word)
127127
if word not in tokens:
128128
if (word in collections["keyword"] or
129-
word in collections["reserved"]):
130-
tokens.append(word)
129+
word in collections["reserved"]):
130+
tokens.append(word)
131131
else:
132132
raise Exception("unknown keyword/reserved word: "
133133
+ word)
@@ -149,8 +149,8 @@
149149
print("%start parser, token;")
150150
print("%%token %s ;" % ("\n\t, ".join(tokens)))
151151
for coll in ["keyword", "reserved"]:
152-
print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])));
152+
print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])))
153153
for coll in ["binop", "unop"]:
154154
print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x]
155-
for x in collections[coll]])));
156-
print("\n".join(lines));
155+
for x in collections[coll]])))
156+
print("\n".join(lines))

0 commit comments

Comments
 (0)