use of net.sourceforge.pmd.lang.Parser in project Gargoyle by callakrsos.
the class PMDUtil method getSupportedLanguageVersions.
/**
* 지원가능한 PMD Language를 리턴.
*
* @작성자 : KYJ
* @작성일 : 2016. 10. 4.
* @return
*/
public static LanguageVersion[] getSupportedLanguageVersions() {
List<LanguageVersion> languageVersions = new ArrayList<>();
for (LanguageVersion languageVersion : LanguageRegistry.findAllVersions()) {
LanguageVersionHandler languageVersionHandler = languageVersion.getLanguageVersionHandler();
if (languageVersionHandler != null) {
Parser parser = languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions());
if (parser != null && parser.canParse()) {
languageVersions.add(languageVersion);
LOGGER.debug("support parser: {}", parser.toString());
} else {
LOGGER.debug("not support parser: {}", parser.toString());
}
} else {
LOGGER.debug("not support parser (handler is null): {}", languageVersion.toString());
}
}
return languageVersions.toArray(new LanguageVersion[languageVersions.size()]);
}
use of net.sourceforge.pmd.lang.Parser in project Gargoyle by callakrsos.
the class DesignerFx method getCompilationUnit.
static Node getCompilationUnit(LanguageVersionHandler languageVersionHandler, String code) {
Parser parser = languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions());
Node node = parser.parse(null, new StringReader(code));
languageVersionHandler.getSymbolFacade().start(node);
languageVersionHandler.getTypeResolutionFacade(DesignerFx.class.getClassLoader()).start(node);
return node;
}
Aggregations