1.1 diff -r e9bf1ed4f331 -r a1cd8cb9d09e parser.y 1.2 --- a/parser.y Mon Dec 31 02:33:50 2001 +0000 1.3 +++ b/parser.y Mon Dec 31 07:25:08 2001 +0000 1.4 @@ -38,6 +38,7 @@ 1.5 %token RESOLUTION 1.6 %token INPUT 1.7 1.8 +%token FORMAT 1.9 %token PAGE 1.10 %token PAGES 1.11 %token BOOKMARK 1.12 @@ -69,21 +70,21 @@ 1.13 | INTEGER { $$.first = $1; $$.last = $1; } ; 1.14 1.15 image_ranges: 1.16 - range { input_images ($1.first, $1.last); } 1.17 - | image_ranges ',' range { input_images ($3.first, $3.last); } ; 1.18 + range { input_images ($1); } 1.19 + | image_ranges ',' range { input_images ($3); } ; 1.20 1.21 1.22 input_file_clause: 1.23 FILE_KEYWORD STRING ';' { input_set_file ($2) } ; 1.24 1.25 image_clause: 1.26 - IMAGE INTEGER ';' { input_images ($2, $2); } ; 1.27 + IMAGE INTEGER ';' { range_t range = { $2, $2 }; input_images (range); } ; 1.28 1.29 images_clause: 1.30 IMAGES image_ranges ';' ; 1.31 1.32 rotate_clause: 1.33 - ROTATE INTEGER ';' { input_set_rotation ($2) }; 1.34 + ROTATE INTEGER ';' { input_set_rotation ($2) } ; 1.35 1.36 unit: 1.37 /* empty */ /* default to INCH */ { $$ = 25.4; } 1.38 @@ -125,7 +126,7 @@ 1.39 ODD { input_set_modifier_context (INPUT_MODIFIER_ODD); } 1.40 modifier_clause_list ';' 1.41 { input_set_modifier_context (INPUT_MODIFIER_ALL); } 1.42 - | EVEN { input_set_modifier_context (INPUT_MODIFIER_ODD); } 1.43 + | EVEN { input_set_modifier_context (INPUT_MODIFIER_EVEN); } 1.44 modifier_clause_list ';' 1.45 { input_set_modifier_context (INPUT_MODIFIER_ALL); } ; 1.46 1.47 @@ -150,24 +151,34 @@ 1.48 output_file_clause: 1.49 FILE_KEYWORD STRING ';' { output_set_file ($2) } ; 1.50 1.51 +format_clause: 1.52 + FORMAT STRING ';' { output_set_page_number_format ($2) } ; 1.53 + 1.54 page_ranges: 1.55 - range { output_pages ($1.first, $1.last); } 1.56 - | page_ranges ',' range { output_pages ($3.first, $3.last); } ; 1.57 + range { output_pages ($1); } 1.58 + | page_ranges ',' range { output_pages ($3); } ; 1.59 1.60 page_clause: 1.61 - PAGE INTEGER ';' { output_pages ($2, $2); } 1.62 - | PAGE STRING ',' INTEGER ';' { output_pages ($4, $4); } ; 1.63 + PAGE INTEGER ';' { range_t range = { $2, $2 }; output_pages (range); } ; 1.64 1.65 pages_clause: 1.66 - PAGES page_ranges ';' 1.67 - | PAGES STRING ',' page_ranges ';' ; 1.68 + PAGES page_ranges ';' ; 1.69 + 1.70 +bookmark_name: 1.71 + STRING { output_set_bookmark ($1); } ; 1.72 + 1.73 +bookmark_name_list: 1.74 + bookmark_name 1.75 + | bookmark_name_list ',' bookmark_name ; 1.76 1.77 bookmark_clause: 1.78 - BOOKMARK INTEGER ',' STRING ';' 1.79 - | BOOKMARK STRING ';' ; 1.80 + BOOKMARK { output_push_context (); } 1.81 + bookmark_name_list 1.82 + output_clause_list ';' { output_pop_context (); } ; 1.83 1.84 output_clause: 1.85 output_file_clause 1.86 + | format_clause 1.87 | page_clause | pages_clause 1.88 | bookmark_clause 1.89 | output_clause_list ; 1.90 @@ -177,7 +188,8 @@ 1.91 | output_clauses output_clause ; 1.92 1.93 output_clause_list: 1.94 - '{' output_clauses '}' ; 1.95 + '{' { output_push_context (); } 1.96 + output_clauses '}' { output_pop_context (); } ; 1.97 1.98 output_statement: 1.99 OUTPUT output_clauses ;