1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser.y Fri Dec 28 04:44:05 2001 +0000 1.3 @@ -0,0 +1,97 @@ 1.4 +%{ 1.5 +#include <stdio.h> 1.6 +%} 1.7 + 1.8 +%union { 1.9 + int integer; 1.10 + double fp; 1.11 + char *string; 1.12 +} 1.13 + 1.14 +%token <integer> INTEGER 1.15 +%token <fp> FLOAT 1.16 +%token <string> STRING 1.17 + 1.18 +%token EVEN 1.19 +%token ODD 1.20 +%token ALL 1.21 + 1.22 +%token FILE 1.23 +%token IMAGE 1.24 +%token ROTATE 1.25 +%token CROP 1.26 +%token SIZE 1.27 +%token INPUT 1.28 + 1.29 +%token PAGE 1.30 +%token BOOKMARK 1.31 +%token OUTPUT 1.32 + 1.33 +%type <integer> range 1.34 +%type <integer> ranges 1.35 + 1.36 +%% 1.37 + 1.38 +statements: statement | statements statement; 1.39 + 1.40 +statement: input_statement | output_statement; 1.41 + 1.42 + 1.43 +range: INTEGER ".." INTEGER 1.44 + | INTEGER; 1.45 + 1.46 +ranges: range 1.47 + | ranges ',' range; 1.48 + 1.49 + 1.50 +file_clause: 1.51 + FILE STRING ';' ; 1.52 + 1.53 +image_clause: 1.54 + IMAGE ranges ';' ; 1.55 + 1.56 +rotate_clause: 1.57 + ROTATE INTEGER ';' ; 1.58 + 1.59 +crop_clause: 1.60 + CROP FLOAT ',' FLOAT ';' ; 1.61 + 1.62 +size_clause: 1.63 + SIZE FLOAT ',' FLOAT ';' ; 1.64 + 1.65 +part: 1.66 + EVEN | ODD | ALL; 1.67 + 1.68 +part_clause: 1.69 + part ';' ; 1.70 + 1.71 +input_clause: 1.72 + part_clause 1.73 + | file_clause | image_clause | rotate_clause 1.74 + | crop_clause | size_clause; 1.75 + 1.76 +input_clauses: 1.77 + input_clause 1.78 + | input_clauses input_clause; 1.79 + 1.80 +input_statement: 1.81 + INPUT '{' input_clauses '}' ; 1.82 + 1.83 + 1.84 +page_clause: 1.85 + PAGE ranges ';' 1.86 + | PAGE ranges ',' STRING ';' ; 1.87 + 1.88 +bookmark_clause: 1.89 + BOOKMARK STRING ';' ; 1.90 + 1.91 +output_clause: 1.92 + page_clause | bookmark_clause; 1.93 + 1.94 +output_clauses: 1.95 + output_clause 1.96 + | output_clauses output_clause; 1.97 + 1.98 +output_statement: 1.99 + OUTPUT '{' output_clauses '}' ; 1.100 +