Examples of FunctionParser


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

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

    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

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

    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

Examples of org.mvel2.util.FunctionParser

            || isNotValidNameorLabel(name))
          throw new CompileException("illegal function name or use of reserved word", expr, cursor);

        if (pCtx == null) pCtx = getParserContext();

        FunctionParser parser = new FunctionParser(name, cursor, end - cursor, expr, fields, pCtx, splitAccumulator);
        Function function = parser.parse();
        cursor = parser.getCursor();

        return lastNode = function;
      }
      case PROTO: {
        if (ProtoParser.isUnresolvedWaiting()) {
          if (pCtx == null) pCtx = getParserContext();
          ProtoParser.checkForPossibleUnresolvedViolations(expr, cursor, pCtx);
        }

        int st = cursor;
        captureToNextTokenJunction();

        if (isReservedWord(name = createStringTrimmed(expr, st, cursor - st))
            || isNotValidNameorLabel(name))
          throw new CompileException("illegal prototype name or use of reserved word", expr, cursor);

        if (expr[cursor = nextNonBlank()] != '{') {
          throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor);
        }

        cursor = balancedCaptureWithLineAccounting(expr, st = cursor + 1, end, '{', pCtx);

        if (pCtx == null) pCtx = getParserContext();

        ProtoParser parser = new ProtoParser(expr, st, cursor, name, pCtx, fields, splitAccumulator);
        Proto proto = parser.parse();

        if (pCtx == null) pCtx = getParserContext();

        pCtx.addImport(proto);

        proto.setCursorPosition(st, cursor);
        cursor = parser.getCursor();

        ProtoParser.notifyForLateResolution(proto);

        return lastNode = proto;
      }
View Full Code Here

Examples of org.mvel2.util.FunctionParser

                || isNotValidNameorLabel(name))
          throw new CompileException("illegal function name or use of reserved word", expr, cursor);

        if (pCtx == null) pCtx = getParserContext();

        FunctionParser parser = new FunctionParser(name, cursor, end - cursor, expr, fields, pCtx, splitAccumulator);
        Function function = parser.parse();
        cursor = parser.getCursor();

        return lastNode = function;
      }
      case PROTO:
        if (ProtoParser.isUnresolvedWaiting()) {
          if (pCtx == null) pCtx = getParserContext();
          ProtoParser.checkForPossibleUnresolvedViolations(expr, cursor, pCtx);
        }

        int st = cursor;
        captureToNextTokenJunction();

        if (isReservedWord(name = createStringTrimmed(expr, st, cursor - st))
                || isNotValidNameorLabel(name))
          throw new CompileException("illegal prototype name or use of reserved word", expr, cursor);

        if (expr[cursor = nextNonBlank()] != '{') {
          throw new CompileException("expected '{' but found: " + expr[cursor], expr, cursor);
        }

        cursor = balancedCaptureWithLineAccounting(expr, st = cursor + 1, end, '{', pCtx);

        if (pCtx == null) pCtx = getParserContext();

        ProtoParser parser = new ProtoParser(expr, st, cursor, name, pCtx, fields, splitAccumulator);
        Proto proto = parser.parse();

        if (pCtx == null) pCtx = getParserContext();

        pCtx.addImport(proto);

        proto.setCursorPosition(st, cursor);
        cursor = parser.getCursor();

        ProtoParser.notifyForLateResolution(proto);

        return lastNode = proto;
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.