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
80101efb
Commit
80101efb
authored
Aug 04, 2014
by
Igor Dejanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NoMatch memoization
parent
5374d79c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
__init__.py
arpeggio/__init__.py
+9
-1
No files found.
arpeggio/__init__.py
View file @
80101efb
...
...
@@ -178,6 +178,12 @@ class ParsingExpression(object):
print
(
"** Cache hit for [{}, {}] = '{}'"
.
format
(
self
.
name
,
c_pos
,
str
(
result
)))
print
(
"<< Leaving rule {}"
.
format
(
self
.
name
))
# If NoMatch is recorded at this position raise.
if
isinstance
(
result
,
NoMatch
):
parser
.
_nm_raise
(
result
)
# else return cached result
return
result
# We are descending down
...
...
@@ -192,8 +198,10 @@ class ParsingExpression(object):
try
:
result
=
self
.
_parse
(
parser
)
except
NoMatch
:
except
NoMatch
as
e
:
parser
.
position
=
c_pos
# Backtracking
# Memoize NoMatch at this position for this rule
self
.
result_cache
[
c_pos
]
=
(
e
,
c_pos
)
raise
finally
:
...
...
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