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
70ee2aaa
Commit
70ee2aaa
authored
Dec 27, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed deprecated concat grammar.
parent
5f68d635
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
35 deletions
+1
-35
src/parser.py
src/parser.py
+1
-35
No files found.
src/parser.py
View file @
70ee2aaa
...
@@ -55,7 +55,7 @@ class Parser(BisonParser):
...
@@ -55,7 +55,7 @@ class Parser(BisonParser):
# of tokens of the lex script.
# of tokens of the lex script.
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
tokens
=
[
'NUMBER'
,
'IDENTIFIER'
,
'PLUS'
,
'MINUS'
,
'TIMES'
,
'DIVIDE'
,
'POW'
,
'PLUS'
,
'MINUS'
,
'TIMES'
,
'DIVIDE'
,
'POW'
,
'LPAREN'
,
'RPAREN'
,
'COMMA'
,
# 'CONCAT_POW',
'LPAREN'
,
'RPAREN'
,
'COMMA'
,
'NEWLINE'
,
'QUIT'
,
'RAISE'
,
'GRAPH'
]
'NEWLINE'
,
'QUIT'
,
'RAISE'
,
'GRAPH'
]
# ------------------------------
# ------------------------------
...
@@ -287,40 +287,6 @@ class Parser(BisonParser):
...
@@ -287,40 +287,6 @@ class Parser(BisonParser):
raise
BisonSyntaxError
(
'Unsupported option %d in target "%s".'
raise
BisonSyntaxError
(
'Unsupported option %d in target "%s".'
%
(
option
,
target
))
# pragma: nocover
%
(
option
,
target
))
# pragma: nocover
#def on_concat(self, option, target, names, values):
# """
# concat : exp IDENTIFIER %prec TIMES
# | exp NUMBER %prec TIMES
# | exp LPAREN exp RPAREN %prec TIMES
# | exp CONCAT_POW %prec TIMES
# | CONCAT_POW
# """
# if option in [0, 1]: # rule: exp IDENTIFIER | exp NUMBER
# # example: xy -> x*y
# # example: (x)4 -> x*4
# val = int(values[1]) if option == 1 else values[1]
# return Node('*', *(combine('*', values[0]) + [Leaf(val)]))
# if option == 2: # rule: exp LPAREN exp RPAREN
# # example: x(y) -> x*(y)
# return Node('*', *(combine('*', values[0])
# + combine('*', values[2])))
# if option == 3:
# # example: xy4 -> x*y^4
# identifier, exponent = list(values[1])
# node = Node('^', Leaf(identifier), Leaf(int(exponent)))
# return Node('*', values[0], node)
# if option == 4:
# # example: x4 -> x^4
# identifier, exponent = list(values[0])
# return Node('^', Leaf(identifier), Leaf(int(exponent)))
# raise BisonSyntaxError('Unsupported option %d in target "%s".'
# % (option, target)) # pragma: nocover
# -----------------------------------------
# -----------------------------------------
# raw lex script, verbatim here
# raw lex script, verbatim here
# -----------------------------------------
# -----------------------------------------
...
...
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