我正在尝试理解我发现的 xtext 语法(如下)。我有两个问题:
- XFeatureCall 已返回 XExpression 类型,但这被 {XFeatureCall} 否决了,所以我也可以设置“返回 XFeatureCall”?或者真的有必要这样做吗?
- 第 8 行和第 14 行以“=>”开头。是这些“选择的谓词”还是到目前为止我没有注意到的其他东西?我在 xtext 文档中找不到所选谓词的这种变体。因此,我希望对其应用进行澄清。
xtext 语法:
StaticEquals:':=';
XFeatureCall returns XExpression:
// Same as Xbase...
{XFeatureCall}
(declaringType=[JvmDeclaredType|StaticQualifier])?
('<' typeArguments+=JvmArgumentTypeReference (',' typeArguments+=JvmArgumentTypeReference)* '>')?
(feature=[JvmIdentifiableElement|IdOrSuper]|'class')
(=>explicitOperationCall?='('
(
featureCallArguments+=XShortClosure
| featureCallArguments+=XExpression (',' featureCallArguments+=XExpression)*
)?
')')?
=>featureCallArguments+=XClosure?
// ... Except with this additional optional clause that allows static members to be set with := operator
({XAssignment.assignable = current} StaticEquals value = XAssignment)?;