Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
arpeggio-gm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
backend
arpeggio-gm
Commits
8609d13a
Commit
8609d13a
authored
Aug 10, 2014
by
Igor Dejanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the way non-terminals are created in the parse method
parent
16a0e2e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
__init__.py
arpeggio/__init__.py
+11
-10
No files found.
arpeggio/__init__.py
View file @
8609d13a
...
@@ -245,17 +245,18 @@ class ParsingExpression(object):
...
@@ -245,17 +245,18 @@ class ParsingExpression(object):
if
parser
.
debug
:
if
parser
.
debug
:
print
(
"<< Leaving rule {}"
.
format
(
self
.
name
))
print
(
"<< Leaving rule {}"
.
format
(
self
.
name
))
# Create terminal or non-terminal if result is not
# For root rules flatten non-terminal/list
# already a Terminal.
if
self
.
root
and
result
and
not
isinstance
(
result
,
Terminal
):
if
self
.
root
and
result
and
not
isinstance
(
result
,
Terminal
):
if
parser
.
reduce_tree
:
if
not
isinstance
(
result
,
NonTerminal
):
if
isinstance
(
result
,
list
):
result
=
flatten
(
result
)
result
=
flatten
(
result
)
if
len
(
result
)
==
1
:
# Tree reduction will eliminate Non-terminal with single child.
result
=
result
[
0
]
if
parser
.
reduce_tree
and
len
(
result
)
==
1
:
else
:
result
=
result
[
0
]
result
=
NonTerminal
(
self
,
c_pos
,
result
)
else
:
# If the result is not parse tree node it must be a plain list
# so create a new NonTerminal.
if
not
isinstance
(
result
,
ParseTreeNode
):
result
=
NonTerminal
(
self
,
c_pos
,
result
)
result
=
NonTerminal
(
self
,
c_pos
,
result
)
# Result caching for use by memoization.
# Result caching for use by memoization.
...
...
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