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
6bc98dd5
Commit
6bc98dd5
authored
Jan 14, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List all possibilities using '??' operator.
parent
090b9861
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
src/parser.py
src/parser.py
+8
-2
No files found.
src/parser.py
View file @
6bc98dd5
...
@@ -50,7 +50,7 @@ class Parser(BisonParser):
...
@@ -50,7 +50,7 @@ class Parser(BisonParser):
# ----------------------------------------------------------------
# ----------------------------------------------------------------
# TODO: add a runtime check to verify that this token list match the list
# TODO: add a runtime check to verify that this token list match the list
# of tokens of the lex script.
# of tokens of the lex script.
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
'POSSIBILITIES'
,
'PLUS'
,
'MINUS'
,
'TIMES'
,
'DIVIDE'
,
'POW'
,
'PLUS'
,
'MINUS'
,
'TIMES'
,
'DIVIDE'
,
'POW'
,
'LPAREN'
,
'RPAREN'
,
'COMMA'
,
'HINT'
,
'REWRITE'
,
'LPAREN'
,
'RPAREN'
,
'COMMA'
,
'HINT'
,
'REWRITE'
,
'NEWLINE'
,
'QUIT'
,
'RAISE'
,
'GRAPH'
]
'NEWLINE'
,
'QUIT'
,
'RAISE'
,
'GRAPH'
]
...
@@ -203,6 +203,7 @@ class Parser(BisonParser):
...
@@ -203,6 +203,7 @@ class Parser(BisonParser):
| exp NEWLINE
| exp NEWLINE
| debug NEWLINE
| debug NEWLINE
| HINT NEWLINE
| HINT NEWLINE
| POSSIBILITIES NEWLINE
| REWRITE NEWLINE
| REWRITE NEWLINE
| RAISE NEWLINE
| RAISE NEWLINE
"""
"""
...
@@ -214,10 +215,14 @@ class Parser(BisonParser):
...
@@ -214,10 +215,14 @@ class Parser(BisonParser):
return
return
if
option
==
4
:
if
option
==
4
:
print
'
\
n
'
.
join
(
map
(
str
,
self
.
last_possibilities
))
return
if
option
==
5
:
suggestion
=
pick_suggestion
(
self
.
last_possibilities
)
suggestion
=
pick_suggestion
(
self
.
last_possibilities
)
return
apply_suggestion
(
suggestion
)
return
apply_suggestion
(
suggestion
)
if
option
==
5
:
if
option
==
6
:
raise
RuntimeError
(
'on_line: exception raised'
)
raise
RuntimeError
(
'on_line: exception raised'
)
def
on_debug
(
self
,
target
,
option
,
names
,
values
):
def
on_debug
(
self
,
target
,
option
,
names
,
values
):
...
@@ -345,6 +350,7 @@ class Parser(BisonParser):
...
@@ -345,6 +350,7 @@ class Parser(BisonParser):
"^" { returntoken(POW); }
"^" { returntoken(POW); }
"/" { returntoken(DIVIDE); }
"/" { returntoken(DIVIDE); }
"," { returntoken(COMMA); }
"," { returntoken(COMMA); }
"??" { returntoken(POSSIBILITIES); }
"?" { returntoken(HINT); }
"?" { returntoken(HINT); }
"@" { returntoken(REWRITE); }
"@" { returntoken(REWRITE); }
"quit" { yyterminate(); returntoken(QUIT); }
"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