Examples of LinkedListToken


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

    addStatement(stmt);
    return new ASTASExpressionStatement(stmt);
  }

  public void addComment(String text) {
    LinkedListToken comment = TokenBuilder.newSLComment("//" + text);
    String indent = findIndentForComment();
    ast.appendToken(TokenBuilder.newNewline());
    ast.appendToken(TokenBuilder.newWhiteSpace(indent));
    ast.appendToken(comment);
  }
View Full Code Here

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

    // startToken for various AST subtrees, so we can't just delete
    // it.  We therefore find the LT token and change its type to
    // match the E4X vocabulary, and then rewind the token stream
    // so that this will be the first token that the E4XParser will
    // see.
    LinkedListToken startMarker = (LinkedListToken)stream.LT(-1);
    startMarker.setType(E4XParser.XML_LCHEVRON);
    stream.seek(stream.index()-1);

    E4XParser parser = new E4XParser(stream);
    parser.setTreeAdaptor(new LinkedListTreeAdaptor());
    parser.setInput(lexer, cs);
View Full Code Here

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

    // startToken for various AST subtrees, so we can't just delete
    // it.  We therefore find the DIC token and change its type to
    // match the regexp vocabulary, and then rewind the token stream
    // so that this will be the first token that the
    // SinpleRegexpParser will see.
    LinkedListToken startMarker = (LinkedListToken)stream.LT(-1);
    startMarker.setType(RegexSimpleParser.REGEXP_DELIMITER);
    stream.seek(stream.index()-1);

    RegexSimpleParser parser = new RegexSimpleParser(stream);
    parser.setTreeAdaptor(new LinkedListTreeAdaptor());
    parser.setInput(lexer, cs);
View Full Code Here

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

  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, ASPrefixExpression.Op operator) {
    OPERATORS_BY_TYPE.put(new Integer(type), operator);
    TYPES_BY_OPERATOR.put(operator, new LinkedListToken(type, text));
  }
View Full Code Here

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

    }
    return op;
  }

  public static void initialiseFromOp(ASPrefixExpression.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

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

    return new ASTStatementList(ast.getFirstChild());
  }

  public ASCatchClause newCatchClause(String var, String type) {
    LinkedListTree catchClause = ASTBuilder.newCatchClause(var, type);
    LinkedListToken space = TokenBuilder.newSpace();
    catchClause.getStartToken().beforeInsert(space);
    catchClause.setStartToken(space);
    if (finallyClause() == null) {
      ast.addChildWithTokens(catchClause);
    } else {
View Full Code Here

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

    setExpr(ast(expr));
  }

  private void setExpr(LinkedListTree expression) {
    if (hasExpr()) {
      LinkedListToken after = ast.getStopToken();
      LinkedListToken before = after.getPrev();
      ast.addChild(expression);
      before.setNext(expression.getStartToken());
      after.setPrev(expression.getStopToken());
      before.afterInsert(TokenBuilder.newSpace());
    } else {
      ast.setChildWithTokens(0, expression);
    }
  }
View Full Code Here

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

    LinkedListTree ext = ASTUtils.findChildByType(ast, AS3Parser.EXTENDS);
    if (ext == null) {
      ext = ASTUtils.newAST(AS3Parser.EXTENDS, "extends");
      ext.appendToken(TokenBuilder.newSpace());
      // hack a space in at the right point,
      LinkedListToken sp = TokenBuilder.newSpace();
      ext.getStartToken().beforeInsert(sp);
      ext.setStartToken(sp);
      ast.addChildWithTokens(EXTENDS_INDEX, ext);
    } else {
      ext.appendToken(TokenBuilder.newComma());
View Full Code Here

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

    this.tokenTypeOpen = tokenTypeOpen;
    this.tokenTypeClose = tokenTypeClose;
  }

  public void addedChild(LinkedListTree parent, LinkedListTree child) {
    LinkedListToken insert = findClose(parent).getPrev();
    insertAfter(insert, insert.getNext(),
                child.getStartToken(), child.getStopToken());
  }
View Full Code Here

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

      }
    }
  }

  public void addedChild(LinkedListTree tree, int index, LinkedListTree child) {
    LinkedListToken target;
    LinkedListToken targetNext;
    if (index == 0) {
      target = findOpen(tree);
      targetNext = target.getNext();
    } else {
      LinkedListTree prev = (LinkedListTree)tree.getChild(index - 1);
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.