Examples of SourceFile


Examples of abstrasy.SourceFile

    private final void _loadSource(File fln) {
        String fname = fln.getAbsolutePath();
        System.out.println("Load " + fname);
        try {
            SourceFile sfile = new SourceFile(fname);
            sfile.load();
            jTextArea1.setText(sfile.getSource());
            referenceSource_ = jTextArea1.getText();
            jTextArea1.setCaretPosition(0);
            jTextArea1.forceColorize();
            jTextArea2.append(fln + " loaded...\n");
            this.setActualFile(fname);
View Full Code Here

Examples of abstrasy.SourceFile

                    cont =
(JOptionPane.showConfirmDialog(this, "The file " + fname + "\nalready exists...\nOverwrite it?", "Existing file...", JOptionPane.YES_NO_OPTION) ==
JOptionPane.YES_OPTION);
                }
                if (cont) {
                    SourceFile sfile = new SourceFile(fname);
                    sfile.setSource(jTextArea1.getText());
                    sfile.save();
                    referenceSource_ = jTextArea1.getText();
                    jTextArea2.append(fln + " saved...\n");
                    this.setActualFile(fname);
                }
                else {
View Full Code Here

Examples of abstrasy.SourceFile

        // chercher le fichier...
        File src = SourceFile.findSourceFileName(npath.getString());
       
        // c'est parti!...
        String msrc = "";
        SourceFile in = null;

        if (src != null) {
            in = new SourceFile(src.getAbsolutePath());
        }
        else {
            Node iPaths = Heap.getv(ASymbol.SYMBOL_IMPORTS_PATH);
            if (iPaths != null) {
                if (iPaths.getQType()==Node.TYPE_CLIST) {
                    for (int ip = (iPaths.size() - 1); ip >= 0; ip--) {
                        Node pval = iPaths.elementAt(ip);
                        if (pval.isString()) {
                            src = SourceFile.findSourceFileName(pval.getString() + npath.getString());
                            if (src != null) {
                                in = new SourceFile(src.getAbsolutePath());
                                ip = -1;
                            }
                        }
                    }
                }
            }
        }
        if (in == null) {
            Node iPaths = Heap.getv(ASymbol.SYMBOL_IMPORTS_BASE_URL);
            if (iPaths != null) {
                if (iPaths.getQType()==Node.TYPE_CLIST) {
                    for (int ip = (iPaths.size() - 1); ip >= 0; ip--) {
                        Node pval = iPaths.elementAt(ip);
                        if (pval.isString()) {
                            URL surl = SourceFile.findSourceURLName(pval.getString() + npath.getString());
                            if (surl != null) {
                                in = new SourceFile(surl);
                                ip = -1;
                            }
                        }
                    }
                }
            }

        }
        if (in != null) {
            try {
                in.load();
                msrc = in.getSource();
                Interpreter interpreter = Interpreter.interpr_getNewChildInterpreter();
                //Register continue dans le même thread...
                Heap.push(); // mais en créant une closure
                interpreter.setSource(msrc);
                interpreter.compile();
View Full Code Here

Examples of abstrasy.SourceFile

        }


        File src = SourceFile.findSourceFileName(npath);
        String msrc = "";
        SourceFile in = null;

        if (src != null) {
            in = new SourceFile(src.getAbsolutePath());
        }
        else {
            Node iPaths = Heap.getv(ASymbol.SYMBOL_IMPORTS_PATH);
            if (iPaths != null) {
                if (iPaths.getQType()==Node.TYPE_CLIST) {
                    for (int ip = (iPaths.size() - 1); ip >= 0; ip--) {
                        Node pval = iPaths.elementAt(ip);
                        if (pval.isString()) {
                            src = SourceFile.findSourceFileName(pval.getString() + npath);
                            if (src != null) {
                                in = new SourceFile(src.getAbsolutePath());
                                ip = -1;
                            }
                        }
                    }
                }
            }
        }
        if (in == null) {
            Node iPaths = Heap.getv(ASymbol.SYMBOL_IMPORTS_BASE_URL);
            if (iPaths != null) {
                if (iPaths.getQType()==Node.TYPE_CLIST) {
                    for (int ip = (iPaths.size() - 1); ip >= 0; ip--) {
                        Node pval = iPaths.elementAt(ip);
                        if (pval.isString()) {
                            URL surl = SourceFile.findSourceURLName(pval.getString() + npath);
                            if (surl != null) {
                                in = new SourceFile(surl);
                                ip = -1;
                            }
                        }
                    }
                }
            }

        }
        if (in != null) {
            try {
                in.load();
                msrc = in.getSource();
                Interpreter interpreter = Interpreter.interpr_getNewChildInterpreter();
                //Register continue dans le même thread...
                Heap.push(); // mais en créant une closure
                interpreter.setSource(msrc);
                interpreter.compile();
View Full Code Here

Examples of com.google.javascript.jscomp.SourceFile

      System.exit(1);
    }
  }

  public static Result compile(String program, int num) {
    SourceFile input = SourceFile.fromCode(""+num, program);
    Compiler compiler = new Compiler();
    Result result = compiler.compile(extern, input, options);
    return result;
  }
View Full Code Here

Examples of com.google.javascript.jscomp.SourceFile

      "* @wizmodule \n" +
      "*/");
  }

  public void testJsDocInfoPosition() throws IOException {
    SourceFile sourceFile = SourceFile.fromCode("comment-position-test.js",
        "   \n" +
        "  /**\n" +
        "   * A comment\n" +
        "   */\n" +
        "  function f(x) {}");
    Node script = parseFull(sourceFile.getCode());
    Preconditions.checkState(script.isScript());
    Node fn = script.getFirstChild();
    Preconditions.checkState(fn.isFunction());
    JSDocInfo jsdoc = fn.getJSDocInfo();

    assertEquals(6, jsdoc.getOriginalCommentPosition());
    assertEquals(2, sourceFile.getLineOfOffset(jsdoc.getOriginalCommentPosition()));
    assertEquals(2, sourceFile.getColumnOfOffset(jsdoc.getOriginalCommentPosition()));
  }
View Full Code Here

Examples of com.google.javascript.jscomp.SourceFile

                        options.setSourceMapOutputPath(sourceMapResult.getPath());
                        // options.setSourceMapLocationMappings(Lists.newArrayList(new
                        // SourceMap.LocationMapping(sourceDir.getPath() + File.separator, "")));
                    }

                    SourceFile input = SourceFile.fromInputStream(mergedFile.getName(), in);
                    List<SourceFile> externs = closureConfig.getExterns();
                    if (closureConfig.getUseDefaultExterns()) {
                        externs.addAll(CommandLineRunner.getDefaultExterns());
                    }
