Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Xtext 15 分钟教程(此处)中,Entity规则定义如下
Entity
Entity: 'entity' name = ID ('extends' superType = [Entity])? '{' features += Feature* '}' ;
这意味着在“扩展”这个词之后,解析器应该期望引用(另一个)实体。这里实际应该使用的ID规则是如何设置的?如果我ID的语法没有规则怎么办?
ID
中的交叉引用superType = [Entity]是superType = [Entity|ID]. 如果使用superType = [Entity|STRING],引用将基于终端规则 STRING 的具体语法。
superType = [Entity]
superType = [Entity|ID]
superType = [Entity|STRING]