Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
01622260
Commit
01622260
authored
Jan 07, 2017
by
Francis Dupont
Committed by
Tomek Mrugalski
Jan 09, 2017
Browse files
[5020fd] Unspecialized raw/udp, added new syntactic context
parent
cdbfb018
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_lexer.cc
View file @
01622260
...
...
@@ -1670,10 +1670,9 @@ case 15:
YY_RULE_SETUP
#line 199 "dhcp4_lexer.ll"
{
std
::
cout
<<
"RAW regexp"
<<
std
::
endl
;
switch
(
driver
.
ctx_
)
{
case
isc
::
dhcp
::
Parser4Context
::
INTERFACES_CONFIG
:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_
DHCP_SOCKET_TYPE_
RAW
(
driver
.
loc_
);
case
isc
::
dhcp
::
Parser4Context
::
DHCP_SOCKET_TYPE
:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_RAW
(
driver
.
loc_
);
default:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_STRING
(
"raw"
,
driver
.
loc_
);
}
...
...
@@ -1683,10 +1682,9 @@ case 16:
YY_RULE_SETUP
#line 209 "dhcp4_lexer.ll"
{
std
::
cout
<<
"RAW regexp"
<<
std
::
endl
;
switch
(
driver
.
ctx_
)
{
case
isc
::
dhcp
::
Parser4Context
::
INTERFACES_CONFIG
:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_
DHCP_SOCKET_TYPE_
UDP
(
driver
.
loc_
);
case
isc
::
dhcp
::
Parser4Context
::
DHCP_SOCKET_TYPE
:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_UDP
(
driver
.
loc_
);
default:
return
isc
::
dhcp
::
Dhcp4Parser
::
make_STRING
(
"udp"
,
driver
.
loc_
);
}
...
...
src/bin/dhcp4/dhcp4_lexer.ll
View file @
01622260
/
*
Copyright
(
C
)
2016
Internet
Systems
Consortium
,
Inc
.
(
"ISC"
)
/
*
Copyright
(
C
)
2016
-2017
Internet
Systems
Consortium
,
Inc
.
(
"ISC"
)
This
Source
Code
Form
is
subject
to
the
terms
of
the
Mozilla
Public
License
,
v
.
2.0
.
If
a
copy
of
the
MPL
was
not
distributed
with
this
...
...
@@ -197,20 +197,18 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
\"
raw\
" {
std::cout << "
RAW
regexp
" << std::endl;
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::
INTERFACES_CONFIG
:
return isc::dhcp::Dhcp4Parser::make_
DHCP_SOCKET_TYPE_
RAW(driver.loc_);
case isc::dhcp::Parser4Context::
DHCP_SOCKET_TYPE
:
return isc::dhcp::Dhcp4Parser::make_RAW(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
raw
", driver.loc_);
}
}
\"
udp\
" {
std::cout << "
RAW
regexp
" << std::endl;
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::
INTERFACES_CONFIG
:
return isc::dhcp::Dhcp4Parser::make_
DHCP_SOCKET_TYPE_
UDP(driver.loc_);
case isc::dhcp::Parser4Context::
DHCP_SOCKET_TYPE
:
return isc::dhcp::Dhcp4Parser::make_UDP(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
udp
", driver.loc_);
}
...
...
src/bin/dhcp4/dhcp4_parser.cc
View file @
01622260
This diff is collapsed.
Click to expand it.
src/bin/dhcp4/dhcp4_parser.h
View file @
01622260
...
...
@@ -40,7 +40,7 @@
#ifndef YY_PARSER4_DHCP4_PARSER_H_INCLUDED
# define YY_PARSER4_DHCP4_PARSER_H_INCLUDED
// // "%code requires" blocks.
#line 17 "dhcp4_parser.yy" // lalr1.cc:3
77
#line 17 "dhcp4_parser.yy" // lalr1.cc:3
92
#include <string>
#include <cc/data.h>
...
...
@@ -52,7 +52,7 @@ using namespace isc::dhcp;
using
namespace
isc
::
data
;
using
namespace
std
;
#line 56 "dhcp4_parser.h" // lalr1.cc:3
77
#line 56 "dhcp4_parser.h" // lalr1.cc:3
92
# include <cassert>
# include <cstdlib> // std::abort
...
...
@@ -135,9 +135,9 @@ using namespace std;
# endif
/* ! defined YYDEBUG */
#endif
/* ! defined PARSER4_DEBUG */
#line 14 "dhcp4_parser.yy" // lalr1.cc:3
77
#line 14 "dhcp4_parser.yy" // lalr1.cc:3
92
namespace
isc
{
namespace
dhcp
{
#line 141 "dhcp4_parser.h" // lalr1.cc:3
77
#line 141 "dhcp4_parser.h" // lalr1.cc:3
92
...
...
@@ -305,6 +305,7 @@ namespace isc { namespace dhcp {
union
union_type
{
// value
// socket_type
char
dummy1
[
sizeof
(
ElementPtr
)];
// "boolean"
...
...
@@ -352,8 +353,8 @@ namespace isc { namespace dhcp {
TOKEN_INTERFACES_CONFIG
=
266
,
TOKEN_INTERFACES
=
267
,
TOKEN_DHCP_SOCKET_TYPE
=
268
,
TOKEN_
DHCP_SOCKET_TYPE_
RAW
=
269
,
TOKEN_
DHCP_SOCKET_TYPE_
UDP
=
270
,
TOKEN_RAW
=
269
,
TOKEN_UDP
=
270
,
TOKEN_ECHO_CLIENT_ID
=
271
,
TOKEN_MATCH_CLIENT_ID
=
272
,
TOKEN_NEXT_SERVER
=
273
,
...
...
@@ -606,11 +607,11 @@ namespace isc { namespace dhcp {
static
inline
symbol_type
make_
DHCP_SOCKET_TYPE_
RAW
(
const
location_type
&
l
);
make_RAW
(
const
location_type
&
l
);
static
inline
symbol_type
make_
DHCP_SOCKET_TYPE_
UDP
(
const
location_type
&
l
);
make_UDP
(
const
location_type
&
l
);
static
inline
symbol_type
...
...
@@ -1262,6 +1263,7 @@ namespace isc { namespace dhcp {
switch
(
other
.
type_get
())
{
case
116
:
// value
case
155
:
// socket_type
value
.
copy
<
ElementPtr
>
(
other
.
value
);
break
;
...
...
@@ -1299,6 +1301,7 @@ namespace isc { namespace dhcp {
switch
(
this
->
type_get
())
{
case
116
:
// value
case
155
:
// socket_type
value
.
copy
<
ElementPtr
>
(
v
);
break
;
...
...
@@ -1395,6 +1398,7 @@ namespace isc { namespace dhcp {
switch
(
yytype
)
{
case
116
:
// value
case
155
:
// socket_type
value
.
template
destroy
<
ElementPtr
>
();
break
;
...
...
@@ -1438,6 +1442,7 @@ namespace isc { namespace dhcp {
switch
(
this
->
type_get
())
{
case
116
:
// value
case
155
:
// socket_type
value
.
move
<
ElementPtr
>
(
s
.
value
);
break
;
...
...
@@ -1600,15 +1605,15 @@ namespace isc { namespace dhcp {
}
Dhcp4Parser
::
symbol_type
Dhcp4Parser
::
make_
DHCP_SOCKET_TYPE_
RAW
(
const
location_type
&
l
)
Dhcp4Parser
::
make_RAW
(
const
location_type
&
l
)
{
return
symbol_type
(
token
::
TOKEN_
DHCP_SOCKET_TYPE_
RAW
,
l
);
return
symbol_type
(
token
::
TOKEN_RAW
,
l
);
}
Dhcp4Parser
::
symbol_type
Dhcp4Parser
::
make_
DHCP_SOCKET_TYPE_
UDP
(
const
location_type
&
l
)
Dhcp4Parser
::
make_UDP
(
const
location_type
&
l
)
{
return
symbol_type
(
token
::
TOKEN_
DHCP_SOCKET_TYPE_
UDP
,
l
);
return
symbol_type
(
token
::
TOKEN_UDP
,
l
);
}
Dhcp4Parser
::
symbol_type
...
...
@@ -2140,9 +2145,9 @@ namespace isc { namespace dhcp {
}
#line 14 "dhcp4_parser.yy" // lalr1.cc:3
77
#line 14 "dhcp4_parser.yy" // lalr1.cc:3
92
}
}
// isc::dhcp
#line 21
46
"dhcp4_parser.h" // lalr1.cc:3
77
#line 21
51
"dhcp4_parser.h" // lalr1.cc:3
92
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
01622260
/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2016
-2017
Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -53,8 +53,8 @@ using namespace std;
INTERFACES_CONFIG "interfaces-config"
INTERFACES "interfaces"
DHCP_SOCKET_TYPE "dhcp-socket-type"
DHCP_SOCKET_TYPE_
RAW "raw"
DHCP_SOCKET_TYPE_
UDP "udp"
RAW "raw"
UDP "udp"
ECHO_CLIENT_ID "echo-client-id"
MATCH_CLIENT_ID "match-client-id"
...
...
@@ -187,6 +187,7 @@ using namespace std;
%token <bool> BOOLEAN "boolean"
%type <ElementPtr> value
%type <ElementPtr> socket_type
%printer { yyoutput << $$; } <*>;
...
...
@@ -445,19 +446,16 @@ interfaces_list: INTERFACES {
ctx.leave();
};
dhcp_socket_type: dhcp_socket_type_raw
| dhcp_socket_type_udp
;
dhcp_socket_type_raw: DHCP_SOCKET_TYPE COLON DHCP_SOCKET_TYPE_RAW {
ElementPtr type(new StringElement("raw", ctx.loc2pos(@3)));
ctx.stack_.back()->set("dhcp-socket-type", type);
dhcp_socket_type: DHCP_SOCKET_TYPE {
ctx.enter(ctx.DHCP_SOCKET_TYPE);
} COLON socket_type {
ctx.stack_.back()->set("dhcp-socket-type", $4);
ctx.leave();
};
dhcp_socket_type_udp: DHCP_SOCKET_TYPE COLON DHCP_SOCKET_TYPE_UDP {
ElementPtr type(new StringElement("udp", ctx.loc2pos(@3)));
ctx.stack_.back()->set("dhcp-socket-type", type);
};
socket_type: RAW { $$ = ElementPtr(new StringElement("raw", ctx.loc2pos(@1))); }
| UDP { $$ = ElementPtr(new StringElement("udp", ctx.loc2pos(@1))); }
;
lease_database: LEASE_DATABASE {
ElementPtr i(new MapElement(ctx.loc2pos(@1)));
...
...
@@ -1371,11 +1369,11 @@ control_socket_params: control_socket_param
| control_socket_params COMMA control_socket_param
;
control_socket_param: socket_type
| socket_name
control_socket_param:
control_
socket_type
|
control_
socket_name
;
socket_type: SOCKET_TYPE {
control_
socket_type: SOCKET_TYPE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr stype(new StringElement($4, ctx.loc2pos(@4)));
...
...
@@ -1383,7 +1381,7 @@ socket_type: SOCKET_TYPE {
ctx.leave();
};
socket_name: SOCKET_NAME {
control_
socket_name: SOCKET_NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr name(new StringElement($4, ctx.loc2pos(@4)));
...
...
src/bin/dhcp4/parser_context.cc
View file @
01622260
// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2016
-2017
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -127,6 +127,8 @@ Parser4Context::contextName()
return
(
"Logging"
);
case
INTERFACES_CONFIG
:
return
(
"interfaces-config"
);
case
DHCP_SOCKET_TYPE
:
return
(
"dhcp-socket-type"
);
case
LEASE_DATABASE
:
return
(
"lease-database"
);
case
HOSTS_DATABASE
:
...
...
src/bin/dhcp4/parser_context.h
View file @
01622260
// Copyright (C) 2015-201
6
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-201
7
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -193,6 +193,9 @@ public:
/// Used while parsing Dhcp4/interfaces structures.
INTERFACES_CONFIG
,
/// Used while parsing Dhcp4/interfaces/dhcp-socket-type structures.
DHCP_SOCKET_TYPE
,
/// Used while parsing Dhcp4/lease-database structures.
LEASE_DATABASE
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment