summaryrefslogtreecommitdiffstats
path: root/tksao/panner/lex.L
blob: f11f8ee6da414767b15003db7f209be4eb2b5f44 (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
/* Copyright (C) 1999-2018
 * Smithsonian Astrophysical Observatory, Cambridge, MA, USA
 * For conditions of distribution and use, see copyright notice in "copyright"
 */

%option noyywrap
%option caseless
%option never-interactive
%option c++

%{
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>

  #include "parser.H"

  extern YYSTYPE* pnlval;
%}

D   [0-9]
E   [Ee][+-]?{D}+

/* rules */

%%

bbox		{return BBOX_;}
begin		{return BEGIN_;}
clear		{return CLEAR_;}
compass		{return COMPASS_;}
debug		{return DEBUG_;}
end		{return END_;}
false		{return FALSE_;}
get		{return GET_;}
height		{return HEIGHT_;}
hide		{return HIDE_;}
highlite	{return HIGHLITE_;}
image		{return IMAGE_;}
invalid		{return INVALID_;}
motion		{return MOTION_;}
n		{return N_;}
no		{return NO_;}
off		{return OFF_;}
on		{return ON_;}
pan		{return PAN_;}
reset		{return RESET_;}
show		{return SHOW_;}
size		{return SIZE_;}
true		{return TRUE_;}
to		{return TO_;}
update		{return UPDATE_;}
version		{return VERSION_;}
warp		{return WARP_;}
wcs		{return WCS_;}
width		{return WIDTH_;}
y		{return Y_;}
yes		{return YES_;}


[+-]?{D}+	{ // Integer
		  pnlval->integer = atoi(yytext);
		  return INT;
		}

[+-]?{D}+"."?({E})? |
[+-]?{D}*"."{D}+({E})? { // Real Number
		  pnlval->real = atof(yytext);
		  return REAL;
		}

0[xX][0-9a-fA-F]+ { // Pointer
		  pnlval->ptr = (void*)strtoul(yytext,NULL,16);
		  return POINTER;
		}

[ \t]+		{ // White Spaces
		} 

.		{ // Else, return the char
		  return yytext[0];
		}

%%