介绍:
https://www.telosys.org/dsl-syntax.html
Telosys DSL 基于 tmLanguage Schema(用于 TextMate 语法定义的 JSON 模式。在 Visual Studio Code 中创建实体定义时,可用于让智能感知工作。):
如何通过 Azure 认知服务使用语音识别?使用自定义 DSL 语言编写实体定义(符合上述 json 语法规则),如下所示,该语言稍后可用于基于某些模板引擎进行代码生成
// Entity Driver: (Driver.entity file)
// Defines a person who is able to drive a car
Driver {
id : long { @Id } ;
firstName : string { @SizeMax(20), @NotEmpty #MyTag(3) #Hidden} ;
lastName : string { @SizeMax(20), @NotEmpty } ;
birthDate : date { @Past };
certified : boolean ;
}
// Entity Car: (Car.entity file)
Car {
id : int { @Id, @AutoIncremented } ; // this id is autoincremented
name : string { @SizeMax(40) } ;
year : short { @Min(1900),
@Max(2020) } ;
price : float { @Min(500), @Max(99999) };
brand : Brand { @NotNull } ;
driver : Driver[] ;
}
我想谈谈并说出一些主要意图,例如:
Create <entity> 'Driver' >> Creates Driver.entity file
[Create <properties> camelCase] >> Optional. This gives current context that what is coming is list of <property> 'id' <type> 'long' 'Id'
<property> 'firstName' <type> 'string' 'Max 20', 'Not Empty', <tags> |<tag> 'MyTag 3' 'Hidden'
...
Create <entity> 'Car' >> Creates Car.entity file
Create <entity> 'Car'
<property> 'id' <type> 'int' 'Id', '[Auto]Increment'
...
这应该产生上面的 2 个文件。
我想在定义 DSL 实体时获得一些 GUI 提示的上下文帮助,以指导我并提供建议和纠错。