1%{
2
3/*****************************************************************************/
4/*
5
6Copyright 1989,1998  The Open Group
7
8Permission to use, copy, modify, distribute, and sell this software and its
9documentation for any purpose is hereby granted without fee, provided that
10the above copyright notice appear in all copies and that both that
11copyright notice and this permission notice appear in supporting
12documentation.
13
14The above copyright notice and this permission notice shall be included in
15all copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of The Open Group shall not be
25used in advertising or otherwise to promote the sale, use or other dealings
26in this Software without prior written authorization from The Open Group.
27
28*/
29/**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
30/**                          Salt Lake City, Utah                           **/
31/**                        Cambridge, Massachusetts                         **/
32/**                                                                         **/
33/**                           All Rights Reserved                           **/
34/**                                                                         **/
35/**    Permission to use, copy, modify, and distribute this software and    **/
36/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
37/**    granted, provided that the above copyright notice appear  in  all    **/
38/**    copies and that both  that  copyright  notice  and  this  permis-    **/
39/**    sion  notice appear in supporting  documentation,  and  that  the    **/
40/**    name of Evans & Sutherland not be used in advertising    **/
41/**    in publicity pertaining to distribution of the  software  without    **/
42/**    specific, written prior permission.                                  **/
43/**                                                                         **/
44/**    EVANS & SUTHERLAND DISCLAIMs ALL WARRANTIES WITH REGARD    **/
45/**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
46/**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND    **/
47/**    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
48/**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
49/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
50/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
51/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
52/*****************************************************************************/
53
54/***********************************************************************
55 *
56 * $Xorg: lex.l,v 1.4 2001/02/09 02:05:36 xorgcvs Exp $
57 *
58 * .twmrc lex file
59 *
60 * 12-Nov-87 Thomas E. LaStrange                File created
61 *
62 ***********************************************************************/
63/* $XFree86: xc/programs/twm/lex.l,v 3.13 2001/08/27 21:11:39 dawes Exp $ */
64
65#define YY_NO_INPUT	/* we have our own! */
66
67/* #include <stdio.h> */ /* lex already includes stdio.h */
68#include "twm.h"
69#include "list.h"
70#include "parse.h"
71
72#ifdef FLEX_SCANNER
73#if (YY_FLEX_MINOR_VERSION == 5) && (YY_FLEX_SUBMINOR_VERSION < 20)
74int yylineno;
75#endif
76
77#undef YY_INPUT
78#define YY_INPUT(buf,result,size) ((result) = doinput((buf),(size)))
79static int
80doinput(char *buf, int size)
81{
82    int c;
83
84    if (size == 0)
85        return (0);
86
87    if ((c = (*twmInputFunc) ()) <= 0)
88        return (0);
89
90    buf[0] = (char) c;
91    if (c == '\n')
92        ++yylineno;
93    return (1);
94}
95#define YY_NO_UNPUT
96#endif
97
98%}
99
100string                          \"([^"]|\\.)*\"
101number                          [0-9]+
102%%
103"{"                             { return (LB); }
104"}"                             { return (RB); }
105"("                             { return (LP); }
106")"                             { return (RP); }
107"="                             { return (EQUALS); }
108":"                             { return (COLON); }
109"+"                             { return PLUS; }
110"-"                             { return MINUS; }
111"|"                             { return OR; }
112
113[a-zA-Z\.]+                     { int token = parse_keyword ((char *)yytext,
114                                                             &yylval.num);
115                                  if (token == ERRORTOKEN) {
116                                      parseWarning (
117                                           "ignoring unknown keyword: %s",
118                                           yytext);
119                                      ParseError = 1;
120                                  } else
121                                    return token;
122                                }
123
124"!"                             { yylval.num = F_EXEC; return FSKEYWORD; }
125"^"                             { yylval.num = F_CUT; return FSKEYWORD; }
126
127{string}                        { yylval.ptr = (char *)yytext; return STRING; }
128{number}                        { (void)sscanf((char *)yytext, "%d", &yylval.num);
129                                  return (NUMBER);
130                                }
131\#[^\n]*\n                      {;}
132[\r\n\t ]                       {;}
133.                               {
134                                  parseWarning (
135                                       "ignoring character \"%s\"",
136                                       yytext);
137                                  ParseError = 1;
138                                }
139%%
140
141#ifndef yywrap
142int
143yywrap(void)
144{
145    return (1);
146}
147#endif
148
149#undef unput
150#undef input
151#undef output
152#undef feof
153#define unput(c)        twmUnput(c)
154#define input()         (*twmInputFunc)()
155#define output(c)       TwmOutput(c)
156#define feof()          (1)
157