Permalink
Browse files

Remove trailiing whitespace from *.py and *.c files (#166)

  • Loading branch information...
granttrec authored and andychu committed Aug 10, 2018
1 parent 33269c7 commit 43822b86589e17a631622295c50aa02f1fd1a0f6
View
@@ -218,7 +218,7 @@ def Print(self, f, indent):
class _CompoundType(AST):
"""Either a Product or Constructor.
encode.py and format.py need a reflection API.
"""
View
@@ -445,7 +445,7 @@ def _PrintTreeObj(node, f, indent, max_col):
f.write('\n') # separate fields
f.write(ind + node.right)
def PrintTree(node, f, indent=0, max_col=100):
"""Second step of printing: turn homogeneous tree into a colored string.
View
@@ -240,7 +240,7 @@ def MakeTypes(module, root, type_lookup):
sum_type = typ
if asdl.is_simple(sum_type):
# An object without fields, which can be stored inline.
# Create a class called foo_e. Unlike the CompoundObj case, it doesn't
# have subtypes. Instead if has attributes foo_e.Bar, which Bar is an
# instance of foo_e.
View
@@ -127,7 +127,7 @@ def __init__(self):
def Null(self, bp, nud, tokens):
"""Register a token that doesn't take anything on the left.
Examples: constant, prefix operator, error.
"""
for token in tokens:
View
@@ -20,7 +20,7 @@ class Tracer(object):
# Limit to 10M events by default.
def __init__(self, max_events=10e6):
self.pid = os.getpid()
# append
# append
self.event_strs = cStringIO.StringIO()
# After max_events we stop recording
@@ -45,7 +45,7 @@ def OnEvent(self, frame, event_type, arg):
name = frame.f_code.co_name
filename = frame.f_code.co_filename
if event_type in ('call', 'c_call'):
self.depth += 1
self.depth += 1
record = '%s%s\t%s\t%s\t%s\t%s\n' % (' ' * self.depth,
event_type, filename, frame.f_lineno, name, arg)
View
@@ -451,7 +451,7 @@ def OshCommandMain(argv):
TODO:
- oshc --help
oshc deps
oshc deps
--path: the $PATH to use to find executables. What about libraries?
NOTE: we're leaving out su -c, find, xargs, etc.? Those should generally
View
@@ -288,7 +288,7 @@ def Pages(f, text_out):
print('<pre>')
prev_topics = topics
else:
# Three or more should be a heading, not a comment.
if line.startswith('###'):
View
@@ -20,7 +20,7 @@
import lib
#import zipfile
#import zipfile
import zipimport
View
@@ -13,7 +13,7 @@
- maybe: integrate with usage
- maybe: integrate with flags
optparse:
optparse:
- has option groups
NOTES about builtins:
@@ -373,7 +373,7 @@ def PrintHelp(self, f):
print(ch)
def ShortFlag(self, short_name, arg_type=None):
"""
"""
This is very similar to ShortFlag for FlagsAndOptions, except we have
separate arity0 and arity1 dicts.
"""
@@ -439,7 +439,7 @@ def Parse(self, argv):
# So look up the first one
# NOTE about -:
# 'set -' ignores it, vs set
# 'set -' ignores it, vs set
# 'unset -' or 'export -' seems to treat it as a variable name
state = _ArgState(argv)
View
@@ -80,7 +80,7 @@ def testFlagsAndOptions(self):
self.assertEqual(3, i)
# Now this is an arg. Gah.
argv = ['+o', 'pipefail', 'errexit']
argv = ['+o', 'pipefail', 'errexit']
arg, i = s.Parse(argv)
self.assertEqual([('pipefail', False)], arg.opt_changes)
self.assertEqual(['errexit'], argv[i:])
View
@@ -53,7 +53,7 @@ def _BraceDetect(w):
# alternatives, with optional prefix and suffix.
brace_expr = part* '{' alt ',' alt (',' alt)* '}' part*
Problem this grammar: it's not LL(1)
Problem this grammar: it's not LL(1)
Is it indirect left-recursive?
What's the best way to handle it? LR(1) parser?
View
@@ -648,7 +648,7 @@ def Matches(self, buf, status_out):
class ReadlineCompleter(object):
def __init__(self, root_comp, status_out, debug=False):
self.root_comp = root_comp
self.status_out = status_out
self.status_out = status_out
self.debug = debug
self.comp_iter = None # current completion being processed
View
@@ -152,7 +152,7 @@ def EvalLhs(node, arith_ev, mem, exec_opts):
#log('lhs_expr NODE %s', node)
assert isinstance(node, ast.lhs_expr), node
if node.tag == lhs_expr_e.LhsName: # a = b
# Problem: It can't be an array?
# Problem: It can't be an array?
# a=(1 2)
# (( a++ ))
lval = runtime.LhsName(node.name)
@@ -325,7 +325,7 @@ def Eval(self, node):
new_int = old_int ^ rhs
else:
raise AssertionError(op_id) # shouldn't get here
self._Store(lval, new_int)
return new_int
View
@@ -121,7 +121,7 @@ def AddBoolKind(self, kind_name, arg_type_pairs):
def AddBoolBinaryForBuiltin(self, token_name, kind, bool_arg_type_e):
"""For [ = ] [ == ] and [ != ].
These operators are NOT added to the lexer. The are "lexed" as StringWord.
"""
token_name = 'BoolBinary_%s' % token_name
@@ -363,7 +363,7 @@ def AddKinds(spec):
'OneChar', 'Stop', 'Hex',
# Two variants of Octal: \377, and \0377.
'Octal3', 'Octal4',
'Unicode4', 'Unicode8', 'Literals',
'Unicode4', 'Unicode8', 'Literals',
'BadBackslash', # \D or trailing \
])
@@ -379,7 +379,7 @@ def AddKinds(spec):
# Shared between [[ and test/[.
_UNARY_STR_CHARS = 'zn' # -z -n
_UNARY_OTHER_CHARS = 'otvR' # -o is overloaded
_UNARY_OTHER_CHARS = 'otvR' # -o is overloaded
_UNARY_PATH_CHARS = 'abcdefghLprsSuwxOGN' # -a is overloaded
_BINARY_PATH = ['ef', 'nt', 'ot']
@@ -425,7 +425,7 @@ def SetupTestBuiltin(Id, Kind, id_spec,
- =~ doesn't exist
- && -> -a, || -> -o
- ( ) -> Op_LParen (they don't appear above)
"""
"""
for letter in _UNARY_STR_CHARS + _UNARY_OTHER_CHARS + _UNARY_PATH_CHARS:
token_name = 'BoolUnary_%s' % letter
unary_lookup['-' + letter] = getattr(Id, token_name)
View
@@ -105,7 +105,7 @@ def main(argv):
else:
with open(labels) as f:
label_lines = f.readlines()
from collections import defaultdict
id_by_kind_index = defaultdict(list) # Kind name -> [list of Id names]
View
@@ -16,21 +16,21 @@
Problem: Need both classes and algebraic data types.
Do we have different splitters? Awk splitter might be useful. Regex
splitter later. CSV splitter?
splitter later. CSV splitter?
LiteralSlice.
Other kinds of splitters:
- RegexSplitter
- CsvSplitter
- CsvSplitter
- TSV2Splitter -- this transforms because of # \u0065 in JSON. So it's not a
pure slice, but neither is IFS splitting because of backslashes.
- AwkSplitter
- Perl?
- does perl have a spilt context?
with SPLIT_REGEX = / digit+ / {
echo $#
echo $#
echo $len(argv)
echo $1 $2
echo @argv
@@ -81,7 +81,7 @@ def _SpansToParts(s, spans):
class SplitContext(object):
""" A polymorphic interface to field splitting.
It respects a STACK of IFS values, for example:
echo $x # uses default shell IFS
@@ -160,7 +160,7 @@ def SplitForWordEval(self, s):
IGNORED can be used for two reasons:
1. The slice is a delimiter.
2. The slice is a a backslash escape.
Example: If you have one\:two, then there are four slices. Only the
backslash one is ignored. In 'one:two', then you have three slices. The
colon is ignored.
@@ -243,7 +243,7 @@ def Split(self, s, allow_escape):
CH_DE_WHITE, CH_DE_GRAY, CH_BLACK, CH_BACKSLASH = range(4)
# Nodes are states
(ST_INVALID, ST_START, ST_DE_WHITE1, ST_DE_GRAY, ST_DE_WHITE2,
(ST_INVALID, ST_START, ST_DE_WHITE1, ST_DE_GRAY, ST_DE_WHITE2,
ST_BLACK, ST_BACKSLASH) = range(7)
# Actions control what spans to emit.
@@ -373,7 +373,7 @@ def Split(self, s, allow_escape):
spans.append((span_e.Backslash, i)) # \
else:
pass # Emit nothing
pass # Emit nothing
state = new_state
i += 1
@@ -384,7 +384,7 @@ def Split(self, s, allow_escape):
elif state == ST_BACKSLASH:
span_type = span_e.Backslash
elif state in (ST_DE_WHITE1, ST_DE_GRAY, ST_DE_WHITE2):
span_type = span_e.Delim
span_type = span_e.Delim
else:
raise AssertionError(state) # shouldn't be in START state
spans.append((span_type, n))
View
@@ -76,11 +76,11 @@ def _CharClassLiteral(arg):
if arg == 0:
s = r'\x00' # "\x00"
elif arg == ord('\n'):
s = r'\n'
s = r'\n'
elif arg == ord('\r'):
s = r'\r'
s = r'\r'
elif arg == ord('\t'):
s = r'\t'
s = r'\t'
elif arg in CHAR_CLASS_META_CODES:
s = '\\' + chr(arg)
else:
@@ -92,11 +92,11 @@ def _Literal(arg):
if arg == 0:
s = r'\x00' # "\000"
elif arg == ord('\n'):
s = r'\n'
s = r'\n'
elif arg == ord('\r'):
s = r'\r'
s = r'\r'
elif arg == ord('\t'):
s = r'\t'
s = r'\t'
elif arg in LITERAL_META_CODES:
s = '\\' + chr(arg)
else:
@@ -142,7 +142,7 @@ def TranslateTree(re_tree, f, in_char_class=False):
elif name == 'negate': # ^ in [^a-z]
assert arg is None
f.write('^')
f.write('^')
elif name == 'literal': # Quote \ and " in re2c syntax
# TODO: it matters if we're inside a character class
View
@@ -88,15 +88,15 @@ def NumOfUtf8Chars(bytes):
if (byte_as_int >> 7) == 0b0:
i += 1
elif (byte_as_int >> 5) == 0b110:
_CheckContinuationByte(bytes[i+1])
_CheckContinuationByte(bytes[i+1])
i += 2
elif (byte_as_int >> 4) == 0b1110:
_CheckContinuationByte(bytes[i+1])
_CheckContinuationByte(bytes[i+2])
_CheckContinuationByte(bytes[i+1])
_CheckContinuationByte(bytes[i+2])
i += 3
elif (byte_as_int >> 3) == 0b11110:
_CheckContinuationByte(bytes[i+1])
_CheckContinuationByte(bytes[i+2])
_CheckContinuationByte(bytes[i+1])
_CheckContinuationByte(bytes[i+2])
_CheckContinuationByte(bytes[i+3])
i += 4
else:
View
@@ -452,7 +452,7 @@ def Start(self):
#log('STARTED process %s, pid = %d', self, pid)
# Invariant, after the process is started, it stores its PID.
self.pid = pid
self.pid = pid
return pid
def WaitUntilDone(self, waiter):
View
@@ -40,7 +40,7 @@ def testLineReadersAreEquivalent(self):
for a in [a1, a2, a3]:
a.PushSource('reader_test.py')
for r in [r1, r2, r3]:
for r in [r1, r2, r3]:
print(r)
# Lines are added to the arena with a line_id.
self.assertEqual((0, 'one\n'), r.GetLine())
View
@@ -23,7 +23,7 @@
class _StringWordEmitter(object):
"""For test/[, we need a word parser that returns StringWord.
The BoolParser calls word.BoolId(w), and deals with Kind.BoolUnary,
Kind.BoolBinary, etc. This is instead of CompoundWord/TokenWord (as in the
[[ case.
View
@@ -84,7 +84,7 @@ class FatalRuntimeError(_ErrorWithLocation):
class ErrExitFailure(FatalRuntimeError):
"""For set -e.
Travels between WordEvaluator and Executor.
"""
pass
View
@@ -27,7 +27,7 @@ def ParsePythonTest(f):
if match:
current_test = match.group(1)
continue
match = METHOD_RE.match(line)
if match and current_test is not None:
print('%s.%s' % (current_test, match.group(1)))
View
@@ -329,7 +329,7 @@ static PyMethodDef methods[] = {
"an error."},
{"fnmatch", func_fnmatch, METH_VARARGS,
"Return whether a string matches a pattern."},
// We need this since Python's glob doesn't have char classes.
// We need this since Python's glob doesn't have char classes.
{"glob", func_glob, METH_VARARGS,
"Return a list of files that match a pattern."},
{"regex_parse", func_regex_parse, METH_VARARGS,
Oops, something went wrong.

0 comments on commit 43822b8

Please sign in to comment.