当前位置: 首页>>代码示例>>Java>>正文


Java Config.LanguageMode方法代码示例

本文整理汇总了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;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:Compiler.java

示例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());
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:24,代码来源:Compiler.java

示例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;
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:26,代码来源:Compiler.java

示例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;
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:14,代码来源:Compiler.java

示例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);
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:9,代码来源:Compiler.java


注:本文中的com.google.javascript.jscomp.parsing.Config.LanguageMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。