parser.y

Sat, 29 Dec 2001 10:19:49 +0000

author
eric
date
Sat, 29 Dec 2001 10:19:49 +0000
changeset 9
de78038d990f
parent 8
7288d2753c18
child 11
30d18cf8bb67
permissions
-rw-r--r--

*** empty log message ***

     1 %{
     2 #include <stdio.h>
     3 %}
     5 %union {
     6   int integer;
     7   double fp;
     8   char *string;
     9   struct { double width, double height } size;
    10 }
    12 %token <integer> INTEGER
    13 %token <fp> FLOAT
    14 %token <string> STRING
    15 %token <size> PAGE_SIZE
    17 %token ELIPSIS
    19 %token CM
    20 %token INCH
    22 %token EVEN
    23 %token ODD
    24 %token ALL
    26 %token PORTRAIT
    27 %token LANDSCAPE
    29 %token FILE
    30 %token IMAGE
    31 %token IMAGES
    32 %token ROTATE
    33 %token CROP
    34 %token SIZE
    35 %token INPUT
    37 %token PAGE
    38 %token PAGES
    39 %token BOOKMARK
    40 %token OUTPUT
    42 %type <integer> image_range
    43 %type <integer> image_ranges
    44 %type <integer> page_range
    45 %type <integer> page_ranges
    47 %type <fp> length
    49 %%
    51 statements: 
    52 	statement
    53 	| statements statement ;
    55 statement:
    56 	input_statement
    57 	| output_statement ;
    60 image_range:
    61 	INTEGER ELIPSIS INTEGER
    62 	| INTEGER ;
    64 image_ranges:
    65 	image_range
    66 	| image_ranges ',' image_range ;
    69 file_clause:
    70 	FILE STRING  ';' ;
    72 image_clause:
    73 	IMAGE INTEGER ';'
    74 	| IMAGE INTEGER modifier_clause_list ';' ;
    76 images_clause:
    77 	IMAGES image_ranges ';'
    78 	| IMAGES image_ranges modifier_clause_list ';'
    79 	| IMAGES image_ranges part_clauses ';' ;
    81 rotate_clause:
    82 	ROTATE INTEGER ';' ;
    84 unit:
    85 	CM
    86 	| INCH ;
    88 length:
    89 	FLOAT
    90 	| FLOAT unit ;
    92 crop_clause:
    93 	CROP PAGE_SIZE ';'
    94 	| CROP PAGE_SIZE orientation ';'
    95 	| CROP length ',' length ';'
    96 	| CROP length ',' length ',' length ',' length ';' ;
    98 orientation:
    99 	PORTRAIT
   100 	| LANDSCAPE ;
   102 size_clause:
   103 	SIZE PAGE_SIZE ';'
   104 	| SIZE PAGE_SIZE orientation ';'
   105 	| SIZE length ',' length ';' ;
   107 modifier_clause:
   108 	rotate_clause | crop_clause | size_clause;
   110 modifier_clauses:
   111 	modifier_clause
   112 	| modifier_clauses modifier_clause;
   114 modifier_clause_list:
   115 	'{' modifier_clauses '}' ;
   117 part:
   118 	EVEN | ODD | ALL ;
   120 part_clause:
   121 	part modifier_clause_list;
   123 part_clauses:
   124 	part_clause
   125 	| part_clauses part_clause;
   127 input_clause:
   128 	file_clause
   129 	| image_clause
   130 	| images_clause
   131 	| modifier_clause
   132 	| input_clause_list ;
   134 input_clauses:
   135 	input_clause
   136 	| input_clauses input_clause ;
   138 input_clause_list:
   139 	'{' input_clauses '}' ;
   141 input_statement:
   142 	INPUT input_clauses ;
   144 page_range:
   145 	INTEGER ELIPSIS INTEGER
   146 	| INTEGER ;
   148 page_ranges:
   149 	page_range
   150 	| page_ranges ',' page_range ;
   152 page_clause:
   153 	PAGE INTEGER ';'
   154 	| PAGE STRING ',' INTEGER ';' ;
   156 pages_clause:
   157 	PAGES page_ranges ';'
   158 	| PAGES STRING ',' page_ranges ';' ;
   160 bookmark_clause:
   161 	BOOKMARK INTEGER ',' STRING ';'
   162 	| BOOKMARK STRING ';' ;
   164 output_clause:
   165 	page_clause | pages_clause | bookmark_clause
   166 	| output_clause_list ;
   168 output_clauses:
   169 	output_clause
   170 	| output_clauses output_clause ;
   172 output_clause_list:
   173 	'{' output_clauses '}' ;
   175 output_statement:
   176 	OUTPUT output_clauses ;