fix and improvements
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
// SYNTAX TEST "tsl"
|
||||
|
||||
// 字符串,数字,注释
|
||||
// 注释 TODO
|
||||
a := "string"; // 字符串
|
||||
b := 123; // 数字
|
||||
c := 1.23; // 浮点数
|
||||
|
||||
|
||||
// 类相关
|
||||
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');
|
||||
|
||||
|
||||
// 三元表达式(不应该有冲突)
|
||||
a ? b : c;
|
||||
a ? b : c ? d : e;
|
||||
|
||||
// select
|
||||
select ["test"] from table end;
|
||||
vselect ["test"] from table end;
|
||||
|
||||
// array
|
||||
a := array(1, 2);
|
||||
b := array((1, 2), (3, 4))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user