1 %{
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                         **/
7 /**                                                                         **/
8 /**                           All Rights Reserved                           **/
9 /**                                                                         **/
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.                                  **/
18 /**                                                                         **/
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 /*****************************************************************************/
28 
29 /***********************************************************************
30  *
31  * $XConsortium: lex.l,v 1.62 89/12/10 17:46:33 jim Exp $
32  *
33  * .twmrc lex file
34  *
35  * 12-Nov-87 Thomas E. LaStrange		File created
36  *
37  ***********************************************************************/
38 
39 /* #include <stdio.h> */		/* lex already includes stdio.h */
40 #include "gram.h"
41 #include "list.h"
42 #include "parse.h"
43 extern char *ProgramName;
44 
45 extern int ParseError;
46 
yywrap()47 yywrap() { return(1);}
48 
49 #define YY_INPUT(buf,result,max_size) \
50     { \
51     int c = (*twmInputFunc)(); \
52     result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
53     }
54 %}
55 
56 
57 string				\"([^"]|\\.)*\"
58 number				[0-9]+
59 %%
60 "{"				{ return (LB); }
61 "}"				{ return (RB); }
62 "("				{ return (LP); }
63 ")"				{ return (RP); }
64 "="				{ return (EQUALS); }
65 ":"				{ return (COLON); }
66 "+"				{ return PLUS; }
67 "-"				{ return MINUS; }
68 "|"				{ return OR; }
69 "@"				{ return (AT); }
70 
71 [a-zA-Z\.]+			{ int token = parse_keyword (yytext,
72 							     &yylval.num);
73 				  if (token == ERRORTOKEN) {
74 				      twmrc_error_prefix();
75 				      fprintf (stderr,
76 				       "ignoring unknown keyword:  %s\n",
77 					       yytext);
78 				      ParseError = 1;
79 				  } else
80 				    return token;
81 				}
82 
83 "!"				{ yylval.num = F_EXEC; return FSKEYWORD; }
84 "^"				{ yylval.num = F_CUT; return FSKEYWORD; }
85 
86 {string}			{ yylval.ptr = (char *)yytext; return STRING; }
87 {number}			{ (void)sscanf(yytext, "%d", &yylval.num);
88 				  return (NUMBER);
89 				}
90 \#[^\n]*\n			{;}
91 [\n\t ]				{;}
92 .				{
93 				  twmrc_error_prefix();
94 				  fprintf (stderr,
95 					   "ignoring character \"%s\"\n",
96 					   yytext);
97 				  ParseError = 1;
98 				}
99 %%
100