0
所以我有以下的語法:如何定義均衡支柱當做解析器規則,而不是詞法規則
BalancedBrace:
: '{' (~('{' | '}') | BalancedBraces)* '}'
;
它運作良好,解析文字是這樣的:
$sect {
some stuff
{ nested braces are fine }
}
但現在我需要允許一些評論插入文本,它應該在處理被忽略:
$sect {
some stuff # starting from the # to the end of line is ignored
another stuff
/# starting from the /# till #/ is ignored
#/
}
因此,這意味着我需要改變balanc但是我想知道什麼是合適的解析器規則定義來允許嵌套大括號?