Você está na página 1de 15

Manual Tcnico

Requerimientos
Contar con algn IDE que reconozca el lenguaje java, se recomienda utilizar Netbeans para tener una mejor visualizacin del cdigo para cargar todo el proyecto Se recomienda utilizar JDK_6U21 en adelante para no tener ningn problema a la hora de correr el proyecto

Archivo Flex:
import java_cup.runtime.Symbol; import javax.swing.table.DefaultTableModel; import javax.swing.JOptionPane; %% %{ int notokens = 1; int noerrores = 1; String contenido=""; String titulos[] = {"No.","Token","No. Linea","No. Columna", "Descripcion"}; String tituerrores[] = {"No.","Error Lexico", "No. Linea", "No. Columna"}; DefaultTableModel misTokens = new DefaultTableModel(titulos, 0); DefaultTableModel ErroresLexicos = new DefaultTableModel(tituerrores, 0); public void AgregarToken(int n, Yytoken tok){ String tokens[] = {""+n, tok.val, ""+tok.linea, ""+tok.columna, ""+tok.descrip}; misTokens.addRow(tokens); } public void AgregarToken(int n, ErroresLex err){ String errores[] = {""+n, err.val, ""+err.linea, ""+err.columna}; ErroresLexicos.addRow(errores); } %}

%line %char %public %full %ignorecase %class Yylex %cup NUMBER = [0-9][0-9]* LETRA = [a-zA-Z|"."|":"|"/"|"\\"] SPACE=([\ \r\t\f\t])

ENTER=[\ \n] COLORES=("Rojo"|"Azul"|"Verde"|"Morado"|"Rosado"|"Blanco"|"Gris"|"Negro"|"Anaranjado"|" Celeste") TFUENTE = ("arial"|"algerian"|"calibri"|"castellar"|"times new roman") TI_TEXT= ("titulo"|"subtitulo"|"titulo_imagen"|"titulo_tabla"|"subtitulo_tabla"|"Contenidos") DIR = ("centrado"|"derecha"|"izquierda"|"justificado") RESP = ("si"|"no") TIPVIN = ("num"|"min"|"mayu"|"punto"|"cuadrado"|"circulo") %% <YYINITIAL> ":" {/*ingored*/} <YYINITIAL> "." {/*ingored*/} <YYINITIAL> "/" {/*ingored*/} <YYINITIAL> "\\" {/*ingored*/} <YYINITIAL> {ENTER} { yychar = 0;} <YYINITIAL> {SPACE} {/*ignored*/} <YYINITIAL> {NUMBER} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Numero"); AgregarToken(notokens++, tok); return new Symbol(sym.NUMBER, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> {LETRA} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Letra"); AgregarToken(notokens++, tok); return new Symbol(sym.LETRA, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> {COLORES} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Color"); AgregarToken(notokens++, tok); return new Symbol(sym.COLORES, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> {TFUENTE} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Tipo Fuente"); AgregarToken(notokens++, tok); return new Symbol(sym.TFUENTE, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> {TI_TEXT} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Tipo Texto"); AgregarToken(notokens++, tok); return new Symbol(sym.TI_TEXT, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> {RESP} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada"); AgregarToken(notokens++, tok); return new Symbol(sym.RESP, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> {TIPVIN} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Tipo Vieta"); AgregarToken(notokens++, tok); return new Symbol(sym.TIPVIN, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "<" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Signo Menor"); AgregarToken(notokens++, tok); return new Symbol(sym.menor, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> ">" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Signo Mayor"); AgregarToken(notokens++, tok); return new Symbol(sym.mayor, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> {DIR} { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Direccion"); AgregarToken(notokens++, tok); return new Symbol(sym.DIR, yyline+1,yychar+1, new String(yytext()));}

