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
2c516e03
Commit
2c516e03
authored
Feb 05, 2014
by
Igor Dejanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small attribute name and docstring changes.
parent
5530e3ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
__init__.py
arpeggio/__init__.py
+5
-12
No files found.
arpeggio/__init__.py
View file @
2c516e03
...
...
@@ -52,8 +52,8 @@ class NoMatch(Exception):
position (int): A position in the input stream where exception occurred.
parser (Parser): An instance of a parser.
"""
def
__init__
(
self
,
valu
e
,
position
,
parser
):
self
.
value
=
valu
e
def
__init__
(
self
,
rul
e
,
position
,
parser
):
self
.
rule
=
rul
e
# Position in the input stream where error occurred
self
.
position
=
position
...
...
@@ -64,7 +64,7 @@ class NoMatch(Exception):
self
.
_up
=
True
def
__str__
(
self
):
return
"Expected
%
s at position
%
s."
%
(
self
.
valu
e
,
return
"Expected
%
s at position
%
s."
%
(
self
.
rul
e
,
str
(
self
.
parser
.
pos_to_linecol
(
self
.
position
)))
...
...
@@ -85,9 +85,8 @@ def flatten(_iterable):
class
ParsingExpression
(
object
):
"""
An abstract class for all parsing expressions.
Represents the node of the Parser Model.
Root parser expression node will create non-terminal parser tree node while
non-root node will create list of terminals and non-terminals.
Attributes:
rule (str): The name of the parser rule if this is the root rule.
...
...
@@ -195,7 +194,7 @@ class ParsingExpression(object):
place of the NoMatch exception.
"""
if
self
.
root
and
self
.
c_pos
==
nm
.
position
and
nm
.
_up
:
nm
.
valu
e
=
self
.
rule
nm
.
rul
e
=
self
.
rule
class
Sequence
(
ParsingExpression
):
...
...
@@ -821,12 +820,6 @@ class ParserPython(Parser):
print
"CrossRef usage:
%
s"
%
c_rule
.
rule_name
return
c_rule
#expression_expression = expression()
#if callable(expression_expression):
#raise GrammarError(
#"Rule element '%s' can't be just another rule in '%s'." %
#(expression_expression, rule))
# Semantic action for the rule
if
hasattr
(
expression
,
"sem"
):
self
.
sem_actions
[
rule
]
=
expression
.
sem
...
...
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