summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/exportparser.tac
blob: 5232eab55f406f37e29ef9f430ef2d49a1bb116a (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
%{
%}

#include numeric.tin
#include string.tin

%start command

%token ARRAY_
%token RGBARRAY_
%token NRRD_
%token ENVI_

%token GIF_
%token TIFF_
%token JPEG_
%token PNG_

%token BIG_
%token LITTLE_
%token NATIVE_

%token NONE_
%token PACKBITS_
%token DEFLATE_

%%

#include numeric.trl

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

export : STRING_ {ExportCmdSave [ExtToFormat $1] $1}
 | STRING_ opts {ExportCmdSave [ExtToFormat $1] $1}
 | STRING_ endian {ExportCmdSave [ExtToFormat $1] $1}

 | ext STRING_ {ExportCmdSave $1 $2}
 | ext STRING_ opts {ExportCmdSave $1 $2}

 | ext2 STRING_ {ExportCmdSave $1 $2}
 | ext2 STRING_ endian {ExportCmdSave $1 $2}
 | ENVI_ STRING_ STRING_ {ExportCmdSave envi $2 $3}
 | ENVI_ STRING_ STRING_ endian {ExportCmdSave envi $2 $3}
 ;

ext : GIF_ {set _ gif}
 | TIFF_ {set _ tiff}
 | JPEG_ {set _ jpeg}
 | PNG_ {set _ png}
 ;

ext2 : ARRAY_ {set _ array}
 | RGBARRAY_ {set _ rgbarray}
 | NRRD_ {set _ nrrd}
 | ENVI_ {set _ envi}
 ;

opts : NONE_ {ExportCmdSet tiff,compress none}
 | JPEG_ {ExportCmdSet tiff,compress jpeg}
 | PACKBITS_ {ExportCmdSet tiff,compress packbits}
 | DEFLATE_ {ExportCmdSet tiff,compress deflate}
 | numeric {ExportCmdSet jpeg,quality $1}
 ;
 
endian : BIG_ {ExportCmdSet endian big}
 | LITTLE_ {ExportCmdSet endian little}
 | NATIVE_ {ExportCmdSet endian native}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}