Package uk.co.badgersinfoil.metaas.impl.antlr

Examples of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListToken


    }
    return op;
  }

  public static void initialiseFromOp(ASAssignmentExpression.Op operator, Token tok) {
    LinkedListToken type = (LinkedListToken)TYPES_BY_OPERATOR.get(operator);
    if (type == null) {
      throw new IllegalArgumentException("No operator for Op "+operator);
    }
    tok.setType(type.getType());
    tok.setText(type.getText());
  }
View Full Code Here


    return getModInfo(mod.getType()) != null;
  }

  private static void deleteAllChildTokens(LinkedListTree modifiers) {
    for (LinkedListToken tok=modifiers.getStartToken(); tok!=null && tok!=modifiers.getStopToken(); ) {
      LinkedListToken next = tok.getNext();
      tok.delete();
      tok = next;
    }
    modifiers.setStartToken(null);
    modifiers.setStopToken(null);
View Full Code Here

  private static final Map OPERATORS_BY_TYPE = new HashMap();
  private static final Map TYPES_BY_OPERATOR = new HashMap();

  private static void mapOp(int type, String text, ASPostfixExpression.Op operator) {
    OPERATORS_BY_TYPE.put(new Integer(type), operator);
    TYPES_BY_OPERATOR.put(operator, new LinkedListToken(type, text));
  }
View Full Code Here

  /**
   * Initialise the type and text of the given token based on the
   * given postfix-op.
   */
  public static void initialiseFromOp(ASPostfixExpression.Op operator, Token tok) {
    LinkedListToken type = (LinkedListToken)TYPES_BY_OPERATOR.get(operator);
    if (type == null) {
      throw new IllegalArgumentException("No operator for Op "+operator);
    }
    tok.setType(type.getType());
    tok.setText(type.getText());
  }
View Full Code Here

  private static LinkedListTree newBlock(int type) {
    LinkedListTree ast = ASTUtils.newParentheticAST(type,
                                                    AS3Parser.LCURLY, "{",
                                                    AS3Parser.RCURLY, "}");
    LinkedListToken nl = TokenBuilder.newNewline();
    ast.getInitialInsertionAfter().afterInsert(nl);
    ast.setInitialInsertionAfter(nl);
    return ast;
  }
View Full Code Here

        return 1;
    }
  }

  public static LinkedListTree newFieldAccessExpression(LinkedListTree target, LinkedListTree name) {
    LinkedListToken op = TokenBuilder.newDot();
    LinkedListTree ast = ASTUtils.newAST(op);
    assertNoParent("target expression", target);
    // don't use addChildWithTokens(); special handling below,
    ast.addChild(target);
    ast.addChild(name);
View Full Code Here

  public static LinkedListTree newConditionalExpression(LinkedListTree conditionExpr,
                                                        LinkedListTree thenExpr,
                                                        LinkedListTree elseExpr)
  {
    LinkedListToken op = TokenBuilder.newQuestion();
    LinkedListToken colon = TokenBuilder.newColon();
    LinkedListTree ast = ASTUtils.newAST(op);
    // don't use addChildWithTokens(); special handling below,
    ast.addChild(conditionExpr);
    conditionExpr.getStopToken().setNext(op);
    ast.addChild(thenExpr);
View Full Code Here

    Map tokens = dupTokStream(ast);
    return dupTree(ast, tokens);
  }

  private static LinkedListTree dupTree(LinkedListTree ast, Map tokens) {
    LinkedListToken newTok = (LinkedListToken)tokens.get(ast.getToken());
    LinkedListTree result = new LinkedListTree(newTok);
    result.setStartToken((LinkedListToken)tokens.get(ast.getStartToken()));
    result.setStopToken((LinkedListToken)tokens.get(ast.getStopToken()));
    result.setTokenListUpdater(ast.getTokenListUpdater());
    result.setInitialInsertionAfter(ast.getInitialInsertionAfter());
View Full Code Here

    return result;
  }

  private static Map dupTokStream(LinkedListTree ast) {
    Map tokens = new HashMap();
    LinkedListToken last = null;
    for (LinkedListToken tok=ast.getStartToken(); tok!=null&&tok.getType()!=-1; tok=tok.getNext()) {
      LinkedListToken newTok = dupTok(tok);
      tokens.put(tok, newTok);
      if (last != null) {
        last.setNext(newTok);
      }
      if (tok == ast.getStopToken()) {
View Full Code Here

    }
    return tokens;
  }

  private static LinkedListToken dupTok(LinkedListToken tok) {
    LinkedListToken result;
    if (tok instanceof PlaceholderLinkedListToken) {
      result = new PlaceholderLinkedListToken(((PlaceholderLinkedListToken)tok).getHeld());
    } else {
      result = new LinkedListToken(tok.getType(),
                                         tok.getText());
    }
    result.setChannel(tok.getChannel());
    result.setCharPositionInLine(tok.getCharPositionInLine());
    result.setLine(tok.getLine());
    return result;
  }
View Full Code Here

TOP

Related Classes of uk.co.badgersinfoil.metaas.impl.antlr.LinkedListToken

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.