Commit Diff


commit - 02be96c6ddfc34e448cccd095b4f3d0efe4de8a3
commit + eb59f87e67daa46d8d51ca11da12a00df0dd2361
blob - 65f8acccf4ef9938ccc7ea2191a03cf939f678ee
blob + 5c1d60c7572f4736c33ccc7a412ba5bf2390ba41
--- lex.l
+++ lex.l
@@ -48,36 +48,35 @@
 	return TNUM;
 }
 
-on		yylval.num = 1; return TBOOL;
 off		yylval.num = 0; return TBOOL;
+on		yylval.num = 1; return TBOOL;
 
+auto		return TAUTO;
+block		return TBLOCK;
+ca		return TCA;
+cert		return TCERT;
+cgi		return TCGI;
+chroot		return TCHROOT;
+client		return TCLIENT;
+default		return TDEFAULT;
+entrypoint	return TENTRYPOINT;
+index		return TINDEX;
 ipv6		return TIPV6;
+key		return TKEY;
+lang		return TLANG;
+location	return TLOCATION;
+mime		return TMIME;
 port		return TPORT;
+prefork		return TPREFORK;
 protocols	return TPROTOCOLS;
-mime		return TMIME;
-default		return TDEFAULT;
+require		return TREQUIRE;
+return		return TRETURN;
+root		return TROOT;
+server		return TSERVER;
+strip		return TSTRIP;
 type		return TTYPE;
-chroot		return TCHROOT;
 user		return TUSER;
-server		return TSERVER;
-prefork		return TPREFORK;
 
-location	return TLOCATION;
-cert		return TCERT;
-key		return TKEY;
-root		return TROOT;
-cgi		return TCGI;
-lang		return TLANG;
-index		return TINDEX;
-auto		return TAUTO;
-strip		return TSTRIP;
-block		return TBLOCK;
-return		return TRETURN;
-entrypoint	return TENTRYPOINT;
-require		return TREQUIRE;
-client		return TCLIENT;
-ca		return TCA;
-
 [{}]		return *yytext;
 
 \n		yylineno++;
blob - 64c787944f3c88d5958b707866050d01aeb21040
blob + 23a9225002b52fb4f71991afcc6d22ca016d9f5c
--- parse.y
+++ parse.y
@@ -73,16 +73,16 @@ options		: /* empty */
 		| options option
 		;
 
-option		: TIPV6 TBOOL		{ conf.ipv6 = $2; }
+option		: TCHROOT TSTRING	{ conf.chroot = $2; }
+		| TIPV6 TBOOL		{ conf.ipv6 = $2; }
+		| TMIME TSTRING TSTRING	{ add_mime(&conf.mime, $2, $3); }
 		| TPORT TNUM		{ conf.port = $2; }
+		| TPREFORK TNUM		{ conf.prefork = check_prefork_num($2); }
 		| TPROTOCOLS TSTRING {
 			if (tls_config_parse_protocols(&conf.protos, $2) == -1)
 				errx(1, "invalid protocols string \"%s\"", $2);
 		}
-		| TMIME TSTRING TSTRING	{ add_mime(&conf.mime, $2, $3); }
-		| TCHROOT TSTRING	{ conf.chroot = $2; }
 		| TUSER TSTRING		{ conf.user = $2; }
-		| TPREFORK TNUM		{ conf.prefork = check_prefork_num($2); }
 		;
 
 vhosts		: /* empty */
@@ -118,8 +118,6 @@ servopts	: /* empty */
 		;
 
 servopt		: TCERT TSTRING		{ host->cert = ensure_absolute_path($2); }
-		| TKEY TSTRING		{ host->key  = ensure_absolute_path($2); }
-		| TROOT TSTRING		{ host->dir  = ensure_absolute_path($2); }
 		| TCGI TSTRING		{
 			/* drop the starting '/', if any */
 			if (*$2 == '/')
@@ -133,6 +131,8 @@ servopt		: TCERT TSTRING		{ host->cert = ensure_absolu
 				memmove($2, $2+1, strlen($2));
 			host->entrypoint = $2;
 		}
+		| TKEY TSTRING		{ host->key  = ensure_absolute_path($2); }
+		| TROOT TSTRING		{ host->dir  = ensure_absolute_path($2); }
 		| locopt
 		;
 
@@ -153,22 +153,7 @@ locopts		: /* empty */
 		| locopts locopt
 		;
 
-locopt		: TDEFAULT TTYPE TSTRING {
-			if (loc->default_mime != NULL)
-				yyerror("`default type' specified more than once");
-			loc->default_mime = $3;
-		}
-		| TLANG TSTRING {
-			if (loc->lang != NULL)
-				yyerror("`lang' specified more than once");
-			loc->lang = $2;
-		}
-		| TINDEX TSTRING {
-			if (loc->index != NULL)
-				yyerror("`index' specified more than once");
-			loc->index = $2;
-		}
-		| TAUTO TINDEX TBOOL	{ loc->auto_index = $3 ? 1 : -1; }
+locopt		: TAUTO TINDEX TBOOL	{ loc->auto_index = $3 ? 1 : -1; }
 		| TBLOCK TRETURN TNUM TSTRING {
 			if (loc->block_fmt != NULL)
 				yyerror("`block' rule specified more than once");
@@ -189,7 +174,21 @@ locopt		: TDEFAULT TTYPE TSTRING {
 			loc->block_fmt = xstrdup("temporary failure");
 			loc->block_code = 40;
 		}
-		| TSTRIP TNUM		{ loc->strip = check_strip_no($2); }
+		| TDEFAULT TTYPE TSTRING {
+			if (loc->default_mime != NULL)
+				yyerror("`default type' specified more than once");
+			loc->default_mime = $3;
+		}
+		| TINDEX TSTRING {
+			if (loc->index != NULL)
+				yyerror("`index' specified more than once");
+			loc->index = $2;
+		}
+		| TLANG TSTRING {
+			if (loc->lang != NULL)
+				yyerror("`lang' specified more than once");
+			loc->lang = $2;
+		}
 		| TREQUIRE TCLIENT TCA TSTRING {
 			if (loc->reqca != NULL)
 				yyerror("`require client ca' specified more than once");
@@ -199,6 +198,7 @@ locopt		: TDEFAULT TTYPE TSTRING {
 				yyerror("couldn't load ca cert: %s", $4);
 			free($4);
 		}
+		| TSTRIP TNUM		{ loc->strip = check_strip_no($2); }
 		;
 
 %%