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

#include wcssys.tin
#include skyframe.tin
#include yesno.tin
#include numeric.tin
#include string.tin

%start command

%token AXIS_
%token AXES_
%token CLOSE_
%token FIRST_
%token INTERVAL_
%token IMAGE_
%token LAST_
%token LOCK_
%token MATCH_
%token NEXT_
%token NONE_
%token OPEN_
%token ORDER_
%token PLAY_
%token PREV_
%token STOP_

%token 123_
%token 132_
%token 213_
%token 231_
%token 312_
%token 321_

%%

#include wcssys.trl
#include skyframe.trl
#include yesno.trl
#include numeric.trl

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

cube : OPEN_
 | CLOSE_ {CubeDestroyDialog}
 | MATCH_ matchslice {MatchCubeCurrent $2}
 | LOCK_ lockslice {ProcessCmdSet cube lock $2 LockCubeCurrent}
 | PLAY_ {CubePlay}
 | STOP_ {CubeStop}
 | NEXT_ {CubeNext}
 | PREV_ {CubePrev}
 | FIRST_ {CubeFirst}
 | LAST_ {CubeLast}
 | INTERVAL_ numeric {ProcessCmdSet cube interval [expr int($2*1000)]}
 | AXES_ order
 | ORDER_ order
 | INT_ {CubeCmd $1}
 | INT_ IMAGE_ {CubeCmd $1}
 | numeric wcssys {CubeCmdCoord $1 $2 fk5}
 | numeric wcssys skyframe {CubeCmdCoord $1 $2 $3}
# backward compatible
 | AXIS_ INT_ {}
 ;

order : LOCK_ yesno {ProcessCmdSet cube lock,axes $2 LockAxesCurrent}
 | orderAxes {ProcessCmdSet cube axes $1}
 ;

orderAxes : 123_ {set _ 123}
 | 132_ {set _ 132}
 | 213_ {set _ 213}
 | 231_ {set _ 231}
 | 312_ {set _ 312}
 | 321_ {set _ 321}
 ;

lockslice : {set _ image}
 | IMAGE_ {set _ image}
 | wcssys {set _ $1}
 | NONE_ {set _ none}
 ;

matchslice : IMAGE_ {set _ image}
 | wcssys {set _ $1}
 ;

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}