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

#include int.tin
#include string.tin

%start command

%token FITS_
%token RGBIMAGE_
%token RGBCUBE_
%token MECUBE_
%token MOSAIC_
%token MOSAICWCS_
%token MOSAICIMAGE_
%token MOSAICIMAGEWCS_
%token WCS_

%token IMAGE_
%token TABLE_
%token SLICE_

%%

command : save 
 | save {global ds9; if {!$ds9(init)} {YYERROR} else {yyclearin; YYACCEPT}} STRING_
 ;

save : STRING_ opts {SaveCmdLoad [ExtToFormat $1] $1}
 | format STRING_ opts {SaveCmdLoad $1 $2}
 ;

format : FITS_ {set _ fits}
 | RGBIMAGE_ {set _ rgbimage}
 | RGBCUBE_ {set _ rgbcube}
 | MECUBE_ {set _ mecube}
 | mosaic {set _ $1}
 | mosaicimage {set _ $1}
 ;
 
mosaic : MOSAIC_ {set _ mosaic}
 | MOSAIC_ WCS_ {set _ mosaic}
 | MOSAICWCS_ {set _ mosaic}
 ;
 
mosaicimage : MOSAICIMAGE_ {set _ mosaicimage}
 | MOSAICIMAGE_ WCS_ {set _ mosaicimage}
 | MOSAICIMAGEWCS_ {set _ mosaicimage}
 ;

opts : {ProcessCmdSet savefits type image; ProcessCmdSet savefits mosaic 1}
 | IMAGE_ {ProcessCmdSet savefits type image}
 | TABLE_ {ProcessCmdSet savefits type table}
 | SLICE_ {ProcessCmdSet savefits type slice}
 | INT_ {ProcessCmdSet savefits mosaic $1}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}