summaryrefslogtreecommitdiffstats
path: root/tksao/magnifier/parser.Y
blob: 6b81e565c9b6912f691030d4e651f123229d8e47 (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
// Copyright (C) 1999-2017
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

%pure-parser
%parse-param {Magnifier* mg}
%lex-param {mgFlexLexer* ll}
%parse-param {mgFlexLexer* ll}

%{
#define YYDEBUG 1

#include <stdlib.h>
#include "magnifier.h"

#undef yyFlexLexer
#define yyFlexLexer mgFlexLexer
#include <FlexLexer.h>

extern int mglex(void*, mgFlexLexer*);
extern void mgerror(Magnifier*, mgFlexLexer*, const char*);
%}

%union {
  float real;
  int integer;
  void* ptr;
  char str[1024];
}

%token <integer> INT
%token <ptr> POINTER

%token BBOX_
%token CLEAR_
%token DEBUG_
%token FALSE_
%token GET_
%token HEIGHT_
%token HIDE_
%token OFF_
%token ON_
%token N_
%token NO_
%token RESET_
%token SHOW_
%token TRUE_
%token UPDATE_
%token VERSION_
%token WIDTH_
%token Y_
%token YES_

%%

command : DEBUG_ debug
	| CLEAR_ {mg->updateCmd(0);}
	| GET_ get
	| HIDE_ {mg->hideCmd();}
	| RESET_ {mg->resetCmd();}
	| SHOW_ {mg->showCmd();}
	| UPDATE_ POINTER {mg->updateCmd($2);}
	| VERSION_ {mg->msg("Magnifier 1.0");}
	;

debug	: ON_ {yydebug=1;}
	| OFF_ {yydebug=0;}
	;

get	: BBOX_ {mg->getBBoxCmd();}
	| HEIGHT_ {mg->getHeightCmd();}
	| WIDTH_ {mg->getWidthCmd();}
	;

%%