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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
%{
%}
#include yesno.tin
#include font.tin
#include coords.tin
#include skyframe.tin
#include skyformat.tin
#include numeric.tin
#include string.tin
%start command
%token ALL_
%token AT_
%token AUTO_
%token AUTOCENTROID_
%token BACK_
%token BACKGROUND_
%token CENTROID_
%token CLOSE_
%token COLOR_
%token COMMAND_
%token COMPOSITE_
%token COORD_
%token COORDFORMAT_
%token COPY_
%token CUT_
%token DELETE_
%token DELETEALL_
%token DELIM_
%token DISSOLVE_
%token EDIT_
%token EPSILON_
%token EXCLUDE_
%token FILE_
%token FIXED_
%token FORMAT_
%token FRONT_
%token GETINFO_
%token GROUP_
%token GROUPS_
%token INTERATION_
%token INCLUDE_
%token INVERT_
%token LIST_
%token LOAD_
%token MOVE_
%token MOVEBACK_
%token MOVEFRONT_
%token NEW_
%token NL_
%token NONE_
%token PASTE_
%token PROPERTY_
%token RADIUS_
%token ROTATE_
%token SAVE_
%token SAVETEMPLATE_
%token SELECT_
%token SELECTALL_
%token SELECTNONE_
%token SHAPE_
%token SHOW_
%token SHOWTEXT_
%token SKY_
%token SKYFORMAT_
%token SOURCE_
%token STRIP_
%token SYSTEM_
%token TAG_
%token TEMPLATE_
%token UNDO_
%token UPDATE_
%token WIDTH_
%token DS9_
%token XML_
%token CIAO_
%token SAOTNG_
%token PROS_
%token SAOIMAGE_
%token XY_
%token CIRCLE_
%token ELLIPSE_
%token BOX_
%token POLYGON_
%token POINT_
%token LINE_
%token VECTOR_
%token TEXT_
%token RULER_
%token COMPASS_
%token PROJECTION_
%token ANNULUS_
%token PANDA_
%token EPANDA_
%token BPANDA_
%token COMPOSITE_
%token DIAMOND_
%token CROSS_
%token ARROW_
%token BOXCIRCLE_
%token -FORMAT_
%token -SYSTEM_
%token -SKY_
%%
#include yesno.trl
#include font.trl
#include coords.trl
#include skyframe.trl
#include skyformat.trl
#include numeric.trl
command : region
| region {yyclearin; YYACCEPT} STRING_
;
region : props {RegionCmdLoad}
| LOAD_ loadall props STRING_ {RegionCmdLoadFn $4 $2}
# backward compatibility
| FILE_ loadall STRING_ {RegionCmdLoadFn $3 $2}
| SAVE_ STRING_ {RegionCmdSaveFn $2}
| LIST_ list
| EPSILON_ INT_ {PRegionCmdSet epsilon $2 MarkerEpsilon}
| SHOW_ yesno {RegionCmdSet show $2 MarkerShow}
| SHOWTEXT_ yesno {RegionCmdSet show,text $2 MarkerShowText}
| CENTROID_ centroid
# backward compatibility
| AUTOCENTROID_ yesno {RegionCmdSet centroid,auto $2 MarkerCentroidAuto}
| GETINFO_ {MarkerInfo}
| MOVE_ move
# backward compatibility
| MOVEFRONT_ {MarkerFront}
# backward compatibility
| MOVEBACK_ {MarkerBack}
| SELECT_ select
# backward compatibility
| SELECTALL_ {MarkerSelectAll}
# backward compatibility
| SELECTNONE_ {MarkerSelectNone}
| DELETE_ delete
# backward compatibility
| DELETEALL_ {MarkerDeleteAll}
| FORMAT_ format {RegionCmdSet format $2}
| SYSTEM_ coordsys {RegionCmdSet system $2}
| SYSTEM_ wcssys {RegionCmdSet system $2}
# backward compatibility
| SYSTEM_ skyframe {RegionCmdSet system wcs; RegionCmdSet sky $2}
| SKY_ skyframe {RegionCmdSet sky $2}
| SKYFORMAT_ skyformat {RegionCmdSet skyformate $2}
| STRIP_ yesno {RegionCmdSet strip $2}
| DELIM_ delim {RegionCmdSet strip $2}
| SHAPE_ shape {RegionCmdSet shape $2}
| COLOR_ STRING_ {RegionCmdSet color $2 MarkerColor}
| WIDTH_ INT_ {RegionCmdSet width $2 MarkerWidth}
| FIXED_ yesno {RegionCmdSet fixed $2 [list MarkerProp fixed]}
| EDIT_ yesno {RegionCmdSet edit $2 [list MarkerProp edit]}
| ROTATE_ yesno {RegionCmdSet rotate $2 [list MarkerProp rotate]}
| DELETE_ yesno {RegionCmdSet delete $2 [list MarkerProp delete]}
| INCLUDE_ {RegionCmdSet include 1 [list MarkerProp include]}
| EXCLUDE_ {RegionCmdSet include 0 [list MarkerProp include]}
| SOURCE_ {RegionCmdSet source 1 [list MarkerProp source]}
| BACKGROUND_ {RegionCmdSet source 0 [list MarkerProp source]}
| GROUPS_ group # waj
| GROUP_ group # waj
| COPY_ {MarkerCopy}
| CUT_ {MarkerCut}
| PASTE_ coordsys {RegionCmdSet paste,system $2 MarkerPaste}
| PASTE_ wcssys {RegionCmdSet paste,system $2 MarkerPaste}
# backward compatibility
| PASTE_ skyframe {RegionCmdSet paste,system wcs MarkerPaste}
| UNDO_ {MarkerUndo}
| COMPOSITE_ {CompositeCreate}
| DISSOLVE_ {CompositeDelete}
| TEMPLATE_ template # waj
| SAVETEMPLATE_ STRING_ # waj
| COMMAND_ STRING_ # waj
;
props : props prop
| prop
;
prop : -FORMAT_ format {RegionCmdSet load,format $2}
| -SYSTEM_ coordsys {RegionCmdSet load,system $2}
| -SYSTEM_ wcssys {RegionCmdSet load,system $2}
# backward compatibility
| -SYSTEM_ skyframe {RegionCmdSet load,system wcs; RegionCmdSet load,sky $2}
| -SKY_ skyframe {RegionCmdSet load,sky $2}
;
loadall : {set _ 0}
| ALL_ {set _ 1}
;
list : {RegionCmdList}
| CLOSE_ {SimpleTextDestroy markertxt}
;
centroid : {MarkerCentroid}
| AUTO_ yesno {RegionCmdSet centroid,auto $2 MarkerCentroidAuto}
| RADIUS_ numeric {RegionCmdSet centroid,radius $2 MarkerCentroidRadius}
| INTERATION_ INT_ {RegionCmdSet centroid,iteration $2 MarkerCentroidInteration}
;
move : FRONT_ {MarkerFront}
| BACK_ {MarkerBack}
;
select : ALL_ {MarkerSelectAll}
| NONE_ {MarkerSelectNone}
| INVERT_ {MarkerSelectInvert}
# backward compatibility
| GROUP_ STRING_ # waj
;
delete : ALL_ {MarkerDeleteAll}
| SELECT_ {MarkerDeleteSelect}
;
format : DS9_ {set _ ds9}
| XML_ {set _ xml}
| CIAO_ {set _ ciao}
| SAOTNG_ {set _ saotng}
| PROS_ {set _ pros}
| SAOIMAGE_ {set _ saoimage}
| XY_ {set _ xy}
;
shape : CIRCLE_
| ELLIPSE_
| BOX_
| POLYGON_
| point POINT_
| LINE_
| VECTOR_
| TEXT_
| RULER_
| COMPASS_
| PROJECTION_
| ANNULUS_
| ELLIPSE_ ANNULUS_
| BOX_ ANNULUS_
| PANDA_
| EPANDA_
| BPANDA_
| COMPOSITE_
;
point :
| CIRCLE_
| BOX_
| DIAMOND_
| CROSS_
| 'X'
| 'x'
| ARROW_
| BOXCIRCLE_
;
delim : NL_ {set _ 0}
| STRING_ {set _ 1}
| yesno {set _ $1}
;
template : STRING_
| STRING_ AT_ numeric numeric coordsys
| STRING_ AT_ numeric numeric wcssys
| STRING_ AT_ numeric numeric wcssys skyframe
;
group : NEW_
| STRING_ NEW_
| STRING_ UPDATE_
| STRING_ SELECT_
| STRING_ COLOR_ STRING_
| STRING_ COPY_
| STRING_ CUT_
| STRING_ DELETE_
| STRING_ FONT_
| STRING_ MOVE_ INT_ INT_
| STRING_ MOVEFRONT_
| STRING_ MOVEBACK_
| STRING_ PROPERTY_ property yesno
;
property : SELECT_ {set _ select}
| EDIT_ {set _ edit}
| MOVE_ {set _ move}
| ROTATE_ {set _ rotate}
| DELETE_ {set _ delete}
| FIXED_ {set _ fixed}
| INCLUDE_ {set _ include}
| SOURCE_ {set _ source}
;
%%
proc region::yyerror {msg} {
variable yycnt
variable yy_current_buffer
variable index_
ParserError $msg $yycnt $yy_current_buffer $index_
}
|