Expression* sintactico::J() { if(CurrentToken->tipo == GUION) { CurrentToken = Lexer->NexToken(); Expression *expr; expr = new exprNegative(A(),Lexer->linea); } else if(CurrentToken->tipo == PARENTESIS_I) { CurrentToken = Lexer->NexToken(); Expression* expression = A(); if(CurrentToken->tipo != PARENTESIS_D) { Fallo = true; return NULL; } CurrentToken = Lexer->NexToken(); return expression; } else if(CurrentToken->tipo == IDENTIFICADOR) { Expression* expression = NULL; Token T = *CurrentToken; string str = T.lexema; CurrentToken = Lexer->NexToken(); if(CurrentToken->tipo == PARENTESIS_I) { expression = MethodCallExpression(T); if(Fallo) return NULL; } else if(CurrentToken->tipo == CORCHETE_I) { exprLvalue *lv = Lvalue(); lv->setId(str); expression = lv; if(Fallo) return NULL; } else { expression = new exprLvalue(str,Lexer->linea); } if(Fallo) return NULL; return expression; } else if(CurrentToken->tipo == INTCONSTANT || CurrentToken->tipo == CADENA || CurrentToken->tipo == BOOLCONSTANT) { Expression* expression = Constant(); if(Fallo) return NULL; return expression; } else { Fallo = true; MensajeError("Se esperaba una constante o identificador",Lexer->linea); return NULL; } }
auto lValues() const { return this->lists | ranges::view::transform ( []( const auto& list ){ return Lvalue( list ); } ); }