summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/contourparser.tac
blob: 450f92b7f54ff291641392fe33b289204779bd18 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
%{
%}

#include yesno.tin
#include coordsys.tin
#include wcssys.tin
#include skyframe.tin
#include numeric.tin
#include string.tin
#include def.tin

%start command

%token ASINH_
%token BLOCK_
%token CLEAR_
%token CLOSE_
%token COLOR_
%token CONVERT_
%token COPY_
%token DASH_
%token EXP_
%token GENERATE_
%token GLOBAL_
%token HISTEQU_
%token LEVELS_
%token LIMITS_
%token LINEAR_
%token LOAD_
%token LOADLEVELS_
%token LOCAL_
%token LOG_
%token METHOD_
%token MINMAX_
%token MODE_
%token NLEVELS_
%token OPEN_
%token PASTE_
%token POW_
%token SAVE_
%token SAVELEVELS_
%token SCALE_
%token SCOPE_
%token SINH_
%token SMOOTH_
%token SQRT_
%token SQUARED_
%token WIDTH_
%token ZMAX_
%token ZSCALE_

%%

#include yesno.trl
#include coordsys.trl
#include wcssys.trl
#include skyframe.trl
#include numeric.trl

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

contour : yesno {ProcessCmdSet contour view $1 UpdateContour}
 | OPEN_ {ContourDialog}
 | CLOSE_ {ContourDestroyDialog}
 | CLEAR_ {ContourOffDialog}
 | LOAD_ load
 | SAVE_ save
 | CONVERT_ {Contour2Polygons}

# backward compatibility
 | LOADLEVELS_ STRING_ {ContourCmdLoadLevels $2}
# backward compatibility
 | SAVELEVELS_ STRING_ {ContourCmdSaveLevels $2}

 | COPY_ {ContourCCopyDialog}
 | PASTE_ paste
 | COLOR_ STRING_ {ContourDialog; ProcessCmdSet contour color $2 UpdateContour}
 | WIDTH_ INT_ {ContourDialog; ProcessCmdSet contour width $2 UpdateContour}
 | DASH_ yesno {ContourDialog; ProcessCmdSet contour dash $2 UpdateContour}
 | SMOOTH_ INT_ {ContourCmdGenerateDialog smooth $2}
 | METHOD_ method {ContourCmdGenerateDialog method $2}
 | NLEVELS_ INT_ {ContourCmdGenerateDialog nlevel $2}
 | SCALE_ scale {ContourCmdScale scale $2}
 | LOG_ log
 | MODE_ modes
 | SCOPE_ scope {ContourCmdMode scope $2}
 | LIMITS_ numeric numeric {ContourCmdLimits $2 $3}
 | LEVELS_ STRING_ {ContourCmdLevels $2}
 | GENERATE_ {ContourDialog; ContourGenerateDialog; UpdateContour}
 ;

load : STRING_ {ContourCmdLoad $1}
 | LEVELS_ STRING_ {ContourCmdLoadLevels $2}
# backward compatibility
 | STRING_ coordsys STRING_ INT_ yesno {ContourCmdLoadOrg $1 $2 fk5 $3 $4 $5}
 | STRING_ wcssys STRING_ INT_ yesno {ContourCmdLoadOrg $1 $2 fk5 $3 $4 $5}
 | STRING_ skyframe STRING_ INT_ yesno {ContourCmdLoadOrg $1 wcs $2 $3 $4 $5}
 | STRING_ wcssys skyframe STRING_ INT_ yesno {ContourCmdLoadOrg $1 $2 $3 $4 $5 $6}
# no longer supported
# | STRING_ STRING_ INT_ yesno
 ;

save : STRING_ {ContourCmdSave $1 physical fk5}
 | STRING_ coordsys {ContourCmdSave $1 $2 fk5}
 | STRING_ wcssys {ContourCmdSave $1 $2 fk5}
 | STRING_ skyframe {ContourCmdSave $1 wcs $2}
 | STRING_ wcssys skyframe {ContourCmdSave $1 $2 $3}
 | LEVELS_ STRING_ {ContourCmdSaveLevels $2}
# backward compatibility
# no longer supported
# | STRING_ wcssys skyframe STRING_ INT_ yesno {ContourCmdSave $1 $2 $3}
 ;

paste : {ContourCmdPaste wcs fk5 green 1 no}
 | coordsys STRING_ INT_ yesno {ContourCmdPaste $1 fk5 $2 $3 $4}
 | wcssys STRING_ INT_ yesno {ContourCmdPaste $1 fk5 $2 $3 $4}
 | skyframe STRING_ INT_ yesno {ContourCmdPaste wcs $1 $2 $3 $4}
 | wcssys skyframe STRING_ INT_ yesno {ContourCmdPaste $1 $2 $3 $4 $5}
# no longer supported
# | coordsys
# | wcssys
 ;

method : BLOCK_ {set _ block}
 | SMOOTH_ {set _ smooth}
 ;

scale : LINEAR_ {set _ linear}
 | LOG_ {set _ log}
 | POW_ {set _ pow}
 | SQUARED_ {set _ squared}
 | SQRT_ {set _ sqrt}
 | ASINH_ {set _ asinh}
 | SINH_ {set _ sinh}
 | HISTEQU_ {set _ histequ}
 ;

log : numeric {ContourCmdScale log $1}
 | EXP_ numeric {ContourCmdScale log $2}
 ;

modes : numeric {ContourCmdMode mode $1}
 | mode {ContourCmdMode mode $1}
 ;

mode : MINMAX_ {set _ minmax}
 | ZSCALE_ {set _ zscale}
 | ZMAX_ {set _ zmax}
 ;

scope : LOCAL_ {set _ local}
 | GLOBAL_ {set _ global}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}