5 class BookkeepingParser extends Parser;
10 importVocab=BookkeepingLexer;
15 ( PI | COMMENT | STARTTAG | ENDTAG | PCDATA | CDATABLOCK )*
17 ) { System.out.println("TOKEN LITERAL"); };
23 class BookkeepingLexer extends Lexer;
26 k=2; // needed for newline junk
27 charVocabulary='\u0000'..'\u007F'; // allow ascii
28 exportVocab=BookkeepingLexer;
32 //TOKEN_LITERAL: ("debit" | "credit")+;
33 LEFT_PAREN: '(' { System.out.println("LEFT PARENTHESESE '('"); };
34 RIGHT_PAREN: ')' { System.out.println("RIGHT PARENTHESESE ')'"); };
35 DELIMITER: ',' { System.out.println("DELIMITER ','"); };
39 OPT_ENTRY: "-entry" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )* { System.out.println("-entry") };
40 OPT_ACCOUNT: "-account" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
41 OPT_JOURNAL: "-journal" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
42 OPT_NAME: "-name" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
43 OPT_TYPE: "-type" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
44 OPT_CWEIGHT: "-counterWeight" WHITESPACE("debit"|"credit");
45 OPT_AMOUNT: "-amount" WHITESPACE(('0'..'9')+'.'('0'..'9')+)*;
46 OPT_ID: "-id" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
47 OPT_ENTRYNUM: "-entrynum" WHITESPACE('0'..'9')*;
48 OPT_DATE: "-date" WHITESPACE(('0'..'9'){1,2}'/'('0'..'9'){1,2}'/'('0'..'9'){4})*;
49 OPT_FILE: "-F" WHITESPACE( 'A'..'Z' | 'a'..'z' | '0'..'9' )*;
54 COMMAND_CREATE: ("create")+ { System.out.println("COMMAND_CREATE"); };
55 COMMAND_ADD!: ("add")+ { System.out.println("COMMAND_ADD"); };
56 COMMAND_REMOVE: ("remove")+ { System.out.println("COMMAND_REMOVE"); };
57 COMMAND_REVERSE: ("reverse")+ { System.out.println("COMMAND_REVERSE"); };
58 COMMAND_FIND: ("find")+ { System.out.println("COMMAND_FIND"); };
59 COMMAND_LOAD: ("load")+ { System.out.println("COMMAND_LOAD"); };
60 COMMAND_LIST: ("list")+ { System.out.println("COMMAND_LIST"); };
61 COMMAND_LOGIN: ("login")+ { System.out.println("COMMAND_LOGIN"); };
62 COMMAND_LOGOUT: ("logout")+ { System.out.println("COMMAND_LOGOUT"); };
63 COMMAND_EXIT: ("exit")+ { System.out.println("COMMAND_EXIT"); };
68 END_COMMAND: ';' { System.out.println("END COMMAND ';'"); };
69 WHITESPACE: ( ' ' | '\r' | '\n' | '\t' ) {
70 System.out.println("");
71 System.out.println("WHITE SPACE ' '");