73 lines
1.5 KiB
Plaintext
73 lines
1.5 KiB
Plaintext
// SYNTAX TEST "tsl"
|
|
|
|
// 字符串,数字,注释
|
|
// 注释 TODO
|
|
// abc();
|
|
a := "string"; // 字符串
|
|
b := 123; // 数字
|
|
c := 1.23; // 浮点数
|
|
a := "字符串函数func()";
|
|
|
|
|
|
// 类相关
|
|
type MyClass = class
|
|
public
|
|
function Create();
|
|
function Destroy();virtual;
|
|
function Func1(a, b);
|
|
function Func2(a: real; b: string): array of string;
|
|
function Func3(a: real = 1; b: string = "123"): array of string;
|
|
|
|
property P1 write param1_ read param1_;
|
|
private
|
|
param1_: real;
|
|
param2_: array of string;
|
|
end;
|
|
|
|
function MyClass.Func1(a, b);
|
|
begin
|
|
end;
|
|
|
|
function MyClass.Func3(a: real = 1; b: string = "123"): array of string;
|
|
begin
|
|
obj.P1;
|
|
self.P1;
|
|
end
|
|
|
|
// 属性链
|
|
echo obj.name;
|
|
user.profile.email;
|
|
data.items.count;
|
|
|
|
// 函数声明
|
|
function f(); // 无参数
|
|
function f(a, b); // 参数无类型
|
|
function f(a: real; b: DD); // 参数有类型
|
|
function f(a: real = 1; b: string = "123"; c: number = abc.CONST1): def; // 带返回类型
|
|
|
|
// 函数调用
|
|
f();
|
|
f(a, b);
|
|
f(a: 1; b: 's');
|
|
f(f(2, "111"));
|
|
|
|
// 类变量声明,三元表达式(不应该有冲突)
|
|
a: string;
|
|
[weakref]b: MyClass;
|
|
a ? b : c;
|
|
a ? b : c ? d : e;
|
|
return ifnil(rpr_.Caps) ? false : rpr_.Caps.IsApplied;
|
|
|
|
// select
|
|
Select ["test"] from table end;
|
|
vselect ["test"] from table end;
|
|
select distinct ["test"] from table where ['a'] = 1 end;
|
|
|
|
// array
|
|
a := array(1, 2);
|
|
b := array((1, 2), (3, 4));
|
|
|
|
sql += "update ts_xbcheck result set isvalid = "$status$remark$" where checkid in ('"$array2str
|
|
(checkid[(i-1)*len:], "','")$"');\r\n"
|
|
sql +=
|