summaryrefslogtreecommitdiffstats
path: root/ds9/parsers/zoomparser.tac
blob: 7328e34cbf6619841576b7c7faf58f564b6c6321 (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
%{
%}

%token INT_
%token REAL_
%token STRING_

%start command

%token CLOSE_
%token IN_
%token FIT_
%token OPEN_
%token OUT_
%token TO_

%%

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

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

zoom : numeric {Zoom $1 $1}
 | numeric numeric {Zoom $1 $2}
 | OPEN_ {PanZoomDialog}
 | CLOSE_ {PanZoomDestroyDialog}
 | IN_ {Zoom 2 2}
 | OUT_ {Zoom .5 .5}
 | TO_ zoomTo
 ;

zoomTo: FIT_ {ZoomToFit}
 | numeric {global zoom; set current(zoom) "$1 $1"; ChangeZoom}
 | numeric numeric {global zoom; set current(zoom) "$1 $2"; ChangeZoom}
 ;

%%

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