<YYINITIAL> "</" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Cierre Etiqueta"); AgregarToken(notokens++, tok); return new Symbol(sym.aper_etiq, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "=" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Signo Igual"); AgregarToken(notokens++, tok); return new Symbol(sym.igual, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "," { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Coma"); AgregarToken(notokens++, tok); return new Symbol(sym.coma, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "_" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Guion Bajo"); AgregarToken(notokens++, tok); return new Symbol(sym.guionbajo, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "-" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Guion"); AgregarToken(notokens++, tok); return new Symbol(sym.guion, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "*" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Signo Por"); AgregarToken(notokens++, tok); return new Symbol(sym.por, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "\"" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Comillas"); AgregarToken(notokens++, tok); return new Symbol(sym.comillas, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "portada" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Portada"); AgregarToken(notokens++, tok); return new Symbol(sym.portada, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "fondo" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Fondo"); AgregarToken(notokens++, tok); return new Symbol(sym.fondo, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "tam" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Tam"); AgregarToken(notokens++, tok); return new Symbol(sym.tam, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "ancho" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Ancho"); AgregarToken(notokens++, tok); return new Symbol(sym.ancho, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "alto" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Alto"); AgregarToken(notokens++, tok); return new Symbol(sym.alto, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "color" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Color"); AgregarToken(notokens++, tok); return new Symbol(sym.color, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "alineacion" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Alineacion"); AgregarToken(notokens++, tok); return new Symbol(sym.alineacion, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "negrita" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Negrita"); AgregarToken(notokens++, tok); return new Symbol(sym.negrita, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "direccion" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Direccion"); AgregarToken(notokens++, tok); return new Symbol(sym.direccion, yyline+1,yychar+1, new String(yytext()));}

<YYINITIAL> "borde" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Borde"); AgregarToken(notokens++, tok); return new Symbol(sym.borde, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "fuente" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Fuente"); AgregarToken(notokens++, tok); return new Symbol(sym.fuente, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "tipo" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Tipo"); AgregarToken(notokens++, tok); return new Symbol(sym.tipo, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "contenido" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Contenido"); AgregarToken(notokens++, tok); return new Symbol(sym.conten, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "seccion" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Seccion"); AgregarToken(notokens++, tok); return new Symbol(sym.seccion, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "sub-seccion" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Sub-Seccion"); AgregarToken(notokens++, tok); return new Symbol(sym.sub, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "texto" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Texto"); AgregarToken(notokens++, tok); return new Symbol(sym.texto, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "imagen" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Imagen"); AgregarToken(notokens++, tok); return new Symbol(sym.imagen, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "vinieta" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Vinieta"); AgregarToken(notokens++, tok); return new Symbol(sym.vinieta, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "tabla" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Tabla"); AgregarToken(notokens++, tok); return new Symbol(sym.tabla, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "vi" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Vi"); AgregarToken(notokens++, tok); return new Symbol(sym.vi, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL> "fila" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Fila"); AgregarToken(notokens++, tok); return new Symbol(sym.fila, yyline+1,yychar+1, new String(yytext())); } <YYINITIAL> "columna" { Yytoken tok = new Yytoken(yytext(), yyline, yychar, "Palabra Reservada Columna"); AgregarToken(notokens++, tok); return new Symbol(sym.columna, yyline+1,yychar+1, new String(yytext()));} <YYINITIAL>. { System.out.println("Error Lexico En " + yyline + "," + yychar + " No se reconoce " + yytext() + "\n"); ErroresLex err = new ErroresLex(yytext(), yyline, yychar); AgregarToken(noerrores++, err); JOptionPane.showMessageDialog(null,"Existen Errores!! Por Favor Verificar","....",JOptionPane.INFORMATION_MESSAGE); yychar=0; }

Archivo Cup
import java_cup.runtime.*; import java.lang.*; import java.util.*; import Objetos.*; import javax.swing.JOptionPane; parser code {: public void syntax_error(Symbol s) { System.out.println("Error sintactico \tTexto : "+ s.value.toString()+" Fila: "+(s.left)+" Collumna: "+(s.right)); } public void unrecovered_syntax_error(Symbol s)throws Exception { System.out.println("unrecovered archivo C \tTexto : "+ (s.value).toString()+" Fila: "+(s.left)+" Columna: "+(s.right) ); }

:} action code{:

:} terminal NUMBER, LETRA, COLORES, TFUENTE, TI_TEXT, DIR, RESP, TIPVIN, menor, aper_etiq, mayor, igual, coma, guionbajo, guion, por, comillas, portada, fondo, tam, ancho, alto, color, alineacion, negrita, direccion, borde, fuente, tipo, seccion, sub, texto, imagen, vinieta, tabla, vi, fila, columna, conten; non terminal S0, S1, S2, S3, S4, S5, S6, S8, S9, S11, S12, S14, S15, S16, S17, S18, S19, S20, S21, S22, S23, S24, S25, S27, S28, S30, S31, S33, S34, S35, S36, S37, S38, S39, AB, SPRIMA, S61, S251, SX, S80, SPRIMA2;

