package tablero;

import java_cup.runtime.*;
import java.io.*;
import java.util.*;


action code {:

:};



parser code {:

public ArrayList m;

public void syntax_error(Symbol s) {

}

public void unrecovered_syntax_error(Symbol s) throws
  java.lang.Exception {
}

 public static void main
    (
     String arg[]
     )
      {
	if (arg.length < 1)
	  {
	    System.out.println("Use: tablero.parser <filename>");
	    return;
	  }
	try 
	  {	
		tablero.Yylex s = new tablero.Yylex(new FileReader( arg[0]) );
		tablero.parser p = new tablero.parser(s);
		p.parse();
	  }
	catch (Exception e)
	  {	    
            System.out.println(e.getMessage());
	  }
      }

:};

terminal String ENTERO;
terminal MENOS;

non terminal DOCUMENTO;

non terminal ArrayList LINEA;
non terminal ArrayList LISTALINEA;

DOCUMENTO ::= LISTALINEA:l {: System.out.println("numero de lineas: " + l.size()); System.out.println(l.toString()); parser.m = l;  RESULT = l; :};

LISTALINEA ::= LINEA:l LISTALINEA:ll {: ll.add(l); RESULT = ll; :}
            |  LINEA:l {: ArrayList d = new ArrayList(); d.add(l); RESULT = d; :};

LINEA ::= ENTERO:e MENOS LINEA:l {: l.add(e); RESULT=l; :}
             | ENTERO:e {: ArrayList d = new ArrayList(); d.add(e); RESULT = d; :};

