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

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


    LinkedListTree lastChild = desc.getLastChild();
    if (lastChild != null) {
      trimEOF(lastChild);
    }
    while (isEOF(desc.getStopToken())) {
      LinkedListToken stop = desc.getStopToken();
      LinkedListToken prev = stop.getPrev();
      desc.setStopToken(prev);
      stop.delete();
    }
  }
View Full Code Here


    return Collections.unmodifiableList(result);
  }

  public static ASMetaTag newMetaTag(LinkedListTree ast, String name) {
    LinkedListTree tag = ASTBuilder.newMetadataTag(name);
    LinkedListToken trailingnl = TokenBuilder.newNewline();
    tag.getStopToken().afterInsert(trailingnl);
    tag.setStopToken(trailingnl);
    String indent = ASTUtils.findIndent(ast);
    if (indent.length() > 0) {
      LinkedListToken stopToken = tag.getStopToken();
      LinkedListToken indentTok = TokenBuilder.newWhiteSpace(indent);
      stopToken.afterInsert(indentTok);
      tag.setStopToken(indentTok);
    }
    findTags(ast).addChildWithTokens(tag);
    return toMetaTag(tag);
View Full Code Here

      private void placeholder(LinkedListTree imaginary) {
        if (imaginary.getChildCount() > 0) {
          return;
        }

        LinkedListToken tok = (LinkedListToken)input.LT(1);
        LinkedListToken placeholder = TokenBuilder.newPlaceholder(imaginary);
        tok.beforeInsert(placeholder);
      }
View Full Code Here

      private LinkedListTree parseRegexpLiteral(LinkedListToken startMarker) throws RecognitionException {
        return RegexSimpleHelper.parseRegexpLiteral(startMarker, lexer, cs, (LinkedListTokenStream)input);
      }

      private boolean virtualSemi() {
        LinkedListToken tok = ((LinkedListToken)input.LT(1)).getPrev();
        while (tok.getType() == WS) {
          tok = tok.getPrev();
        }
        return tok.getType() == NL;
      }
View Full Code Here

        // know where new tokens should be inserted if the calling app
        // adds a child to this node.  We therefore insert a virtual
        // token at this point in the stream just so that the AST node
        // can remember its own location.

        LinkedListToken tok = (LinkedListToken)input.LT(1);
            LinkedListToken placeholder = TokenBuilder.newPlaceholder(imaginary);
        tok.beforeInsert(placeholder);
        return placeholder;
      }
View Full Code Here

      print(tok);
    }
  }

  private LinkedListToken findStart(LinkedListTree ast) {
    LinkedListToken result = null;
    for (LinkedListToken tok=ast.getStartToken(); viable(tok); tok=tok.getPrev()) {
      result = tok;
    }
    return result;
  }
View Full Code Here

    return (LinkedListTree)TREE_ADAPTOR.create(type, tokenName(type));
  }

  public static LinkedListTree newPlaceholderAST(int type) {
    LinkedListTree node = newImaginaryAST(type);
    LinkedListToken placeholder = TokenBuilder.newPlaceholder(node);
    return node;
  }
View Full Code Here

  /**
   * Constructs a new AST of the given type, initialized to contain the
   * given text.
   */
  public static LinkedListTree newAST(int type, String text) {
    LinkedListToken tok = TokenBuilder.newToken(type, text);
    LinkedListTree ast = (LinkedListTree)TREE_ADAPTOR.create(tok);
    return ast;
  }
View Full Code Here

                                                  int startType,
                                                  String startText,
                                                  int endType,
                                                  String endText) {
    LinkedListTree ast = newImaginaryAST(type);
    LinkedListToken start = TokenBuilder.newToken(startType, startText);
    ast.setStartToken(start);
    LinkedListToken stop = TokenBuilder.newToken(endType, endText);
    ast.setStopToken(stop);
    start.setNext(stop);
    ast.setInitialInsertionAfter(start);
    return ast;
  }
View Full Code Here

    ast.setInitialInsertionAfter(start);
    return ast;
  }

  public static void increaseIndent(LinkedListTree node, String indent) {
    LinkedListToken newStart = increaseIndentAt(node.getStartToken(), indent);
    node.setStartToken(newStart);
    increaseIndentAfterFirstLine(node, indent);
  }
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.