2 /*****************************************************************************/
3 /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/
4 /** Salt Lake City, Utah **/
5 /** Portions Copyright 1989 by the Massachusetts Institute of Technology **/
6 /** Cambridge, Massachusetts **/
8 /** All Rights Reserved **/
10 /** Permission to use, copy, modify, and distribute this software and **/
11 /** its documentation for any purpose and without fee is hereby **/
12 /** granted, provided that the above copyright notice appear in all **/
13 /** copies and that both that copyright notice and this permis- **/
14 /** sion notice appear in supporting documentation, and that the **/
15 /** names of Evans & Sutherland and M.I.T. not be used in advertising **/
16 /** in publicity pertaining to distribution of the software without **/
17 /** specific, written prior permission. **/
19 /** EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD **/
20 /** TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- **/
21 /** ABILITY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND OR **/
22 /** M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAM- **/
23 /** AGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA **/
24 /** OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER **/
25 /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/
26 /** OR PERFORMANCE OF THIS SOFTWARE. **/
27 /*****************************************************************************/
29 /***********************************************************************
31 * $XConsortium: lex.l,v 1.62 89/12/10 17:46:33 jim Exp $
35 * 12-Nov-87 Thomas E. LaStrange File created
37 ***********************************************************************/
39 /* #include <stdio.h> */ /* lex already includes stdio.h */
43 extern int parse_keyword();
44 extern void twmrc_error_prefix();
46 extern char *ProgramName;
47 extern int ParseError;
51 #define YY_INPUT(b,r,s) r = ((b[0] = (*twmInputFunc)()) != 0)
55 string \"([^"]|\\.)*\"
56 regexp \/([^/]|\\.)*\/
63 "=" { return (EQUALS); }
64 "~" { return (TILDE); }
65 ":" { return (COLON); }
70 [a-zA-Z\.]+ { int token = parse_keyword (yytext,
72 if (token == ERRORTOKEN) {
75 "ignoring unknown keyword: %s\n",
82 "!" { yylval.num = F_EXEC; return FSKEYWORD; }
83 "^" { yylval.num = F_CUT; return FSKEYWORD; }
85 {string} { yylval.ptr = (char *)yytext; return STRING; }
86 {regexp} { yylval.ptr = (char *)yytext; return REGEXP; }
87 {number} { (void)sscanf((char *)&yytext[0], "%d", &yylval.num);
95 "ignoring character \"%s\"\n",
101 yywrap() { return(1);}
106 #define input() (*twmInputFunc)()
109 #define output(c) TwmOutput(c)
111 #define unput(c) twmUnput(c)