Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
691ab059
Commit
691ab059
authored
Nov 21, 2014
by
Alexandre Duret-Lutz
Browse files
hoa: catch redefinition of states
* src/hoaparse/hoaparse.yy: Here. * src/tgbatest/hoaparse.test: More test.
parent
69678152
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/hoaparse/hoaparse.yy
View file @
691ab059
...
...
@@ -47,6 +47,7 @@
std::vector<int> ap;
std::vector<bdd> guards;
std::vector<bdd>::const_iterator cur_guard;
std::vector<bool> declared_states; // States that have been declared.
spot::location states_loc;
spot::location ap_loc;
spot::location state_label_loc;
...
...
@@ -189,6 +190,7 @@ header-item: "States:" INT
- res.h->aut->num_states();
assert(missing >= 0);
res.h->aut->new_states(missing);
res.declared_states.resize(res.declared_states.size() + missing);
}
| "Start:" state-conj-2
{
...
...
@@ -443,7 +445,11 @@ state-num: INT
}
int missing = ((int) $1) - res.h->aut->num_states() + 1;
if (missing >= 0)
res.h->aut->new_states(missing);
{
res.h->aut->new_states(missing);
res.declared_states.resize(res.declared_states.size()
+ missing);
}
}
$$ = $1;
}
...
...
@@ -462,6 +468,13 @@ state: state-name labeled-edges
state-name: "State:" state-label_opt state-num string_opt acc-sig_opt
{
res.cur_state = $3;
if (res.declared_states[$3])
{
std::ostringstream o;
o << "redeclaration of state " << $3;
error(@1 + @3, o.str());
}
res.declared_states[$3] = true;
res.acc_state = $5;
}
label: '[' label-expr ']'
...
...
@@ -614,7 +627,9 @@ namespace spot
if (!r.h->aut)
return nullptr;
if (r.start != -1)
r.h->aut->set_init_state(r.start);
{
r.h->aut->set_init_state(r.start);
}
else
{
// If no initial state has been declared, add one, because
...
...
src/tgbatest/hoaparse.test
View file @
691ab059
...
...
@@ -85,6 +85,24 @@ input:10.5: state number is larger than state count...
input
:
2.1
-
9
:
...
declared
here
.
EOF
cat
>
input
<<
EOF
HOA
:
v1
States
:
1
Start
:
0
AP
:
1
"a"
Acceptance
:
1
Inf
(
0
)
--
BODY
--
State
:
0
{
0
}
[
0
]
0
State
:
0
{
0
}
[
t
]
0
--
END
--
EOF
expecterr
input
<<
EOF
input
:
9.1
-
8
:
redeclaration
of
state
0
EOF
cat
>
input
<<
EOF
HOA
:
v1
States
:
0
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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