Package com.google.dart.engine.scanner

Examples of com.google.dart.engine.scanner.Token


    return null;
  }

  @Override
  public Void visitBlockFunctionBody(BlockFunctionBody node) {
    Token keyword = node.getKeyword();
    if (keyword != null) {
      writer.print(keyword.getLexeme());
      if (node.getStar() != null) {
        writer.print('*');
      }
      writer.print(' ');
    }
View Full Code Here


    return null;
  }

  @Override
  public Void visitExpressionFunctionBody(ExpressionFunctionBody node) {
    Token keyword = node.getKeyword();
    if (keyword != null) {
      writer.print(keyword.getLexeme());
      writer.print(' ');
    }
    writer.print("=> ");
    visitNode(node.getExpression());
    if (node.getSemicolon() != null) {
View Full Code Here

    return visitor.visitListLiteral(this);
  }

  @Override
  public Token getBeginToken() {
    Token token = getConstKeyword();
    if (token != null) {
      return token;
    }
    TypeArgumentList typeArguments = getTypeArguments();
    if (typeArguments != null) {
View Full Code Here

    return visitor.visitMapLiteral(this);
  }

  @Override
  public Token getBeginToken() {
    Token token = getConstKeyword();
    if (token != null) {
      return token;
    }
    TypeArgumentList typeArguments = getTypeArguments();
    if (typeArguments != null) {
View Full Code Here

  private TaskData createParseDartTask(Source source, DartEntry dartEntry) {
    if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID
        || dartEntry.getState(SourceEntry.LINE_INFO) != CacheState.VALID) {
      return createScanDartTask(source, dartEntry);
    }
    Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM);
    DartEntryImpl dartCopy = dartEntry.getWritableCopy();
    dartCopy.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED);
    dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
    cache.put(source, dartCopy);
    return new TaskData(new ParseDartTask(
View Full Code Here

        return metadata.getBeginToken();
      }
    } else if (metadata.isEmpty()) {
      return comment.getBeginToken();
    }
    Token commentToken = comment.getBeginToken();
    Token metadataToken = metadata.getBeginToken();
    if (commentToken.getOffset() < metadataToken.getOffset()) {
      return commentToken;
    }
    return metadataToken;
  }
View Full Code Here

    this.errorReporter = errorReporter;
  }

  @Override
  public Void visitBinaryExpression(BinaryExpression node) {
    Token operator = node.getOperator();
    boolean isAmpAmp = operator.getType() == TokenType.AMPERSAND_AMPERSAND;
    boolean isBarBar = operator.getType() == TokenType.BAR_BAR;
    if (isAmpAmp || isBarBar) {
      Expression lhsCondition = node.getLeftOperand();
      if (!isDebugConstant(lhsCondition)) {
        ValidResult lhsResult = getConstantBooleanValue(lhsCondition);
        if (lhsResult != null) {
View Full Code Here

    return endToken;
  }

  @Override
  public int getLength() {
    Token endToken = getEndToken();
    if (endToken == null) {
      return 0;
    }
    return endToken.getOffset() + endToken.getLength();
  }
View Full Code Here

   *
   * @param token the head of the list of tokens being searched
   */
  private void gatherTodoComments(Token token) {
    while (token != null && token.getType() != TokenType.EOF) {
      Token commentToken = token.getPrecedingComments();
      while (commentToken != null) {
        if (commentToken.getType() == TokenType.SINGLE_LINE_COMMENT
            || commentToken.getType() == TokenType.MULTI_LINE_COMMENT) {
          scrapeTodoComment(commentToken);
        }
        commentToken = commentToken.getNext();
      }
      token = token.getNext();
    }
  }
View Full Code Here

   * Return the number of characters in the node's source range.
   *
   * @return the number of characters in the node's source range
   */
  public int getLength() {
    Token beginToken = getBeginToken();
    Token endToken = getEndToken();
    if (beginToken == null || endToken == null) {
      return -1;
    }
    return endToken.getOffset() + endToken.getLength() - beginToken.getOffset();
  }
View Full Code Here

TOP

Related Classes of com.google.dart.engine.scanner.Token

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.