Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
29081790
Commit
29081790
authored
Aug 10, 2014
by
Maxime Perrotin
Browse files
Regression fix - on index check and choice syntax check
parent
a7387b78
Changes
5
Hide whitespace changes
Inline
Side-by-side
README
View file @
29081790
...
...
@@ -44,7 +44,8 @@ You need to install the following dependencies before you can run Opengeode:
$ cd /opt
$ sudo wget http://www.semantix.gr/asn1scc/asn1Comp.tar.gz
$ sudo tar zxvf asn1Comp.tar.gz
$ sudo apt-get install mono-runtime libmono-system-runtime4.0-cil
$ sudo apt-get install mono-runtime libmono-system-runtime4.0-cil libmono-i18n-west2.0-cil libmono-posix2.0-cil libmono-security2.0-cil
libmono-system-runtime-serialization4.0-cil
Check that it works:
$ asn1Comp/bin/asn1.exe
...
...
README.md
View file @
29081790
...
...
@@ -57,7 +57,8 @@ Apart from pygraphviz, all of them exist for Linux, Windows, FreeBSD, and most l
On Debian, Ubuntu, and probably other distributions:
```
bash
$
sudo
apt-get
install
python-pyside pyside-tools graphviz pip gnat mono-runtime libmono-system-runtime4.0-cil
$
sudo
apt-get
install
python-pyside pyside-tools graphviz pip gnat mono-runtime libmono-system-runtime4.0-cil libmono-i18n-west2.0-cil libmono-posix2.0-cil libmono-security2.0-cil
libmono-system-runtime-serialization4.0-cil
$
sudo
pip
install
--upgrade
graphviz enum34 singledispatch
$
sudo
pip
install
antlr_python_runtime
--allow-external
antlr_python_runtime
--allow-unverified
antlr_python_runtime
```
...
...
ogParser.py
View file @
29081790
...
...
@@ -1452,12 +1452,15 @@ def primary_index(root, context):
if
not
is_integer
(
idx_bty
):
errors
.
append
(
error
(
root
,
'Index is not an integer'
))
else
:
if
float
(
idx_bty
.
Min
)
<
float
(
r_min
)
or
\
float
(
idx_bty
.
Max
)
>=
float
(
r_max
):
if
float
(
idx_bty
.
Max
)
>=
float
(
r_max
):
errors
.
append
(
error
(
root
,
'Index outside of range [{} .. <{}]'
.
format
(
r_min
,
r_max
)))
'Index range [{id1} .. {id2}] '
'outside of range [0 .. <{r2}]'
.
format
(
id1
=
idx_bty
.
Min
,
id2
=
idx_bty
.
Max
,
r2
=
r_max
)))
elif
float
(
idx_bty
.
Min
)
>
float
(
r_min
):
warnings
.
append
(
warning
(
root
,
'Index higher than range min value'
))
else
:
msg
=
'Index can only be applied to type SequenceOf'
errors
.
append
(
error
(
root
,
msg
))
...
...
@@ -1528,7 +1531,7 @@ def selector_expression(root, context):
field_name
=
root
.
children
[
1
].
text
.
replace
(
'_'
,
'-'
).
lower
()
try
:
if
receiver_bty
.
kind
==
'ChoiceType'
:
error
s
.
append
(
error
(
root
,
'Wrong syntax for a CHOICE selector. '
warning
s
.
append
(
error
(
root
,
'Wrong syntax for a CHOICE selector. '
'Use "var := {field}: value" instead of '
'"var!{field} := value"'
.
format
(
field
=
field_name
)))
...
...
@@ -3541,7 +3544,8 @@ def for_loop(root, context):
basic
=
find_basic_type
(
start_expr
.
exprType
)
r_min
=
basic
.
Min
if
basic
!=
UNKNOWN_TYPE
else
'0'
basic
=
find_basic_type
(
stop_expr
.
exprType
)
r_max
=
basic
.
Max
if
basic
!=
UNKNOWN_TYPE
else
'4294967295'
r_max
=
str
(
int
(
float
(
basic
.
Max
)
-
1
))
\
if
basic
!=
UNKNOWN_TYPE
else
'4294967295'
# basic may be UNKNOWN_TYPE if the expression is a
# reference to an ASN.1 constant - their values are not
# currently visible to the SDL parser
...
...
@@ -3715,6 +3719,9 @@ def pr_file(root):
# Can happen if DataView.py is not there
LOG
.
info
(
'USE Clause did not contain ASN.1 filename'
)
LOG
.
debug
(
str
(
err
))
except
TypeError
as
err
:
errors
.
append
(
'ASN.1 compiler execution failed'
)
LOG
.
debug
(
str
(
err
))
for
child
in
systems
:
LOG
.
debug
(
'found SYSTEM'
)
...
...
tests/regression/test4/Makefile
View file @
29081790
all
:
test-ada
edit
:
../../../opengeode.py orchestrator.pr system_structure.pr
test-parse
:
../../../opengeode.py orchestrator.pr system_structure.pr
--check
...
...
tests/regression/test9/challenge.pr
View file @
29081790
...
...
@@ -20,29 +20,29 @@ dcl testvalue t_boolean := true;
dcl nested Nested := {a {b {c {p {x 1, y 2}, l {3, 4}}}}};
/* CIF ENDTEXT */
/* CIF START (6
7
2,
1
4), (68, 37) */
/* CIF START (6
3
2,
2
4), (68, 37) */
START;
/* CIF TASK (
61
3,
6
6), (184, 72) */
TASK for x in count:
/* CIF TASK (
57
3,
7
6), (184, 72) */
TASK for x in
range(
count
)
:
count(x) := count_max
actual_count(x) := 0
endfor;
/* CIF TASK (5
5
7, 1
5
3), (298, 35) */
/* CIF TASK (5
1
7, 1
6
3), (298, 35) */
TASK nested := {a {b {c {p {x 1, y 2}, l {3, 4}}}}};
/* CIF NEXTSTATE (6
7
1, 2
0
3), (70, 35) */
/* CIF NEXTSTATE (6
3
1, 2
1
3), (70, 35) */
NEXTSTATE Wait;
/* CIF STATE (75
9
, 11), (68, 35) */
/* CIF STATE (75
7
, 11), (68, 35) */
STATE Wait;
ENDSTATE;
/* CIF STATE (6
7
1, 2
0
3), (70, 35) */
/* CIF STATE (6
3
1, 2
1
3), (70, 35) */
STATE Wait;
/* CIF INPUT (6
7
1, 2
5
8), (70, 35) */
/* CIF INPUT (6
3
1, 2
6
8), (70, 35) */
INPUT run;
/* CIF PROCEDURECALL (
62
2, 3
0
8), (166, 35) */
/* CIF PROCEDURECALL (
58
2, 3
1
8), (166, 35) */
CALL writeln('Computing');
/* CIF TASK (4
99
, 3
5
8), (4
12
, 216) */
/* CIF TASK (4
43
, 3
6
8), (4
44
, 216) */
TASK for x in range(exceed_nb):
for n in range(
nb_bit):
for n in range(
20): -- can't use nb_bit: asn1 constants are not visible
call pow(2, n, pow_value);
check := if val_max - x>0 and pow_value>0 then 1 else 0 fi
bitwise := bitwise and bitwise
...
...
@@ -54,7 +54,7 @@ endfor;
call test((n+1) mod 255, testvalue);
endfor
endfor;
/* CIF NEXTSTATE (6
7
1, 5
8
9), (70, 35) */
/* CIF NEXTSTATE (6
3
1, 5
9
9), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS challenge;
\ No newline at end of file
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