blob: 0c2637f16270188daa07186d4d43696832a7c45f (
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
|
%{
source $ds9(root)/library/zoomparser.tab.tcl
%}
%option noyywrap
%option caseless
%option nodefault
%option nointeractive
#%option stack
%option yylineno
#%option debug
D [0-9]
E [Ee][+-]?{D}+
%%
-pan {return $zoom::CMD_}
-rotate {return $zoom::CMD_}
-zscale {return $zoom::CMD_}
-zoom {return $zoom::CMD_}
close {return $zoom::CLOSE_}
in {return $zoom::IN_}
fit {return $zoom::FIT_}
open {return $zoom::OPEN_}
out {return $zoom::OUT_}
to {return $zoom::TO_}
# INT
[+-]?{D}+ {set zoom::yylval $yytext; return $zoom::INT_}
# REAL
[+-]?{D}+"."?({E})? |
[+-]?{D}*"."{D}+({E})? {set zoom::yylval $yytext; return $zoom::REAL_}
# Quoted STRING
\"[^\"]*\" {set zoom::yylval [string range $yytext 1 end-1]; return $zoom::STRING_}
# Quoted STRING
\'[^\']*\' {set zoom::yylval [string range $yytext 1 end-1]; return $zoom::STRING_}
# Quoted STRING
\{[^\}]*\} {set zoom::yylval [string range $yytext 1 end-1]; return $zoom::STRING_}
# STRING
\S+\S+ {set zoom::yylval $yytext; return $zoom::STRING_}
\s # ignore whitespace
. {set zoom::yylval $yytext; return $zoom::yylval}
%%
|