Fri, 28 Dec 2001 04:44:05 +0000
Initial revision
eric@5 | 1 | %{ |
eric@5 | 2 | #include <stdio.h> |
eric@5 | 3 | %} |
eric@5 | 4 | |
eric@5 | 5 | %union { |
eric@5 | 6 | int integer; |
eric@5 | 7 | double fp; |
eric@5 | 8 | char *string; |
eric@5 | 9 | } |
eric@5 | 10 | |
eric@5 | 11 | %token <integer> INTEGER |
eric@5 | 12 | %token <fp> FLOAT |
eric@5 | 13 | %token <string> STRING |
eric@5 | 14 | |
eric@5 | 15 | %token EVEN |
eric@5 | 16 | %token ODD |
eric@5 | 17 | %token ALL |
eric@5 | 18 | |
eric@5 | 19 | %token FILE |
eric@5 | 20 | %token IMAGE |
eric@5 | 21 | %token ROTATE |
eric@5 | 22 | %token CROP |
eric@5 | 23 | %token SIZE |
eric@5 | 24 | %token INPUT |
eric@5 | 25 | |
eric@5 | 26 | %token PAGE |
eric@5 | 27 | %token BOOKMARK |
eric@5 | 28 | %token OUTPUT |
eric@5 | 29 | |
eric@5 | 30 | %type <integer> range |
eric@5 | 31 | %type <integer> ranges |
eric@5 | 32 | |
eric@5 | 33 | %% |
eric@5 | 34 | |
eric@5 | 35 | statements: statement | statements statement; |
eric@5 | 36 | |
eric@5 | 37 | statement: input_statement | output_statement; |
eric@5 | 38 | |
eric@5 | 39 | |
eric@5 | 40 | range: INTEGER ".." INTEGER |
eric@5 | 41 | | INTEGER; |
eric@5 | 42 | |
eric@5 | 43 | ranges: range |
eric@5 | 44 | | ranges ',' range; |
eric@5 | 45 | |
eric@5 | 46 | |
eric@5 | 47 | file_clause: |
eric@5 | 48 | FILE STRING ';' ; |
eric@5 | 49 | |
eric@5 | 50 | image_clause: |
eric@5 | 51 | IMAGE ranges ';' ; |
eric@5 | 52 | |
eric@5 | 53 | rotate_clause: |
eric@5 | 54 | ROTATE INTEGER ';' ; |
eric@5 | 55 | |
eric@5 | 56 | crop_clause: |
eric@5 | 57 | CROP FLOAT ',' FLOAT ';' ; |
eric@5 | 58 | |
eric@5 | 59 | size_clause: |
eric@5 | 60 | SIZE FLOAT ',' FLOAT ';' ; |
eric@5 | 61 | |
eric@5 | 62 | part: |
eric@5 | 63 | EVEN | ODD | ALL; |
eric@5 | 64 | |
eric@5 | 65 | part_clause: |
eric@5 | 66 | part ';' ; |
eric@5 | 67 | |
eric@5 | 68 | input_clause: |
eric@5 | 69 | part_clause |
eric@5 | 70 | | file_clause | image_clause | rotate_clause |
eric@5 | 71 | | crop_clause | size_clause; |
eric@5 | 72 | |
eric@5 | 73 | input_clauses: |
eric@5 | 74 | input_clause |
eric@5 | 75 | | input_clauses input_clause; |
eric@5 | 76 | |
eric@5 | 77 | input_statement: |
eric@5 | 78 | INPUT '{' input_clauses '}' ; |
eric@5 | 79 | |
eric@5 | 80 | |
eric@5 | 81 | page_clause: |
eric@5 | 82 | PAGE ranges ';' |
eric@5 | 83 | | PAGE ranges ',' STRING ';' ; |
eric@5 | 84 | |
eric@5 | 85 | bookmark_clause: |
eric@5 | 86 | BOOKMARK STRING ';' ; |
eric@5 | 87 | |
eric@5 | 88 | output_clause: |
eric@5 | 89 | page_clause | bookmark_clause; |
eric@5 | 90 | |
eric@5 | 91 | output_clauses: |
eric@5 | 92 | output_clause |
eric@5 | 93 | | output_clauses output_clause; |
eric@5 | 94 | |
eric@5 | 95 | output_statement: |
eric@5 | 96 | OUTPUT '{' output_clauses '}' ; |
eric@5 | 97 |