- config parser changed. Gives some syntax errors closer to where they

occurred. Does not enforce a space after keyword anymore.
  Does not allow literal newlines inside quoted strings anymore.



git-svn-id: file:///svn/unbound/trunk@1460 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-02-06 10:19:16 +00:00
parent 2705aaaad9
commit 2b873f1b57
3 changed files with 1158 additions and 1088 deletions

View file

@ -3,6 +3,9 @@
- iana portlist updated. - iana portlist updated.
- fixup EOL in include directive (reported by Paul Wouters). - fixup EOL in include directive (reported by Paul Wouters).
You can no longer specify newlines in the names of included files. You can no longer specify newlines in the names of included files.
- config parser changed. Gives some syntax errors closer to where they
occurred. Does not enforce a space after keyword anymore.
Does not allow literal newlines inside quoted strings anymore.
5 February 2009: Wouter 5 February 2009: Wouter
- ldns 1.5.0 rc as tarball included. - ldns 1.5.0 rc as tarball included.

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,13 @@ void ub_c_error(const char *message);
#define LEXOUT(s) #define LEXOUT(s)
#endif #endif
#define YDOUT LEXOUT(("v(%s )", yytext)) /** A parser variable, this is a statement in the config file which is
* of the form variable: value1 value2 ... nargs is the number of values. */
#define YDVAR(nargs, var) \
num_args=(nargs); \
LEXOUT(("v(%s%d) ", yytext, num_args)); \
if(num_args > 0) { BEGIN(val); } \
return (var);
struct inc_state { struct inc_state {
char* filename; char* filename;
@ -34,6 +40,8 @@ struct inc_state {
static struct inc_state parse_stack[MAXINCLUDES]; static struct inc_state parse_stack[MAXINCLUDES];
static YY_BUFFER_STATE include_stack[MAXINCLUDES]; static YY_BUFFER_STATE include_stack[MAXINCLUDES];
static int config_include_stack_ptr = 0; static int config_include_stack_ptr = 0;
static int inc_prev = 0;
static int num_args = 0;
static void config_start_include(const char* filename) static void config_start_include(const char* filename)
{ {
@ -100,120 +108,125 @@ static void config_end_include(void)
SPACE [ \t] SPACE [ \t]
LETTER [a-zA-Z] LETTER [a-zA-Z]
UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\. UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\.
UNQUOTEDLETTER_NOCOLON [^\:\'\"\n\r \t\\]|\\.
NEWLINE [\r\n] NEWLINE [\r\n]
COMMENT \# COMMENT \#
COLON \: COLON \:
DQANY [^\"\n\r\\]|\\. DQANY [^\"\n\r\\]|\\.
SQANY [^\'\n\r\\]|\\. SQANY [^\'\n\r\\]|\\.
%x quotedstring singlequotedstr include include_quoted %x quotedstring singlequotedstr include include_quoted val
%% %%
{SPACE}* { LEXOUT(("SP ")); /* ignore */ } <INITIAL,val>{SPACE}* {
{SPACE}*{COMMENT}.* { LEXOUT(("comment(%s) ", yytext)); /* ignore */ } LEXOUT(("SP ")); /* ignore */ }
server{COLON} { YDOUT; return VAR_SERVER;} <INITIAL,val>{SPACE}*{COMMENT}.*$ {
num-threads{COLON} { YDOUT; return VAR_NUM_THREADS;} LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
verbosity{COLON} { YDOUT; return VAR_VERBOSITY;} server{COLON} { YDVAR(0, VAR_SERVER) }
port{COLON} { YDOUT; return VAR_PORT;} num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) }
outgoing-range{COLON} { YDOUT; return VAR_OUTGOING_RANGE;} verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) }
outgoing-port-permit{COLON} { YDOUT; return VAR_OUTGOING_PORT_PERMIT;} port{COLON} { YDVAR(1, VAR_PORT) }
outgoing-port-avoid{COLON} { YDOUT; return VAR_OUTGOING_PORT_AVOID;} outgoing-range{COLON} { YDVAR(1, VAR_OUTGOING_RANGE) }
outgoing-num-tcp{COLON} { YDOUT; return VAR_OUTGOING_NUM_TCP;} outgoing-port-permit{COLON} { YDVAR(1, VAR_OUTGOING_PORT_PERMIT) }
incoming-num-tcp{COLON} { YDOUT; return VAR_INCOMING_NUM_TCP;} outgoing-port-avoid{COLON} { YDVAR(1, VAR_OUTGOING_PORT_AVOID) }
do-ip4{COLON} { YDOUT; return VAR_DO_IP4;} outgoing-num-tcp{COLON} { YDVAR(1, VAR_OUTGOING_NUM_TCP) }
do-ip6{COLON} { YDOUT; return VAR_DO_IP6;} incoming-num-tcp{COLON} { YDVAR(1, VAR_INCOMING_NUM_TCP) }
do-udp{COLON} { YDOUT; return VAR_DO_UDP;} do-ip4{COLON} { YDVAR(1, VAR_DO_IP4) }
do-tcp{COLON} { YDOUT; return VAR_DO_TCP;} do-ip6{COLON} { YDVAR(1, VAR_DO_IP6) }
do-daemonize{COLON} { YDOUT; return VAR_DO_DAEMONIZE;} do-udp{COLON} { YDVAR(1, VAR_DO_UDP) }
interface{COLON} { YDOUT; return VAR_INTERFACE;} do-tcp{COLON} { YDVAR(1, VAR_DO_TCP) }
outgoing-interface{COLON} { YDOUT; return VAR_OUTGOING_INTERFACE;} do-daemonize{COLON} { YDVAR(1, VAR_DO_DAEMONIZE) }
interface-automatic{COLON} { YDOUT; return VAR_INTERFACE_AUTOMATIC;} interface{COLON} { YDVAR(1, VAR_INTERFACE) }
chroot{COLON} { YDOUT; return VAR_CHROOT;} outgoing-interface{COLON} { YDVAR(1, VAR_OUTGOING_INTERFACE) }
username{COLON} { YDOUT; return VAR_USERNAME;} interface-automatic{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
directory{COLON} { YDOUT; return VAR_DIRECTORY;} chroot{COLON} { YDVAR(1, VAR_CHROOT) }
logfile{COLON} { YDOUT; return VAR_LOGFILE;} username{COLON} { YDVAR(1, VAR_USERNAME) }
pidfile{COLON} { YDOUT; return VAR_PIDFILE;} directory{COLON} { YDVAR(1, VAR_DIRECTORY) }
root-hints{COLON} { YDOUT; return VAR_ROOT_HINTS;} logfile{COLON} { YDVAR(1, VAR_LOGFILE) }
msg-buffer-size{COLON} { YDOUT; return VAR_MSG_BUFFER_SIZE;} pidfile{COLON} { YDVAR(1, VAR_PIDFILE) }
msg-cache-size{COLON} { YDOUT; return VAR_MSG_CACHE_SIZE;} root-hints{COLON} { YDVAR(1, VAR_ROOT_HINTS) }
msg-cache-slabs{COLON} { YDOUT; return VAR_MSG_CACHE_SLABS;} msg-buffer-size{COLON} { YDVAR(1, VAR_MSG_BUFFER_SIZE) }
rrset-cache-size{COLON} { YDOUT; return VAR_RRSET_CACHE_SIZE;} msg-cache-size{COLON} { YDVAR(1, VAR_MSG_CACHE_SIZE) }
rrset-cache-slabs{COLON} { YDOUT; return VAR_RRSET_CACHE_SLABS;} msg-cache-slabs{COLON} { YDVAR(1, VAR_MSG_CACHE_SLABS) }
cache-max-ttl{COLON} { YDOUT; return VAR_CACHE_MAX_TTL;} rrset-cache-size{COLON} { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
infra-host-ttl{COLON} { YDOUT; return VAR_INFRA_HOST_TTL;} rrset-cache-slabs{COLON} { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
infra-lame-ttl{COLON} { YDOUT; return VAR_INFRA_LAME_TTL;} cache-max-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_TTL) }
infra-cache-slabs{COLON} { YDOUT; return VAR_INFRA_CACHE_SLABS;} infra-host-ttl{COLON} { YDVAR(1, VAR_INFRA_HOST_TTL) }
infra-cache-numhosts{COLON} { YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;} infra-lame-ttl{COLON} { YDVAR(1, VAR_INFRA_LAME_TTL) }
infra-cache-lame-size{COLON} { YDOUT; return VAR_INFRA_CACHE_LAME_SIZE;} infra-cache-slabs{COLON} { YDVAR(1, VAR_INFRA_CACHE_SLABS) }
num-queries-per-thread{COLON} { YDOUT; return VAR_NUM_QUERIES_PER_THREAD;} infra-cache-numhosts{COLON} { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
jostle-timeout{COLON} { YDOUT; return VAR_JOSTLE_TIMEOUT;} infra-cache-lame-size{COLON} { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
target-fetch-policy{COLON} { YDOUT; return VAR_TARGET_FETCH_POLICY;} num-queries-per-thread{COLON} { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
harden-short-bufsize{COLON} { YDOUT; return VAR_HARDEN_SHORT_BUFSIZE;} jostle-timeout{COLON} { YDVAR(1, VAR_JOSTLE_TIMEOUT) }
harden-large-queries{COLON} { YDOUT; return VAR_HARDEN_LARGE_QUERIES;} target-fetch-policy{COLON} { YDVAR(1, VAR_TARGET_FETCH_POLICY) }
harden-glue{COLON} { YDOUT; return VAR_HARDEN_GLUE;} harden-short-bufsize{COLON} { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
harden-dnssec-stripped{COLON} { YDOUT; return VAR_HARDEN_DNNSEC_STRIPPED;} harden-large-queries{COLON} { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
harden-referral-path{COLON} { YDOUT; return VAR_HARDEN_REFERRAL_PATH;} harden-glue{COLON} { YDVAR(1, VAR_HARDEN_GLUE) }
use-caps-for-id{COLON} { YDOUT; return VAR_USE_CAPS_FOR_ID;} harden-dnssec-stripped{COLON} { YDVAR(1, VAR_HARDEN_DNNSEC_STRIPPED) }
unwanted-reply-threshold{COLON} { YDOUT; return VAR_UNWANTED_REPLY_THRESHOLD;} harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
private-address{COLON} { YDOUT; return VAR_PRIVATE_ADDRESS;} use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
private-domain{COLON} { YDOUT; return VAR_PRIVATE_DOMAIN;} unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
stub-zone{COLON} { YDOUT; return VAR_STUB_ZONE;} private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) }
name{COLON} { YDOUT; return VAR_NAME;} private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) }
stub-addr{COLON} { YDOUT; return VAR_STUB_ADDR;} stub-zone{COLON} { YDVAR(0, VAR_STUB_ZONE) }
stub-host{COLON} { YDOUT; return VAR_STUB_HOST;} name{COLON} { YDVAR(1, VAR_NAME) }
stub-prime{COLON} { YDOUT; return VAR_STUB_PRIME;} stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) }
forward-zone{COLON} { YDOUT; return VAR_FORWARD_ZONE;} stub-host{COLON} { YDVAR(1, VAR_STUB_HOST) }
forward-addr{COLON} { YDOUT; return VAR_FORWARD_ADDR;} stub-prime{COLON} { YDVAR(1, VAR_STUB_PRIME) }
forward-host{COLON} { YDOUT; return VAR_FORWARD_HOST;} forward-zone{COLON} { YDVAR(0, VAR_FORWARD_ZONE) }
do-not-query-address{COLON} { YDOUT; return VAR_DO_NOT_QUERY_ADDRESS;} forward-addr{COLON} { YDVAR(1, VAR_FORWARD_ADDR) }
do-not-query-localhost{COLON} { YDOUT; return VAR_DO_NOT_QUERY_LOCALHOST;} forward-host{COLON} { YDVAR(1, VAR_FORWARD_HOST) }
access-control{COLON} { YDOUT; return VAR_ACCESS_CONTROL;} do-not-query-address{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
hide-identity{COLON} { YDOUT; return VAR_HIDE_IDENTITY;} do-not-query-localhost{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
hide-version{COLON} { YDOUT; return VAR_HIDE_VERSION;} access-control{COLON} { YDVAR(2, VAR_ACCESS_CONTROL) }
identity{COLON} { YDOUT; return VAR_IDENTITY;} hide-identity{COLON} { YDVAR(1, VAR_HIDE_IDENTITY) }
version{COLON} { YDOUT; return VAR_VERSION;} hide-version{COLON} { YDVAR(1, VAR_HIDE_VERSION) }
module-config{COLON} { YDOUT; return VAR_MODULE_CONF;} identity{COLON} { YDVAR(1, VAR_IDENTITY) }
dlv-anchor{COLON} { YDOUT; return VAR_DLV_ANCHOR;} version{COLON} { YDVAR(1, VAR_VERSION) }
dlv-anchor-file{COLON} { YDOUT; return VAR_DLV_ANCHOR_FILE;} module-config{COLON} { YDVAR(1, VAR_MODULE_CONF) }
trust-anchor-file{COLON} { YDOUT; return VAR_TRUST_ANCHOR_FILE;} dlv-anchor{COLON} { YDVAR(1, VAR_DLV_ANCHOR) }
trusted-keys-file{COLON} { YDOUT; return VAR_TRUSTED_KEYS_FILE;} dlv-anchor-file{COLON} { YDVAR(1, VAR_DLV_ANCHOR_FILE) }
trust-anchor{COLON} { YDOUT; return VAR_TRUST_ANCHOR;} trust-anchor-file{COLON} { YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
val-override-date{COLON} { YDOUT; return VAR_VAL_OVERRIDE_DATE;} trusted-keys-file{COLON} { YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
val-bogus-ttl{COLON} { YDOUT; return VAR_BOGUS_TTL;} trust-anchor{COLON} { YDVAR(1, VAR_TRUST_ANCHOR) }
val-clean-additional{COLON} { YDOUT; return VAR_VAL_CLEAN_ADDITIONAL;} val-override-date{COLON} { YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
val-permissive-mode{COLON} { YDOUT; return VAR_VAL_PERMISSIVE_MODE;} val-bogus-ttl{COLON} { YDVAR(1, VAR_BOGUS_TTL) }
key-cache-size{COLON} { YDOUT; return VAR_KEY_CACHE_SIZE;} val-clean-additional{COLON} { YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
key-cache-slabs{COLON} { YDOUT; return VAR_KEY_CACHE_SLABS;} val-permissive-mode{COLON} { YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
neg-cache-size{COLON} { YDOUT; return VAR_NEG_CACHE_SIZE;} key-cache-size{COLON} { YDVAR(1, VAR_KEY_CACHE_SIZE) }
val-nsec3-keysize-iterations{COLON} { YDOUT; return VAR_VAL_NSEC3_KEYSIZE_ITERATIONS;} key-cache-slabs{COLON} { YDVAR(1, VAR_KEY_CACHE_SLABS) }
use-syslog{COLON} { YDOUT; return VAR_USE_SYSLOG;} neg-cache-size{COLON} { YDVAR(1, VAR_NEG_CACHE_SIZE) }
local-zone{COLON} { YDOUT; return VAR_LOCAL_ZONE;} val-nsec3-keysize-iterations{COLON} {
local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;} YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
local-data-ptr{COLON} { YDOUT; return VAR_LOCAL_DATA_PTR;} use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
statistics-interval{COLON} { YDOUT; return VAR_STATISTICS_INTERVAL;} local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
statistics-cumulative{COLON} { YDOUT; return VAR_STATISTICS_CUMULATIVE;} local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
extended-statistics{COLON} { YDOUT; return VAR_EXTENDED_STATISTICS;} local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
remote-control{COLON} { YDOUT; return VAR_REMOTE_CONTROL; } statistics-interval{COLON} { YDVAR(1, VAR_STATISTICS_INTERVAL) }
control-enable{COLON} { YDOUT; return VAR_CONTROL_ENABLE; } statistics-cumulative{COLON} { YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
control-interface{COLON} { YDOUT; return VAR_CONTROL_INTERFACE; } extended-statistics{COLON} { YDVAR(1, VAR_EXTENDED_STATISTICS) }
control-port{COLON} { YDOUT; return VAR_CONTROL_PORT; } remote-control{COLON} { YDVAR(0, VAR_REMOTE_CONTROL) }
server-key-file{COLON} { YDOUT; return VAR_SERVER_KEY_FILE; } control-enable{COLON} { YDVAR(1, VAR_CONTROL_ENABLE) }
server-cert-file{COLON} { YDOUT; return VAR_SERVER_CERT_FILE; } control-interface{COLON} { YDVAR(1, VAR_CONTROL_INTERFACE) }
control-key-file{COLON} { YDOUT; return VAR_CONTROL_KEY_FILE; } control-port{COLON} { YDVAR(1, VAR_CONTROL_PORT) }
control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; } server-key-file{COLON} { YDVAR(1, VAR_SERVER_KEY_FILE) }
{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;} server-cert-file{COLON} { YDVAR(1, VAR_SERVER_CERT_FILE) }
control-key-file{COLON} { YDVAR(1, VAR_CONTROL_KEY_FILE) }
control-cert-file{COLON} { YDVAR(1, VAR_CONTROL_CERT_FILE) }
<INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
/* Quoted strings. Strip leading and ending quotes */ /* Quoted strings. Strip leading and ending quotes */
\" { BEGIN(quotedstring); LEXOUT(("QS ")); } <val>\" { BEGIN(quotedstring); LEXOUT(("QS ")); }
<quotedstring><<EOF>> { <quotedstring><<EOF>> {
yyerror("EOF inside quoted string"); yyerror("EOF inside quoted string");
BEGIN(INITIAL); if(--num_args == 0) { BEGIN(INITIAL); }
} }
<quotedstring>{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } <quotedstring>{DQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
<quotedstring>\n { cfg_parser->line++; yymore(); } <quotedstring>{NEWLINE} { yyerror("newline inside quoted string, no end \"");
cfg_parser->line++; BEGIN(INITIAL); }
<quotedstring>\" { <quotedstring>\" {
LEXOUT(("QE ")); LEXOUT(("QE "));
BEGIN(INITIAL); if(--num_args == 0) { BEGIN(INITIAL); }
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
yylval.str = strdup(yytext); yylval.str = strdup(yytext);
if(!yylval.str) if(!yylval.str)
@ -222,16 +235,17 @@ control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; }
} }
/* Single Quoted strings. Strip leading and ending quotes */ /* Single Quoted strings. Strip leading and ending quotes */
\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); } <val>\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
<singlequotedstr><<EOF>> { <singlequotedstr><<EOF>> {
yyerror("EOF inside quoted string"); yyerror("EOF inside quoted string");
BEGIN(INITIAL); if(--num_args == 0) { BEGIN(INITIAL); }
} }
<singlequotedstr>{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } <singlequotedstr>{SQANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
<singlequotedstr>\n { cfg_parser->line++; yymore(); } <singlequotedstr>{NEWLINE} { yyerror("newline inside quoted string, no end '");
cfg_parser->line++; BEGIN(INITIAL); }
<singlequotedstr>\' { <singlequotedstr>\' {
LEXOUT(("SQE ")); LEXOUT(("SQE "));
BEGIN(INITIAL); if(--num_args == 0) { BEGIN(INITIAL); }
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
yylval.str = strdup(yytext); yylval.str = strdup(yytext);
if(!yylval.str) if(!yylval.str)
@ -240,10 +254,11 @@ control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; }
} }
/* include: directive */ /* include: directive */
include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); } <INITIAL,val>include{COLON} {
LEXOUT(("v(%s) ", yytext)); inc_prev = YYSTATE; BEGIN(include); }
<include><<EOF>> { <include><<EOF>> {
yyerror("EOF inside include directive"); yyerror("EOF inside include directive");
BEGIN(INITIAL); BEGIN(inc_prev);
} }
<include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ } <include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ }
<include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;} <include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
@ -251,22 +266,22 @@ include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
<include>{UNQUOTEDLETTER}* { <include>{UNQUOTEDLETTER}* {
LEXOUT(("Iunquotedstr(%s) ", yytext)); LEXOUT(("Iunquotedstr(%s) ", yytext));
config_start_include(yytext); config_start_include(yytext);
BEGIN(INITIAL); BEGIN(inc_prev);
} }
<include_quoted><<EOF>> { <include_quoted><<EOF>> {
yyerror("EOF inside quoted string"); yyerror("EOF inside quoted string");
BEGIN(INITIAL); BEGIN(inc_prev);
} }
<include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); } <include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
<include_quoted>{NEWLINE} { yyerror("EOL before \" in include name"); <include_quoted>{NEWLINE} { yyerror("newline before \" in include name");
cfg_parser->line++; BEGIN(INITIAL); } cfg_parser->line++; BEGIN(inc_prev); }
<include_quoted>\" { <include_quoted>\" {
LEXOUT(("IQE ")); LEXOUT(("IQE "));
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
config_start_include(yytext); config_start_include(yytext);
BEGIN(INITIAL); BEGIN(inc_prev);
} }
<INITIAL><<EOF>> { <INITIAL,val><<EOF>> {
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
if (config_include_stack_ptr == 0) { if (config_include_stack_ptr == 0) {
yyterminate(); yyterminate();
@ -276,7 +291,15 @@ include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
} }
} }
{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext)); <val>{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext));
if(--num_args == 0) { BEGIN(INITIAL); }
yylval.str = strdup(yytext); return STRING; } yylval.str = strdup(yytext); return STRING; }
{UNQUOTEDLETTER_NOCOLON}* {
ub_c_error_msg("unknown keyword '%s'", yytext);
}
. {
ub_c_error_msg("stray '%s'", yytext);
}
%% %%