lex.l revision 9aa2a2b5
1/*
2** lex file for xgc syntax
3*/
4
5/* Lots of stuff stolen from gwm's wool.lex */
6
7%{
8
9#include <X11/X.h>
10#include <stdlib.h>
11#include "gram.h"
12#include "constants.h"
13#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__UNIXOS2__)
14int yylineno;
15#endif
16%}
17
18%p				4000
19%a				3000
20
21number				[0-9]+
22word				[^\n\t ]+
23string				\"([^"]|\\.)*\"
24
25%%
26
27[Rr]un				{ return (RUN); }
28
29[Ff]unction			{ return (FUNCTION); }
30[Cc]lear			{ yylval.num = GXclear;
31				  return (FUNCTIONTYPE); }
32[Aa]nd				{ yylval.num = GXand;
33				  return (FUNCTIONTYPE); }
34[Aa]ndReverse			{ yylval.num = GXandReverse;
35				  return (FUNCTIONTYPE); }
36[Cc]opy				{ yylval.num = GXcopy;
37				  return (FUNCTIONTYPE); }
38[Aa]ndInverted			{ yylval.num = GXandInverted;
39				  return (FUNCTIONTYPE); }
40[Nn]oop				{ yylval.num = GXnoop;
41				  return (FUNCTIONTYPE); }
42[Xx]or				{ yylval.num = GXxor;
43				  return (FUNCTIONTYPE); }
44[Oo]r				{ yylval.num = GXor;
45				  return (FUNCTIONTYPE); }
46[Nn]or				{ yylval.num = GXnor;
47				  return (FUNCTIONTYPE); }
48[Ee]quiv			{ yylval.num = GXequiv;
49				  return (FUNCTIONTYPE); }
50[Ii]nvert			{ yylval.num = GXinvert;
51				  return (FUNCTIONTYPE); }
52[Oo]rReverse			{ yylval.num = GXorReverse;
53				  return (FUNCTIONTYPE); }
54[Cc]opyInverted			{ yylval.num = GXcopyInverted;
55				  return (FUNCTIONTYPE); }
56[Oo]rInverted			{ yylval.num = GXorInverted;
57				  return (FUNCTIONTYPE); }
58[Nn]and				{ yylval.num = GXnand;
59				  return (FUNCTIONTYPE); }
60[Ss]et				{ yylval.num = GXset;
61				  return (FUNCTIONTYPE); }
62
63[Tt]est				{ return (TEST); }
64CopyArea			{ yylval.num = CopyArea;
65				  return (TESTTYPE); }
66CopyPlane			{ yylval.num = CopyPlane;
67				  return (TESTTYPE); }
68PolyPoint			{ yylval.num = PolyPoint;
69				  return (TESTTYPE); }
70PolyLine			{ yylval.num = PolyLine;
71				  return (TESTTYPE); }
72PolySegment			{ yylval.num = PolySegment;
73				  return (TESTTYPE); }
74PolyRectangle			{ yylval.num = PolyRectangle;
75				  return (TESTTYPE); }
76PolyArc				{ yylval.num = PolyArc;
77				  return (TESTTYPE); }
78FillPolygon			{ yylval.num = FillPolygon;
79				  return (TESTTYPE); }
80PolyFillRect			{ yylval.num = PolyFillRect;
81				  return (TESTTYPE); }
82PolyFillArc			{ yylval.num = PolyFillArc;
83				  return (TESTTYPE); }
84PutImage			{ yylval.num = PutImage;
85				  return (TESTTYPE); }
86GetImage			{ yylval.num = GetImage;
87				  return (TESTTYPE); }
88PolyText8			{ yylval.num = PolyText8;
89				  return (TESTTYPE); }
90ImageText8			{ yylval.num = ImageText8;
91				  return (TESTTYPE); }
92PolyText16			{ yylval.num = PolyText16;
93				  return (TESTTYPE); }
94ImageText16			{ yylval.num = ImageText16;
95				  return (TESTTYPE); }
96
97[Ll]inestyle			{ return (LINESTYLE); }
98OnOffDash			{ yylval.num = LineOnOffDash;
99				  return (LINESTYLETYPE); }
100DoubleDash			{ yylval.num = LineDoubleDash;
101				  return (LINESTYLETYPE); }
102
103[Cc]apstyle			{ return (CAPSTYLE); }
104NotLast				{ yylval.num = CapNotLast;
105				  return (CAPSTYLETYPE); }
106Butt				{ yylval.num = CapButt;
107				  return (CAPSTYLETYPE); }
108Projecting			{ yylval.num = CapProjecting;
109				  return (CAPSTYLETYPE); }
110
111[Jj]oinstyle			{ return (JOINSTYLE); }
112Miter				{ yylval.num = JoinMiter;
113				  return (JOINSTYLETYPE); }
114Bevel				{ yylval.num = JoinBevel;
115				  return (JOINSTYLETYPE); }
116
117Round				{ return (ROUND); }
118
119[Ff]illstyle			{ return (FILLSTYLE); }
120Tiled				{ yylval.num = FillTiled;
121				  return (FILLSTYLETYPE); }
122Stippled			{ yylval.num = FillStippled;
123				  return (FILLSTYLETYPE); }
124OpaqueStippled			{ yylval.num = FillOpaqueStippled;
125				  return (FILLSTYLETYPE); }
126
127Solid				{ return (SOLID); }
128
129[Ff]illrule			{ return (FILLRULE); }
130EvenOdd				{ yylval.num = EvenOddRule;
131				  return (FILLRULETYPE); }
132Winding				{ yylval.num = WindingRule;
133				  return (FILLRULETYPE); }
134
135[Aa]rcmode			{ return (ARCMODE); }
136Chord				{ yylval.num = ArcChord;
137				  return (ARCMODETYPE); }
138PieSlice			{ yylval.num = ArcPieSlice;
139				  return (ARCMODETYPE); }
140
141[Ff]oreground			{ return (FOREGROUND); }
142[Bb]ackground			{ return (BACKGROUND); }
143[Ll]inewidth			{ return (LINEWIDTH); }
144[Pp]lanemask			{ return (PLANEMASK); }
145[Dd]ashlist			{ return (DASHLIST); }
146[Ff]ont				{ return (FONT); }
147[Pp]ercent			{ return (PERCENT); }
148
149{number}			{ (void) sscanf ((char *)yytext, "%d", &yylval.num);
150				  return (NUMBER); }
151{string}			{ yylval.ptr = (char *) yytext;
152				  return (STRING); }
153\#[^\n]*\n			{ ; }
154[\t ]				{ ; }
155\n				{ return ('\n'); }
156
157{word}				{ yylval.ptr = (char *) yytext;
158				  return (STRING); }
159
160.				{ fprintf(stderr,
161					"xgc: bad character `%s', line %d\n",
162					yytext, yylineno); }
163
164%%
165
166#ifndef yywrap
167int yywrap(void) { return (1); }
168#endif
169