-- added fancybox 1.3.1 to project, initially for showing screenshots. See documentat...
[Bookkeeping.git] / grammar / bookkeeping.g
blobe111f8e624b23d62a1bddc52b021183bb5d27983
3 /* PARSER 
4  */ 
5 class BookkeepingParser extends Parser;
7 options {
8         
9         importVocab=XMLLexer; 
10         importVocab=BookkeepingLexer; 
13 /*TOKEN_LITERAL:        ( 
14                                         STARTTAG 
15                                                 ( PI | COMMENT | STARTTAG | ENDTAG | PCDATA | CDATABLOCK )* 
16                                         ENDTAG 
17                                 ) { System.out.println("TOKEN LITERAL"); }; 
21 /* LEXER 
22  */
23 class BookkeepingLexer extends Lexer;
25 options {
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 ','"); }; 
38 // OPTIONS 
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' )*; 
53 // COMMANDS 
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"); }; 
67 // MISCELLANEOUS 
68 END_COMMAND:    ';'     { System.out.println("END COMMAND ';'"); }; 
69 WHITESPACE:     ( ' ' | '\r' | '\n' | '\t' ) {
70                 System.out.println("");
71                 System.out.println("WHITE SPACE ' '"); 
72                 $setType(Token.SKIP);
73         };