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
430b1f49
Commit
430b1f49
authored
Jan 14, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of kompiler.org:trs
parents
8f9717d5
a836452c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
external/pybison
external/pybison
+1
-1
src/parser.py
src/parser.py
+8
-2
No files found.
pybison
@
b4fd7ccf
Subproject commit
805ca9d3acb5053906157b66604a1ac5054c2df3
Subproject commit
b4fd7ccf01d7030c3d6207c1ce2ff6bdbb8cad55
src/parser.py
View file @
430b1f49
...
...
@@ -50,7 +50,7 @@ class Parser(BisonParser):
# ----------------------------------------------------------------
# TODO: add a runtime check to verify that this token list match the list
# of tokens of the lex script.
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
'POSSIBILITIES'
,
'PLUS'
,
'MINUS'
,
'TIMES'
,
'DIVIDE'
,
'POW'
,
'LPAREN'
,
'RPAREN'
,
'COMMA'
,
'HINT'
,
'REWRITE'
,
'NEWLINE'
,
'QUIT'
,
'RAISE'
,
'GRAPH'
]
...
...
@@ -203,6 +203,7 @@ class Parser(BisonParser):
| exp NEWLINE
| debug NEWLINE
| HINT NEWLINE
| POSSIBILITIES NEWLINE
| REWRITE NEWLINE
| RAISE NEWLINE
"""
...
...
@@ -214,10 +215,14 @@ class Parser(BisonParser):
return
if
option
==
4
:
print
'
\
n
'
.
join
(
map
(
str
,
self
.
last_possibilities
))
return
if
option
==
5
:
suggestion
=
pick_suggestion
(
self
.
last_possibilities
)
return
apply_suggestion
(
suggestion
)
if
option
==
5
:
if
option
==
6
:
raise
RuntimeError
(
'on_line: exception raised'
)
def
on_debug
(
self
,
target
,
option
,
names
,
values
):
...
...
@@ -345,6 +350,7 @@ class Parser(BisonParser):
"^" { returntoken(POW); }
"/" { returntoken(DIVIDE); }
"," { returntoken(COMMA); }
"??" { returntoken(POSSIBILITIES); }
"?" { returntoken(HINT); }
"@" { returntoken(REWRITE); }
"quit" { yyterminate(); returntoken(QUIT); }
...
...
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