summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/siaparser.tac
blob: 7dca210a3ec6c296098359660b34e3914aad9aab (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
%{
%}
#include def.tin

#include wcssys.tin
#include skyframe.tin
#include wcsformat.tin
#include numeric.tin
#include sexstr.tin
#include string.tin

%start command

%token CANCEL_
%token CLEAR_
%token CLOSE_
%token COORDINATE_
%token CROSSHAIR_
%token EXPORT_
%token NAME_
%token PRINT_
%token RADIUS_
%token RETRIEVE_
%token SAVE_
%token SIZE_
%token SKY_
%token SKYFORMAT_
%token SYSTEM_
%token UPDATE_

%token 2MASS_
%token AKARI_
%token ASTROWISE_
%token CADC_
%token CXC_
%token MAST_
%token SDSS_
%token SKYVIEW_
%token TGSSADR_

%token XML_
%token VOT_
%token SB_
%token STARBASE_
%token CSV_
%token TSV_

%%

#include wcssys.trl
#include skyframe.trl
#include wcsformat.trl
#include numeric.trl

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

sia : {if {![SIACmdCheck]} {sia::YYABORT}} siaCmd
 | site {SIACmdRef $1}
 | site {SIACmdRef $1} siaCmd
 ;

siaCmd : CANCEL_ {ProcessCmdCVAR0 ARCancel}
 | CLOSE_ {ProcessCmdCVAR0 SIADestroy}
 | CLEAR_ {ProcessCmdCVAR0 SIAOff}
 | COORDINATE_ coordinate
 | CROSSHAIR_ {ProcessCmdCVAR0 IMGSVRCrosshair}
 | EXPORT_ writer STRING_ {SIACmdSave $3 $2}
 | SAVE_ STRING_ {SIACmdSave $2 VOTWrite}
 | NAME_ STRING_ {ProcessCmdCVAR name $2}
 | PRINT_ {ProcessCmdCVAR0 CATPrint}
 | RETRIEVE_ {global cvarname; SIAApply $cvarname 1}
 | RADIUS_ numeric rformat {SIACmdSize $2 $3}
# backward compatibily
 | SIZE_ numeric numeric rformat {SIACmdSize [expr ($2+$3)/2.] $4}
 | SKY_ skyframe {SIACmdSkyframe $2}
 | SKYFORMAT_ skyformat {ProcessCmdCVAR skyformat $2}
 | SYSTEM_ wcssys {SIACmdSystem $2}
 | UPDATE_ {ProcessCVAR0 IMGSVRUpdate}
 ;

coordinate : numeric numeric {SIACmdCoord $1 $2 fk5}
 | numeric numeric skyframe {SIACmdCoord $1 $2 $3}
 | SEXSTR_ SEXSTR_ {SIACmdCoord $1 $2 fk5}
 | SEXSTR_ SEXSTR_ skyframe {SIACmdCoord $1 $2 $3}
 ;

site : 2MASS_ {set _ 2mass}
 | AKARI_ {set _ akari}
 | ASTROWISE_ {set _ astrowise}
 | CADC_ {set _ cadc}
 | CXC_ {set _ cxc}
 | MAST_ {set _ mast}
 | SDSS_ {set _ sdss}
 | SKYVIEW_ {set _ skyview}
 | TGSSADR_ {set _ tgssadr}
 ;

writer : XML_ {set _ VOTWrite}
 | VOT_ {set _ VOTWrite}
 | SB_ {set _ starbase_write}
 | STARBASE_ {set _ starbase_write}
 | CSV_ {set _ TSVWrite}
 | TSV_ {set _ TSVWrite}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}