2024-01-20 12:38:25 +08:00
|
|
|
var t, id1, id2;
|
2021-03-11 22:48:16 +01:00
|
|
|
var n := 0;
|
|
|
|
|
|
2024-10-04 10:29:55 +02:00
|
|
|
function testPrint( num )
|
|
|
|
|
n += 1;
|
|
|
|
|
print( CStr( n ) + "." );
|
|
|
|
|
print( TypeOf( t ) );
|
|
|
|
|
print( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
t := $""; // zero parts
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"foo"; // one part, string
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"{1}"; // one part, expression -> integer literal
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
id1 := 0xbad.beefp4;
|
2024-10-04 10:29:55 +02:00
|
|
|
t := $"{id1}"; // one part, expression -> identifier -> hex float literal
|
|
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
// #5
|
|
|
|
|
t := $"foo{""}"; // two parts
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"{1}bar"; // one part, expression -> integer literal
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
id1 := "foo";
|
|
|
|
|
id2 := "bar";
|
2024-10-04 10:29:55 +02:00
|
|
|
t := $"{id1}{id2}"; // two parts
|
|
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"{uninit}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"!{uninit}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
// #10
|
|
|
|
|
t := $"{uninit}!";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"!{uninit}!";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
2024-10-04 10:29:55 +02:00
|
|
|
t := $"{CAsc( "a" )}"; // expression -> function call, that returns a Long
|
|
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"{48879:#x}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"Hello {"string":#x}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
2024-02-06 16:44:26 +07:00
|
|
|
// #15
|
2021-03-11 22:48:16 +01:00
|
|
|
t := $"Hello, {@testPrint}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
|
|
|
|
t := $"Hello{$"\x61\x62\x63"}World";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2021-03-11 22:48:16 +01:00
|
|
|
|
2024-10-04 10:29:55 +02:00
|
|
|
t := $"Hello, {{{"_".join( array{ 1, 2, 3 } )}}}";
|
|
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"{{";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"{{{{";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
// #20
|
|
|
|
|
t := $"}}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"}}}}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"{{}}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"{{{{}}}}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
t := $"{{{{{"_"}}}}}!{{{{" - "}}}}"; // interstring MINUS string
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|
2024-02-06 16:44:26 +07:00
|
|
|
|
|
|
|
|
// #25
|
|
|
|
|
t := $"{{{{{"-"}}}}}!{{{"-"}}}";
|
2024-10-04 10:29:55 +02:00
|
|
|
testPrint( t );
|