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

#include yesno.tin
#include numeric.tin
#include string.tin

%start command

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

%%

#include yesno.trl
#include numeric.trl

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

block : OPEN_ {BlockDialog}
 | CLOSE_ {BlockDestroyDialog}
 | MATCH_ {MatchBlockCurrent}
 | LOCK_ yesno {ProcessCmdSet block lock $2 LockBlockCurrent}
 | IN_ {Block .5 .5}
 | OUT_ {Block 2 2}
 | TO_ blockTo
 | numeric {Block $1 $1}
 | numeric numeric {Block $1 $2}
 ;

blockTo : numeric {ProcessCmdSet block factor "$1 $1" ChangeBlock}
 | numeric numeric {ProcessCmdSet block factor "$1 $2" ChangeBlock}
 | FIT_ {BlockToFit}
 ; 

%%

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

     ParserError $msg $yycnt $yy_current_buffer $index_
}