hoa: diagnose undefined states that appear as destination

This was discussed in the comments of
https://github.com/adl/hoaf/issues/39

* src/hoaparse/hoaparse.yy: Rename defined_states as info_states
and keep additional information about states in this vector to
diagnose undefined states.
* src/tgbatest/hoaparse.test: Add a test case.
This commit is contained in:
Alexandre Duret-Lutz 2015-04-18 20:54:04 +02:00
parent 9e959cdc7e
commit a83bde72b3
2 changed files with 98 additions and 19 deletions

View file

@ -168,7 +168,7 @@ input:3.1-9: ... declared here.
input:6.10-14: ignoring acceptance sets because of missing acceptance condition
input:7.5: state number is larger than state count...
input:3.1-9: ... declared here.
input:4.1-8: no definition for this initial state
input:4.1-8: initial state 1 has no definition
EOF
cat >input <<EOF
@ -184,7 +184,7 @@ expecterr input <<EOF
input:3.1-8: initial state number is larger than state count...
input:4.1-9: ... declared here.
input:1.1-4.9: missing 'Acceptance:' header
input:3.1-8: no definition for this initial state
input:3.1-8: initial state 1 has no definition
EOF
cat >input <<EOF
@ -200,7 +200,7 @@ EOF
expecterr input <<EOF
input:5.1-13: ignoring this redefinition of the acceptance condition...
input:2.1-13: ... previously defined here.
input:3.1-8: no definition for this initial state
input:3.1-8: initial state 0 has no definition
EOF
cat >input <<EOF
@ -963,7 +963,7 @@ input:21.5-7: $se string, expecting integer
input:25.1: $se \$undefined, expecting $end
input:25.1-12: ignoring leading garbage
input:32.1-5: $se header name, expecting --END-- or State:
input:28.1-8: no definition for this initial state
input:28.1-8: initial state 0 has no definition
input:37.1: $se 't', expecting $end
autfilt: failed to read automaton from input
EOF
@ -1628,6 +1628,47 @@ State: 0
EOF
expecterr bug <<EOF
bug:2.1-8: no definition for this initial state
bug:7.1-8: no definition for this initial state
bug:2.1-8: initial state 6 has no definition
bug:7.1-8: initial state 1 has no definition
EOF
cat >input <<EOF
HOA: v1
States: 10
Start: 0
AP: 2 "p0" "p1"
acc-name: all
Acceptance: 0 t
properties: trans-labels explicit-labels state-acc
--BODY--
State: 1
[!0&1] 0
[!0&!1] 3
State: 3
[!0&!1] 2
[!0&!1] 8
State: 4
[0&1] 6
[0&1] 5
[0&1] 2
[!0&1] 3
State: 6
[!0&!1] 1
[!0&!1] 3
[0&1] 7
[!0&1] 8
State: 7
[!0&1] 8
State: 9
[0&!1] 9
[0&!1] 5
--END--
EOF
expecterr input <<EOF
input:3.1-8: initial state 0 has no definition
input:13.9: state 2 has no definition
input:17.7: state 5 has no definition
input:14.9: state 8 has no definition
EOF