parser.y

changeset 27
7a28031fe457
parent 20
a1cd8cb9d09e
child 30
35fad7ec7732
     1.1 --- a/parser.y	Tue Jan 01 03:44:40 2002 +0000
     1.2 +++ b/parser.y	Tue Jan 01 03:46:08 2002 +0000
     1.3 @@ -6,15 +6,18 @@
     1.4  
     1.5  %union {
     1.6    int integer;
     1.7 +  char character;
     1.8    double fp;
     1.9    char *string;
    1.10    page_size_t size;
    1.11    range_t range;
    1.12 +  page_label_t page_label;
    1.13  }
    1.14  
    1.15  %token <integer> INTEGER
    1.16  %token <fp> FLOAT
    1.17  %token <string> STRING
    1.18 +%token <character> CHARACTER
    1.19  %token <size> PAGE_SIZE
    1.20  
    1.21  %token ELIPSIS
    1.22 @@ -38,7 +41,7 @@
    1.23  %token RESOLUTION
    1.24  %token INPUT
    1.25  
    1.26 -%token FORMAT
    1.27 +%token LABEL
    1.28  %token PAGE
    1.29  %token PAGES
    1.30  %token BOOKMARK
    1.31 @@ -151,8 +154,11 @@
    1.32  output_file_clause:
    1.33  	FILE_KEYWORD STRING  ';' { output_set_file ($2) } ;
    1.34  
    1.35 -format_clause:
    1.36 -	FORMAT STRING ';' { output_set_page_number_format ($2) } ;
    1.37 +label_clause:
    1.38 +	LABEL ';' { page_label_t label = { NULL, '\0' }; output_set_page_label (label); }
    1.39 +	| LABEL STRING ';' { page_label_t label = { $2, '\0' }; output_set_page_label (label); }
    1.40 +	| LABEL CHARACTER ';' { page_label_t label = { NULL, $2 }; output_set_page_label (label); }
    1.41 +	| LABEL STRING ',' CHARACTER ';' { page_label_t label = { $2, $4 }; output_set_page_label (label); } ;
    1.42  
    1.43  page_ranges:
    1.44  	range { output_pages ($1); }
    1.45 @@ -172,13 +178,13 @@
    1.46  	| bookmark_name_list ',' bookmark_name ;
    1.47  
    1.48  bookmark_clause:
    1.49 -	BOOKMARK { output_push_context (); }
    1.50 +	BOOKMARK { output_push_context (); bookmark_level++; }
    1.51  	bookmark_name_list
    1.52 -	output_clause_list ';' { output_pop_context (); } ;
    1.53 +	output_clause_list ';' { bookmark_level--; output_pop_context (); } ;
    1.54  
    1.55  output_clause:
    1.56  	output_file_clause
    1.57 -	| format_clause
    1.58 +	| label_clause
    1.59  	| page_clause | pages_clause
    1.60  	| bookmark_clause
    1.61  	| output_clause_list ;