Exemple #1
0
        private string escribirTablaSimbolos(Entorno ent)
        {
            string html = "<!Doctype html>\n<html lang=\"es-Es\">\n<head>\n";

            html += "<link rel=\"stylesheet\" href=\"estiloTabla.css\">\n";
            html += "<title>Tabla de Simbolos</title>\n</head>\n<body>\n<h1><center>Tabla de Simbolos en Compilación</center></h1>\n<table style=\"margin: 0 auto;\">\n";
            html += "<caption>Variables globales declaradas</caption>\n";
            html += "<thead>\n<tr>\n<th>Nombre</th>\n<th>Tipo</th>\n<th>Posicion</th>\n<th>Es Constante</th>\n<th>Linea</th>\n<th>Columna</th>\n</tr>\n</thead>\n<tbody>\n";
            //RECORRERMOS LAS VARIABLES DEL ENTORNO GLOBAL
            foreach (DictionaryEntry variable in ent.vars)
            {
                Simbolo simbolo = (Simbolo)variable.Value;
                html += "<tr>\n";
                html += "<td>" + simbolo.identificador + "</td>\n";
                if (simbolo.type.tipo == Tipos.STRUCT)
                {
                    html += "<td>" + simbolo.type.tipoToString() + ":" + simbolo.type.tipoId + "</td>\n";
                }
                else
                {
                    html += "<td>" + simbolo.type.tipoToString() + "</td>\n";
                }
                html += "<td>" + simbolo.position + "</td>\n";
                if (simbolo.isConst)
                {
                    html += "<td>Si</td>\n";
                }
                else
                {
                    html += "<td>No</td>\n";
                }
                html += "<td>" + (simbolo.linea + 1) + "</td>\n";
                html += "<td>" + (simbolo.columna + 1) + "</td>\n";
                html += "</tr>\n";
            }
            html += "</tbody>\n</table>\n";
            html += "</br></br>\n";

            html += "<table style=\"margin: 0 auto;\">\n<caption>Procedimientos/Funciones declaradas</caption>\n";
            html += "<thead>\n<tr>\n<th>Nombre</th>\n<th>Tipo de Retorno</th>\n<th>PRO o FUN Padre</th>\n<th># Parametros</th>\n<th>Linea</th>\n<th>Columna</th>\n</tr>\n</thead>\n<tbody>\n";
            //RECORREMOS LAS FUNCIONES
            foreach (DictionaryEntry funcion in ent.functions)
            {
                SimboloFunction simbolo = (SimboloFunction)funcion.Value;
                html += "<tr>\n";
                html += "<td>" + simbolo.id + "</td>\n";
                if (simbolo.type.tipo == Tipos.STRUCT)
                {
                    html += "<td>" + simbolo.type.tipoToString() + ":" + simbolo.type.tipoId + "</td>\n";
                }
                else
                {
                    html += "<td>" + simbolo.type.tipoToString() + "</td>\n";
                }
                html += "<td>--</td>\n";
                html += "<td>" + simbolo.size + "</td>\n";
                html += "<td>" + (simbolo.linea + 1) + "</td>\n";
                html += "<td>" + (simbolo.columna + 1) + "</td>\n";
                html += "</tr>\n";
            }
            html += "</tbody>\n</table>\n</body>\n</html>";
            return(html);
        }