start with S0;

S0::= menor portada S1 mayor SPRIMA | {: JOptionPane.showMessageDialog(null,"No ha abierto ningun archivo","....",JOptionPane.INFORMATION_MESSAGE);:} | error {: System.out.println("Falta Etiqueta");:} SPRIMA ; S1::= tam guionbajo portada igual NUMBER AB | fondo igual comillas COLORES comillas AB | ; AB::= coma tam guionbajo portada igual NUMBER AB | coma fondo igual comillas COLORES comillas AB | ; SPRIMA::= S2 | S21 ; S2::= menor seccion guionbajo NUMBER alto guionbajo seccion igual NUMBER S3 ; S3::= coma ancho guionbajo seccion igual NUMBER mayor S4 aper_etiq seccion guionbajo NUMBER mayor S20 | mayor S4 aper_etiq seccion guionbajo NUMBER mayor S20 ; S4::= menor sub guionbajo NUMBER ancho guionbajo seccion igual NUMBER S5 | S6 ; S5::= coma alto guionbajo seccion igual NUMBER mayor S6 aper_etiq sub guionbajo NUMBER mayor S4 | mayor S6 aper_etiq sub guionbajo NUMBER mayor S4 ; S6::= menor S61 | ; S61::= texto tipo guionbajo texto igual comillas TI_TEXT comillas S8 | imagen direccion igual comillas SX comillas S11 | vinieta tipo guionbajo vinieta igual comillas TIPVIN comillas S14 | tabla S16 ; S8::= coma tam guionbajo fuente igual NUMBER S8

| coma fuente igual comillas TFUENTE comillas S8 | coma color guionbajo fuente igual comillas COLORES comillas S8 | coma alineacion igual comillas DIR comillas S8 | coma negrita igual comillas RESP comillas S8 | coma tipo guionbajo seccion igual comillas SX comillas S8 | mayor S9 ; S9::= LETRA S9 | aper_etiq texto mayor S6 ; SX::= LETRA SX | ; S11::= coma tam guionbajo imagen igual NUMBER por NUMBER S11 | coma alineacion igual comillas DIR comillas S11 | mayor S12 ; S12::= LETRA S12 | aper_etiq imagen mayor S6 ; S14::= coma tam guionbajo fuente igual NUMBER S14 | coma fuente igual comillas TFUENTE comillas S14 | coma color guionbajo fuente igual comillas COLORES comillas S14 | coma negrita igual comillas RESP comillas S14 | mayor S15 ; S15::= menor vi mayor SX aper_etiq vi mayor S15 | aper_etiq vinieta mayor S6 ; S16::= borde igual NUMBER S17 | ancho igual NUMBER S17 | alto igual NUMBER S17 | mayor S18 ; S17::= coma borde igual NUMBER S17 | coma ancho igual NUMBER S17 | coma alto igual NUMBER S17 | mayor S18 ;

S18::= menor fila mayor S19 | aper_etiq tabla mayor S6 ; S19::= menor columna mayor SX aper_etiq columna mayor S19 | aper_etiq fila mayor S18 ; S20::= aper_etiq portada mayor {: JOptionPane.showMessageDialog(null,"Proceso Finalizado!!","....",JOptionPane.INFORMATION_MESSAGE); :} | S2 | error {: System.out.println("Falta Etiqueta Cierre Portada");:} ;

S21::= menor sub guionbajo NUMBER ancho guionbajo seccion igual NUMBER S22 ; S22::= coma alto guionbajo seccion igual NUMBER mayor S23 aper_etiq sub guionbajo NUMBER mayor S39 | mayor S23 aper_etiq sub guionbajo NUMBER mayor S39 ; S23::= menor seccion guionbajo NUMBER alto guionbajo seccion igual NUMBER S24 | S25 ; S24::= coma ancho guionbajo seccion igual NUMBER mayor S25 aper_etiq seccion guionbajo NUMBER mayor S23 | mayor S25 aper_etiq seccion guionbajo NUMBER mayor S23 ; S25::= menor S251 | ; S251::= texto tipo guionbajo texto igual comillas TI_TEXT comillas S27 | imagen direccion igual comillas SX comillas S30 | vinieta tipo guionbajo vinieta igual comillas TIPVIN comillas S33 | tabla S35 ; S27::= coma tam guionbajo fuente igual NUMBER S27 | coma fuente igual comillas TFUENTE comillas S27 | coma color guionbajo fuente igual comillas COLORES comillas S27 | coma alineacion igual comillas DIR comillas S27

