/[hydra]/hydra/src/boa_grammar.y
ViewVC logotype

Annotation of /hydra/src/boa_grammar.y

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Sep 24 17:12:47 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
Changes since 1.1: +25 -6 lines
Added some support for host based virtual hosting.

1 nmav 1.1 %{
2    
3     /*
4     * Boa, an http server
5     * Copyright (C) 1995 Paul Phillips <psp@well.com>
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 1, or (at your option)
10     * any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20     *
21     */
22    
23 nmav 1.2 /* $Id: boa_grammar.y,v 1.1.1.1 2002/09/21 13:53:38 nmav Exp $*/
24 nmav 1.1
25     #include <string.h>
26     #include <stdio.h>
27     #include <stdlib.h>
28     #include <unistd.h>
29     /* #include "boa.h" */
30     #include "parse.h"
31    
32     int yyerror(char * msg);
33    
34     /* yydebug = 1; */
35    
36     #ifdef DEBUG
37     #define DBG(x) x
38     #else
39     #define DBG(x)
40     #endif
41    
42     char *arg1hold;
43 nmav 1.2 char *arg2hold;
44     char *arg3hold;
45 nmav 1.1 char mime_type[256]; /* global to inherit */
46    
47     %}
48    
49     %union {
50     char * sval;
51     int ival;
52     struct ccommand * cval;
53     };
54    
55     /* boa.conf tokens */
56 nmav 1.2 %token <cval> STMT_NO_ARGS STMT_ONE_ARG STMT_TWO_ARGS STMT_FOUR_ARGS
57 nmav 1.1
58     /* mime.type tokens */
59     %token <sval> MIMETYPE
60     %token <sval> STRING
61     %token <ival> INTEGER
62 nmav 1.2 %token STRING_SEP ':'
63 nmav 1.1
64     %start ConfigFiles
65    
66     %%
67    
68     ConfigFiles: BoaConfigStmts MimeTypeStmts
69     ;
70    
71     BoaConfigStmts: BoaConfigStmts BoaConfigStmt
72     | /* empty */
73     ;
74    
75     BoaConfigStmt:
76     StmtNoArgs
77     | StmtOneArg
78     | StmtTwoArgs
79 nmav 1.2 | StmtFourArgs
80 nmav 1.1 ;
81    
82     StmtNoArgs: STMT_NO_ARGS
83     { if ($1->action) {
84     DBG(printf("StmtNoArgs: %s\n",$1->name);)
85 nmav 1.2 $1->action(NULL, NULL, NULL,NULL,$1->object);
86 nmav 1.1 }
87     }
88     ;
89    
90     StmtOneArg: STMT_ONE_ARG STRING
91     { if ($1->action) {
92     DBG(printf("StmtOneArg: %s %s\n",$1->name,$2);)
93 nmav 1.2 $1->action($2,NULL, NULL, NULL,$1->object);
94 nmav 1.1 }
95     }
96     ;
97    
98     StmtTwoArgs: STMT_TWO_ARGS STRING
99     { arg1hold = strdup($2); }
100     STRING
101     { if ($1->action) {
102     DBG(printf("StmtTwoArgs: '%s' '%s' '%s'\n",
103     $1->name,arg1hold,$4);)
104 nmav 1.2 $1->action($4,arg1hold,NULL, NULL, $1->object);
105 nmav 1.1 }
106     free(arg1hold);
107     }
108 nmav 1.2 StmtFourArgs: STMT_FOUR_ARGS STRING
109     { arg1hold = strdup($2); }
110     STRING
111     { arg2hold = strdup($4); }
112     STRING
113     { arg3hold = strdup($6); }
114     STRING
115     { if ($1->action) {
116     DBG(printf("StmtTwoArgs: '%s' '%s' '%s' '%s' '%s'\n",
117     $1->name,arg1hold, arg2hold, arg3hold, $8);)
118     $1->action(arg1hold, arg2hold, arg3hold, $8, $1->object);
119     }
120     free(arg1hold);
121     free(arg2hold);
122     free(arg3hold);
123     }
124 nmav 1.1 ;
125    
126     /******************* mime.types **********************/
127    
128     MimeTypeStmts: MimeTypeStmts MimeTypeStmt
129     | /* empty */
130     ;
131    
132     MimeTypeStmt: MIMETYPE
133     { strcpy(mime_type, $1); }
134     ExtensionList
135     ;
136    
137     ExtensionList: ExtensionList Extension
138     | /* empty */
139     ;
140    
141     Extension: STRING
142     { add_mime_type($1, mime_type); }
143     ;
144    
145     %%
146    

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26