Package com.google.dart.engine.scanner

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


  /**
   * Parses given {@link String} as an {@link Expression} at the given offset.
   */
  Expression parseDartExpression(String contents, int startIndex, int endIndex, int offset) {
    Token token = scanDart(contents, startIndex, endIndex, offset);
    return parseDartExpressionInToken(token);
  }
View Full Code Here


    List<Token> tokens = Lists.newArrayList();
    tokens.add(token);
    while (token.getType() != TokenType.EOF) {
      if (token.getType() == TokenType.BAR) {
        tokens.add(token);
        Token eofToken = new Token(TokenType.EOF, 0);
        token.getPrevious().setNext(eofToken);
      }
      token = token.getNext();
    }
    return tokens;
View Full Code Here

    return new RawXmlExpression(e);
  }

  protected AngularExpression parseAngularExpression(AngularHtmlUnitResolver resolver,
      XmlAttributeNode attribute) {
    Token token = scanAttribute(resolver, attribute);
    return resolver.parseAngularExpressionInToken(token);
  }
View Full Code Here

    return resolver.parseAngularExpressionInToken(token);
  }

  protected Expression parseDartExpression(AngularHtmlUnitResolver resolver,
      XmlAttributeNode attribute) {
    Token token = scanAttribute(resolver, attribute);
    return resolver.parseDartExpressionInToken(token);
  }
View Full Code Here

    return super.visitAwaitExpression(node);
  }

  @Override
  public Void visitBinaryExpression(BinaryExpression node) {
    Token operator = node.getOperator();
    TokenType type = operator.getType();
    if (type == TokenType.AMPERSAND_AMPERSAND || type == TokenType.BAR_BAR) {
      String lexeme = operator.getLexeme();
      checkForAssignability(
          node.getLeftOperand(),
          boolType,
          StaticTypeWarningCode.NON_BOOL_OPERAND,
          lexeme);
View Full Code Here

   * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_NAME
   * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME
   * @see CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME
   */
  private boolean checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode errorCode) {
    Token token = identifier.getToken();
    if (token.getType() == TokenType.KEYWORD) {
      errorReporter.reportErrorForNode(errorCode, identifier, identifier.getName());
      return true;
    }
    return false;
  }
View Full Code Here

   * @param body the function body being checked
   * @param errorCode the error code to be reported if a modifier is found
   * @return {@code true} if an error was reported
   */
  private boolean checkForInvalidModifierOnBody(FunctionBody body, CompileTimeErrorCode errorCode) {
    Token keyword = body.getKeyword();
    if (keyword != null) {
      errorReporter.reportErrorForToken(errorCode, keyword, keyword.getLexeme());
      return true;
    }
    return false;
  }
View Full Code Here

  private boolean hasDeferredPrefixCollision(ArrayList<ImportDirective> directives) {
    boolean foundError = false;
    int count = directives.size();
    if (count > 1) {
      for (int i = 0; i < count; i++) {
        Token deferredToken = directives.get(i).getDeferredToken();
        if (deferredToken != null) {
          errorReporter.reportErrorForToken(
              CompileTimeErrorCode.SHARED_DEFERRED_PREFIX,
              deferredToken);
          foundError = true;
View Full Code Here

  @Override
  public Void visitFunctionDeclaration(FunctionDeclaration node) {
    ExecutableElement outerExecutable = enclosingExecutable;
    try {
      SimpleIdentifier functionName = node.getName();
      Token property = node.getPropertyKeyword();
      if (property == null) {
        if (enclosingExecutable != null) {
          enclosingExecutable = findIdentifier(enclosingExecutable.getFunctions(), functionName);
        } else {
          enclosingExecutable = findIdentifier(enclosingUnit.getFunctions(), functionName);
View Full Code Here

  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ExecutableElement outerExecutable = enclosingExecutable;
    try {
      Token property = node.getPropertyKeyword();
      SimpleIdentifier methodName = node.getName();
      String nameOfMethod = methodName.getName();
      if (nameOfMethod.equals(TokenType.MINUS.getLexeme())
          && node.getParameters().getParameters().size() == 0) {
        nameOfMethod = "unary-";
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.