mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-05 21:40:25 +00:00
Merge pull request #202 from mkilgore/fix-string-bit-n-length
Fix `String * n` and `Bit * n` when used with `Static` arrays.
This commit is contained in:
commit
085444f9c2
|
@ -22382,41 +22382,54 @@ FUNCTION type2symbol$ (typ$)
|
|||
IF MID$(t$, i, 1) = sp THEN MID$(t$, i, 1) = " "
|
||||
NEXT
|
||||
e$ = "Cannot convert type (" + typ$ + ") to symbol"
|
||||
t2$ = "_UNSIGNED _BIT": s$ = "~`1": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED _BYTE": s$ = "~%%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED LONG": s$ = "~&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED _INTEGER64": s$ = "~&&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED INTEGER": s$ = "~%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED _OFFSET": s$ = "~%&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_BIT": s$ = "`1": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_BYTE": s$ = "%%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "INTEGER": s$ = "%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "LONG": s$ = "&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_INTEGER64": s$ = "&&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_OFFSET": s$ = "%&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "SINGLE": s$ = "!": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "DOUBLE": s$ = "#": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_FLOAT": s$ = "##": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "STRING": s$ = "$": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED BIT": s$ = "~`1": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED LONG": s$ = "~&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED INTEGER": s$ = "~%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _BIT": s$ = "~`1": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED BIT": s$ = "~`1": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "BIT": s$ = "`1": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_BYTE": s$ = "%%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "BYTE": s$ = "%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_UNSIGNED LONG": s$ = "~&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED LONG": s$ = "~&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_UNSIGNED INTEGER": s$ = "~%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED INTEGER": s$ = "~%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_UNSIGNED _BYTE": s$ = "~%%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED BYTE": s$ = "~%%": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_UNSIGNED _OFFSET": s$ = "~%&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED OFFSET": s$ = "~%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_UNSIGNED _INTEGER64": s$ = "~&&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED INTEGER64": s$ = "~&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_INTEGER64": s$ = "&&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "INTEGER64": s$ = "&&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "INTEGER": s$ = "%": IF t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_OFFSET": s$ = "%&": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "OFFSET": s$ = "%&": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
t2$ = "_FLOAT": s$ = "##": IF t$ = t2$ THEN GOTO t2sfound
|
||||
t2$ = "FLOAT": s$ = "##": IF qb64prefix_set = 1 AND t$ = t2$ THEN GOTO t2sfound
|
||||
|
||||
' These can have a length after them, so LEFT$() is used
|
||||
t2$ = "STRING": s$ = "$": IF LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED _BIT": s$ = "~`1": IF LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_UNSIGNED BIT": s$ = "~`1": IF qb64prefix_set = 1 AND LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED _BIT": s$ = "~`1": IF qb64prefix_set = 1 AND LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "UNSIGNED BIT": s$ = "~`1": IF qb64prefix_set = 1 AND LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "_BIT": s$ = "`1": IF LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
t2$ = "BIT": s$ = "`1": IF qb64prefix_set = 1 AND LEFT$(t$, LEN(t2$)) = t2$ THEN GOTO t2sfound
|
||||
|
||||
Give_Error e$: EXIT FUNCTION
|
||||
t2sfound:
|
||||
type2symbol$ = s$
|
||||
|
@ -22567,9 +22580,15 @@ FUNCTION typname2typ& (t2$)
|
|||
IF u THEN typname2typ& = UBITTYPE ELSE typname2typ& = BITTYPE
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
IF LEFT$(t$, 7) <> "_BIT * " OR (LEFT$(t$, 6) = "BIT * " AND qb64prefix_set = 1) THEN Give_Error "Expected _BIT * number": EXIT FUNCTION
|
||||
|
||||
n$ = RIGHT$(t$, LEN(t$) - 7)
|
||||
IF LEFT$(t$, 7) <> "_BIT * " AND LEFT$(t$, 6) <> "BIT * " THEN Give_Error "Expected " + qb64prefix$ + "BIT * number": EXIT FUNCTION
|
||||
|
||||
IF LEFT$(t$, 4) = "_BIT" THEN
|
||||
n$ = RIGHT$(t$, LEN(t$) - 7)
|
||||
ELSE
|
||||
n$ = RIGHT$(t$, LEN(t$) - 6)
|
||||
END IF
|
||||
|
||||
IF isuinteger(n$) = 0 THEN Give_Error "Invalid size after " + qb64prefix$ + "BIT *": EXIT FUNCTION
|
||||
b = VAL(n$)
|
||||
IF b = 0 OR b > 64 THEN Give_Error "Invalid size after " + qb64prefix$ + "BIT *": EXIT FUNCTION
|
||||
|
|
126
tests/compile_tests/types/all_types.bas
Normal file
126
tests/compile_tests/types/all_types.bas
Normal file
|
@ -0,0 +1,126 @@
|
|||
$NoPrefix
|
||||
$CONSOLE:ONLY
|
||||
|
||||
Dim dim_m As _Mem
|
||||
|
||||
Dim dim_s As String
|
||||
Dim dim_s2 As String * 8
|
||||
|
||||
Dim dim_b As _Bit
|
||||
Dim dim_b1 As Bit
|
||||
Dim dim_b2 As _Unsigned _Bit
|
||||
Dim dim_b3 As Unsigned _Bit
|
||||
Dim dim_b4 As _Unsigned Bit
|
||||
Dim dim_b5 As Unsigned Bit
|
||||
|
||||
Dim dim_bn As _Bit * 7
|
||||
Dim dim_bn1 As Bit * 7
|
||||
Dim dim_bn2 As _Unsigned _Bit * 7
|
||||
Dim dim_bn3 As Unsigned _Bit * 7
|
||||
Dim dim_bn4 As _Unsigned Bit * 7
|
||||
Dim dim_bn5 As Unsigned Bit * 7
|
||||
|
||||
Dim dim_byte As _Byte
|
||||
Dim dim_byte1 As Byte
|
||||
Dim dim_byte2 As _Unsigned _Byte
|
||||
Dim dim_byte3 As Unsigned _Byte
|
||||
Dim dim_byte4 As _Unsigned Byte
|
||||
Dim dim_byte5 As Unsigned Byte
|
||||
|
||||
Dim dim_i64 As _Integer64
|
||||
Dim dim_i64_1 As Integer64
|
||||
Dim dim_i64_2 As _Unsigned _Integer64
|
||||
Dim dim_i64_3 As Unsigned _Integer64
|
||||
Dim dim_i64_4 As _Unsigned Integer64
|
||||
Dim dim_i64_5 As Unsigned Integer64
|
||||
|
||||
Dim dim_o As _Offset
|
||||
Dim dim_o1 As Offset
|
||||
Dim dim_o2 As _Unsigned _Offset
|
||||
Dim dim_o3 As Unsigned _Offset
|
||||
Dim dim_o4 As _Unsigned Offset
|
||||
Dim dim_o5 As Unsigned Offset
|
||||
|
||||
Dim dim_i As Integer
|
||||
Dim dim_i2 As _Unsigned Integer
|
||||
Dim dim_i3 As Unsigned Integer
|
||||
|
||||
Dim dim_l As Long
|
||||
Dim dim_l2 As _Unsigned Long
|
||||
Dim dim_l3 As Unsigned Long
|
||||
|
||||
Dim dim_si As Single
|
||||
Dim dim_d As Double
|
||||
Dim dim_f As _Float
|
||||
|
||||
test
|
||||
|
||||
SYSTEM
|
||||
|
||||
Sub test ()
|
||||
Static m As _Mem
|
||||
|
||||
Static s As String
|
||||
Static s2 As String * 8
|
||||
|
||||
Static b As _Bit
|
||||
Static b1 As Bit
|
||||
Static b2 As _Unsigned _Bit
|
||||
Static b3 As Unsigned _Bit
|
||||
Static b4 As _Unsigned Bit
|
||||
Static b5 As Unsigned Bit
|
||||
|
||||
Static bn As _Bit * 7
|
||||
Static bn1 As Bit * 7
|
||||
Static bn2 As _Unsigned _Bit * 7
|
||||
Static bn3 As Unsigned _Bit * 7
|
||||
Static bn4 As _Unsigned Bit * 7
|
||||
Static bn5 As Unsigned Bit * 7
|
||||
|
||||
Static byt As _Byte
|
||||
Static byt1 As Byte
|
||||
Static byt2 As _Unsigned _Byte
|
||||
Static byt3 As Unsigned _Byte
|
||||
Static byt4 As _Unsigned Byte
|
||||
Static byt5 As Unsigned Byte
|
||||
|
||||
Static i64 As _Integer64
|
||||
Static i64_1 As Integer64
|
||||
Static i64_2 As _Unsigned _Integer64
|
||||
Static i64_3 As Unsigned _Integer64
|
||||
Static i64_4 As _Unsigned Integer64
|
||||
Static i64_5 As Unsigned Integer64
|
||||
|
||||
Static o As _Offset
|
||||
Static o1 As Offset
|
||||
Static o2 As _Unsigned _Offset
|
||||
Static o3 As Unsigned _Offset
|
||||
Static o4 As _Unsigned Offset
|
||||
Static o5 As Unsigned Offset
|
||||
|
||||
Static i As Integer
|
||||
Static i2 As _Unsigned Integer
|
||||
Static i3 As Unsigned Integer
|
||||
|
||||
Static l As Long
|
||||
Static l2 As _Unsigned Long
|
||||
Static l3 As Unsigned Long
|
||||
|
||||
Static si As Single
|
||||
Static d As Double
|
||||
Static f As _Float
|
||||
|
||||
' Just check a few of them
|
||||
s2 = "HI"
|
||||
b = -1
|
||||
bn = 20
|
||||
byt = 50
|
||||
i64 = 23456
|
||||
i = 70
|
||||
l = 80
|
||||
si = 2.2
|
||||
d = 2.4
|
||||
f = 2.8
|
||||
|
||||
PRINT "TEST: "; s2; b; bn; byt; i64; i; l; si; d; f
|
||||
End Sub
|
1
tests/compile_tests/types/all_types.output
Normal file
1
tests/compile_tests/types/all_types.output
Normal file
|
@ -0,0 +1 @@
|
|||
TEST: HI -1 20 50 23456 70 80 2.2 2.4 2.8
|
70
tests/compile_tests/types/dim.bas
Normal file
70
tests/compile_tests/types/dim.bas
Normal file
|
@ -0,0 +1,70 @@
|
|||
$NoPrefix
|
||||
$CONSOLE:ONLY
|
||||
|
||||
Dim m As _Mem
|
||||
|
||||
Dim s As String
|
||||
Dim s2 As String * 8
|
||||
|
||||
Dim b As _Bit
|
||||
Dim b1 As Bit
|
||||
Dim b2 As _Unsigned _Bit
|
||||
Dim b3 As Unsigned _Bit
|
||||
Dim b4 As _Unsigned Bit
|
||||
Dim b5 As Unsigned Bit
|
||||
|
||||
Dim bn As _Bit * 7
|
||||
Dim bn1 As Bit * 7
|
||||
Dim bn2 As _Unsigned _Bit * 7
|
||||
Dim bn3 As Unsigned _Bit * 7
|
||||
Dim bn4 As _Unsigned Bit * 7
|
||||
Dim bn5 As Unsigned Bit * 7
|
||||
|
||||
Dim byt As _Byte
|
||||
Dim byt1 As Byte
|
||||
Dim byt2 As _Unsigned _Byte
|
||||
Dim byt3 As Unsigned _Byte
|
||||
Dim byt4 As _Unsigned Byte
|
||||
Dim byt5 As Unsigned Byte
|
||||
|
||||
Dim i64 As _Integer64
|
||||
Dim i64_1 As Integer64
|
||||
Dim i64_2 As _Unsigned _Integer64
|
||||
Dim i64_3 As Unsigned _Integer64
|
||||
Dim i64_4 As _Unsigned Integer64
|
||||
Dim i64_5 As Unsigned Integer64
|
||||
|
||||
Dim o As _Offset
|
||||
Dim o1 As Offset
|
||||
Dim o2 As _Unsigned _Offset
|
||||
Dim o3 As Unsigned _Offset
|
||||
Dim o4 As _Unsigned Offset
|
||||
Dim o5 As Unsigned Offset
|
||||
|
||||
Dim i As Integer
|
||||
Dim i2 As _Unsigned Integer
|
||||
Dim i3 As Unsigned Integer
|
||||
|
||||
Dim l As Long
|
||||
Dim l2 As _Unsigned Long
|
||||
Dim l3 As Unsigned Long
|
||||
|
||||
Dim si As Single
|
||||
Dim d As Double
|
||||
Dim f As _Float
|
||||
|
||||
' Just check a few of them
|
||||
s2 = "HI"
|
||||
b = -1
|
||||
bn = 20
|
||||
byt = 50
|
||||
i64 = 23456
|
||||
i = 70
|
||||
l = 80
|
||||
si = 2.2
|
||||
d = 2.4
|
||||
f = 2.8
|
||||
|
||||
PRINT "TEST: "; s2; b; bn; byt; i64; i; l; si; d; f
|
||||
|
||||
SYSTEM
|
1
tests/compile_tests/types/dim.output
Normal file
1
tests/compile_tests/types/dim.output
Normal file
|
@ -0,0 +1 @@
|
|||
TEST: HI -1 20 50 23456 70 80 2.2 2.4 2.8
|
70
tests/compile_tests/types/dim_array.bas
Normal file
70
tests/compile_tests/types/dim_array.bas
Normal file
|
@ -0,0 +1,70 @@
|
|||
$NoPrefix
|
||||
$CONSOLE:ONLY
|
||||
|
||||
Dim m(3) As _Mem
|
||||
|
||||
Dim s(3) As String
|
||||
Dim s2(3) As String * 8
|
||||
|
||||
Dim b(3) As _Bit
|
||||
Dim b1(3) As Bit
|
||||
Dim b2(3) As _Unsigned _Bit
|
||||
Dim b3(3) As Unsigned _Bit
|
||||
Dim b4(3) As _Unsigned Bit
|
||||
Dim b5(3) As Unsigned Bit
|
||||
|
||||
Dim bn(3) As _Bit * 7
|
||||
Dim bn1(3) As Bit * 7
|
||||
Dim bn2(3) As _Unsigned _Bit * 7
|
||||
Dim bn3(3) As Unsigned _Bit * 7
|
||||
Dim bn4(3) As _Unsigned Bit * 7
|
||||
Dim bn5(3) As Unsigned Bit * 7
|
||||
|
||||
Dim byt(3) As _Byte
|
||||
Dim byt1(3) As Byte
|
||||
Dim byt2(3) As _Unsigned _Byte
|
||||
Dim byt3(3) As Unsigned _Byte
|
||||
Dim byt4(3) As _Unsigned Byte
|
||||
Dim byt5(3) As Unsigned Byte
|
||||
|
||||
Dim i64(3) As _Integer64
|
||||
Dim i64_1(3) As Integer64
|
||||
Dim i64_2(3) As _Unsigned _Integer64
|
||||
Dim i64_3(3) As Unsigned _Integer64
|
||||
Dim i64_4(3) As _Unsigned Integer64
|
||||
Dim i64_5(3) As Unsigned Integer64
|
||||
|
||||
Dim o(3) As _Offset
|
||||
Dim o1(3) As Offset
|
||||
Dim o2(3) As _Unsigned _Offset
|
||||
Dim o3(3) As Unsigned _Offset
|
||||
Dim o4(3) As _Unsigned Offset
|
||||
Dim o5(3) As Unsigned Offset
|
||||
|
||||
Dim i(3) As Integer
|
||||
Dim i2(3) As _Unsigned Integer
|
||||
Dim i3(3) As Unsigned Integer
|
||||
|
||||
Dim l(3) As Long
|
||||
Dim l2(3) As _Unsigned Long
|
||||
Dim l3(3) As Unsigned Long
|
||||
|
||||
Dim si(3) As Single
|
||||
Dim d(3) As Double
|
||||
Dim f(3) As _Float
|
||||
|
||||
' Just check a few of them
|
||||
s2(1) = "HI"
|
||||
b(1) = -1
|
||||
bn(1) = 20
|
||||
byt(1) = 50
|
||||
i64(1) = 23456
|
||||
i(1) = 70
|
||||
l(1) = 80
|
||||
si(1) = 2.2
|
||||
d(1) = 2.4
|
||||
f(1) = 2.8
|
||||
|
||||
PRINT "TEST: "; s2(1); b(1); bn(1); byt(1); i64(1); i(1); l(1); si(1); d(1); f(1)
|
||||
|
||||
SYSTEM
|
1
tests/compile_tests/types/dim_array.output
Normal file
1
tests/compile_tests/types/dim_array.output
Normal file
|
@ -0,0 +1 @@
|
|||
TEST: HI -1 20 50 23456 70 80 2.2 2.4 2.8
|
3
tests/compile_tests/types/dim_bad_bit_no_length.bas
Normal file
3
tests/compile_tests/types/dim_bad_bit_no_length.bas
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
' The length of the _Bit is missing
|
||||
Dim bi As _Bit *
|
4
tests/compile_tests/types/dim_bad_bit_no_length.err
Normal file
4
tests/compile_tests/types/dim_bad_bit_no_length.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected _BIT * number
|
||||
Caused by (or after):DIM BI AS _BIT *
|
||||
LINE 3:Dim bi As _Bit *
|
3
tests/compile_tests/types/dim_bad_string_no_length.bas
Normal file
3
tests/compile_tests/types/dim_bad_string_no_length.bas
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
' The length of the fixed length string is missing
|
||||
Dim s As String *
|
4
tests/compile_tests/types/dim_bad_string_no_length.err
Normal file
4
tests/compile_tests/types/dim_bad_string_no_length.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected STRING * number/constant
|
||||
Caused by (or after):DIM S AS STRING *
|
||||
LINE 3:Dim s As String *
|
3
tests/compile_tests/types/dim_bad_typename_byte.bas
Normal file
3
tests/compile_tests/types/dim_bad_typename_byte.bas
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
' "f" after _Byte is an invalid type
|
||||
Dim b As _Bytef
|
4
tests/compile_tests/types/dim_bad_typename_byte.err
Normal file
4
tests/compile_tests/types/dim_bad_typename_byte.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Unknown type
|
||||
Caused by (or after):DIM B AS _BYTEF
|
||||
LINE 3:Dim b As _Bytef
|
3
tests/compile_tests/types/dim_bad_typename_string.bas
Normal file
3
tests/compile_tests/types/dim_bad_typename_string.bas
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
' "foobar" after "String" is invalid
|
||||
Dim s As Stringfoobar * 2
|
4
tests/compile_tests/types/dim_bad_typename_string.err
Normal file
4
tests/compile_tests/types/dim_bad_typename_string.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected STRING * number/constant
|
||||
Caused by (or after):DIM S AS STRINGFOOBAR * 2
|
||||
LINE 3:Dim s As Stringfoobar * 2
|
74
tests/compile_tests/types/static.bas
Normal file
74
tests/compile_tests/types/static.bas
Normal file
|
@ -0,0 +1,74 @@
|
|||
$NoPrefix
|
||||
$CONSOLE:ONLY
|
||||
|
||||
test
|
||||
|
||||
SYSTEM
|
||||
|
||||
Sub test ()
|
||||
Static m As _Mem
|
||||
|
||||
Static s As String
|
||||
Static s2 As String * 8
|
||||
|
||||
Static b As _Bit
|
||||
Static b1 As Bit
|
||||
Static b2 As _Unsigned _Bit
|
||||
Static b3 As Unsigned _Bit
|
||||
Static b4 As _Unsigned Bit
|
||||
Static b5 As Unsigned Bit
|
||||
|
||||
Static bn As _Bit * 7
|
||||
Static bn1 As Bit * 7
|
||||
Static bn2 As _Unsigned _Bit * 7
|
||||
Static bn3 As Unsigned _Bit * 7
|
||||
Static bn4 As _Unsigned Bit * 7
|
||||
Static bn5 As Unsigned Bit * 7
|
||||
|
||||
Static byt As _Byte
|
||||
Static byt1 As Byte
|
||||
Static byt2 As _Unsigned _Byte
|
||||
Static byt3 As Unsigned _Byte
|
||||
Static byt4 As _Unsigned Byte
|
||||
Static byt5 As Unsigned Byte
|
||||
|
||||
Static i64 As _Integer64
|
||||
Static i64_1 As Integer64
|
||||
Static i64_2 As _Unsigned _Integer64
|
||||
Static i64_3 As Unsigned _Integer64
|
||||
Static i64_4 As _Unsigned Integer64
|
||||
Static i64_5 As Unsigned Integer64
|
||||
|
||||
Static o As _Offset
|
||||
Static o1 As Offset
|
||||
Static o2 As _Unsigned _Offset
|
||||
Static o3 As Unsigned _Offset
|
||||
Static o4 As _Unsigned Offset
|
||||
Static o5 As Unsigned Offset
|
||||
|
||||
Static i As Integer
|
||||
Static i2 As _Unsigned Integer
|
||||
Static i3 As Unsigned Integer
|
||||
|
||||
Static l As Long
|
||||
Static l2 As _Unsigned Long
|
||||
Static l3 As Unsigned Long
|
||||
|
||||
Static si As Single
|
||||
Static d As Double
|
||||
Static f As _Float
|
||||
|
||||
' Just check a few of them
|
||||
s2 = "HI"
|
||||
b = -1
|
||||
bn = 20
|
||||
byt = 50
|
||||
i64 = 23456
|
||||
i = 70
|
||||
l = 80
|
||||
si = 2.2
|
||||
d = 2.4
|
||||
f = 2.8
|
||||
|
||||
PRINT "TEST: "; s2; b; bn; byt; i64; i; l; si; d; f
|
||||
End Sub
|
1
tests/compile_tests/types/static.output
Normal file
1
tests/compile_tests/types/static.output
Normal file
|
@ -0,0 +1 @@
|
|||
TEST: HI -1 20 50 23456 70 80 2.2 2.4 2.8
|
74
tests/compile_tests/types/static_array.bas
Normal file
74
tests/compile_tests/types/static_array.bas
Normal file
|
@ -0,0 +1,74 @@
|
|||
$NoPrefix
|
||||
$CONSOLE:ONLY
|
||||
|
||||
test
|
||||
|
||||
SYSTEM
|
||||
|
||||
Sub test ()
|
||||
Static m(3) As _Mem
|
||||
|
||||
Static s(3) As String
|
||||
Static s2(3) As String * 8
|
||||
|
||||
Static b(3) As _Bit
|
||||
Static b1(3) As Bit
|
||||
Static b2(3) As _Unsigned _Bit
|
||||
Static b3(3) As Unsigned _Bit
|
||||
Static b4(3) As _Unsigned Bit
|
||||
Static b5(3) As Unsigned Bit
|
||||
|
||||
Static bn(3) As _Bit * 7
|
||||
Static bn1(3) As Bit * 7
|
||||
Static bn2(3) As _Unsigned _Bit * 7
|
||||
Static bn3(3) As Unsigned _Bit * 7
|
||||
Static bn4(3) As _Unsigned Bit * 7
|
||||
Static bn5(3) As Unsigned Bit * 7
|
||||
|
||||
Static byt(3) As _Byte
|
||||
Static byt1(3) As Byte
|
||||
Static byt2(3) As _Unsigned _Byte
|
||||
Static byt3(3) As Unsigned _Byte
|
||||
Static byt4(3) As _Unsigned Byte
|
||||
Static byt5(3) As Unsigned Byte
|
||||
|
||||
Static i64(3) As _Integer64
|
||||
Static i64_1(3) As Integer64
|
||||
Static i64_2(3) As _Unsigned _Integer64
|
||||
Static i64_3(3) As Unsigned _Integer64
|
||||
Static i64_4(3) As _Unsigned Integer64
|
||||
Static i64_5(3) As Unsigned Integer64
|
||||
|
||||
Static o(3) As _Offset
|
||||
Static o1(3) As Offset
|
||||
Static o2(3) As _Unsigned _Offset
|
||||
Static o3(3) As Unsigned _Offset
|
||||
Static o4(3) As _Unsigned Offset
|
||||
Static o5(3) As Unsigned Offset
|
||||
|
||||
Static i(3) As Integer
|
||||
Static i2(3) As _Unsigned Integer
|
||||
Static i3(3) As Unsigned Integer
|
||||
|
||||
Static l(3) As Long
|
||||
Static l2(3) As _Unsigned Long
|
||||
Static l3(3) As Unsigned Long
|
||||
|
||||
Static si(3) As Single
|
||||
Static d(3) As Double
|
||||
Static f(3) As _Float
|
||||
|
||||
' Just check a few of them
|
||||
s2(1) = "HI"
|
||||
b(1) = -1
|
||||
bn(1) = 20
|
||||
byt(1) = 50
|
||||
i64(1) = 23456
|
||||
i(1) = 70
|
||||
l(1) = 80
|
||||
si(1) = 2.2
|
||||
d(1) = 2.4
|
||||
f(1) = 2.8
|
||||
|
||||
PRINT "TEST: "; s2(1); b(1); bn(1); byt(1); i64(1); i(1); l(1); si(1); d(1); f(1)
|
||||
End Sub
|
1
tests/compile_tests/types/static_array.output
Normal file
1
tests/compile_tests/types/static_array.output
Normal file
|
@ -0,0 +1 @@
|
|||
TEST: HI -1 20 50 23456 70 80 2.2 2.4 2.8
|
5
tests/compile_tests/types/static_bad_bit_no_length.bas
Normal file
5
tests/compile_tests/types/static_bad_bit_no_length.bas
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
' The length of the _Bit is missing
|
||||
Sub test ()
|
||||
Static bi As _Bit *
|
||||
End Sub
|
4
tests/compile_tests/types/static_bad_bit_no_length.err
Normal file
4
tests/compile_tests/types/static_bad_bit_no_length.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected _BIT * number
|
||||
Caused by (or after):STATIC BI AS _BIT *
|
||||
LINE 4:Static bi As _Bit *
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
' The length of the fixed length string is missing
|
||||
Sub test ()
|
||||
Static s As String *
|
||||
End Sub
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected STRING * number/constant
|
||||
Caused by (or after):STATIC S AS STRING *
|
||||
LINE 4:Static s As String *
|
5
tests/compile_tests/types/static_bad_typename_byte.bas
Normal file
5
tests/compile_tests/types/static_bad_typename_byte.bas
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
' "f" after _Byte is an invalid type
|
||||
Sub test ()
|
||||
Static b As _Bytef
|
||||
End Sub
|
4
tests/compile_tests/types/static_bad_typename_byte.err
Normal file
4
tests/compile_tests/types/static_bad_typename_byte.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Unknown type
|
||||
Caused by (or after):STATIC B AS _BYTEF
|
||||
LINE 4:Static b As _Bytef
|
5
tests/compile_tests/types/static_bad_typename_string.bas
Normal file
5
tests/compile_tests/types/static_bad_typename_string.bas
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
' "foobar" after "String" is invalid
|
||||
Sub test ()
|
||||
Static s As Stringfoobar * 2
|
||||
End Sub
|
4
tests/compile_tests/types/static_bad_typename_string.err
Normal file
4
tests/compile_tests/types/static_bad_typename_string.err
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
Expected STRING * number/constant
|
||||
Caused by (or after):STATIC S AS STRINGFOOBAR * 2
|
||||
LINE 4:Static s As Stringfoobar * 2
|
Loading…
Reference in a new issue