Package com.googlecode.goclipse.go.lang.parser

Examples of com.googlecode.goclipse.go.lang.parser.FunctionParser


    public void init() throws IOException {

      try {
        Lexer lexer = new Lexer();
        Tokenizer tokenizer = new Tokenizer(lexer);
        FunctionParser functionParser = new FunctionParser(true, tokenizer, file);

        BufferedReader reader = new BufferedReader(new FileReader(file));
        String temp = "";
        StringBuilder builder = new StringBuilder();
        while ((temp = reader.readLine()) != null) {
          builder.append(temp);
          builder.append("\n");
        }
        reader.close();
        lexer.scan(builder.toString());

        List<Function> functions = functionParser.getFunctions();
        for (Function function : functions) {
          System.out.println(function.getName());

          TestFunction tf = new TestFunction(function);
          children.add(tf);
View Full Code Here


    Tokenizer     tokenizer     = new Tokenizer(lexer);
    PackageParser packageParser = new PackageParser(tokenizer, file);
    ImportParser  importParser  = new ImportParser(tokenizer, file);
    ScopeParser   scopeParser   = new ScopeParser(tokenizer, file);

    FunctionParser functionParser = new FunctionParser(false, tokenizer, file);
    functionParser.setScopeParser(scopeParser);

    TypeParser typeParser = new TypeParser(false, tokenizer, file);
    typeParser.setScopeParser(scopeParser);

    VariableParser variableParser = new VariableParser(tokenizer, file, functionParser);
    variableParser.setScopeParser(scopeParser);

    // InterfaceParser interfaceParser = new InterfaceParser(tokenizer);

    lexer.scan(fileText);

    if (!packagePeer) {
      codeContext.page = new TokenizedPage(tokenizer.getTokenizedStream());
      codeContext.pkg = packageParser.getPckg();
      codeContext.imports.addAll(importParser.getImports());
    }

    codeContext.methods.addAll(functionParser.getMethods());
    codeContext.functions.addAll(functionParser.getFunctions());
    codeContext.types.addAll(typeParser.getTypes());
    codeContext.vars.addAll(variableParser.getVars());

    if (useExternalContext) {
     
View Full Code Here

    for (File file : files) {
      Lexer          lexer          = new Lexer();
      Tokenizer      tokenizer      = new Tokenizer(lexer);
      PackageParser  packageParser  = new PackageParser(tokenizer, file);
      FunctionParser functionParser = new FunctionParser(true, tokenizer, file);
      TypeParser     typeParser     = new TypeParser(true, tokenizer, file);

      if (file.canRead() && file.getName().endsWith(".go") && !file.getName().endsWith("_test.go")) {

        lexer.reset();
        lexer.scan(file);

        codeContext.pkg = packageParser.getPckg();
        codeContext.methods.addAll(functionParser.getMethods());
        for (Method method : functionParser.getMethods()) {
          if (method.getFile() == null) {
            method.setFile(file);
          }
        }

        codeContext.functions.addAll(functionParser.getFunctions());
        for (Function function : functionParser.getFunctions()) {
          if (function.getFile() == null) {
            function.setFile(file);
          }
        }
View Full Code Here

TOP

Related Classes of com.googlecode.goclipse.go.lang.parser.FunctionParser

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.