File: scanner.l

package info (click to toggle)
fvwm 1%3A2.7.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,968 kB
  • sloc: ansic: 145,836; xml: 17,096; perl: 7,237; sh: 5,100; makefile: 1,101; yacc: 688; lex: 187; sed: 11
file content (187 lines) | stat: -rw-r--r-- 5,472 bytes parent folder | download | duplicates (6)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
%{
/* This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see: <http://www.gnu.org/licenses/>
 */
# include "config.h"
# include "script.h"
# include "types.h"
# include "libs/Parse.h"

/* Suppress definition of yyunput() and yyinput(), as we do not use it. */
#define YY_NO_UNPUT
#define YY_NO_INPUT

int numligne=1;
%}


bl		[ \t]*			
nl		\n
commentaire	#.*
nb		[-+]?[0-9]*
str		[^ = \t \n \( \) \< \> \} \{]+
gstr		\{[^\{\}\n]*[\}\n]
inf		<
infeq		<=
equal		==
supeq		>=
sup		>
diff		<>
get		=

%%
{bl}		;
{commentaire}	;

^{bl}+UseGettext	       { return USEGETTEXT; }
^{bl}+WindowTitle	       { return WINDOWTITLE; }
^{bl}+ChangeWindowTitle	       { return CHWINDOWTITLE; }
^{bl}+ChangeWindowTitleFromArg { return CHWINDOWTITLEFARG; }
^{bl}+WindowLocaleTitle	       { return WINDOWLOCALETITLE; }
^{bl}+WindowSize	       { return WINDOWSIZE; }
^{bl}+WindowPosition	       { return WINDOWPOSITION; }
^{bl}+ForeColor		       { return FORECOLOR; }
^{bl}+BackColor		       { return BACKCOLOR; }
^{bl}+ShadowColor	       { return SHADCOLOR; }
^{bl}+HilightColor	       { return LICOLOR; }
^{bl}+Colorset		       { return COLORSET; }
^{bl}+Widget		       { return OBJECT; }
^{bl}+Property		       { return PROP; }
^{bl}+Main		       { return MAIN; }
^{bl}+End		       { return END; }
^{bl}+Font.* {
  char *tmp,*rest;

  rest = GetNextToken(yytext, &tmp); /* skip Font */
  GetNextToken(rest, &yylval.str); /* get the font */
  if (tmp != NULL)
    free(tmp);
  return FONT;
}

^{bl}+Type		{ return TYPE; }
^{bl}+Size		{ return SIZE; }
^{bl}+Position		{ return POSITION; }
^{bl}+Value		{ return VALUE; }
^{bl}+MinValue		{ return VALUEMIN; }
^{bl}+MaxValue		{ return VALUEMAX; }
^{bl}+Title		{ return TITLE; }
^{bl}+LocaleTitle	{ return LOCALETITLE; }
^{bl}+SwallowExec	{ return SWALLOWEXEC; }
^{bl}+Icon		{ return ICON; }
^{bl}+Flags		{ return FLAGS; }
Hidden			{ return HIDDEN; }
NoFocus			{ return NOFOCUS; }
NoReliefString		{ return NORELIEFSTRING; }
Center			{ return CENTER; }
Left			{ return LEFT; }
Right			{ return RIGHT; }

^{bl}+Do		{ return EXEC; }
^{bl}+HideWidget	{ return HIDE; }
^{bl}+ShowWidget	{ return SHOW; }
^{bl}+ChangeValue	{ return CHVALUE; }
^{bl}+ChangeMaxValue	{ return CHVALUEMAX; }
^{bl}+ChangeMinValue	{ return CHVALUEMIN; }
GetTitle		{ return GETTITLE; }
GetValue		{ return GETVALUE; }
GetMinValue		{ return GETMINVALUE; }
GetMaxValue		{ return GETMAXVALUE; }
GetFore			{ return GETFORE; }
GetBack			{ return GETBACK; }
GetHilight		{ return GETHILIGHT; }
GetShadow		{ return GETSHADOW; }
GetOutput		{ return GETOUTPUT; }
NumToHex		{ return NUMTOHEX; }
HexToNum		{ return HEXTONUM; }
Add			{ return ADD;}
Mult			{ return MULT;}
Div			{ return DIV;}
StrCopy			{ return STRCOPY; }
LaunchScript		{ return LAUNCHSCRIPT; }
GetScriptFather		{ return GETSCRIPTFATHER; }
ReceivFromScript	{ return RECEIVFROMSCRIPT; }
RemainderOfDiv		{ return REMAINDEROFDIV; }
GetTime			{ return GETTIME; }
GetScriptArgument	{ return GETSCRIPTARG; }
GetPid			{ return GETPID; }
SendMsgAndGet		{ return SENDMSGANDGET; }
Parse			{ return PARSE; }
LastString		{ return LASTSTRING; }
Gettext                 { return GETTEXT; }
^{bl}+ChangePosition	{ return POSITION; }
^{bl}+ChangeSize	{ return SIZE; }
^{bl}+ChangeTitle	{ return TITLE; }
^{bl}+ChangeLocaleTitle	{ return LOCALETITLE; }
^{bl}+ChangeIcon	{ return ICON; }
^{bl}+ChangeFont	{ return CHFONT; }
^{bl}+ChangeForeColor	{ return CHFORECOLOR; }
^{bl}+ChangeBackColor	{ return CHBACKCOLOR; }
^{bl}+ChangeColorset	{ return CHCOLORSET; }
^{bl}+Set		{ return SET; }
^{bl}+SendSignal	{ return SENDSIGN; }
^{bl}+Quit		{ return QUIT; }
^{bl}+Init		{ return INIT; }
^{bl}+PeriodicTasks	{ return PERIODICTASK; }
^{bl}+QuitFunc		{ return QUITFUNC; }
^{bl}+For		{ return FOR; }
^{bl}+WarpPointer	{ return WARP; }
^{bl}+WriteToFile	{ return WRITETOFILE; }
^{bl}+SendToScript	{ return SENDTOSCRIPT; }
^{bl}+SingleClic	{ return SINGLECLIC; }
^{bl}+DoubleClic	{ return DOUBLECLIC; }
^{bl}+Key		{ return KEY; }
To			{ return TO; }
Do			{ return DO; }
^{bl}+If		{ return IF; }
Then			{ return THEN; }
Else			{ return ELSE; }

{inf}			{ return INF; }
{infeq}			{ return INFEQ; }
{supeq}			{ return SUPEQ; }
{sup}			{ return SUP; }
{diff}			{ return DIFF; }
{equal}			{ return EQUAL; }
{get}			{ return GET; }

^{bl}+While		{ return WHILE; }
^{bl}+Case+[ \t]+message+[ \t]of { return CASE; }
^{bl}+Begin		{ return BEG; }
:			{ return POINT; }
[\(]			{ return BEGF; }
[\)]			{ return ENDF; }


{nb}		{ yylval.number=atoi(yytext);
                  return NUMBER;
                }

[\$]+{str}	{
		  yylval.str=(char*) safestrdup(yytext+1);
		  yylval.str[yyleng-1]='\0';
                  return VAR;
		}

{gstr}		{ /* Str entre "" */
		  yylval.str=(char*) safestrdup(yytext+1);
		  yylval.str[yyleng-2]='\0';
                  return GSTR;
		}

{str}		{ yylval.str=(char*) safestrdup(yytext);
		  yylval.str[yyleng]='\0';
                  return STR;
		}

{nl}		{ numligne++; }