- 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: https://unbound.nlnetlabs.nl/svn/trunk@1460 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
931ad02a30
commit
727fc21dad
@ -3,6 +3,9 @@
|
||||
- iana portlist updated.
|
||||
- fixup EOL in include directive (reported by Paul Wouters).
|
||||
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
|
||||
- ldns 1.5.0 rc as tarball included.
|
||||
|
1996
util/configlexer.c
1996
util/configlexer.c
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,13 @@ void ub_c_error(const char *message);
|
||||
#define LEXOUT(s)
|
||||
#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 {
|
||||
char* filename;
|
||||
@ -34,6 +40,8 @@ struct inc_state {
|
||||
static struct inc_state parse_stack[MAXINCLUDES];
|
||||
static YY_BUFFER_STATE include_stack[MAXINCLUDES];
|
||||
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)
|
||||
{
|
||||
@ -100,120 +108,125 @@ static void config_end_include(void)
|
||||
SPACE [ \t]
|
||||
LETTER [a-zA-Z]
|
||||
UNQUOTEDLETTER [^\'\"\n\r \t\\]|\\.
|
||||
UNQUOTEDLETTER_NOCOLON [^\:\'\"\n\r \t\\]|\\.
|
||||
NEWLINE [\r\n]
|
||||
COMMENT \#
|
||||
COLON \:
|
||||
DQANY [^\"\n\r\\]|\\.
|
||||
SQANY [^\'\n\r\\]|\\.
|
||||
|
||||
%x quotedstring singlequotedstr include include_quoted
|
||||
%x quotedstring singlequotedstr include include_quoted val
|
||||
|
||||
%%
|
||||
{SPACE}* { LEXOUT(("SP ")); /* ignore */ }
|
||||
{SPACE}*{COMMENT}.* { LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
|
||||
server{COLON} { YDOUT; return VAR_SERVER;}
|
||||
num-threads{COLON} { YDOUT; return VAR_NUM_THREADS;}
|
||||
verbosity{COLON} { YDOUT; return VAR_VERBOSITY;}
|
||||
port{COLON} { YDOUT; return VAR_PORT;}
|
||||
outgoing-range{COLON} { YDOUT; return VAR_OUTGOING_RANGE;}
|
||||
outgoing-port-permit{COLON} { YDOUT; return VAR_OUTGOING_PORT_PERMIT;}
|
||||
outgoing-port-avoid{COLON} { YDOUT; return VAR_OUTGOING_PORT_AVOID;}
|
||||
outgoing-num-tcp{COLON} { YDOUT; return VAR_OUTGOING_NUM_TCP;}
|
||||
incoming-num-tcp{COLON} { YDOUT; return VAR_INCOMING_NUM_TCP;}
|
||||
do-ip4{COLON} { YDOUT; return VAR_DO_IP4;}
|
||||
do-ip6{COLON} { YDOUT; return VAR_DO_IP6;}
|
||||
do-udp{COLON} { YDOUT; return VAR_DO_UDP;}
|
||||
do-tcp{COLON} { YDOUT; return VAR_DO_TCP;}
|
||||
do-daemonize{COLON} { YDOUT; return VAR_DO_DAEMONIZE;}
|
||||
interface{COLON} { YDOUT; return VAR_INTERFACE;}
|
||||
outgoing-interface{COLON} { YDOUT; return VAR_OUTGOING_INTERFACE;}
|
||||
interface-automatic{COLON} { YDOUT; return VAR_INTERFACE_AUTOMATIC;}
|
||||
chroot{COLON} { YDOUT; return VAR_CHROOT;}
|
||||
username{COLON} { YDOUT; return VAR_USERNAME;}
|
||||
directory{COLON} { YDOUT; return VAR_DIRECTORY;}
|
||||
logfile{COLON} { YDOUT; return VAR_LOGFILE;}
|
||||
pidfile{COLON} { YDOUT; return VAR_PIDFILE;}
|
||||
root-hints{COLON} { YDOUT; return VAR_ROOT_HINTS;}
|
||||
msg-buffer-size{COLON} { YDOUT; return VAR_MSG_BUFFER_SIZE;}
|
||||
msg-cache-size{COLON} { YDOUT; return VAR_MSG_CACHE_SIZE;}
|
||||
msg-cache-slabs{COLON} { YDOUT; return VAR_MSG_CACHE_SLABS;}
|
||||
rrset-cache-size{COLON} { YDOUT; return VAR_RRSET_CACHE_SIZE;}
|
||||
rrset-cache-slabs{COLON} { YDOUT; return VAR_RRSET_CACHE_SLABS;}
|
||||
cache-max-ttl{COLON} { YDOUT; return VAR_CACHE_MAX_TTL;}
|
||||
infra-host-ttl{COLON} { YDOUT; return VAR_INFRA_HOST_TTL;}
|
||||
infra-lame-ttl{COLON} { YDOUT; return VAR_INFRA_LAME_TTL;}
|
||||
infra-cache-slabs{COLON} { YDOUT; return VAR_INFRA_CACHE_SLABS;}
|
||||
infra-cache-numhosts{COLON} { YDOUT; return VAR_INFRA_CACHE_NUMHOSTS;}
|
||||
infra-cache-lame-size{COLON} { YDOUT; return VAR_INFRA_CACHE_LAME_SIZE;}
|
||||
num-queries-per-thread{COLON} { YDOUT; return VAR_NUM_QUERIES_PER_THREAD;}
|
||||
jostle-timeout{COLON} { YDOUT; return VAR_JOSTLE_TIMEOUT;}
|
||||
target-fetch-policy{COLON} { YDOUT; return VAR_TARGET_FETCH_POLICY;}
|
||||
harden-short-bufsize{COLON} { YDOUT; return VAR_HARDEN_SHORT_BUFSIZE;}
|
||||
harden-large-queries{COLON} { YDOUT; return VAR_HARDEN_LARGE_QUERIES;}
|
||||
harden-glue{COLON} { YDOUT; return VAR_HARDEN_GLUE;}
|
||||
harden-dnssec-stripped{COLON} { YDOUT; return VAR_HARDEN_DNNSEC_STRIPPED;}
|
||||
harden-referral-path{COLON} { YDOUT; return VAR_HARDEN_REFERRAL_PATH;}
|
||||
use-caps-for-id{COLON} { YDOUT; return VAR_USE_CAPS_FOR_ID;}
|
||||
unwanted-reply-threshold{COLON} { YDOUT; return VAR_UNWANTED_REPLY_THRESHOLD;}
|
||||
private-address{COLON} { YDOUT; return VAR_PRIVATE_ADDRESS;}
|
||||
private-domain{COLON} { YDOUT; return VAR_PRIVATE_DOMAIN;}
|
||||
stub-zone{COLON} { YDOUT; return VAR_STUB_ZONE;}
|
||||
name{COLON} { YDOUT; return VAR_NAME;}
|
||||
stub-addr{COLON} { YDOUT; return VAR_STUB_ADDR;}
|
||||
stub-host{COLON} { YDOUT; return VAR_STUB_HOST;}
|
||||
stub-prime{COLON} { YDOUT; return VAR_STUB_PRIME;}
|
||||
forward-zone{COLON} { YDOUT; return VAR_FORWARD_ZONE;}
|
||||
forward-addr{COLON} { YDOUT; return VAR_FORWARD_ADDR;}
|
||||
forward-host{COLON} { YDOUT; return VAR_FORWARD_HOST;}
|
||||
do-not-query-address{COLON} { YDOUT; return VAR_DO_NOT_QUERY_ADDRESS;}
|
||||
do-not-query-localhost{COLON} { YDOUT; return VAR_DO_NOT_QUERY_LOCALHOST;}
|
||||
access-control{COLON} { YDOUT; return VAR_ACCESS_CONTROL;}
|
||||
hide-identity{COLON} { YDOUT; return VAR_HIDE_IDENTITY;}
|
||||
hide-version{COLON} { YDOUT; return VAR_HIDE_VERSION;}
|
||||
identity{COLON} { YDOUT; return VAR_IDENTITY;}
|
||||
version{COLON} { YDOUT; return VAR_VERSION;}
|
||||
module-config{COLON} { YDOUT; return VAR_MODULE_CONF;}
|
||||
dlv-anchor{COLON} { YDOUT; return VAR_DLV_ANCHOR;}
|
||||
dlv-anchor-file{COLON} { YDOUT; return VAR_DLV_ANCHOR_FILE;}
|
||||
trust-anchor-file{COLON} { YDOUT; return VAR_TRUST_ANCHOR_FILE;}
|
||||
trusted-keys-file{COLON} { YDOUT; return VAR_TRUSTED_KEYS_FILE;}
|
||||
trust-anchor{COLON} { YDOUT; return VAR_TRUST_ANCHOR;}
|
||||
val-override-date{COLON} { YDOUT; return VAR_VAL_OVERRIDE_DATE;}
|
||||
val-bogus-ttl{COLON} { YDOUT; return VAR_BOGUS_TTL;}
|
||||
val-clean-additional{COLON} { YDOUT; return VAR_VAL_CLEAN_ADDITIONAL;}
|
||||
val-permissive-mode{COLON} { YDOUT; return VAR_VAL_PERMISSIVE_MODE;}
|
||||
key-cache-size{COLON} { YDOUT; return VAR_KEY_CACHE_SIZE;}
|
||||
key-cache-slabs{COLON} { YDOUT; return VAR_KEY_CACHE_SLABS;}
|
||||
neg-cache-size{COLON} { YDOUT; return VAR_NEG_CACHE_SIZE;}
|
||||
val-nsec3-keysize-iterations{COLON} { YDOUT; return VAR_VAL_NSEC3_KEYSIZE_ITERATIONS;}
|
||||
use-syslog{COLON} { YDOUT; return VAR_USE_SYSLOG;}
|
||||
local-zone{COLON} { YDOUT; return VAR_LOCAL_ZONE;}
|
||||
local-data{COLON} { YDOUT; return VAR_LOCAL_DATA;}
|
||||
local-data-ptr{COLON} { YDOUT; return VAR_LOCAL_DATA_PTR;}
|
||||
statistics-interval{COLON} { YDOUT; return VAR_STATISTICS_INTERVAL;}
|
||||
statistics-cumulative{COLON} { YDOUT; return VAR_STATISTICS_CUMULATIVE;}
|
||||
extended-statistics{COLON} { YDOUT; return VAR_EXTENDED_STATISTICS;}
|
||||
remote-control{COLON} { YDOUT; return VAR_REMOTE_CONTROL; }
|
||||
control-enable{COLON} { YDOUT; return VAR_CONTROL_ENABLE; }
|
||||
control-interface{COLON} { YDOUT; return VAR_CONTROL_INTERFACE; }
|
||||
control-port{COLON} { YDOUT; return VAR_CONTROL_PORT; }
|
||||
server-key-file{COLON} { YDOUT; return VAR_SERVER_KEY_FILE; }
|
||||
server-cert-file{COLON} { YDOUT; return VAR_SERVER_CERT_FILE; }
|
||||
control-key-file{COLON} { YDOUT; return VAR_CONTROL_KEY_FILE; }
|
||||
control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; }
|
||||
{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
|
||||
<INITIAL,val>{SPACE}* {
|
||||
LEXOUT(("SP ")); /* ignore */ }
|
||||
<INITIAL,val>{SPACE}*{COMMENT}.*$ {
|
||||
LEXOUT(("comment(%s) ", yytext)); /* ignore */ }
|
||||
server{COLON} { YDVAR(0, VAR_SERVER) }
|
||||
num-threads{COLON} { YDVAR(1, VAR_NUM_THREADS) }
|
||||
verbosity{COLON} { YDVAR(1, VAR_VERBOSITY) }
|
||||
port{COLON} { YDVAR(1, VAR_PORT) }
|
||||
outgoing-range{COLON} { YDVAR(1, VAR_OUTGOING_RANGE) }
|
||||
outgoing-port-permit{COLON} { YDVAR(1, VAR_OUTGOING_PORT_PERMIT) }
|
||||
outgoing-port-avoid{COLON} { YDVAR(1, VAR_OUTGOING_PORT_AVOID) }
|
||||
outgoing-num-tcp{COLON} { YDVAR(1, VAR_OUTGOING_NUM_TCP) }
|
||||
incoming-num-tcp{COLON} { YDVAR(1, VAR_INCOMING_NUM_TCP) }
|
||||
do-ip4{COLON} { YDVAR(1, VAR_DO_IP4) }
|
||||
do-ip6{COLON} { YDVAR(1, VAR_DO_IP6) }
|
||||
do-udp{COLON} { YDVAR(1, VAR_DO_UDP) }
|
||||
do-tcp{COLON} { YDVAR(1, VAR_DO_TCP) }
|
||||
do-daemonize{COLON} { YDVAR(1, VAR_DO_DAEMONIZE) }
|
||||
interface{COLON} { YDVAR(1, VAR_INTERFACE) }
|
||||
outgoing-interface{COLON} { YDVAR(1, VAR_OUTGOING_INTERFACE) }
|
||||
interface-automatic{COLON} { YDVAR(1, VAR_INTERFACE_AUTOMATIC) }
|
||||
chroot{COLON} { YDVAR(1, VAR_CHROOT) }
|
||||
username{COLON} { YDVAR(1, VAR_USERNAME) }
|
||||
directory{COLON} { YDVAR(1, VAR_DIRECTORY) }
|
||||
logfile{COLON} { YDVAR(1, VAR_LOGFILE) }
|
||||
pidfile{COLON} { YDVAR(1, VAR_PIDFILE) }
|
||||
root-hints{COLON} { YDVAR(1, VAR_ROOT_HINTS) }
|
||||
msg-buffer-size{COLON} { YDVAR(1, VAR_MSG_BUFFER_SIZE) }
|
||||
msg-cache-size{COLON} { YDVAR(1, VAR_MSG_CACHE_SIZE) }
|
||||
msg-cache-slabs{COLON} { YDVAR(1, VAR_MSG_CACHE_SLABS) }
|
||||
rrset-cache-size{COLON} { YDVAR(1, VAR_RRSET_CACHE_SIZE) }
|
||||
rrset-cache-slabs{COLON} { YDVAR(1, VAR_RRSET_CACHE_SLABS) }
|
||||
cache-max-ttl{COLON} { YDVAR(1, VAR_CACHE_MAX_TTL) }
|
||||
infra-host-ttl{COLON} { YDVAR(1, VAR_INFRA_HOST_TTL) }
|
||||
infra-lame-ttl{COLON} { YDVAR(1, VAR_INFRA_LAME_TTL) }
|
||||
infra-cache-slabs{COLON} { YDVAR(1, VAR_INFRA_CACHE_SLABS) }
|
||||
infra-cache-numhosts{COLON} { YDVAR(1, VAR_INFRA_CACHE_NUMHOSTS) }
|
||||
infra-cache-lame-size{COLON} { YDVAR(1, VAR_INFRA_CACHE_LAME_SIZE) }
|
||||
num-queries-per-thread{COLON} { YDVAR(1, VAR_NUM_QUERIES_PER_THREAD) }
|
||||
jostle-timeout{COLON} { YDVAR(1, VAR_JOSTLE_TIMEOUT) }
|
||||
target-fetch-policy{COLON} { YDVAR(1, VAR_TARGET_FETCH_POLICY) }
|
||||
harden-short-bufsize{COLON} { YDVAR(1, VAR_HARDEN_SHORT_BUFSIZE) }
|
||||
harden-large-queries{COLON} { YDVAR(1, VAR_HARDEN_LARGE_QUERIES) }
|
||||
harden-glue{COLON} { YDVAR(1, VAR_HARDEN_GLUE) }
|
||||
harden-dnssec-stripped{COLON} { YDVAR(1, VAR_HARDEN_DNNSEC_STRIPPED) }
|
||||
harden-referral-path{COLON} { YDVAR(1, VAR_HARDEN_REFERRAL_PATH) }
|
||||
use-caps-for-id{COLON} { YDVAR(1, VAR_USE_CAPS_FOR_ID) }
|
||||
unwanted-reply-threshold{COLON} { YDVAR(1, VAR_UNWANTED_REPLY_THRESHOLD) }
|
||||
private-address{COLON} { YDVAR(1, VAR_PRIVATE_ADDRESS) }
|
||||
private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) }
|
||||
stub-zone{COLON} { YDVAR(0, VAR_STUB_ZONE) }
|
||||
name{COLON} { YDVAR(1, VAR_NAME) }
|
||||
stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) }
|
||||
stub-host{COLON} { YDVAR(1, VAR_STUB_HOST) }
|
||||
stub-prime{COLON} { YDVAR(1, VAR_STUB_PRIME) }
|
||||
forward-zone{COLON} { YDVAR(0, VAR_FORWARD_ZONE) }
|
||||
forward-addr{COLON} { YDVAR(1, VAR_FORWARD_ADDR) }
|
||||
forward-host{COLON} { YDVAR(1, VAR_FORWARD_HOST) }
|
||||
do-not-query-address{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_ADDRESS) }
|
||||
do-not-query-localhost{COLON} { YDVAR(1, VAR_DO_NOT_QUERY_LOCALHOST) }
|
||||
access-control{COLON} { YDVAR(2, VAR_ACCESS_CONTROL) }
|
||||
hide-identity{COLON} { YDVAR(1, VAR_HIDE_IDENTITY) }
|
||||
hide-version{COLON} { YDVAR(1, VAR_HIDE_VERSION) }
|
||||
identity{COLON} { YDVAR(1, VAR_IDENTITY) }
|
||||
version{COLON} { YDVAR(1, VAR_VERSION) }
|
||||
module-config{COLON} { YDVAR(1, VAR_MODULE_CONF) }
|
||||
dlv-anchor{COLON} { YDVAR(1, VAR_DLV_ANCHOR) }
|
||||
dlv-anchor-file{COLON} { YDVAR(1, VAR_DLV_ANCHOR_FILE) }
|
||||
trust-anchor-file{COLON} { YDVAR(1, VAR_TRUST_ANCHOR_FILE) }
|
||||
trusted-keys-file{COLON} { YDVAR(1, VAR_TRUSTED_KEYS_FILE) }
|
||||
trust-anchor{COLON} { YDVAR(1, VAR_TRUST_ANCHOR) }
|
||||
val-override-date{COLON} { YDVAR(1, VAR_VAL_OVERRIDE_DATE) }
|
||||
val-bogus-ttl{COLON} { YDVAR(1, VAR_BOGUS_TTL) }
|
||||
val-clean-additional{COLON} { YDVAR(1, VAR_VAL_CLEAN_ADDITIONAL) }
|
||||
val-permissive-mode{COLON} { YDVAR(1, VAR_VAL_PERMISSIVE_MODE) }
|
||||
key-cache-size{COLON} { YDVAR(1, VAR_KEY_CACHE_SIZE) }
|
||||
key-cache-slabs{COLON} { YDVAR(1, VAR_KEY_CACHE_SLABS) }
|
||||
neg-cache-size{COLON} { YDVAR(1, VAR_NEG_CACHE_SIZE) }
|
||||
val-nsec3-keysize-iterations{COLON} {
|
||||
YDVAR(1, VAR_VAL_NSEC3_KEYSIZE_ITERATIONS) }
|
||||
use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
|
||||
local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
|
||||
local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
|
||||
local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
|
||||
statistics-interval{COLON} { YDVAR(1, VAR_STATISTICS_INTERVAL) }
|
||||
statistics-cumulative{COLON} { YDVAR(1, VAR_STATISTICS_CUMULATIVE) }
|
||||
extended-statistics{COLON} { YDVAR(1, VAR_EXTENDED_STATISTICS) }
|
||||
remote-control{COLON} { YDVAR(0, VAR_REMOTE_CONTROL) }
|
||||
control-enable{COLON} { YDVAR(1, VAR_CONTROL_ENABLE) }
|
||||
control-interface{COLON} { YDVAR(1, VAR_CONTROL_INTERFACE) }
|
||||
control-port{COLON} { YDVAR(1, VAR_CONTROL_PORT) }
|
||||
server-key-file{COLON} { YDVAR(1, VAR_SERVER_KEY_FILE) }
|
||||
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 */
|
||||
\" { BEGIN(quotedstring); LEXOUT(("QS ")); }
|
||||
<val>\" { BEGIN(quotedstring); LEXOUT(("QS ")); }
|
||||
<quotedstring><<EOF>> {
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
if(--num_args == 0) { BEGIN(INITIAL); }
|
||||
}
|
||||
<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>\" {
|
||||
LEXOUT(("QE "));
|
||||
BEGIN(INITIAL);
|
||||
if(--num_args == 0) { BEGIN(INITIAL); }
|
||||
yytext[yyleng - 1] = '\0';
|
||||
yylval.str = strdup(yytext);
|
||||
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 */
|
||||
\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
|
||||
<val>\' { BEGIN(singlequotedstr); LEXOUT(("SQS ")); }
|
||||
<singlequotedstr><<EOF>> {
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
if(--num_args == 0) { BEGIN(INITIAL); }
|
||||
}
|
||||
<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>\' {
|
||||
LEXOUT(("SQE "));
|
||||
BEGIN(INITIAL);
|
||||
if(--num_args == 0) { BEGIN(INITIAL); }
|
||||
yytext[yyleng - 1] = '\0';
|
||||
yylval.str = strdup(yytext);
|
||||
if(!yylval.str)
|
||||
@ -240,10 +254,11 @@ control-cert-file{COLON} { YDOUT; return VAR_CONTROL_CERT_FILE; }
|
||||
}
|
||||
|
||||
/* 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>> {
|
||||
yyerror("EOF inside include directive");
|
||||
BEGIN(INITIAL);
|
||||
BEGIN(inc_prev);
|
||||
}
|
||||
<include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ }
|
||||
<include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
|
||||
@ -251,22 +266,22 @@ include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
|
||||
<include>{UNQUOTEDLETTER}* {
|
||||
LEXOUT(("Iunquotedstr(%s) ", yytext));
|
||||
config_start_include(yytext);
|
||||
BEGIN(INITIAL);
|
||||
BEGIN(inc_prev);
|
||||
}
|
||||
<include_quoted><<EOF>> {
|
||||
yyerror("EOF inside quoted string");
|
||||
BEGIN(INITIAL);
|
||||
BEGIN(inc_prev);
|
||||
}
|
||||
<include_quoted>{DQANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
|
||||
<include_quoted>{NEWLINE} { yyerror("EOL before \" in include name");
|
||||
cfg_parser->line++; BEGIN(INITIAL); }
|
||||
<include_quoted>{NEWLINE} { yyerror("newline before \" in include name");
|
||||
cfg_parser->line++; BEGIN(inc_prev); }
|
||||
<include_quoted>\" {
|
||||
LEXOUT(("IQE "));
|
||||
yytext[yyleng - 1] = '\0';
|
||||
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. */
|
||||
if (config_include_stack_ptr == 0) {
|
||||
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; }
|
||||
|
||||
{UNQUOTEDLETTER_NOCOLON}* {
|
||||
ub_c_error_msg("unknown keyword '%s'", yytext);
|
||||
}
|
||||
. {
|
||||
ub_c_error_msg("stray '%s'", yytext);
|
||||
}
|
||||
|
||||
%%
|
||||
|
Loading…
Reference in New Issue
Block a user