View Full Code Here

Examples of com.google.javascript.jscomp.SourceFile

    Compiler compiler = new Compiler(getErrorManager()); // We shouldn't reuse compilers

    // disable JS Closure Compiler internal thread
    compiler.disableThreads();

    SourceFile source = SourceFile.fromCode(content.getSource(), content.get());
    Result result = compiler.compile(externs, Lists.newArrayList(source), options);

    if (result.errors.length > 0) {
      throw new CompilerException(result.errors);
    }
View Full Code Here

Examples of com.google.javascript.jscomp.parsing.parser.SourceFile

      StaticSourceFile sourceFile,
      String sourceString,
      Config config,
      ErrorReporter errorReporter) {
    // TODO(johnlenz): unify "SourceFile", "Es6ErrorReporter" and "Config"
    SourceFile file = new SourceFile(sourceFile.getName(), sourceString);
    Es6ErrorReporter es6ErrorReporter =
        new Es6ErrorReporter(errorReporter, file, config);
    com.google.javascript.jscomp.parsing.parser.Parser.Config es6config =
        new com.google.javascript.jscomp.parsing.parser.Parser.Config(mode(
            config.languageMode));
View Full Code Here

Examples of com.icona.tree.nodes.SourceFile

        e.printStackTrace();
      }
      BufferedWriter Bw = new BufferedWriter(fw);

      PrintWriter pw = new PrintWriter(Bw);
      SourceFile src = parser.getSrc();
      System.out.println(src.toString());

      pw.print("public class " + filename + "{\n");
      pw.print(src.toString());
      pw.print("public static void main(String[] args){\n");
      pw.print("\tSystem.out.println(\"The program compiles\");\n");
      pw.print("}\n");
      pw.print("}");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.