summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/panparser.tac
blob: 90ce91f1d6e3fa3a8f4b704ab2aa4a8a8139ad88 (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
%{
namespace eval pan {
  variable xx {}
  variable yy {}
}
%}

%token INT_
%token REAL_
%token STRING_
%token SEXSTR_

%start command

%token CLOSE_
%token OPEN_
%token TO_

%token IMAGE_
%token PHYSICAL_
%token AMPLIFIER_
%token DETECTOR_

%token WCS_
%token WCSA_
%token WCSB_
%token WCSC_
%token WCSD_
%token WCSE_
%token WCSF_
%token WCSG_
%token WCSH_
%token WCSI_
%token WCSJ_
%token WCSK_
%token WCSL_
%token WCSM_
%token WCSN_
%token WCSO_
%token WCSP_
%token WCSQ_
%token WCSR_
%token WCSS_
%token WCST_
%token WCSU_
%token WCSV_
%token WCSW_
%token WCSX_
%token WCSY_
%token WCSZ_

%token FK4_
%token FK5_
%token ICRS_
%token GALACTIC_
%token ECLIPTIC_
%token J2000_
%token B1950_

%%

command : pan
 | pan STRING_ {pan::yyclearin}
 ;

numeric	: INT_ {set _ $1}
 | REAL_ {set _ $1}
 ;

coordsys : IMAGE_ {set _ image}
 | PHYSICAL_ {set _ physical}
 | AMPLIFIER_ {set _ amplifier}
 | DETECTOR_ {set _ detector}
 ;

wcssys : WCS_ {set _ wcs}
 | WCSA_ {set _ wcsa}
 | WCSB_ {set _ wcsb}
 | WCSC_ {set _ wcsc}
 | WCSD_ {set _ wcsd}
 | WCSE_ {set _ wcse}
 | WCSF_ {set _ wcsf}
 | WCSG_ {set _ wcsg}
 | WCSH_ {set _ wcsh}
 | WCSI_ {set _ wcsi}
 | WCSJ_ {set _ wcsj}
 | WCSK_ {set _ wcsk}
 | WCSL_ {set _ wcsl}
 | WCSM_ {set _ wcsm}
 | WCSN_ {set _ wcsn}
 | WCSO_ {set _ wcso}
 | WCSP_ {set _ wcsp}
 | WCSQ_ {set _ wcsq}
 | WCSR_ {set _ wcsr}
 | WCSS_ {set _ wcss}
 | WCST_ {set _ wcst}
 | WCSU_ {set _ wcsu}
 | WCSV_ {set _ wcsv}
 | WCSW_ {set _ wcsw}
 | WCSX_ {set _ wcsx}
 | WCSY_ {set _ wcsy}
 | WCSZ_ {set _ wcsz}
 ;

skyframe : FK4_ {set _ fk4}
 | B1950_ {set _ fk4}
 | FK5_ {set _ fk5}
 | J2000_ {set _ fk5}
 | ICRS_ {set _ icrs}
 | GALACTIC_ {set _ galactic}
 | ECLIPTIC_ {set _ ecliptic}
 ;

coord : numeric numeric {set pan::xx $1; set pan::yy $2}
 ;

skycoord : numeric numeric {set pan::xx $1; set pan::yy $2}
 | SEXSTR_ SEXSTR_ {set pan::xx $1; set pan::yy $2}
 ;

pan : OPEN_ {PanZoomDialog}
 | CLOSE_ {PanZoomDestroyDialog}
 | TO_ panTo
 | coord {Pan $pan::xx $pan::yy physical}
 | coord coordsys {Pan $pan::xx $pan::yy $2}
 | skycoord wcssys {Pan $pan::xx $pan::yy $2 fk5}
 | skycoord wcssys skyframe {Pan $pan::xx $pan::yy $2 $3}
 | skycoord skyframe {Pan $pan::xx $pan::yy wcs $2}
 ;

panTo : coord {PanTo $pan::xx $pan::yy physical}
 | coord coordsys {PanTo $pan::xx $pan::yy $2}
 | skycoord wcssys {PanTo $pan::xx $pan::yy $2 fk5}
 | skycoord wcssys skyframe {PanTo $pan::xx $pan::yy $2 $3}
 | skycoord skyframe {PanTo $pan::xx $pan::yy wcs $2}
 ;

%%

proc pan::yyerror {msg} {
     puts stderr "$msg:"
     puts stderr "$pan::yy_current_buffer"
     puts stderr [format "pan %*s" $pan::index_ ^]
}