commit - 74f0778b9ae93a700d8b0f759b05f24e69f54921
commit + ef129b08ef85ad6d034548fa1fbe71570a61e75a
blob - 9182fd417e1e392c09e1aceb233e0806fcf9486e
blob + 0f17cb25a395684e3fb00623527627a0293a315c
--- parse.y
+++ parse.y
FILE *yyfp;
+typedef struct {
+ union {
+ char *str;
+ int num;
+ };
+ int lineno;
+ int colno;
+} yystype;
+#define YYSTYPE yystype
+
/*
* #define YYDEBUG 1
* int yydebug = 1;
struct location *loc;
static int goterror;
-static int lineno, colno;
static struct vhost *new_vhost(void);
static struct location *new_location(void);
/* for bison: */
/* %define parse.error verbose */
-%union {
- char *str;
- int num;
-}
-
%token TIPV6 TPORT TPROTOCOLS TMIME TDEFAULT TTYPE TCHROOT TUSER TSERVER
%token TPREFORK TLOCATION TCERT TKEY TROOT TCGI TENV TLANG TLOG TINDEX TAUTO
%token TSTRIP TBLOCK TRETURN TENTRYPOINT TREQUIRE TCLIENT TCA TALIAS TTCP
host->domain = $2;
if (strstr($2, "xn--") != NULL) {
- warnx("%s:%d \"%s\" looks like punycode: "
+ warnx("%s:%d:%d \"%s\" looks like punycode: "
"you should use the decoded hostname.",
- config_path, lineno, $2);
+ config_path, yylval.lineno+1, yylval.colno,
+ $2);
}
} '{' servopts locations '}' {
goterror = 1;
va_start(ap, msg);
- fprintf(stderr, "%s:%d: ", config_path, lineno);
+ fprintf(stderr, "%s:%d: ", config_path, yylval.lineno);
vfprintf(stderr, msg, ap);
fprintf(stderr, "\n");
va_end(ap);
repeat:
/* skip whitespace first */
for (c = getc(yyfp); isspace(c); c = getc(yyfp)) {
- colno++;
+ yylval.colno++;
if (c == '\n') {
- lineno++;
- colno = 0;
+ yylval.lineno++;
+ yylval.colno = 0;
}
}
while ((c = getc(yyfp)) != '\n')
if (c == EOF)
goto eof;
- colno = 0;
- lineno++;
+ yylval.colno = 0;
+ yylval.lineno++;
goto repeat;
case EOF:
goto eof;
}
/* parsing next word */
- for (;; c = getc(yyfp), colno++) {
+ for (;; c = getc(yyfp), yylval.colno++) {
switch (c) {
case '\0':
yyerror("unallowed character NULL in column %d",
- colno+1);
+ yylval.colno+1);
escape = 0;
continue;
case '\\':
case '\n':
if (quotes)
yyerror("unterminated quotes in column %d",
- colno+1);
+ yylval.colno+1);
if (escape) {
nonkw = 1;
escape = 0;
- colno = 0;
- lineno++;
+ yylval.colno = 0;
+ yylval.lineno++;
}
goto eow;
case EOF:
if (escape)
yyerror("unterminated escape in column %d",
- colno);
+ yylval.colno);
if (quotes)
yyerror("unterminated quotes in column %d",
qpos+1);
quotes = !quotes;
if (quotes) {
nonkw = 1;
- qpos = colno;
+ qpos = yylval.colno;
}
continue;
}