summaryrefslogtreecommitdiff
path: root/examples/parseTabularData.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-12-22 09:28:48 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2018-12-22 13:46:56 -0800
commitde8326d00dffdb500c02839a98330b869c2457f3 (patch)
tree6c5fdae41cf8b335ff1c64f37856786523e4fd0d /examples/parseTabularData.py
parent59dfd314c23fd653271bdad37631f0497e8ad748 (diff)
downloadpyparsing-git-de8326d00dffdb500c02839a98330b869c2457f3.tar.gz
Trim trailing white space throughout the project
Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines.
Diffstat (limited to 'examples/parseTabularData.py')
-rw-r--r--examples/parseTabularData.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/parseTabularData.py b/examples/parseTabularData.py
index 3846310..5aa6f09 100644
--- a/examples/parseTabularData.py
+++ b/examples/parseTabularData.py
@@ -2,7 +2,7 @@
# parseTabularData.py
#
# Example of parsing data that is formatted in a tabular listing, with
-# potential for missing values. Uses new addCondition method on
+# potential for missing values. Uses new addCondition method on
# ParserElements.
#
# Copyright 2015, Paul McGuire
@@ -27,20 +27,20 @@ def mustMatchCols(startloc,endloc):
def tableValue(expr, colstart, colend):
empty_cell_is_zero = False
if empty_cell_is_zero:
- return Optional(expr.copy().addCondition(mustMatchCols(colstart,colend),
- message="text not in expected columns"),
+ return Optional(expr.copy().addCondition(mustMatchCols(colstart,colend),
+ message="text not in expected columns"),
default=0)
else:
- return Optional(expr.copy().addCondition(mustMatchCols(colstart,colend),
+ return Optional(expr.copy().addCondition(mustMatchCols(colstart,colend),
message="text not in expected columns"))
# define the grammar for this simple table
colorname = Word(alphas)
integer = Word(nums).setParseAction(lambda t: int(t[0])).setName("integer")
-row = (colorname("name") +
- tableValue(integer, 11, 12)("S") +
- tableValue(integer, 15, 16)("M") +
+row = (colorname("name") +
+ tableValue(integer, 11, 12)("S") +
+ tableValue(integer, 15, 16)("M") +
tableValue(integer, 19, 20)("L"))
# parse the sample text - skip over the header and counter lines