JLex - 如何识别以“{”开头并以“}”结尾的注释

时间:2017-05-17 20:09:29

标签: regex

JLex文件的内容:

//Main
%%
//Possible text of file: {This is a comment}
Comments=[\{][.*][\}]
Whitespaces=[\ \r\n]

%% 
{Comments}{System.out.println("Line"+(yyline+1)+" Comments\t"+yytext());}
{Whitespaces}{}

问题:

  • 仅识别{}作为评论

期望:

  • {}内的内容应该被识别为评论(以及{}

这个正则表达式有问题吗?

  

正则表达式:[\{][.*][\}]

非常感谢你的时间!

0 个答案:

没有答案