summaryrefslogtreecommitdiff
path: root/examples/LAparser.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2021-08-01 12:57:10 -0500
committerptmcg <ptmcg@austin.rr.com>2021-08-01 12:57:10 -0500
commitf22dcdc9be6aebf7defc1ef43e39c53921ba7566 (patch)
treed40b225f53c90a0b4676c59323251c9c2c825df6 /examples/LAparser.py
parent1688592bd97e573174e9eab482846e0f1194652a (diff)
downloadpyparsing-git-f22dcdc9be6aebf7defc1ef43e39c53921ba7566.tar.gz
Update __versionTime__; blacken core code and examples
Diffstat (limited to 'examples/LAparser.py')
-rw-r--r--examples/LAparser.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/LAparser.py b/examples/LAparser.py
index b72166f..31494b8 100644
--- a/examples/LAparser.py
+++ b/examples/LAparser.py
@@ -381,18 +381,18 @@ def parse(input_string):
##-----------------------------------------------------------------------------------
def fprocess(infilep, outfilep):
"""
- Scans an input file for LA equations between double square brackets,
- e.g. [[ M3_mymatrix = M3_anothermatrix^-1 ]], and replaces the expression
- with a comment containing the equation followed by nested function calls
- that implement the equation as C code. A trailing semi-colon is appended.
- The equation within [[ ]] should NOT end with a semicolon as that will raise
- a ParseException. However, it is ok to have a semicolon after the right brackets.
-
- Other text in the file is unaltered.
-
- The arguments are file objects (NOT file names) opened for reading and
- writing, respectively.
- """
+ Scans an input file for LA equations between double square brackets,
+ e.g. [[ M3_mymatrix = M3_anothermatrix^-1 ]], and replaces the expression
+ with a comment containing the equation followed by nested function calls
+ that implement the equation as C code. A trailing semi-colon is appended.
+ The equation within [[ ]] should NOT end with a semicolon as that will raise
+ a ParseException. However, it is ok to have a semicolon after the right brackets.
+
+ Other text in the file is unaltered.
+
+ The arguments are file objects (NOT file names) opened for reading and
+ writing, respectively.
+ """
pattern = r"\[\[\s*(.*?)\s*\]\]"
eqn = re.compile(pattern, re.DOTALL)
s = infilep.read()
@@ -408,10 +408,10 @@ def fprocess(infilep, outfilep):
##-----------------------------------------------------------------------------------
def test():
"""
- Tests the parsing of various supported expressions. Raises
- an AssertError if the output is not what is expected. Prints the
- input, expected output, and actual output for all tests.
- """
+ Tests the parsing of various supported expressions. Raises
+ an AssertError if the output is not what is expected. Prints the
+ input, expected output, and actual output for all tests.
+ """
print("Testing LAParser")
testcases = [
("Scalar addition", "a = b+c", "a=(b+c)"),