Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
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
graph_drawing
Commits
a9eb446f
Commit
a9eb446f
authored
Sep 13, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Latest commit seemed to screw up multiplications o mlutiplications, not anymore...
parent
fe4e092c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
line.py
line.py
+2
-1
tests/test_line.py
tests/test_line.py
+4
-0
No files found.
line.py
View file @
a9eb446f
...
@@ -247,7 +247,8 @@ def generate_line(root):
...
@@ -247,7 +247,8 @@ def generate_line(root):
lparens
=
is_right_assoc
(
left
.
title
())
or
is_right_assoc
(
op
)
lparens
=
is_right_assoc
(
left
.
title
())
or
is_right_assoc
(
op
)
if
rpred
<
op_pred
:
if
rpred
<
op_pred
:
rparens
=
not
unary_right
or
len
(
right
[
0
])
>
1
rparens
=
not
unary_right
\
or
(
pred
(
right
[
0
])
<
op_pred
and
len
(
right
[
0
])
>
1
)
elif
rpred
==
op_pred
and
len
(
right
)
>
1
:
elif
rpred
==
op_pred
and
len
(
right
)
>
1
:
if
right
.
title
()
==
op
:
if
right
.
title
()
==
op
:
rparens
=
not
is_right_assoc
(
op
)
rparens
=
not
is_right_assoc
(
op
)
...
...
tests/test_line.py
View file @
a9eb446f
...
@@ -348,3 +348,7 @@ class TestLine(unittest.TestCase):
...
@@ -348,3 +348,7 @@ class TestLine(unittest.TestCase):
root
=
N
(
'/'
,
L
(
1
),
N
(
'*'
,
-
L
(
'a'
),
L
(
'b'
)))
root
=
N
(
'/'
,
L
(
1
),
N
(
'*'
,
-
L
(
'a'
),
L
(
'b'
)))
self
.
assertEquals
(
generate_line
(
root
),
'1 / ((-a)b)'
)
self
.
assertEquals
(
generate_line
(
root
),
'1 / ((-a)b)'
)
root
=
N
(
'*'
,
N
(
'*'
,
L
(
2
),
L
(
'b'
)),
-
N
(
'*'
,
L
(
3
),
L
(
'b'
)))
self
.
assertEquals
(
generate_line
(
root
),
'2b * -3b'
)
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