0
爲什麼我不能在解析器規則中使用setText函數?ANTLR4 setText函數不能使用解析器規則
例如:
normalClassDeclaration
: classModifier* 'class' Identifier typeParameters? superclass? superinterfaces? classBody
{
$Identifier.setText("TEST");
}
;
如果我生成解析器和詞法與此語法解析器不知道功能的setText。 如果我這樣做的詞法規則,沒有任何問題,他正在改變每個標識符「TEST」
Identifier
: JavaLetter JavaLetterOrDigit*
{
setText("V");
}
;
但他應該只更改標識符時,其類/函數/變量標識符。
謝謝。非常有幫助。 – vizero
不客氣 – Yevgeniy