本文整理汇总了Java中com.google.javascript.jscomp.parsing.Config.LanguageMode方法的典型用法代码示例。如果您正苦于以下问题:Java Config.LanguageMode方法的具体用法?Java Config.LanguageMode怎么用?Java Config.LanguageMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.jscomp.parsing.Config
的用法示例。
在下文中一共展示了Config.LanguageMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParserConfig
import com.google.javascript.jscomp.parsing.Config; //导入方法依赖的package包/类
@Override
Config getParserConfig() {
if (parserConfig == null) {
Config.LanguageMode mode;
switch (options.getLanguageIn()) {
case ECMASCRIPT3:
mode = Config.LanguageMode.ECMASCRIPT3;
break;
case ECMASCRIPT5:
mode = Config.LanguageMode.ECMASCRIPT5;
break;
case ECMASCRIPT5_STRICT:
mode = Config.LanguageMode.ECMASCRIPT5_STRICT;
break;
default:
throw new IllegalStateException("unexpected language mode");
}
parserConfig = ParserRunner.createConfig(
isIdeMode(),
mode,
acceptConstKeyword(),
options.extraAnnotationNames);
}
return parserConfig;
}
示例2: getParserConfigLanguageMode
import com.google.javascript.jscomp.parsing.Config; //导入方法依赖的package包/类
private Config.LanguageMode getParserConfigLanguageMode(
CompilerOptions.LanguageMode languageMode) {
switch (languageMode) {
case ECMASCRIPT3:
return Config.LanguageMode.ECMASCRIPT3;
case ECMASCRIPT5:
case ECMASCRIPT5_STRICT:
return Config.LanguageMode.ECMASCRIPT5;
case ECMASCRIPT_2015:
return Config.LanguageMode.ECMASCRIPT6;
case ECMASCRIPT6_TYPED:
return Config.LanguageMode.TYPESCRIPT;
case ECMASCRIPT_2016:
return Config.LanguageMode.ECMASCRIPT7;
case ECMASCRIPT_2017:
return Config.LanguageMode.ECMASCRIPT8;
case ECMASCRIPT_NEXT:
return Config.LanguageMode.ES_NEXT;
default:
throw new IllegalStateException("Unexpected language mode: "
+ options.getLanguageIn());
}
}
示例3: getParserConfig
import com.google.javascript.jscomp.parsing.Config; //导入方法依赖的package包/类
@Override
Config getParserConfig(ConfigContext context) {
if (parserConfig == null || externsParserConfig == null) {
synchronized (this) {
if (parserConfig == null) {
Config.LanguageMode configLanguageMode = getParserConfigLanguageMode(
options.getLanguageIn());
Config.StrictMode strictMode =
options.expectStrictModeInput() ? Config.StrictMode.STRICT : Config.StrictMode.SLOPPY;
parserConfig = createConfig(configLanguageMode, strictMode);
// Externs must always be parsed with at least ES5 language mode.
externsParserConfig =
configLanguageMode.equals(Config.LanguageMode.ECMASCRIPT3)
? createConfig(Config.LanguageMode.ECMASCRIPT5, strictMode)
: parserConfig;
}
}
}
switch (context) {
case EXTERNS:
return externsParserConfig;
default:
return parserConfig;
}
}
示例4: createConfig
import com.google.javascript.jscomp.parsing.Config; //导入方法依赖的package包/类
protected Config createConfig(Config.LanguageMode mode, Config.StrictMode strictMode) {
Config config =
ParserRunner.createConfig(
mode,
options.isParseJsDocDocumentation(),
options.canContinueAfterErrors()
? Config.RunMode.KEEP_GOING
: Config.RunMode.STOP_AFTER_ERROR,
options.extraAnnotationNames,
options.parseInlineSourceMaps,
strictMode);
return config;
}
示例5: createConfig
import com.google.javascript.jscomp.parsing.Config; //导入方法依赖的package包/类
protected Config createConfig(Config.LanguageMode mode) {
return ParserRunner.createConfig(
isIdeMode(),
mode,
acceptConstKeyword(),
options.extraAnnotationNames,
options.useNewParser);
}