Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
69c3cd5d
Commit
69c3cd5d
authored
Jun 22, 2012
by
Taddeus Kroes
Committed by
Taddeüs Kroes
Sep 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed pi notation.
parent
903dfc6f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
src/parser.py
src/parser.py
+3
-3
tests/test_parser.py
tests/test_parser.py
+2
-0
No files found.
src/parser.py
View file @
69c3cd5d
...
...
@@ -181,7 +181,7 @@ class Parser(BisonParser):
return
data
# Replace known keywords with escape sequences.
words
=
list
(
self
.
__class__
.
words
)
words
=
list
(
self
.
words
)
words
.
insert
(
10
,
'
\
n
'
)
words
.
insert
(
13
,
'
\
r
'
)
...
...
@@ -211,8 +211,8 @@ class Parser(BisonParser):
# inserted between a function and its argument(s): "sin x" should
# not be written as "sin*x", because that is bogus.
# Bugfix: omit 0x0e (pi) to prevent "pi a" (should be "pi*a")
if ord(left) <= 0x9 or 0x0b <= ord(left) <= 0x0d
\
or 0x0f <= ord(left)
<= 0x19:
o = ord(left)
if o <= 0x9 or 0x0b <= o <= 0x0d or 0x0f <= o
<= 0x19:
return left + '
' + right
# If all characters on the right are numbers. e.g. "a4", the
...
...
tests/test_parser.py
View file @
69c3cd5d
...
...
@@ -83,6 +83,8 @@ class TestParser(RulesTestCase):
# FIXME: self.assertEqual(tree('|a|b'), tree('|a| * b'))
self
.
assertEqual
(
tree
(
'|a||b|'
),
tree
(
'|a| * |b|'
))
self
.
assertEqual
(
tree
(
'pi2'
),
tree
(
'pi * 2'
))
def
test_functions
(
self
):
x
=
tree
(
'x'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment