about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicho Healey <richo@psych0tik.net>2015-01-27 01:02:13 -0800
committerRicho Healey <richo@psych0tik.net>2015-01-27 01:26:03 -0800
commit888a14908806d8f0fc60ff4df44aad6e761d3d00 (patch)
tree24ef0521089880eeb381a86f55de98a0b1f5552e
parent7faffbef68faf268bd310d07df1c24368379dfb9 (diff)
downloadrust-888a14908806d8f0fc60ff4df44aad6e761d3d00.tar.gz
rust-888a14908806d8f0fc60ff4df44aad6e761d3d00.zip
Fix PEP8 for extract_grammar
-rwxr-xr-xsrc/etc/extract_grammar.py136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/etc/extract_grammar.py b/src/etc/extract_grammar.py
index 53781652902..a12c3298cb3 100755
--- a/src/etc/extract_grammar.py
+++ b/src/etc/extract_grammar.py
@@ -14,11 +14,11 @@
 
 import fileinput
 
-collections = { "gram": [],
-                "keyword": [],
-                "reserved": [],
-                "binop": [],
-                "unop": [] }
+collections = {"gram": [],
+               "keyword": [],
+               "reserved": [],
+               "binop": [],
+               "unop": []}
 
 
 in_coll = False
@@ -47,66 +47,66 @@ for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8")):
 # Define operator symbol-names here
 
 tokens = ["non_star", "non_slash", "non_eol",
-          "non_single_quote", "non_double_quote", "ident" ]
+          "non_single_quote", "non_double_quote", "ident"]
 
 symnames = {
-".": "dot",
-"+": "plus",
-"-": "minus",
-"/": "slash",
-"*": "star",
-"%": "percent",
-
-"~": "tilde",
-"@": "at",
-
-"!": "not",
-"&": "and",
-"|": "or",
-"^": "xor",
-
-"<<": "lsl",
-">>": "lsr",
-">>>": "asr",
-
-"&&": "andand",
-"||": "oror",
-
-"<" : "lt",
-"<=" : "le",
-"==" : "eqeq",
-">=" : "ge",
-">" : "gt",
-
-"=": "eq",
-
-"+=": "plusequal",
-"-=": "minusequal",
-"/=": "divequal",
-"*=": "starequal",
-"%=": "percentequal",
-
-"&=": "andequal",
-"|=": "orequal",
-"^=": "xorequal",
-
-">>=": "lsrequal",
-">>>=": "asrequal",
-"<<=": "lslequal",
-
-"::": "coloncolon",
-
-"->": "rightarrow",
-"<-": "leftarrow",
-"<->": "swaparrow",
-
-"//": "linecomment",
-"/*": "openblockcomment",
-"*/": "closeblockcomment",
-"macro_rules": "macro_rules",
-"=>" : "eg",
-".." : "dotdot",
-","  : "comma"
+    ".": "dot",
+    "+": "plus",
+    "-": "minus",
+    "/": "slash",
+    "*": "star",
+    "%": "percent",
+
+    "~": "tilde",
+    "@": "at",
+
+    "!": "not",
+    "&": "and",
+    "|": "or",
+    "^": "xor",
+
+    "<<": "lsl",
+    ">>": "lsr",
+    ">>>": "asr",
+
+    "&&": "andand",
+    "||": "oror",
+
+    "<": "lt",
+    "<=": "le",
+    "==": "eqeq",
+    ">=": "ge",
+    ">": "gt",
+
+    "=": "eq",
+
+    "+=": "plusequal",
+    "-=": "minusequal",
+    "/=": "divequal",
+    "*=": "starequal",
+    "%=": "percentequal",
+
+    "&=": "andequal",
+    "|=": "orequal",
+    "^=": "xorequal",
+
+    ">>=": "lsrequal",
+    ">>>=": "asrequal",
+    "<<=": "lslequal",
+
+    "::": "coloncolon",
+
+    "->": "rightarrow",
+    "<-": "leftarrow",
+    "<->": "swaparrow",
+
+    "//": "linecomment",
+    "/*": "openblockcomment",
+    "*/": "closeblockcomment",
+    "macro_rules": "macro_rules",
+    "=>": "eg",
+    "..": "dotdot",
+    ",": "comma"
 }
 
 lines = []
@@ -126,8 +126,8 @@ for line in collections["gram"]:
                                         + word)
                 if word not in tokens:
                     if (word in collections["keyword"] or
-                        word in collections["reserved"]):
-                       tokens.append(word)
+                            word in collections["reserved"]):
+                        tokens.append(word)
                     else:
                         raise Exception("unknown keyword/reserved word: "
                                         + word)
@@ -149,8 +149,8 @@ for sym in collections["unop"] + collections["binop"] + symnames.keys():
 print("%start parser, token;")
 print("%%token %s ;" % ("\n\t, ".join(tokens)))
 for coll in ["keyword", "reserved"]:
-    print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])));
+    print("%s: %s ; " % (coll, "\n\t| ".join(collections[coll])))
 for coll in ["binop", "unop"]:
     print("%s: %s ; " % (coll, "\n\t| ".join([symnames[x]
-                                              for x in collections[coll]])));
-print("\n".join(lines));
+                                              for x in collections[coll]])))
+print("\n".join(lines))