Sat, 29 Dec 2001 10:19:49 +0000
*** empty log message ***
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@9 | 9 | struct { double width, double height } size; |
eric@5 | 10 | } |
eric@5 | 11 | |
eric@5 | 12 | %token <integer> INTEGER |
eric@5 | 13 | %token <fp> FLOAT |
eric@5 | 14 | %token <string> STRING |
eric@9 | 15 | %token <size> PAGE_SIZE |
eric@5 | 16 | |
eric@7 | 17 | %token ELIPSIS |
eric@7 | 18 | |
eric@9 | 19 | %token CM |
eric@9 | 20 | %token INCH |
eric@9 | 21 | |
eric@5 | 22 | %token EVEN |
eric@5 | 23 | %token ODD |
eric@5 | 24 | %token ALL |
eric@5 | 25 | |
eric@9 | 26 | %token PORTRAIT |
eric@9 | 27 | %token LANDSCAPE |
eric@9 | 28 | |
eric@5 | 29 | %token FILE |
eric@5 | 30 | %token IMAGE |
eric@9 | 31 | %token IMAGES |
eric@5 | 32 | %token ROTATE |
eric@5 | 33 | %token CROP |
eric@5 | 34 | %token SIZE |
eric@5 | 35 | %token INPUT |
eric@5 | 36 | |
eric@5 | 37 | %token PAGE |
eric@8 | 38 | %token PAGES |
eric@5 | 39 | %token BOOKMARK |
eric@5 | 40 | %token OUTPUT |
eric@5 | 41 | |
eric@9 | 42 | %type <integer> image_range |
eric@9 | 43 | %type <integer> image_ranges |
eric@9 | 44 | %type <integer> page_range |
eric@9 | 45 | %type <integer> page_ranges |
eric@9 | 46 | |
eric@9 | 47 | %type <fp> length |
eric@5 | 48 | |
eric@5 | 49 | %% |
eric@5 | 50 | |
eric@9 | 51 | statements: |
eric@9 | 52 | statement |
eric@9 | 53 | | statements statement ; |
eric@5 | 54 | |
eric@9 | 55 | statement: |
eric@9 | 56 | input_statement |
eric@9 | 57 | | output_statement ; |
eric@5 | 58 | |
eric@5 | 59 | |
eric@9 | 60 | image_range: |
eric@9 | 61 | INTEGER ELIPSIS INTEGER |
eric@7 | 62 | | INTEGER ; |
eric@5 | 63 | |
eric@9 | 64 | image_ranges: |
eric@9 | 65 | image_range |
eric@9 | 66 | | image_ranges ',' image_range ; |
eric@5 | 67 | |
eric@5 | 68 | |
eric@5 | 69 | file_clause: |
eric@5 | 70 | FILE STRING ';' ; |
eric@5 | 71 | |
eric@5 | 72 | image_clause: |
eric@9 | 73 | IMAGE INTEGER ';' |
eric@9 | 74 | | IMAGE INTEGER modifier_clause_list ';' ; |
eric@9 | 75 | |
eric@9 | 76 | images_clause: |
eric@9 | 77 | IMAGES image_ranges ';' |
eric@9 | 78 | | IMAGES image_ranges modifier_clause_list ';' |
eric@9 | 79 | | IMAGES image_ranges part_clauses ';' ; |
eric@5 | 80 | |
eric@5 | 81 | rotate_clause: |
eric@5 | 82 | ROTATE INTEGER ';' ; |
eric@5 | 83 | |
eric@9 | 84 | unit: |
eric@9 | 85 | CM |
eric@9 | 86 | | INCH ; |
eric@9 | 87 | |
eric@9 | 88 | length: |
eric@9 | 89 | FLOAT |
eric@9 | 90 | | FLOAT unit ; |
eric@9 | 91 | |
eric@5 | 92 | crop_clause: |
eric@9 | 93 | CROP PAGE_SIZE ';' |
eric@9 | 94 | | CROP PAGE_SIZE orientation ';' |
eric@9 | 95 | | CROP length ',' length ';' |
eric@9 | 96 | | CROP length ',' length ',' length ',' length ';' ; |
eric@9 | 97 | |
eric@9 | 98 | orientation: |
eric@9 | 99 | PORTRAIT |
eric@9 | 100 | | LANDSCAPE ; |
eric@5 | 101 | |
eric@5 | 102 | size_clause: |
eric@9 | 103 | SIZE PAGE_SIZE ';' |
eric@9 | 104 | | SIZE PAGE_SIZE orientation ';' |
eric@9 | 105 | | SIZE length ',' length ';' ; |
eric@9 | 106 | |
eric@9 | 107 | modifier_clause: |
eric@9 | 108 | rotate_clause | crop_clause | size_clause; |
eric@9 | 109 | |
eric@9 | 110 | modifier_clauses: |
eric@9 | 111 | modifier_clause |
eric@9 | 112 | | modifier_clauses modifier_clause; |
eric@9 | 113 | |
eric@9 | 114 | modifier_clause_list: |
eric@9 | 115 | '{' modifier_clauses '}' ; |
eric@5 | 116 | |
eric@5 | 117 | part: |
eric@7 | 118 | EVEN | ODD | ALL ; |
eric@5 | 119 | |
eric@5 | 120 | part_clause: |
eric@9 | 121 | part modifier_clause_list; |
eric@9 | 122 | |
eric@9 | 123 | part_clauses: |
eric@9 | 124 | part_clause |
eric@9 | 125 | | part_clauses part_clause; |
eric@5 | 126 | |
eric@5 | 127 | input_clause: |
eric@9 | 128 | file_clause |
eric@9 | 129 | | image_clause |
eric@9 | 130 | | images_clause |
eric@9 | 131 | | modifier_clause |
eric@7 | 132 | | input_clause_list ; |
eric@5 | 133 | |
eric@5 | 134 | input_clauses: |
eric@5 | 135 | input_clause |
eric@7 | 136 | | input_clauses input_clause ; |
eric@7 | 137 | |
eric@7 | 138 | input_clause_list: |
eric@7 | 139 | '{' input_clauses '}' ; |
eric@5 | 140 | |
eric@5 | 141 | input_statement: |
eric@8 | 142 | INPUT input_clauses ; |
eric@5 | 143 | |
eric@9 | 144 | page_range: |
eric@9 | 145 | INTEGER ELIPSIS INTEGER |
eric@9 | 146 | | INTEGER ; |
eric@9 | 147 | |
eric@9 | 148 | page_ranges: |
eric@9 | 149 | page_range |
eric@9 | 150 | | page_ranges ',' page_range ; |
eric@9 | 151 | |
eric@5 | 152 | page_clause: |
eric@8 | 153 | PAGE INTEGER ';' |
eric@9 | 154 | | PAGE STRING ',' INTEGER ';' ; |
eric@8 | 155 | |
eric@8 | 156 | pages_clause: |
eric@9 | 157 | PAGES page_ranges ';' |
eric@9 | 158 | | PAGES STRING ',' page_ranges ';' ; |
eric@5 | 159 | |
eric@5 | 160 | bookmark_clause: |
eric@8 | 161 | BOOKMARK INTEGER ',' STRING ';' |
eric@8 | 162 | | BOOKMARK STRING ';' ; |
eric@5 | 163 | |
eric@5 | 164 | output_clause: |
eric@8 | 165 | page_clause | pages_clause | bookmark_clause |
eric@7 | 166 | | output_clause_list ; |
eric@5 | 167 | |
eric@5 | 168 | output_clauses: |
eric@5 | 169 | output_clause |
eric@7 | 170 | | output_clauses output_clause ; |
eric@7 | 171 | |
eric@7 | 172 | output_clause_list: |
eric@7 | 173 | '{' output_clauses '}' ; |
eric@5 | 174 | |
eric@5 | 175 | output_statement: |
eric@8 | 176 | OUTPUT output_clauses ; |