com.sonar.sslr.impl.Parser.builder()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中com.sonar.sslr.impl.Parser.builder()方法的一些代码示例,展示了Parser.builder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.builder()方法的具体详情如下:
包路径:com.sonar.sslr.impl.Parser
类名称:Parser
方法名:builder

Parser.builder介绍

暂无

代码示例

代码示例来源:origin: fundacionjala/enforce-sonarqube-plugin

/**
   * Creates a Parser integrated with Grammar and Lexer.
   *
   * @param config apex configuration.
   * @return a parser
   * @throws IllegalArgumentException when configuration is null.
   */
  public static Parser<Grammar> create(ApexConfiguration config) {
    if (config == null) {
      throw new IllegalArgumentException(ERROR_MESSAGE);
    }
    return Parser.builder(ApexGrammar.create())
        .withLexer(ApexLexer.create(config)).build();
  }
}

代码示例来源:origin: Backelite/sonar-swift

public static Parser<SwiftGrammar> create(SwiftConfiguration conf) {
  return Parser.builder((SwiftGrammar) new SwiftGrammarImpl())
      .withLexer(SwiftLexer.create(conf))
      .build();
}

代码示例来源:origin: Backelite/sonar-swift

public static Parser<ObjectiveCGrammar> create(ObjectiveCConfiguration conf) {
  return Parser.builder((ObjectiveCGrammar) new ObjectiveCGrammarImpl())
      .withLexer(ObjectiveCLexer.create(conf))
      .build();
}

代码示例来源:origin: SonarSource/sslr

public static Parser<Grammar> create() {
 return Parser.builder(MiniCGrammar.create()).withLexer(MiniCLexer.create()).build();
}

代码示例来源:origin: org.sonarsource.sslr/sslr-testing-harness

public static Parser<Grammar> create() {
 return Parser.builder(MiniCGrammar.create()).withLexer(MiniCLexer.create()).build();
}

代码示例来源:origin: uartois/sonar-golang

public static Parser<Grammar> create() {
return Parser.builder(GoGrammar.create()).withLexer(GoLexer.create()).build();
}

代码示例来源:origin: octo-technology/sonar-objective-c

public static Parser<ObjectiveCGrammar> create(ObjectiveCConfiguration conf, ParsingEventListener... parsingEventListeners) {
  return Parser.builder((ObjectiveCGrammar) new ObjectiveCGrammarImpl())
      .withLexer(ObjectiveCLexer.create(conf))
      .setParsingEventListeners(parsingEventListeners).build();
}

代码示例来源:origin: org.sonarsource.python/python-squid

public static Parser<Grammar> create(PythonConfiguration conf) {
 return Parser.builder(PythonGrammar.create().build())
  .withLexer(PythonLexer.create(conf)).build();
}

代码示例来源:origin: felipebz/sonar-plsql

public static Parser<Grammar> create(PlSqlConfiguration conf) {
    return Parser.builder(PlSqlGrammar.create(conf).build())
        .withLexer(PlSqlLexer.create(conf)).build();
  }
}

代码示例来源:origin: sonar-perl/sonar-perl

public static Parser<Grammar> create(PerlConfiguration conf) {
    return Parser.builder(PerlGrammar.create().build())
        .withLexer(PerlLexer.create(conf)).build();
  }
}

代码示例来源:origin: org.codehaus.sonar-plugins.python/python-squid

public static Parser<Grammar> create(PythonConfiguration conf) {
 return Parser.builder(PythonGrammar.create().build())
  .withLexer(PythonLexer.create(conf)).build();
}

代码示例来源:origin: SonarSource/sonar-python

public static Parser<Grammar> create(PythonConfiguration conf) {
 return Parser.builder(PythonGrammar.create().build())
  .withLexer(PythonLexer.create(conf)).build();
}

代码示例来源:origin: org.codehaus.sonar-plugins.dotnet.csharp/csharp-squid

public static Parser<Grammar> create(CSharpConfiguration conf, ParsingEventListener... parsingEventListeners) {
 return Parser.builder(CSharpGrammar.create().buildWithMemoizationOfMatchesForAllRules())
   .withLexer(CSharpLexer.create(conf))
   .setParsingEventListeners(parsingEventListeners)
   .build();
}

代码示例来源:origin: org.sonarsource.sslr/sslr-testing-harness

private Parser createParserWithEofMatcher() {
 RuleDefinition rule = actual.getRootRule();
 RuleDefinition endOfInput = new RuleDefinition(new EndOfInput())
   .is(new FirstOfExpression(EndOfInputExpression.INSTANCE, new TokenTypeExpression(GenericTokenType.EOF)));
 RuleDefinition withEndOfInput = new RuleDefinition(new WithEndOfInput(actual.getRootRule().getRuleKey()))
   .is(rule, endOfInput);
 Parser parser = Parser.builder(actual).build();
 parser.setRootRule(withEndOfInput);
 return parser;
}

代码示例来源:origin: SonarSource/sslr

private Parser createParserWithEofMatcher() {
 RuleDefinition rule = actual.getRootRule();
 RuleDefinition endOfInput = new RuleDefinition(new EndOfInput())
   .is(new FirstOfExpression(EndOfInputExpression.INSTANCE, new TokenTypeExpression(GenericTokenType.EOF)));
 RuleDefinition withEndOfInput = new RuleDefinition(new WithEndOfInput(actual.getRootRule().getRuleKey()))
   .is(rule, endOfInput);
 Parser parser = Parser.builder(actual).build();
 parser.setRootRule(withEndOfInput);
 return parser;
}

相关文章