~ctwm/ctwm/trunk

1 by Claude Lecommandeur
CTWM version 1.1
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 "parse.h"
42
extern char *ProgramName;
43
44
extern int ParseError;
45
46
%}
47
48
string				\"([^"]|\\.)*\"
49
number				[0-9]+
50
%%
51
"{"				{ return (LB); }
52
"}"				{ return (RB); }
53
"("				{ return (LP); }
54
")"				{ return (RP); }
55
"="				{ return (EQUALS); }
56
":"				{ return (COLON); }
57
"+"				{ return PLUS; }
58
"-"				{ return MINUS; }
59
"|"				{ return OR; }
60
61
[a-zA-Z\.]+			{ int token = parse_keyword (yytext, 
62
							     &yylval.num);
63
				  if (token == ERRORTOKEN) {
64
				      twmrc_error_prefix();
65
				      fprintf (stderr,
66
				       "ignoring unknown keyword:  %s\n", 
67
					       yytext);
68
				      ParseError = 1;
69
				  } else 
70
				    return token;
71
				}
72
73
"!"				{ yylval.num = F_EXEC; return FSKEYWORD; }
74
"^"				{ yylval.num = F_CUT; return FSKEYWORD; }
75
76
{string}			{ yylval.ptr = (char *)yytext; return STRING; }
77
{number}			{ (void)sscanf(yytext, "%d", &yylval.num);
78
				  return (NUMBER);
79
				}
80
\#[^\n]*\n			{;}
81
[\n\t ]				{;}
82
.				{
83
				  twmrc_error_prefix();
84
				  fprintf (stderr, 
85
					   "ignoring character \"%s\"\n",
86
					   yytext);
87
				  ParseError = 1;
88
				}
89
%%
90
yywrap() { return(1);}
91
92
#undef unput
93
#undef input
94
#undef output
95
#undef feof
96
#define unput(c)	twmUnput(c)
97
#define input()		(*twmInputFunc)()
98
#define output(c)	TwmOutput(c)
99
#define feof()		(1)