summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/maskparser.tac
blob: 3c777a7f2e8e8abd04cf1ba4efac9d045d8e1754 (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 coordsys.tin
#include wcssys.tin
#include numeric.tin
#include string.tin

%start command

%token CLEAR_
%token CLOSE_
%token COLOR_
%token MARK_
%token NAN_
%token NONNAN_
%token NONZERO_
%token OPEN_
%token RANGE_
%token SYSTEM_
%token TRANSPARENCY_
%token ZERO_

%%

#include coordsys.trl
#include wcssys.trl
#include numeric.trl

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

mask : {global parse; set parse(result) mask}
 | OPEN_
 | CLOSE_ {MaskDestroyDialog}
 | CLEAR_ {MaskClear}
 | COLOR_ STRING_ {ProcessCmdSet mask color $2 MaskColor}
 | MARK_ mark {ProcessCmdSet mask mark $2 MaskMark}
 | RANGE_ numeric numeric {ProcessCmdSet2 mask low $2 high $3 MaskRange}
 | SYSTEM_ system
 | TRANSPARENCY_ numeric {ProcessCmdSet mask transparency $2 MaskTransparency}
# backward compatibility
 | MARK_ INT_ {ProcessCmdSet mask mark $2 MaskMark}
 ;

mark : ZERO_ {set _ zero}
 | NONZERO_ {set _ nonzero}
 | NAN_ {set _ nan}
 | NONNAN_ {set _ nonnan}
 | RANGE_ {set _ range}
 ;

system : coordsys {ProcessCmdSet mask system $1 MaskSystem}
 | wcssys {ProcessCmdSet mask system $1 MaskSystem}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}