本文整理汇总了Java中com.sonar.sslr.api.typed.ActionParser类的典型用法代码示例。如果您正苦于以下问题:Java ActionParser类的具体用法?Java ActionParser怎么用?Java ActionParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionParser类属于com.sonar.sslr.api.typed包,在下文中一共展示了ActionParser类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public static ActionParser<Tree> createParser(Charset charset) {
return new OneCParser(
charset,
OneCLexer.createGrammarBuilder(),
OneCGrammar.class,
new TreeFactory(),
new OneCNodeBuilder(),
OneCLexer.COMPILATION_UNIT);
}
开发者ID:antowski,项目名称:sonar-onec,代码行数:10,代码来源:OneCParser.java
示例2: assertThat
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public static ParserAssert assertThat(LexerlessGrammarBuilder b, GrammarRuleKey rule) {
return new ParserAssert(new ActionParser<Tree>(
Charsets.UTF_8,
b,
OneCGrammar.class,
new TreeFactory(),
new OneCNodeBuilder(),
rule));
}
开发者ID:antowski,项目名称:sonar-onec,代码行数:10,代码来源:Assertions.java
示例3: buildModel
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@Override
protected Model<Location> buildModel(final SensorContext context) {
// Result
final Model<Location> model = new Model<>();
final ModelCreatingTreeVisitor visitor = new ModelCreatingTreeVisitor(model);
// Read all source files
final ActionParser<Tree> parser = JavaParser.createParser();
final JavaClasspath javaClassPath = new JavaClasspath(settings, context.fileSystem());
final FileSystem fs = context.fileSystem();
// Scan only main files for the 'current' language.
final FilePredicate filesToScan = fs.predicates().and(fs.predicates().hasType(Type.MAIN),
fs.predicates().hasLanguage(LANGUAGE));
for (final InputFile file : fs.inputFiles(filesToScan)) {
// Parse source
LOGGER.debug("Analyzing source file: {}", file.relativePath());
try {
visitor.on(file);
final Tree tree = parser.parse(file.contents());
// Create semantic model
LOGGER.debug("Creating semantic model ...");
SemanticModel.createFor((CompilationUnitTree) tree, javaClassPath.getElements());
// Read into model
LOGGER.debug("Reading model ...");
tree.accept(visitor);
} catch (final IOException e) {
LOGGER.warn("Could not read contents for {}", file.relativePath(), e);
}
}
return model;
}
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:37,代码来源:JavaSensor.java
示例4: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new CssParser(
charset,
LexicalGrammar.createCssGrammar(),
CssGrammar.class,
new TreeFactory(),
new CssNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:10,代码来源:CssParser.java
示例5: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new EmbeddedCssParser(
charset,
LexicalGrammar.createEmbeddedCssGrammar(),
EmbeddedCssGrammar.class,
new TreeFactory(),
new EmbeddedCssNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:10,代码来源:EmbeddedCssParser.java
示例6: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new LessParser(
charset,
LexicalGrammar.createLessGrammar(),
LessGrammar.class,
new TreeFactory(),
new LessNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:10,代码来源:LessParser.java
示例7: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new ScssParser(
charset,
LexicalGrammar.createScssGrammar(),
ScssGrammar.class,
new TreeFactory(),
new ScssNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:10,代码来源:ScssParser.java
示例8: verify
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static void verify(CssCheck check, File file, Charset charset, ActionParser<Tree> parser, String language) {
TreeImpl tree = (TreeImpl) parser.parse(file);
CssTreeVisitorContext context = new CssTreeVisitorContext(tree, file, language);
CssCheckVerifier checkVerifier = new CssCheckVerifier();
checkVerifier.scanFile(context);
List<TestIssue> expectedIssues = checkVerifier.expectedIssues
.stream()
.sorted((i1, i2) -> Integer.compare(i1.line(), i2.line()))
.collect(Collectors.toList());
if (check instanceof CharsetAwareVisitor) {
((CharsetAwareVisitor) check).setCharset(charset);
}
Iterator<Issue> actualIssues = getActualIssues(check, context);
for (TestIssue expected : expectedIssues) {
if (actualIssues.hasNext()) {
verifyIssue(expected, actualIssues.next(), file);
} else {
throw new AssertionError("Missing issue at line " + expected.line() + " in file " + file.getAbsolutePath());
}
}
if (actualIssues.hasNext()) {
Issue issue = actualIssues.next();
throw new AssertionError("Unexpected issue at line " + line(issue) + ": \"" + message(issue) + "\"" + " in file " + file.getAbsolutePath());
}
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:32,代码来源:CssCheckVerifier.java
示例9: getIssues
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public static Collection<CheckMessage> getIssues(String relativePath, CssCheck check, ActionParser<Tree> parser) {
File file = new File(relativePath);
TreeImpl tree = (TreeImpl) parser.parse(file);
CssTreeVisitorContext context = new CssTreeVisitorContext(tree, file, "css");
List<Issue> issues = check.scanFile(context);
return getCheckMessages(issues);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:10,代码来源:TreeCheckTest.java
示例10: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new ActionParser<>(
charset,
JavaPropertiesLexicalGrammar.createGrammar(),
JavaPropertiesGrammar.class,
new TreeFactory(),
new JavaPropertiesNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:10,代码来源:JavaPropertiesParserBuilder.java
示例11: createParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
private static ActionParser<Tree> createParser(Charset charset, GrammarRuleKey rootRule) {
return new ActionParser<>(
charset,
JSONLexicalGrammar.createGrammar(),
JSONGrammar.class,
new TreeFactory(),
new JSONNodeBuilder(),
rootRule);
}
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:10,代码来源:JSONParserBuilder.java
示例12: ParserAssert
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public ParserAssert(ActionParser<Tree> actual) {
super(ParserAssert.class, actual);
}
开发者ID:antowski,项目名称:sonar-onec,代码行数:4,代码来源:Assertions.java
示例13: createTestParser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@VisibleForTesting
public static ActionParser<Tree> createTestParser(Charset charset, GrammarRuleKey rootRule) {
return createParser(charset, rootRule);
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:5,代码来源:CssParser.java
示例14: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public ActionParser<Tree> parser() {
return parser;
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:4,代码来源:CssTreeTest.java
示例15: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@Override
public ActionParser<Tree> parser(FileSystem fileSystem) {
return CssParser.createParser(fileSystem.encoding());
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:5,代码来源:CssAnalyzerSensor.java
示例16: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@Override
public ActionParser<Tree> parser(FileSystem fileSystem) {
return EmbeddedCssParser.createParser(fileSystem.encoding());
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:5,代码来源:EmbeddedCssAnalyzerSensor.java
示例17: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@Override
public ActionParser<Tree> parser(FileSystem fileSystem) {
return LessParser.createParser(fileSystem.encoding());
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:5,代码来源:LessAnalyzerSensor.java
示例18: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
@Override
public ActionParser<Tree> parser(FileSystem fileSystem) {
return ScssParser.createParser(fileSystem.encoding());
}
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:5,代码来源:ScssAnalyzerSensor.java
示例19: parser
import com.sonar.sslr.api.typed.ActionParser; //导入依赖的package包/类
public abstract ActionParser<Tree> parser(FileSystem fileSystem);
开发者ID:racodond,项目名称:sonar-css-plugin,代码行数:2,代码来源:AbstractLanguageAnalyzerSensor.java
注:本文中的com.sonar.sslr.api.typed.ActionParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论