Package com.google.dart.engine.scanner

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


   * e<sub>2</sub>)</i> where <i>a</i> and <i>i</i> are a variables that are not used in
   * <i>e<sub>3</sub></i>.</blockquote>
   */
  @Override
  public Void visitAssignmentExpression(AssignmentExpression node) {
    TokenType operator = node.getOperator().getType();
    if (operator == TokenType.EQ) {
      Expression rightHandSide = node.getRightHandSide();

      Type staticType = getStaticType(rightHandSide);
      recordStaticType(node, staticType);
View Full Code Here


   */
  @Override
  public Void visitPostfixExpression(PostfixExpression node) {
    Expression operand = node.getOperand();
    Type staticType = getStaticType(operand);
    TokenType operator = node.getOperator().getType();
    if (operator == TokenType.MINUS_MINUS || operator == TokenType.PLUS_PLUS) {
      Type intType = typeProvider.getIntType();
      if (getStaticType(node.getOperand()) == intType) {
        staticType = intType;
      }
View Full Code Here

   * <i>op e</i> is equivalent to a method invocation <i>expression e.op()</i>. An expression of the
   * form <i>op super</i> is equivalent to the method invocation <i>super.op()<i>.</blockquote>
   */
  @Override
  public Void visitPrefixExpression(PrefixExpression node) {
    TokenType operator = node.getOperator().getType();
    if (operator == TokenType.BANG) {
      recordStaticType(node, typeProvider.getBoolType());
    } else {
      // The other cases are equivalent to invoking a method.
      ExecutableElement staticMethodElement = node.getStaticElement();
View Full Code Here

   * @param node the binary expression to analyze
   * @param staticType the static type of the expression as resolved
   * @return the better type guess, or the same static type as given
   */
  private Type refineBinaryExpressionType(BinaryExpression node, Type staticType) {
    TokenType operator = node.getOperator().getType();
    // bool
    if (operator == TokenType.AMPERSAND_AMPERSAND || operator == TokenType.BAR_BAR
        || operator == TokenType.EQ_EQ || operator == TokenType.BANG_EQ) {
      return typeProvider.getBoolType();
    }
View Full Code Here

    // assignableExpression is a subset of conditionalExpression, so we can parse a conditional
    // expression and then determine whether it is followed by an assignmentOperator, checking for
    // conformance to the restricted grammar after making that determination.
    //
    Expression expression = parseConditionalExpression();
    TokenType tokenType = currentToken.getType();
    if (tokenType == TokenType.PERIOD_PERIOD) {
      List<Expression> cascadeSections = new ArrayList<Expression>();
      while (tokenType == TokenType.PERIOD_PERIOD) {
        Expression section = parseCascadeSection();
        if (section != null) {
          cascadeSections.add(section);
        }
        tokenType = currentToken.getType();
      }
      return new CascadeExpression(expression, cascadeSections);
    } else if (tokenType.isAssignmentOperator()) {
      Token operator = getAndAdvance();
      ensureAssignable(expression);
      return new AssignmentExpression(expression, operator, parseExpression());
    }
    return expression;
View Full Code Here

    }
    token = skipSimpleIdentifier(token);
    if (token == null) {
      return false;
    }
    TokenType type = token.getType();
    return type == TokenType.EQ || type == TokenType.COMMA || type == TokenType.SEMICOLON
        || tokenMatchesKeyword(token, Keyword.IN);
  }
View Full Code Here

   * and {@code true} will be returned.
   *
   * @return {@code true} if the current token has a type of {@link TokenType#GT}
   */
  private boolean matchesGt() {
    TokenType currentType = currentToken.getType();
    if (currentType == TokenType.GT) {
      return true;
    } else if (currentType == TokenType.GT_GT) {
      int offset = currentToken.getOffset();
      Token first = new Token(TokenType.GT, offset);
View Full Code Here

    Token equals = expect(TokenType.EQ);
    boolean wasInInitializer = inInitializer;
    inInitializer = true;
    try {
      Expression expression = parseConditionalExpression();
      TokenType tokenType = currentToken.getType();
      if (tokenType == TokenType.PERIOD_PERIOD) {
        List<Expression> cascadeSections = new ArrayList<Expression>();
        while (tokenType == TokenType.PERIOD_PERIOD) {
          Expression section = parseCascadeSection();
          if (section != null) {
View Full Code Here

   * @param startToken the token at which parsing is to begin
   * @return the string literal that was parsed
   */
  private Token skipStringInterpolation(Token startToken) {
    Token token = startToken;
    TokenType type = token.getType();
    while (type == TokenType.STRING_INTERPOLATION_EXPRESSION
        || type == TokenType.STRING_INTERPOLATION_IDENTIFIER) {
      if (type == TokenType.STRING_INTERPOLATION_EXPRESSION) {
        token = token.getNext();
        type = token.getType();
View Full Code Here

   */
  private Token skipStringLiteral(Token startToken) {
    Token token = startToken;
    while (token != null && tokenMatches(token, TokenType.STRING)) {
      token = token.getNext();
      TokenType type = token.getType();
      if (type == TokenType.STRING_INTERPOLATION_EXPRESSION
          || type == TokenType.STRING_INTERPOLATION_IDENTIFIER) {
        token = skipStringInterpolation(token);
      }
    }
View Full Code Here

TOP

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

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.