summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/psparser.tac
blob: 4c0622b18e16bff10e99cb92e0afd53bb0229095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%{
%}

#include string.tin

%start command

%token COLOR_
%token COMMAND_
%token DESTINATION_
%token FILE_
%token FILENAME_
%token INTERPOLATE_
%token LEVEL_
%token PRINTER_
%token RESOLUTION_

%token RGB_
%token CMYK_ 
%token GRAY_

%token 72_
%token SCREEN_
%token 96_
%token 144_
%token 150_
%token 225_
%token 300_
%token 600_
%token 1200_

%%

command : ps 
 | ps {yyclearin; YYACCEPT} STRING_
 ;

ps : {PostScript}
 | DESTINATION_ dest {ProcessCmdSet ps dest $2}
 | COMMAND_ STRING_ {ProcessCmdSet ps cmd $2}
 | FILENAME_ STRING_ {ProcessCmdSet ps filename $2}
 | COLOR_ color {ProcessCmdSet ps color $2}
 | LEVEL_ level {ProcessCmdSet ps level $2}
 | RESOLUTION_ resolution {ProcessCmdSet ps resolution $2}
#backward compatibility
 | INTERPOLATE_
 ;

dest : PRINTER_ {set _ printer}
 | FILE_ {set _ file}
 ;

color : RGB_ {set _ rgb}
 | CMYK_ {set _ cmyk}
 | GRAY_ {set _ gray}
 ;

level : '1' {set _ 1}
 | '2' {set _ 2}
 | '3' {set _ 3}
 ;

resolution : 72_ {set _ 72}
 | SCREEN_ {set _ Screen}
 | 96_ {set _ 96}
 | 144_ {set _ 144}
 | 150_ {set _ 150}
 | 225_ {set _ 225}
 | 300_ {set _ 300}
 | 600_ {set _ 600}
 | 1200_ {set _ 1200}
 ;

%%

proc ps::yyerror {msg} {
     variable yycnt
     variable yy_current_buffer
     variable index_

     ParserError $msg $yycnt $yy_current_buffer $index_
}