如何让用户决定在antlr中的何处插入换行符?

时间:2019-01-21 21:07:16

标签: antlr antlr4

我想知道是否可以让用户选择ANTLR中的编程风格?

我希望用户可以在代码中插入两种样式。我已经尝试在代码中插入\n?,例如:

ifstatement:
'if' '(' expr ')' '\n'?
'{'? '\n'? statements '\n'? '}'? '\n'?;  but I think it's a waste of time

//first style
if(...){
    ...
}
//second style
if(...)
{
    ...
}

你知道是否有可能?

0 个答案:

没有答案