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
75e2027a
Commit
75e2027a
authored
Oct 22, 2014
by
Igor Dejanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing semantic action results test
parent
a6ad2785
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
test_semantic_action_results.py
tests/unit/test_semantic_action_results.py
+5
-10
No files found.
tests/unit/test_semantic_action_results.py
View file @
75e2027a
...
...
@@ -12,7 +12,7 @@ import pytest
# Grammar
from
arpeggio
import
ZeroOrMore
,
OneOrMore
,
ParserPython
,
Terminal
,
NonTerminal
,
\
SemanticAction
,
SemanticActionResults
SemanticAction
Results
,
PTNodeVisitor
,
visit_parse_tree
from
arpeggio.export
import
PTDOTExporter
from
arpeggio
import
RegExMatch
as
_
...
...
@@ -27,23 +27,18 @@ def fourth(): return _(r'\d+')
first_sar
=
None
third_sar
=
None
class
FirstSA
(
SemanticAction
):
def
first_pass
(
self
,
parser
,
node
,
children
):
class
TestVisitor
(
PTNodeVisitor
):
def
visit_first
(
self
,
node
,
children
):
global
first_sar
first_sar
=
children
class
ThirdSA
(
SemanticAction
):
def
first_pass
(
self
,
parser
,
node
,
children
):
def
visit_third
(
self
,
node
,
children
):
global
third_sar
third_sar
=
children
return
1
first
.
sem
=
FirstSA
()
third
.
sem
=
ThirdSA
()
def
test_semantic_action_results
():
global
first_sar
,
third_sar
...
...
@@ -55,7 +50,7 @@ def test_semantic_action_results():
PTDOTExporter
()
.
exportFile
(
result
,
'test_semantic_action_results_pt.dot'
)
parser
.
getASG
(
)
visit_parse_tree
(
result
,
TestVisitor
()
)
assert
isinstance
(
first_sar
,
SemanticActionResults
)
assert
len
(
first_sar
.
third
)
==
3
...
...
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