1 %{
2 /* This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, see: <http://www.gnu.org/licenses/>
14  */
15 # include "config.h"
16 # include "script.h"
17 # include "types.h"
18 # include "libs/Parse.h"
19 
20 /* Suppress definition of yyunput() and yyinput(), as we do not use it. */
21 #define YY_NO_UNPUT
22 #define YY_NO_INPUT
23 
24 int numligne=1;
25 %}
26 
27 
28 bl		[ \t]*
29 nl		\n
30 commentaire	#.*
31 nb		[-+]?[0-9]*
32 str		[^ = \t \n \( \) \< \> \} \{]+
33 gstr		\{[^\{\}\n]*[\}\n]
34 inf		<
35 infeq		<=
36 equal		==
37 supeq		>=
38 sup		>
39 diff		<>
40 get		=
41 
42 %%
43 {bl}		;
44 {commentaire}	;
45 
46 ^{bl}+UseGettext	       { return USEGETTEXT; }
47 ^{bl}+WindowTitle	       { return WINDOWTITLE; }
48 ^{bl}+ChangeWindowTitle	       { return CHWINDOWTITLE; }
49 ^{bl}+ChangeWindowTitleFromArg { return CHWINDOWTITLEFARG; }
50 ^{bl}+WindowLocaleTitle	       { return WINDOWLOCALETITLE; }
51 ^{bl}+WindowSize	       { return WINDOWSIZE; }
52 ^{bl}+WindowPosition	       { return WINDOWPOSITION; }
53 ^{bl}+ForeColor		       { return FORECOLOR; }
54 ^{bl}+BackColor		       { return BACKCOLOR; }
55 ^{bl}+ShadowColor	       { return SHADCOLOR; }
56 ^{bl}+HilightColor	       { return LICOLOR; }
57 ^{bl}+Colorset		       { return COLORSET; }
58 ^{bl}+Widget		       { return OBJECT; }
59 ^{bl}+Property		       { return PROP; }
60 ^{bl}+Main		       { return MAIN; }
61 ^{bl}+End		       { return END; }
62 ^{bl}+Font.* {
63   char *tmp,*rest;
64 
65   rest = GetNextToken(yytext, &tmp); /* skip Font */
66   GetNextToken(rest, &yylval.str); /* get the font */
67   if (tmp != NULL)
68     free(tmp);
69   return FONT;
70 }
71 
72 ^{bl}+Type		{ return TYPE; }
73 ^{bl}+Size		{ return SIZE; }
74 ^{bl}+Position		{ return POSITION; }
75 ^{bl}+Value		{ return VALUE; }
76 ^{bl}+MinValue		{ return VALUEMIN; }
77 ^{bl}+MaxValue		{ return VALUEMAX; }
78 ^{bl}+Title		{ return TITLE; }
79 ^{bl}+LocaleTitle	{ return LOCALETITLE; }
80 ^{bl}+SwallowExec	{ return SWALLOWEXEC; }
81 ^{bl}+Icon		{ return ICON; }
82 ^{bl}+Flags		{ return FLAGS; }
83 Hidden			{ return HIDDEN; }
84 NoFocus			{ return NOFOCUS; }
85 NoReliefString		{ return NORELIEFSTRING; }
86 Center			{ return CENTER; }
87 Left			{ return LEFT; }
88 Right			{ return RIGHT; }
89 
90 ^{bl}+Do		{ return EXEC; }
91 ^{bl}+HideWidget	{ return HIDE; }
92 ^{bl}+ShowWidget	{ return SHOW; }
93 ^{bl}+ChangeValue	{ return CHVALUE; }
94 ^{bl}+ChangeMaxValue	{ return CHVALUEMAX; }
95 ^{bl}+ChangeMinValue	{ return CHVALUEMIN; }
96 GetTitle		{ return GETTITLE; }
97 GetValue		{ return GETVALUE; }
98 GetMinValue		{ return GETMINVALUE; }
99 GetMaxValue		{ return GETMAXVALUE; }
100 GetFore			{ return GETFORE; }
101 GetBack			{ return GETBACK; }
102 GetHilight		{ return GETHILIGHT; }
103 GetShadow		{ return GETSHADOW; }
104 GetOutput		{ return GETOUTPUT; }
105 NumToHex		{ return NUMTOHEX; }
106 HexToNum		{ return HEXTONUM; }
107 Add			{ return ADD;}
108 Mult			{ return MULT;}
109 Div			{ return DIV;}
110 StrCopy			{ return STRCOPY; }
111 LaunchScript		{ return LAUNCHSCRIPT; }
112 GetScriptFather		{ return GETSCRIPTFATHER; }
113 ReceivFromScript	{ return RECEIVFROMSCRIPT; }
114 RemainderOfDiv		{ return REMAINDEROFDIV; }
115 GetTime			{ return GETTIME; }
116 GetScriptArgument	{ return GETSCRIPTARG; }
117 GetPid			{ return GETPID; }
118 SendMsgAndGet		{ return SENDMSGANDGET; }
119 Parse			{ return PARSE; }
120 LastString		{ return LASTSTRING; }
121 Gettext                 { return GETTEXT; }
122 ^{bl}+ChangePosition	{ return POSITION; }
123 ^{bl}+ChangeSize	{ return SIZE; }
124 ^{bl}+ChangeTitle	{ return TITLE; }
125 ^{bl}+ChangeLocaleTitle	{ return LOCALETITLE; }
126 ^{bl}+ChangeIcon	{ return ICON; }
127 ^{bl}+ChangeFont	{ return CHFONT; }
128 ^{bl}+ChangeForeColor	{ return CHFORECOLOR; }
129 ^{bl}+ChangeBackColor	{ return CHBACKCOLOR; }
130 ^{bl}+ChangeColorset	{ return CHCOLORSET; }
131 ^{bl}+Set		{ return SET; }
132 ^{bl}+SendSignal	{ return SENDSIGN; }
133 ^{bl}+Quit		{ return QUIT; }
134 ^{bl}+Init		{ return INIT; }
135 ^{bl}+PeriodicTasks	{ return PERIODICTASK; }
136 ^{bl}+QuitFunc		{ return QUITFUNC; }
137 ^{bl}+For		{ return FOR; }
138 ^{bl}+WarpPointer	{ return WARP; }
139 ^{bl}+WriteToFile	{ return WRITETOFILE; }
140 ^{bl}+SendToScript	{ return SENDTOSCRIPT; }
141 ^{bl}+SingleClic	{ return SINGLECLIC; }
142 ^{bl}+DoubleClic	{ return DOUBLECLIC; }
143 ^{bl}+Key		{ return KEY; }
144 To			{ return TO; }
145 Do			{ return DO; }
146 ^{bl}+If		{ return IF; }
147 Then			{ return THEN; }
148 Else			{ return ELSE; }
149 
150 {inf}			{ return INF; }
151 {infeq}			{ return INFEQ; }
152 {supeq}			{ return SUPEQ; }
153 {sup}			{ return SUP; }
154 {diff}			{ return DIFF; }
155 {equal}			{ return EQUAL; }
156 {get}			{ return GET; }
157 
158 ^{bl}+While		{ return WHILE; }
159 ^{bl}+Case+[ \t]+message+[ \t]of { return CASE; }
160 ^{bl}+Begin		{ return BEG; }
161 :			{ return POINT; }
162 [\(]			{ return BEGF; }
163 [\)]			{ return ENDF; }
164 
165 
166 {nb}		{ yylval.number=atoi(yytext);
167                   return NUMBER;
168                 }
169 
170 [\$]+{str}	{
171 		  yylval.str=(char*) safestrdup(yytext+1);
172 		  yylval.str[yyleng-1]='\0';
173                   return VAR;
174 		}
175 
176 {gstr}		{ /* Str entre "" */
177 		  yylval.str=(char*) safestrdup(yytext+1);
178 		  yylval.str[yyleng-2]='\0';
179                   return GSTR;
180 		}
181 
182 {str}		{ yylval.str=(char*) safestrdup(yytext);
183 		  yylval.str[yyleng]='\0';
184                   return STR;
185 		}
186 
187 {nl}		{ numligne++; }
188