Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/etc/check-summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

if __name__ == '__main__':
summaries = []

def summarise(fname):
summary = {}
with open(fname) as fd:
Expand All @@ -27,12 +28,14 @@ def summarise(fname):
# track bench runs
if splitline[1] == 'ns/iter':
status = 'bench'
if not summary.has_key(status):
if status not in summary:
summary[status] = []
summary[status].append(test)
summaries.append((fname, summary))

def count(t):
return sum(map(lambda (f, s): len(s.get(t, [])), summaries))

logfiles = sys.argv[1:]
for files in map(glob.glob, logfiles):
map(summarise, files)
Expand All @@ -41,8 +44,9 @@ def count(t):
ignored = count('ignored')
measured = count('bench')
print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % \
(len(logfiles), ok, failed, ignored, measured)
(len(logfiles), ok, failed, ignored, measured)
print ""

if failed > 0:
print "failed tests:"
for f, s in summaries:
Expand Down
4 changes: 3 additions & 1 deletion src/etc/errorck.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
# Digs error codes out of files named 'diagnostics.rs' across
# the tree, and ensures thare are no duplicates.

import sys, os, re
import sys
import os
import re

src_dir = sys.argv[1]
errcode_map = {}
Expand Down
136 changes: 68 additions & 68 deletions src/etc/extract_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import fileinput

collections = { "gram": [],
"keyword": [],
"reserved": [],
"binop": [],
"unop": [] }
collections = {"gram": [],
"keyword": [],
"reserved": [],
"binop": [],
"unop": []}


in_coll = False
Expand Down Expand Up @@ -47,66 +47,66 @@
# 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 = []
Expand All @@ -126,8 +126,8 @@
+ 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)
Expand All @@ -149,8 +149,8 @@
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))
Loading