1 %{
2 /*
3  * This is a plug-in for GIMP.
4  *
5  * Generates clickable image maps.
6  *
7  * Copyright (C) 1998-1999 Maurits Rijk  lpeek.mrijk@consunet.nl
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
21  *
22  */
23 
24 #include <string.h>
25 
26 #include <glib.h>
27 
28 #include "imap_ncsa_parse.h"
29 
30 #ifdef FLEX_SCANNER
31 #define YY_NO_UNPUT
32 #endif /* FLEX_SCANNER */
33 
34 %}
35 
36 %option noyywrap
37 %option noinput
38 %option nounput
39 
40 DIGIT	[0-9]
41 ID	[a-zA-Z_][a-zA-Z0-9_\-]*
42 WS	[ \t\n]+
43 
44 %x imap_link
45 %x comment
46 
47 %%
48 
49 #\$AUTHOR:	       		{
50 				   BEGIN(comment);
51 				   return AUTHOR;
52 				}
53 
54 #\$TITLE:	       		{
55 				   BEGIN(comment);
56 				   return TITLE;
57 				}
58 
59 #\$DESCRIPTION:	       		{
60 				   BEGIN(comment);
61 				   return DESCRIPTION;
62 				}
63 
64 #				{
65 				   BEGIN(comment);
66 				   return BEGIN_COMMENT;
67 				}
68 
69 <comment>.*	 		{
70 				   BEGIN(INITIAL);
71    				   ncsa_lval.id = g_strndup (yytext, yyleng);
72    				   return COMMENT;
73 				}
74 
75 RECT				{
76 				   BEGIN(imap_link);
77    				   return RECTANGLE;
78 				}
79 
80 CIRCLE				{
81 				   BEGIN(imap_link);
82 				   return CIRCLE;
83 				}
84 
85 POLY				{
86 				   BEGIN(imap_link);
87 				   return POLYGON;
88 				}
89 
90 DEFAULT				{
91 				   BEGIN(imap_link);
92 				   return DEFAULT;
93 				}
94 
95 <imap_link>[^ ,\t\n]+		{
96    				   BEGIN(INITIAL);
97    				   ncsa_lval.id = g_strndup (yytext, yyleng);
98 				   return LINK;
99 				}
100 
101 -?{DIGIT}*"."?{DIGIT}*([Ee][-+]?{DIGIT}*)? {
102                                    ncsa_lval.value = g_ascii_strtod (yytext, NULL);
103 				   return FLOAT;
104 				}
105 
106 {WS}				; /* Eat white space */
107 
108 .				return *yytext;
109 
110 %%
111 
112 
113