本文整理了Java中com.sonar.sslr.impl.Parser.getGrammar()
方法的一些代码示例,展示了Parser.getGrammar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.getGrammar()
方法的具体详情如下:
包路径:com.sonar.sslr.impl.Parser
类名称:Parser
方法名:getGrammar
暂无
代码示例来源:origin: org.codehaus.sonar-plugins.dotnet.csharp/sonar-csharp-squid-plugin
public IgnoreUsingDirectivePreprocessor(CSharpConfiguration conf) {
this.parser = CSharpParser.create(conf);
this.parser.setRootRule(this.parser.getGrammar().usingDirective);
}
代码示例来源:origin: org.codehaus.sonar.sslr-squid-bridge/sslr-squid-bridge
protected AstScanner(Builder<G> builder) {
this.visitors = Lists.newArrayList(builder.visitors);
this.parser = builder.baseParser;
this.context = builder.context;
this.context.setGrammar(parser.getGrammar());
this.context.getProject().setSourceCodeIndexer(indexer);
this.context.setCommentAnalyser(builder.commentAnalyser);
this.metrics = builder.metrics;
this.filesMetric = builder.filesMetric;
indexer.index(context.getProject());
}
代码示例来源:origin: sonar-perl/sonar-perl
protected void setRootRule(GrammarRuleKey ruleKey) {
p.setRootRule(p.getGrammar().rule(ruleKey));
}
}
代码示例来源:origin: fundacionjala/enforce-sonarqube-plugin
/**
* Re-parses a query that was retrieved as a String.
*
* @param astNode The String's node.
* @return The query as a new QUERY_EXPRESSION node.
*/
public static AstNode parseQuery(AstNode astNode) {
AstNode parsedQuery = null;
try {
String string = astNode.getTokenOriginalValue();
String queryAsString = StringUtils.substringBetween(string, "'", "'");
Parser<Grammar> queryParser = ApexParser.create(new ApexConfiguration(Charsets.UTF_8));
queryParser.setRootRule(queryParser.getGrammar().rule(ApexGrammarRuleKey.QUERY_EXPRESSION));
parsedQuery = queryParser.parse(queryAsString);
} catch (Exception e) {
ChecksLogger.logCheckError(CLASS_TO_LOG, METHOD_TO_LOG, e.toString());
}
return parsedQuery;
}
}
代码示例来源:origin: sonar-perl/sonar-perl
@Test
public void ok() {
p.getGrammar().rule(PerlGrammar.ATOM).mock();
assertThat(p).matches("ATOM");
assertThat(p).matches("ATOM ATOM");
assertThat(p).matches("\n");
assertThat(p).matches("ATOM\nATOM");
}
内容来源于网络,如有侵权,请联系作者删除!