Skip to content

Commit 6fbce81

Browse files
committed
Support accessing float DATA array values.
This closes #111.
1 parent db16d9d commit 6fbce81

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/syntax/float.syn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ INPUT_VAR:
128128
# Arrays
129129
ARRAY_FLOAT_ADDR:
130130
emit { TOK_VAR_LOAD, VT_ARRAY_FLOAT } E_VAR_SEARCH "%" emit TOK_PUSH PAR_EXPR emit { TOK_MUL6, TOK_ADD }
131+
emit { TOK_NUM, VT_ARRAY_FLOAT } E_LABEL "%" emit TOK_PUSH PAR_EXPR emit { TOK_MUL6, TOK_ADD }
131132
132133
# This is added at start of current table (<)
133134
DIM_VAR_TYPE:<

testsuite/tests/floatadr.bas

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ A%(2) = 0.03125
1616
@SUM &A%, 3
1717
? SUM%
1818

19+
' Test address of data arrays
1920
DATA B%() = -0.125, 0.0625, 0.03125
2021
@SUM &B%, 3
2122
? SUM%
2223

23-
X%=1234.5
2424

25+
' Test address of variables
26+
X%=1234.5
2527
@SUM &X%, 1
2628
? SUM%
29+
30+
' Test access to individual data array values
31+
X%=B%(1)
32+
? X%

testsuite/tests/floatadr.chk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Output:
44
0.21875
55
-0.03125
66
1234.5
7+
0.0625

0 commit comments

Comments
 (0)