Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
类似的问题和作者的网站给了我这样的解决方案:
Identifier "identifier" = !ReservedWord [A-Za-z_]+ ReservedWord = "test" / "abc"
此解决方案无法解析像“test_var”这样的标识符。
在此示例中,语法 !ReservedWord 将排除所有以“test”或“abc”开头的变量。
提前致谢。
ReservedWord成功,当保留字完成时,不管后面是什么。因此,解决方案是在包含更多标识符字符的更长匹配项时使其失败:
ReservedWord
Identifier "identifier" = !ReservedWord [A-Za-z_]+ ReservedWord = ( "test" / "abc" ) ![A-Za-z_]