Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
trs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
trs
Commits
d32f994f
Commit
d32f994f
authored
12 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Parentheses for logarithms are now added using OP_PARENS instead of the old hacky way
parent
b30cbe67
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/node.py
+6
-8
6 additions, 8 deletions
src/node.py
with
6 additions
and
8 deletions
src/node.py
+
6
−
8
View file @
d32f994f
...
...
@@ -342,17 +342,17 @@ class ExpressionNode(Node, ExpressionBase):
base
=
self
[
1
].
value
if
base
==
DEFAULT_LOGARITHM_BASE
:
return
self
.
value
+
'
(
'
return
self
.
value
if
base
==
E
:
return
'
ln
(
'
return
'
ln
'
base
=
str
(
self
[
1
])
if
not
re
.
match
(
'
^[0-9]+|[a-zA-Z]$
'
,
base
):
base
=
'
(
'
+
base
+
'
)
'
return
'
%s_%s
(
'
%
(
self
.
value
,
base
)
return
'
%s_%s
'
%
(
self
.
value
,
base
)
if
self
.
op
==
OP_DXDER
:
return
self
.
value
+
str
(
self
[
1
])
...
...
@@ -374,14 +374,12 @@ class ExpressionNode(Node, ExpressionBase):
return
bounds_str
(
ExpressionNode
(
OP_BRACKETS
,
Fx
),
a
,
b
)
def
preprocess_str_exp
(
self
):
if
self
.
op
==
OP_PRIME
and
not
self
[
0
].
is_op
(
OP_PRIME
):
if
self
.
op
==
OP_LOG
:
self
[
0
]
=
ExpressionNode
(
OP_PARENS
,
self
[
0
])
elif
self
.
op
==
OP_PRIME
and
not
self
[
0
].
is_op
(
OP_PRIME
):
self
[
0
]
=
ExpressionNode
(
OP_BRACKETS
,
self
[
0
])
def
postprocess_str
(
self
,
s
):
# A bit hacky, but forced because of operator() method
if
self
.
op
==
OP_LOG
:
return
s
.
replace
(
'
(
'
,
'
(
'
)
+
'
)
'
if
self
.
op
==
OP_INT
:
return
'
%s d%s
'
%
(
s
,
self
[
1
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment