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
4821058c
Commit
4821058c
authored
Nov 19, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled debug/verbosity and code cleanup.
parent
314ca19b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
src/calc.py
src/calc.py
+5
-8
No files found.
src/calc.py
View file @
4821058c
...
@@ -45,7 +45,7 @@ class Parser(BisonParser):
...
@@ -45,7 +45,7 @@ class Parser(BisonParser):
# ------------------------------------------------------------------
# ------------------------------------------------------------------
def
read
(
self
,
nbytes
):
def
read
(
self
,
nbytes
):
try
:
try
:
return
raw_input
(
"> "
)
+
"
\
n
"
return
raw_input
(
">
>>
"
)
+
"
\
n
"
except
EOFError
:
except
EOFError
:
return
''
return
''
...
@@ -75,8 +75,7 @@ class Parser(BisonParser):
...
@@ -75,8 +75,7 @@ class Parser(BisonParser):
| exp NEWLINE
| exp NEWLINE
"""
"""
if
option
==
1
:
if
option
==
1
:
print
'option:'
,
option
print
'on_line: exp ='
,
values
[
0
]
#print 'on_line:', values[0]
def
on_exp
(
self
,
target
,
option
,
names
,
values
):
def
on_exp
(
self
,
target
,
option
,
names
,
values
):
"""
"""
...
@@ -92,11 +91,9 @@ class Parser(BisonParser):
...
@@ -92,11 +91,9 @@ class Parser(BisonParser):
print
'on_exp: got %s %s %s %s'
%
(
target
,
option
,
names
,
values
)
print
'on_exp: got %s %s %s %s'
%
(
target
,
option
,
names
,
values
)
if
option
==
0
:
if
option
==
0
:
return
return
float
(
values
[
0
])
#return float(values[0])
elif
option
==
1
:
elif
option
==
1
:
return
return
values
[
0
]
+
values
[
2
]
#return values[0] + values[2]
elif
option
==
2
:
elif
option
==
2
:
return
values
[
0
]
-
values
[
2
]
return
values
[
0
]
-
values
[
2
]
elif
option
==
3
:
elif
option
==
3
:
...
@@ -150,4 +147,4 @@ class Parser(BisonParser):
...
@@ -150,4 +147,4 @@ class Parser(BisonParser):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
p
=
Parser
(
verbose
=
0
,
keepfiles
=
1
)
p
=
Parser
(
verbose
=
0
,
keepfiles
=
1
)
p
.
run
(
debug
=
1
)
p
.
run
(
debug
=
0
)
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