| coma negrita igual comillas RESP comillas S27 | coma tipo guionbajo seccion igual comillas SX comillas S27 | mayor S28 ; S28::= LETRA S28 | aper_etiq texto mayor S25 ;

S30::= coma tam guionbajo imagen igual NUMBER por NUMBER S30 | coma alineacion igual comillas DIR comillas S30 | mayor S31 ; S31::= LETRA S31 | aper_etiq imagen mayor S25 ;

S33::= coma tam guionbajo fuente igual NUMBER S33 | coma fuente igual comillas TFUENTE comillas S33 | coma color guionbajo fuente igual comillas COLORES comillas S33 | coma negrita igual comillas RESP comillas S33 | mayor S34 ; S34::= menor vi mayor SX aper_etiq vi mayor S34 | aper_etiq vinieta mayor S25 ; S35::= borde igual NUMBER S36 | ancho igual NUMBER S36 | alto igual NUMBER S36 | mayor S37 ; S36::= coma borde igual NUMBER S36 | coma ancho igual NUMBER S36 | coma alto igual NUMBER S36 | mayor S37 ; S37::= menor fila mayor S38 | aper_etiq tabla mayor S25 ; S38::= menor columna mayor SX aper_etiq columna mayor S38

| aper_etiq fila mayor S37 ; S39::= aper_etiq portada mayor {: JOptionPane.showMessageDialog(null,"Proceso Finalizado!!","....",JOptionPane.INFORMATION_MESSAGE); :} | error {: System.out.println("Falta Etiqueta Cierre Portada");:} mayor | S21 ;

Mtodos:
public void abrirarch(){ selector.setFileSelectionMode(JFileChooser.FILES_ONLY); FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivos TXT","txt"); selector.setFileFilter(filter); int resultado=selector.showOpenDialog(this); nombrearchivo=selector.getSelectedFile(); if(resultado==JFileChooser.CANCEL_OPTION){ cont=+1; return; } else if(nombrearchivo==null||nombrearchivo.getName().equals("")){ JOptionPane.showMessageDialog(this,"nombre de archivo incorrecto","nombre de archivo incorrecto",JOptionPane.ERROR_MESSAGE); } else{ try{ salida= new FileInputStream(nombrearchivo);

System.out.println("archivo abierto"); } catch(IOException e){ System.out.println("archivo no abierto"); e.getMessage(); } } }

Este mtodo que manda a llamar una instancia de la clase FileChooser con la cual abrir se abrir el archivo en el editor de texto para generar el laberinto

String cad; if(nombrearchivo!=null){ cad=String.valueOf(nombrearchivo); } else{ cad=""; } return cad; } Mtodo que devuelve un String relacionado con el nombre del archivo comparando mediante un if si el nombre del archivo es nulo o no. Y si no es nulo despliega el nombre del archivo.

public void guardararch(String cadena){ selector.setDialogTitle("Guardar....."); selector.setFileSelectionMode(JFileChooser.FILES_ONLY); FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivos TXT","txt"); selector.setFileFilter(filter); int resultado=selector.showSaveDialog(this); nombrearchivo=selector.getSelectedFile(); if(resultado==JFileChooser.CANCEL_OPTION){ return; } else if(nombrearchivo==null||nombrearchivo.getName().equals("")) { JOptionPane.showMessageDialog(this,"incorrecto","nombre de archivo incorrecto",JOptionPane.ERROR_MESSAGE); } else{ JOptionPane.showMessageDialog(this,"Archivo guardado Satisfactoriamente","informacion!!!",JOptionPane.INFORMATION_MESSA GE); creararch(nombrearchivo,cadena);

} }

Con este mtodo podemos guardar archivos de texto tipo txt mediante una instancia de la clase filechooser.

public void creararch(File nombrearch,String cadena){ try{ FileWriter fw= new FileWriter(nombrearch); BufferedWriter bw=new BufferedWriter(fw); PrintWriter salida=new PrintWriter(bw); salida.flush(); salida.println(cadena); salida.close(); } catch(IOException e){ e.getMessage(); } }

Con este mtodo se crean archivos de texto tipo txt escribindolos por lnea. Mediante las clases FileWriter y BufferedWriter

