summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/zlexer.lex
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nsd/zlexer.lex')
-rw-r--r--usr.sbin/nsd/zlexer.lex11
1 files changed, 11 insertions, 0 deletions
diff --git a/usr.sbin/nsd/zlexer.lex b/usr.sbin/nsd/zlexer.lex
index 98635ccbe35..fb6eadf0716 100644
--- a/usr.sbin/nsd/zlexer.lex
+++ b/usr.sbin/nsd/zlexer.lex
@@ -105,6 +105,12 @@ parser_flush(void)
lexer_state = EXPECT_OWNER;
}
+int at_eof(void)
+{
+ static int once = 1;
+ return (once = !once) ? 0 : NL;
+}
+
#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */
#define yy_set_bol(at_bol) \
{ \
@@ -224,12 +230,17 @@ ANY [^\"\n\\]|\\.
parser->error_occurred = error_occurred;
}
<INITIAL><<EOF>> {
+ int eo = at_eof();
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
if (include_stack_ptr == 0) {
+ if(eo == NL)
+ return eo;
yyterminate();
} else {
fclose(yyin);
pop_parser_state();
+ if(eo == NL)
+ return eo;
}
}
^{DOLLAR}{LETTER}+ { zc_warning("Unknown directive: %s", yytext); }