public void guardarErrores(ParseTree arbol)
        {
            for (int i = 0; i < arbol.ParserMessages.Count; i++)
            {
                String descripcion = arbol.ParserMessages.ElementAt(i).Message;
                int    fila        = arbol.ParserMessages.ElementAt(i).Location.Line;
                int    columna     = arbol.ParserMessages.ElementAt(i).Location.Column;
                String tipo        = "";
                if (arbol.ParserMessages.ElementAt(i).Message.Contains("Invalid"))
                {
                    tipo = "Lexico";
                }
                else
                {
                    tipo = "Sintactico";
                }
                ErrorC error = new ErrorC(fila, columna, "lexema", tipo, descripcion);

                Data.errores.Add(error);
            }
        }
Пример #2
0
        private void extraerErrores(JArray errs)
        {
            ErrorC auxiliar;

            foreach (JObject error in errs)
            {
                auxiliar = new ErrorC();
                if (Convert.ToString(error.GetValue("tipo")).Equals("Semantico"))
                {
                    auxiliar.tipo        = "Semantico";
                    auxiliar.descripcion = Convert.ToString(error.GetValue("descripcion"));
                    errores.Add(auxiliar);
                }
                else
                {
                    auxiliar.tipo        = Convert.ToString(error.GetValue("tipo"));
                    auxiliar.descripcion = Convert.ToString(error.GetValue("descripcion"));
                    auxiliar.lexema      = Convert.ToString(error.GetValue("lexema"));
                    auxiliar.fila        = Convert.ToInt32(error.GetValue("fila"));
                    auxiliar.columna     = Convert.ToInt32(error.GetValue("columna"));
                    errores.Add(auxiliar);
                }
            }
        }