Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xwin / winprefslex.l
CommitLineData
a09e091a
JB
1%{ # -*- C -*-
2/*
3 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
4 * Copyright (C) Colin Harrison 2005-2008
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 * Except as contained in this notice, the name of the XFree86 Project
26 * shall not be used in advertising or otherwise to promote the sale, use
27 * or other dealings in this Software without prior written authorization
28 * from the XFree86 Project.
29 *
30 * Authors: Earle F. Philhower, III
31 * Colin Harrison
32 */
33/* $XFree86: $ */
34
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include "winprefsyacc.h"
39
40extern int yyparse(void);
41
42extern void ErrorF (const char* /*f*/, ...);
43
44/* Copy the parsed string, must be free()d in yacc parser */
45static char *makestr(char *str)
46{
47 char *ptr;
48 ptr = (char*)malloc (strlen(str)+1);
49 if (!ptr)
50 {
51 ErrorF ("winMultiWindowLex:makestr() out of memory\n");
52 exit (-1);
53 }
54 strcpy(ptr, str);
55 return ptr;
56}
57
58%}
59
60%option yylineno
61%option nounput
62%option noinput
63%option never-interactive
64
65%%
66\#.*[\r\n] { /* comment */ return NEWLINE; }
67\/\/.*[\r\n] { /* comment */ return NEWLINE; }
68[\r\n] { return NEWLINE; }
69[ \t]+ { /* ignore whitespace */ }
70MENU { return MENU; }
71ICONDIRECTORY { return ICONDIRECTORY; }
72DEFAULTICON { return DEFAULTICON; }
73ICONS { return ICONS; }
74STYLES { return STYLES; }
75TOPMOST { return TOPMOST; }
76MAXIMIZE { return MAXIMIZE; }
77MINIMIZE { return MINIMIZE; }
78BOTTOM { return BOTTOM; }
79NOTITLE { return NOTITLE; }
80OUTLINE { return OUTLINE; }
81NOFRAME { return NOFRAME; }
82ROOTMENU { return ROOTMENU; }
83DEFAULTSYSMENU { return DEFAULTSYSMENU; }
84SYSMENU { return SYSMENU; }
85SEPARATOR { return SEPARATOR; }
86ATSTART { return ATSTART; }
87ATEND { return ATEND; }
88EXEC { return EXEC; }
89ALWAYSONTOP { return ALWAYSONTOP; }
90DEBUG { return DEBUGOUTPUT; }
91RELOAD { return RELOAD; }
92TRAYICON { return TRAYICON; }
93SILENTEXIT { return SILENTEXIT; }
94"{" { return LB; }
95"}" { return RB; }
96"\""[^\"\r\n]+"\"" { yylval.sVal = makestr(yytext+1); \
97 yylval.sVal[strlen(yylval.sVal)-1] = 0; \
98 return STRING; }
99[^ \t\r\n]+ { yylval.sVal = makestr(yytext); \
100 return STRING; }
101%%
102
103/*
104 * Run-of-the mill requirement for yacc
105 */
106int
107yywrap (void)
108{
109 return 1;
110}
111
112/*
113 * Run a file through the yacc parser
114 */
115int
116parse_file (FILE *file)
117{
118 int ret;
119
120 if (!file)
121 return 1;
122
123 yylineno = 1;
124 yyin = file;
125 ret = yyparse ();
126 yylex_destroy ();
127 return ret;
128}
129