private void mostrar_codigo_fuente(Archivos arch){ try{ ruta_archivo=String.valueOf(arch.devolver_ruta_archivo());//tipo string file=new File(ruta_archivo); f=new FileReader(file); e=new BufferedReader(f); jT_laber.setText("");//limpiar pantalla while(e.ready()==true){ //mostrar en pantalla codigo el contenido del archivo abierto jT_laber.setText(jT_laber.getText()+" "+e.readLine()+"\n"); jT_laber.setForeground(Color.red); } } catch(Exception error){

JOptionPane.showMessageDialog(null,"No se abrio archivo alguno","....",JOptionPane.INFORMATION_MESSAGE); //mensaje de error al no abrir ningun archivo } } Muestra en pantalla el cdigo contenido en el archivo abierto mediante la obtencin de la ruta del archivo y as mismo sino se abre ningn archivo muestra un mensaje de error.

public void abrir(String nombrepdf) { try { File ver = new File (nombrepdf); Desktop.getDesktop().open(ver); } catch (Exception ex) { JOptionPane.showMessageDialog(null,"Archivo buscado inexistente"); System.out.println(ex); } } Metodo con el cual abrimos

abrirpdf abrirarchivos =new abrirpdf(); abrirarchivos.abrir("manualusuariocompi1.pdf"); Metodo con el cual visualizamos el archivo pdf

public class Yytoken{ manejaHTML result; String archivo; String val; String descrip; int linea; int columna; public Yytoken(String val, int linea, int columna, String descrip){ this.val = val; this.linea = linea;

this.columna = columna; this.descrip = descrip; this.linea++; this.columna++; } public Yytoken() { this.val = ""; this.linea = 1; this.columna = 1; } } Almacena los tokens, filas y columnas obtenidos por el analizador lxico lex.flex

public void CrearEncabezadoHTML() {

html.append("<carpeta>\r\n"); html.append("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\r\n"); html.append("<html xmlns='http://www.w3.org/1999/xhtml'>\r\n"); html.append("<head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <title>Tabla De Tokens</title>\r\n"); html.append("<img src='usac.jpg' width='140' height='140' alt='usac' /></head>"); html.append("<font Size='20' face='Algerian'><center>TABLA SIMBOLOS</center></font>"); html.append("<table border='1'> <tr>"); html.append("<td width='150' align='center'>No.</td>"); html.append("<td width='250' align='center'>Token</td>"); html.append("<td width='250' align='center'>Linea</td>"); html.append("<td width='250' align='center'>Columna</td>"); html.append("<td width='400' align='center'>Descripcion</td></tr>"); html.append("</table>"); } public void ingresar_datos(String n, String val, String linea, String columna, String descrip){

html.append("<body bgcolor='#99FF66'>"); html.append("<table border='1'> <tr>"); html.append("<td width='150'align='center'>"+n+"</td>"); html.append("<td width='250'align='center'>"+val+"</td>"); html.append("<td width='250' align='center'>"+linea+"</td>"); html.append("<td width='250' align='center'>"+columna+"</td>");

html.append("<td width='400' align='center'>"+descrip+"</td></tr>"); html.append("</table></body></html>"); }

public void crear_HTML(String nombre){ html.append("</carpeta>\r\n"); this.creararch(nombre,html.toString()); } private void creararch(String nombrearch,String cadena){//crea archivos de texto escritos por linea, tipo_tabla 2*/ nombrearch = "Tabla_simbolos"; File f=new File(nombrearch); try{ FileWriter fw= new FileWriter(f+".html"); BufferedWriter bw=new BufferedWriter(fw); PrintWriter salida=new PrintWriter(bw); salida.flush(); salida.println(cadena); salida.close(); //JOptionPane.showMessageDialog(this,"Puede ver los resultados \nNombre archivo:"+nombrearch,"SucessFile!!",JOptionPane.INFORMATION_MESSAGE); } catch(IOException e){ JOptionPane.showMessageDialog(this,e.getMessage()+ "Algo esta mal","",JOptionPane.INFORMATION_MESSAGE); e.getMessage(); } Esta clase se encargar de manejar los html de tabla de simbolos y de errores lxicos.

Yylex lexer = new Yylex(new StringReader(jT_editor.getText())); parser miparser = new parser(lexer); miparser.parse(); Aqu realizamos el anlisis lxico, pasando como parmetro lo que se encuentra en el area del editor de texto

Você também pode gostar