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
Show 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
...
@@ -12,7 +12,7 @@ import pytest
# Grammar
# Grammar
from
arpeggio
import
ZeroOrMore
,
OneOrMore
,
ParserPython
,
Terminal
,
NonTerminal
,
\
from
arpeggio
import
ZeroOrMore
,
OneOrMore
,
ParserPython
,
Terminal
,
NonTerminal
,
\
SemanticAction
,
SemanticActionResults
SemanticAction
Results
,
PTNodeVisitor
,
visit_parse_tree
from
arpeggio.export
import
PTDOTExporter
from
arpeggio.export
import
PTDOTExporter
from
arpeggio
import
RegExMatch
as
_
from
arpeggio
import
RegExMatch
as
_
...
@@ -27,23 +27,18 @@ def fourth(): return _(r'\d+')
...
@@ -27,23 +27,18 @@ def fourth(): return _(r'\d+')
first_sar
=
None
first_sar
=
None
third_sar
=
None
third_sar
=
None
class
FirstSA
(
SemanticAction
):
class
TestVisitor
(
PTNodeVisitor
):
def
first_pass
(
self
,
parser
,
node
,
children
):
def
visit_first
(
self
,
node
,
children
):
global
first_sar
global
first_sar
first_sar
=
children
first_sar
=
children
def
visit_third
(
self
,
node
,
children
):
class
ThirdSA
(
SemanticAction
):
def
first_pass
(
self
,
parser
,
node
,
children
):
global
third_sar
global
third_sar
third_sar
=
children
third_sar
=
children
return
1
return
1
first
.
sem
=
FirstSA
()
third
.
sem
=
ThirdSA
()
def
test_semantic_action_results
():
def
test_semantic_action_results
():
global
first_sar
,
third_sar
global
first_sar
,
third_sar
...
@@ -55,7 +50,7 @@ def test_semantic_action_results():
...
@@ -55,7 +50,7 @@ def test_semantic_action_results():
PTDOTExporter
()
.
exportFile
(
result
,
'test_semantic_action_results_pt.dot'
)
PTDOTExporter
()
.
exportFile
(
result
,
'test_semantic_action_results_pt.dot'
)
parser
.
getASG
(
)
visit_parse_tree
(
result
,
TestVisitor
()
)
assert
isinstance
(
first_sar
,
SemanticActionResults
)
assert
isinstance
(
first_sar
,
SemanticActionResults
)
assert
len
(
first_sar
.
third
)
==
3
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