blob: f89f17bf4c63edb9829414edf2020921c18bf24e (
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
|
// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"
%pure-parser
%parse-param {SAOColorMap* cm}
%lex-param {liFlexLexer* ll}
%parse-param {liFlexLexer* ll}
%{
#define YYDEBUG 1
#define DISCARD_(x) {yyclearin; liDiscard(x);}
#include <string.h>
#include <iostream>
#include "sao.h"
#undef yyFlexLexer
#define yyFlexLexer liFlexLexer
#include <FlexLexer.h>
extern int lilex(void*, liFlexLexer*);
extern void lierror(SAOColorMap*, liFlexLexer*, const char*);
extern void liDiscard(int);
%}
%union {
#define SAOBUFSIZE 4096
char str[SAOBUFSIZE];
int integer;
float real;
}
%type <real> numeric
%token <real> REAL
%token <integer> INT
%token <str> STRING
%token EOF_
%token BLUE_
%token DEBUG_
%token GAMMA_
%token GREEN_
%token FALSE_
%token NO_
%token OFF_
%token ON_
%token PSEUDOCOLOR_
%token RED_
%token TRUE_
%token YES_
%%
commands: commands command terminator
| command terminator
;
command : DEBUG_ debug
| color
| PSEUDOCOLOR_
| '#' {DISCARD_(1)} STRING
| lis
;
color : RED_ ':' gamma {cm->setChannel(SAOColorMap::RED);}
| GREEN_ ':' gamma {cm->setChannel(SAOColorMap::GREEN);}
| BLUE_ ':' gamma {cm->setChannel(SAOColorMap::BLUE);}
;
gamma : /* empty */
| GAMMA_ numeric
;
lis : lis li
| li
;
li : '(' numeric ',' numeric ')' {cm->newLIColor($2,$4);}
;
terminator: '\n'
| ';'
| EOF_ {YYACCEPT;}
;
numeric : REAL {$$=$1;}
| INT {$$=$1;}
;
debug : ON_ {yydebug=1;}
| OFF_ {yydebug=0;}
;
%%
|