Exemplo n.º 1
0
 private static bool AssignmentExpression()
 {
     if (Tokens.GetToken().lexeme == "new")
     {
         Tokens.NextToken();
         if (!type())
         {
             SyntaxError(Tokens.GetToken(), "a type");
             return(false);
         }
         currentType = Tokens.GetToken().lexeme;
         Tokens.NextToken();
         if (!NewDeclaration())
         {
             SyntaxError(Tokens.GetToken(), "new  declaration");
         }
         return(true);
     }
     else if (Tokens.GetToken().lexeme == "itoa" || Tokens.GetToken().lexeme == "atoi")
     {
         string lexeme = Tokens.GetToken().lexeme;
         Tokens.NextToken();
         if (Tokens.GetToken().lexeme != "(")
         {
             SyntaxError(Tokens.GetToken(), "(");
         }
         if (semanticPass)
         {
             SemanticActions.oPush(Tokens.GetToken());
         }
         Tokens.NextToken();
         if (!Expression())
         {
             SyntaxError(Tokens.GetToken(), "expression");
         }
         if (Tokens.GetToken().lexeme != ")")
         {
             SyntaxError(Tokens.GetToken(), ")");
         }
         Tokens.NextToken();
         if (semanticPass && (lexeme == "atoi"))
         {
             SemanticActions.ShuntYardAll();
             SemanticActions.atoi();
         }
         else if (semanticPass && (lexeme == "itoa"))
         {
             SemanticActions.ShuntYardAll();
             SemanticActions.itoa();
         }
         return(true);
     }
     else if (Expression())
     {
         return(true);
     }
     return(false);
 }