您可以在这里看到函数的定义:
* Creates parsing expression - "next not".
* During execution of this expression parser will execute sub-expression once.
* This expression succeeds only if sub-expression fails.
*
* @param e sub-expression
* @throws IllegalArgumentException if given argument is not a parsing expression
*/
public final Object nextNot(Object e) {
return new NextNotExpression(convertToExpression(e));
}
如果我理解正确,如果看到对象e
,它将失败
然而,我正在研究SonarQube的Python语法,并且PRINT_EXP
是这样的:
b.rule(PRINT_STMT).is("print", b.nextNot("("), b.firstOf(
b.sequence(">>", TEST, b.optional(b.oneOrMore(",", TEST), b.optional(","))),
b.optional(TEST, b.zeroOrMore(",", TEST), b.optional(","))));
这是否意味着,如果看到括号,将被视为失败? 因为在python3.x中,print是一个函数
nextNot
是一种负匹配。在您突出显示的示例中,PRINT_STMT
与print
后跟(
时不匹配对python3中
print
函数的调用应该匹配EXPRESSION_STMT
注:
nextNot
是SSLR library的一部分,它独立于SonarQube相关问题 更多 >
编程相关推荐