Commit | Line | Data |
---|---|---|
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 | ||
40 | extern int yyparse(void); | |
41 | ||
42 | extern void ErrorF (const char* /*f*/, ...); | |
43 | ||
44 | /* Copy the parsed string, must be free()d in yacc parser */ | |
45 | static 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 */ } | |
70 | MENU { return MENU; } | |
71 | ICONDIRECTORY { return ICONDIRECTORY; } | |
72 | DEFAULTICON { return DEFAULTICON; } | |
73 | ICONS { return ICONS; } | |
74 | STYLES { return STYLES; } | |
75 | TOPMOST { return TOPMOST; } | |
76 | MAXIMIZE { return MAXIMIZE; } | |
77 | MINIMIZE { return MINIMIZE; } | |
78 | BOTTOM { return BOTTOM; } | |
79 | NOTITLE { return NOTITLE; } | |
80 | OUTLINE { return OUTLINE; } | |
81 | NOFRAME { return NOFRAME; } | |
82 | ROOTMENU { return ROOTMENU; } | |
83 | DEFAULTSYSMENU { return DEFAULTSYSMENU; } | |
84 | SYSMENU { return SYSMENU; } | |
85 | SEPARATOR { return SEPARATOR; } | |
86 | ATSTART { return ATSTART; } | |
87 | ATEND { return ATEND; } | |
88 | EXEC { return EXEC; } | |
89 | ALWAYSONTOP { return ALWAYSONTOP; } | |
90 | DEBUG { return DEBUGOUTPUT; } | |
91 | RELOAD { return RELOAD; } | |
92 | TRAYICON { return TRAYICON; } | |
93 | SILENTEXIT { 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 | */ | |
106 | int | |
107 | yywrap (void) | |
108 | { | |
109 | return 1; | |
110 | } | |
111 | ||
112 | /* | |
113 | * Run a file through the yacc parser | |
114 | */ | |
115 | int | |
116 | parse_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 |