Package net.jangaroo.jooc.input

Examples of net.jangaroo.jooc.input.InputSource


    ParserOptions parserOptions = new CCRParserOptions();
    jangarooParser = new JangarooParser(parserOptions, new StdOutCompileLog()) {
      @Override
      protected InputSource findSource(String qname) {
        InputSource inputSource = super.findSource(qname);
        if (inputSource != null) {
          // A regular source file (not a generated file) has been found. Use it.
          return inputSource;
        }
        // Just in case the requested class is a class
        // that is generated from an EXML file, regenerate the file before
        // it is too late. This will only affect generated files, so it is pretty safe.
        tryGenerateClass(qname);
        // Just in case the source was not found on the first attempt, fetch it again.
        return super.findSource(qname);
      }
    };
    List<File> fullClassPath = new ArrayList<File>(config.getClassPath());
    fullClassPath.add(config.getOutputDirectory());
    InputSource classPathInputSource = PathInputSource.fromFiles(fullClassPath,
      new String[]{"", JangarooParser.JOO_API_IN_JAR_DIRECTORY_PREFIX}, false);
    jangarooParser.setUp(sourcePathInputSource, classPathInputSource);
    exmlConfigPackageXsdGenerator = new ExmlConfigPackageXsdGenerator();
  }
View Full Code Here


    ExmlSourceFile exmlSourceFile = getExmlSourceFilesByConfigClassName().get(qname);
    if (exmlSourceFile != null) {
      exmlSourceFile.generateConfigClass();
    } else {
      // is there an EXML file for the qname interpreted as a target class name?
      InputSource exmlInputSource = sourcePathInputSource.getChild(JangarooParser.getInputSourceFileName(qname, sourcePathInputSource, Exmlc.EXML_SUFFIX));
      if (exmlInputSource != null) {
        String configClassName = computeConfigClassNameFromTargetClassName(qname);
        exmlSourceFile = getExmlSourceFilesByConfigClassName().get(configClassName);
        if (exmlSourceFile != null) {
          exmlSourceFile.generateTargetClass();
View Full Code Here

      addSourceConfigClass(sourceFilesByName, exmlFile.getSourceFile(), exmlFile.getConfigClass());
    }
  }

  private void scanAsFiles(Map<String, File> sourceFilesByName) {
    InputSource configPackageInputSource = sourcePathInputSource.getChild(config.getConfigClassPackage().replace('.', File.separatorChar));
    if (configPackageInputSource != null) {
      for (InputSource source : configPackageInputSource.list()) {
        File file = ((FileInputSource) source).getFile();
        if (file.isFile() && file.getName().endsWith(Jooc.AS_SUFFIX)) {
          try {
            File sourceDir = getConfig().findSourceDir(file);
            String qName = CompilerUtils.qNameFromFile(sourceDir, file);
View Full Code Here

    buildConfigClass("/testNamespace/config/badConfig2.as");
  }

  private ConfigClass buildConfigClass(String resourceName) throws URISyntaxException {
    File sourceFile = new File(getClass().getResource("/test-module/" + resourceName).toURI());
    InputSource inputSource = new FileInputSource(sourceFile, true);
    CompilationUnit compilationUnit = Jooc.doParse(inputSource, new StdOutCompileLog(), SemicolonInsertionMode.QUIRKS);
    ConfigClassBuilder configClassBuilder = new ConfigClassBuilder(compilationUnit);
    return configClassBuilder.buildConfigClass();
  }
View Full Code Here

      filename = matcher.group(1);
    }
    File file = new File(filename);
    InputStream in = null;
    if (!file.exists() && !file.isAbsolute()) {
      InputSource parent = source.getParent();
      InputSource input = parent.getChild(filename);
      if (input == null) {
        throw new IOException("cannot find input file " + parent.getPath() + parent.getFileSeparatorChar() + filename);
      }
      in = input.getInputStream();
    }
    if (in == null) {
      in = new FileInputStream(file);
    }
    Reader result = new InputStreamReader(in, "UTF-8");
View Full Code Here

    }
  }

  protected InputSource findSource(final String qname) {
    // scan sourcepath
    InputSource result = sourcePathInputSource.getChild(getInputSourceFileName(qname, sourcePathInputSource, Jooc.AS_SUFFIX));
    if (result == null) {
      // scan classpath
      result = classPathInputSource.getChild(getInputSourceFileName(qname, classPathInputSource, Jooc.AS_SUFFIX));
    }
    return result;
View Full Code Here

  }

  public CompilationUnit getCompilationUnit(String qname) {
    CompilationUnit compilationUnit = compilationUnitsByQName.get(qname);
    if (compilationUnit == null) {
      InputSource source = findSource(qname);
      if (source == null) {
        return null;
      }
      compilationUnit = importSource(source);
    }
View Full Code Here

      return new CompilationResultImpl(CompilationResult.RESULT_CODE_INTERNAL_COMPILER_ERROR);
    }
  }

  private CompilationResult run1() {
    InputSource sourcePathInputSource;
    InputSource classPathInputSource;
    try {
      sourcePathInputSource = PathInputSource.fromFiles(getConfig().getSourcePath(), new String[]{""}, true);
      classPathInputSource = PathInputSource.fromFiles(getConfig().getClassPath(), new String[]{"", JOO_API_IN_JAR_DIRECTORY_PREFIX}, false);
    } catch (IOException e) {
      throw new CompilerError("IO Exception occurred", e);
View Full Code Here

TOP

Related Classes of net.jangaroo.jooc.input.InputSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.