本文整理汇总了Java中com.google.common.css.compiler.ast.GssParser.parse方法的典型用法代码示例。如果您正苦于以下问题:Java GssParser.parse方法的具体用法?Java GssParser.parse怎么用?Java GssParser.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.css.compiler.ast.GssParser
的用法示例。
在下文中一共展示了GssParser.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseAndPrint
import com.google.common.css.compiler.ast.GssParser; //导入方法依赖的package包/类
/**
* Helper method for parsing and outputting the result.
*/
private void parseAndPrint(StringBuilder result, GssParser parser)
throws GssParserException {
cssTree = parser.parse();
if (job.outputFormat != OutputFormat.DEBUG) {
passRunner.runPasses(cssTree);
}
if (job.outputFormat == OutputFormat.COMPRESSED) {
CompactPrinter compactPrinterPass = new CompactPrinter(cssTree, gssSourceMapGenerator);
compactPrinterPass.setPreserveMarkedComments(job.preserveImportantComments);
compactPrinterPass.runPass();
result.append(compactPrinterPass.getCompactPrintedString());
} else {
PrettyPrinter prettyPrinterPass = new PrettyPrinter(cssTree
.getVisitController(),
null /* use external buffer */,
gssSourceMapGenerator);
prettyPrinterPass
.setPreserveComments(job.preserveComments)
.runPass();
result.append(prettyPrinterPass.getPrettyPrintedString());
}
}
示例2: parse
import com.google.common.css.compiler.ast.GssParser; //导入方法依赖的package包/类
private void parse(String styleSheet, RecordingSubstitutionMap map) {
SourceCode input = new SourceCode("test-input", styleSheet);
GssParser parser = new GssParser(input);
CssTree cssTree;
try {
cssTree = parser.parse();
} catch (GssParserException e) {
throw new RuntimeException(e);
}
JobDescription job = new JobDescriptionBuilder().getJobDescription();
ErrorManager errorManager = new DummyErrorManager();
PassRunner passRunner = new PassRunner(job, errorManager, map);
passRunner.runPasses(cssTree);
}
示例3: parseStyleSheet
import com.google.common.css.compiler.ast.GssParser; //导入方法依赖的package包/类
private CssTree parseStyleSheet(String sourceCode) {
SourceCode input = new SourceCode("testInput", sourceCode);
GssParser parser = new GssParser(input);
try {
return parser.parse();
} catch (GssParserException e) {
throw new RuntimeException(e);
}
}