private void initComponent(String texto) { //iniciamos la bandera para saber si ha sido guardado los datos this.modificado = false; //Inicializamos la gramatica y su lenguage para tener el parse Gramatica = new SBScriptGrammar(); language = new LanguageData(Gramatica); parser = new Parser(language); //creamos el textbox TBContenido = new IronyFCTB(); TBContenido.Grammar = Gramatica; TBContenido.Multiline = true; TBContenido.Text = texto; //TBContenido.ScrollBars = RichTextBoxScrollBars.Both; TBContenido.WordWrap = false; TBContenido.Dock = DockStyle.Fill; //configuramos el label panel = new Label(); panel.Dock = DockStyle.Bottom; panel.Text = "Linea: 1, Columna: 1"; panel.TextAlign = ContentAlignment.MiddleRight; //agregamos los eventos TBContenido.TextChanged += TBContenido_TextChanged; TBContenido.SelectionChanged += TBContenido_SelectionChanged; //agregamos los elementos this.Controls.Add(TBContenido); this.Controls.Add(panel); //creamos el boton cerrar LidorSystems.IntegralUI.Controls.CommandButton closeButton = new LidorSystems.IntegralUI.Controls.CommandButton(); closeButton.ImageIndex = 0; closeButton.Key = "TAB_CLOSE"; //agreagamos el boton al tab this.Buttons.Add(closeButton); this.UseParentButtons = false; }
public EjecutarSBS GenerarSimbolo(String texto, String ruta) { SBScriptGrammar Gramatica; LanguageData language; Parser parser; Gramatica = new SBScriptGrammar(); language = new LanguageData(Gramatica); parser = new Parser(language); ParseTree parseTree = parser.Parse(texto); EjecutarSBS ejecutar = null; if (parseTree.Root != null && parseTree.ParserMessages.Count == 0) { GenerarTablaSimbolo a = new GenerarTablaSimbolo(parseTree, ruta); ejecutar = a.Ejecutar; ejecutar.Iniciar(); } else { TitusNotifiaciones.LimpiarDatosErrores(); TabError tablaerror = new TabError(); foreach (Irony.LogMessage error in parseTree.ParserMessages) { if (error.Message.Contains("Syntax error,")) { tablaerror.InsertarFila("Sintactico", error.Message.Replace("Syntax error", " "), ruta, (error.Location.Line + 1).ToString(), (error.Location.Column + 1).ToString()); } else if (error.Message.Contains("Invalid character")) { tablaerror.InsertarFila("Lexico", error.Message.Replace("Invalid character", "Caracter invalido"), ruta, (error.Location.Line + 1).ToString(), (error.Location.Column + 1).ToString()); } else { tablaerror.InsertarFila("Sintactico", error.Message.Replace("Unclosed cooment block", "Comentario de bloque sin cerrar"), ruta, (error.Location.Line + 1).ToString(), (error.Location.Column + 1).ToString()); } } TitusNotifiaciones.setDatosErrores(tablaerror); } return(ejecutar); }