private object getValor(Expresion expresion, Entorno entorno, Reporte reporte) { if (expresion is ObtenerVariable) { return(((ObtenerVariable)expresion).id); } else if (expresion is ObtenerObjeto) { return(nombre.evaluar(entorno, reporte).valor); } else { throw new util.ErrorPascal(0, 0, "valor no valido para obtener objeto", "semantico", reporte); } }
public override Simbolo evaluar(Entorno entorno, Reporte reporte) { Simbolo contenido = expresion.evaluar(entorno, reporte); if (contenido.tipo.tipo != Tipos.BOOLEAN) { throw new util.ErrorPascal(0, 0, "No se puede operar un Not en una expresion no booleana", "semantico", reporte); } if ((bool)(contenido.valor) == true) { return(new Simbolo(false, contenido.tipo, contenido.id)); } return(new Simbolo(true, contenido.tipo, contenido.id)); }