grammar CSV2HTML; @members { int cnt=0; public static void main(String[] args) throws Exception { CSV2HTMLLexer lex = new CSV2HTMLLexer(new ANTLRFileStream(args[0])); CommonTokenStream tokens = new CommonTokenStream(lex); CSV2HTMLParser parser = new CSV2HTMLParser(tokens); try { parser.s(); } catch (RecognitionException e) { e.printStackTrace(); } } } /*------------------------------------------------------------------ * LEXER RULES *------------------------------------------------------------------*/ PV : ';' ; US : '\r'? '\n'; NUM : ('0'..'9')+; /*------------------------------------------------------------------ * PARSER RULES *------------------------------------------------------------------*/ s : {System.out.println("");} (sor US)* {System.out.println("
Összesen "+cnt+" sor
");}; sor : {System.out.print("");} oszlop (PV oszlop)+ {System.out.println("");cnt++;}; oszlop : n=NUM {System.out.print(""+$n.text+"");};