Commit c4cd450f authored by Francis Dupont's avatar Francis Dupont
Browse files

[4204fd] Applied my proposed changes

parent 83a7bf90
......@@ -161,7 +161,7 @@
<row><entry>Hex String</entry><entry>0XABCD</entry><entry>A hexadecimal string</entry></row>
<row><entry>Integer</entry><entry>123</entry><entry>An integer value</entry></row>
<row><entry>Option Text</entry><entry>option[code].text</entry><entry>The value of the option with code "code" from the packet as text</entry></row>
<row><entry>Option Hex</entry><entry>option[code].hex</entry><entry>The value of the option with code "code" from the packet as hex</entry></row>
<row><entry>Option Bin</entry><entry>option[code].bin</entry><entry>The value of the option with code "code" from the packet as binary</entry></row>
</tbody>
</tgroup>
</table>
......@@ -178,8 +178,8 @@
<para>
"option[code]" extracts the value of the option with the given code
from the incoming packet. If the packet doesn't contain the option, it
returns the empty string. The string can be presented as text or hex
with the ".text" or ".hex" modifiers. In both cases only the payload
returns the empty string. The string can be presented as text or binary
with the ".text" or ".bin" modifiers. In both cases only the payload
is presented; the type code and length fields are not included.
</para>
......@@ -297,7 +297,7 @@
"client-classes": [<userinput>
{
"name": "Client_enterprise",
"test": "substring(option[2].hex,0,6) == 0x0002AABBCCDD'",
"test": "substring(option[2].bin,0,6) == 0x0002AABBCCDD'",
"option-data": [
{
"name": "dns-servers",
......@@ -370,7 +370,7 @@
"client-classes": [
{
"name": "Client_enterprise",
"test": "substring(option[2].hex,0,6) == 0x0002AABBCCDD'",
"test": "substring(option[2].bin,0,6) == 0x0002AABBCCDD'",
"option-data": [
{
"name": "dns-servers",
......
......@@ -1615,7 +1615,7 @@ should include options from the isc option space:
"client-classes": [
{<userinput>
"name": "Client_enterprise",
"test": "substring(option[2].hex,0,6) == 0x0002AABBCCDD'",
"test": "substring(option[2].bin,0,6) == 0x0002AABBCCDD'",
"option-data": [
{
"name": "dns-servers",
......
......@@ -1766,6 +1766,101 @@ TEST_F(Dhcpv4SrvTest, matchClassification) {
EXPECT_FALSE(opt3);
}
// Checks if client packets are classified properly using match expressions
// using option names
TEST_F(Dhcpv4SrvTest, matchClassificationOptionName) {
NakedDhcpv4Srv srv(0);
// The router class matches incoming packets with foo in a host-name
string config = "{ \"interfaces-config\": {"
" \"interfaces\": [ \"*\" ] }, "
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000, "
"\"subnet4\": [ "
"{ \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ], "
" \"subnet\": \"192.0.2.0/24\" } ], "
"\"client-classes\": [ "
"{ \"name\": \"router\", "
" \"test\": \"option[host-name].text == 'foo'\" } ] }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr status;
// Configure the server and make sure the config is accepted
EXPECT_NO_THROW(status = configureDhcp4Server(srv, json));
ASSERT_TRUE(status);
comment_ = config::parseAnswer(rcode_, status);
ASSERT_EQ(0, rcode_);
CfgMgr::instance().commit();
// Create a packet with enough to select the subnet
Pkt4Ptr query(new Pkt4(DHCPDISCOVER, 1234));
query->setRemoteAddr(IOAddress("192.0.2.1"));
// Create and add a host-name option to the query
OptionStringPtr hostname(new OptionString(Option::V4, 12, "foo"));
ASSERT_TRUE(hostname);
query->addOption(hostname);
// Classify packets
srv.classifyPacket(query);
// The queey should be in the router class
EXPECT_TRUE(query->inClass("router"));
}
// Checks if client packets are classified properly using match expressions
// using option names and definitions
TEST_F(Dhcpv4SrvTest, matchClassificationOptionDef) {
NakedDhcpv4Srv srv(0);
// The router class matches incoming packets with foo in a defined
// option
string config = "{ \"interfaces-config\": {"
" \"interfaces\": [ \"*\" ] }, "
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"valid-lifetime\": 4000, "
"\"subnet4\": [ "
"{ \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ], "
" \"subnet\": \"192.0.2.0/24\" } ], "
"\"client-classes\": [ "
"{ \"name\": \"router\", "
" \"test\": \"option[my-host-name].text == 'foo'\" } ], "
"\"option-def\": [ {"
" \"name\": \"my-host-name\", "
" \"code\": 250, "
" \"type\": \"string\" } ] }";
ElementPtr json = Element::fromJSON(config);
ConstElementPtr status;
// Configure the server and make sure the config is accepted
EXPECT_NO_THROW(status = configureDhcp4Server(srv, json));
ASSERT_TRUE(status);
comment_ = config::parseAnswer(rcode_, status);
ASSERT_EQ(0, rcode_);
CfgMgr::instance().commit();
// Create a packet with enough to select the subnet
Pkt4Ptr query(new Pkt4(DHCPDISCOVER, 1234));
query->setRemoteAddr(IOAddress("192.0.2.1"));
// Create and add a my-host-name option to the query
OptionStringPtr hostname(new OptionString(Option::V4, 250, "foo"));
ASSERT_TRUE(hostname);
query->addOption(hostname);
// Classify packets
srv.classifyPacket(query);
// The queey should be in the router class
EXPECT_TRUE(query->inClass("router"));
}
// Checks subnet options have the priority over class options
TEST_F(Dhcpv4SrvTest, subnetClassPriority) {
IfaceMgrTestConfig test_config(true);
......
......@@ -1837,6 +1837,7 @@ TEST_F(Dhcpv6SrvTest, docsisClientClassification) {
}
// Checks if client packets are classified properly using match expressions.
// Note option names and definitions are used.
TEST_F(Dhcpv6SrvTest, matchClassification) {
IfaceMgrTestConfig test_config(true);
......@@ -1866,7 +1867,7 @@ TEST_F(Dhcpv6SrvTest, matchClassification) {
" \"option-data\": ["
" { \"name\": \"ipv6-forwarding\", "
" \"data\": \"true\" } ], "
" \"test\": \"option[1234].text == 'foo'\" } ] }";
" \"test\": \"option[host-name].text == 'foo'\" } ] }";
ASSERT_NO_THROW(configure(config));
// Create packets with enough to select the subnet
......
......@@ -229,7 +229,7 @@ Option::toBinary(const bool include_header) {
pack(buf);
} catch (const std::exception &ex) {
isc_throw(OutOfRange, "unable to obtain hexadecimal representation"
isc_throw(OutOfRange, "unable to obtain binary representation"
" of option " << getType() << ": " << ex.what());
}
const uint8_t* option_data = static_cast<const uint8_t*>(buf.getData());
......
......@@ -182,19 +182,19 @@ TEST_F(ExpressionParserTest, validExpressionWithOptionName4) {
"hundred4");
}
// Verifies that given a valid expression using .hex operator for option, the
// Verifies that given a valid expression using .bin operator for option, the
// ExpressionParser produces an Expression which can be evaluated against
// a v4 packet.
TEST_F(ExpressionParserTest, validExpressionWithHex4) {
testValidExpression<Pkt4>(Option::V4, "\"option[12].hex == 0x68756E6472656434\"",
TEST_F(ExpressionParserTest, validExpressionWithBin4) {
testValidExpression<Pkt4>(Option::V4, "\"option[12].bin == 0x68756E6472656434\"",
"hundred4");
}
// Verifies that the option name can be used together with .hex operator in
// Verifies that the option name can be used together with .bin operator in
// the evaluated expression.
TEST_F(ExpressionParserTest, validExpressionWithOptionNameAndHex4) {
TEST_F(ExpressionParserTest, validExpressionWithOptionNameAndBin4) {
testValidExpression<Pkt6>(Option::V4,
"\"option[host-name].text == 0x68756E6472656434\"",
"\"option[host-name].bin == 0x68756E6472656434\"",
"hundred4");
}
......@@ -212,19 +212,19 @@ TEST_F(ExpressionParserTest, validExpressionWithOptionName6) {
"hundred6");
}
// Verifies that given a valid expression using .hex operator for option, the
// Verifies that given a valid expression using .bin operator for option, the
// ExpressionParser produces an Expression which can be evaluated against
// a v6 packet.
TEST_F(ExpressionParserTest, validExpressionWithHex6) {
testValidExpression<Pkt6>(Option::V6, "\"option[59].hex == 0x68756E6472656436\"",
TEST_F(ExpressionParserTest, validExpressionWithBin6) {
testValidExpression<Pkt6>(Option::V6, "\"option[59].bin == 0x68756E6472656436\"",
"hundred6");
}
// Verifies that the option name can be used together with .hex operator in
// Verifies that the option name can be used together with .bin operator in
// the evaluated expression.
TEST_F(ExpressionParserTest, validExpressionWithOptionNameAndHex6) {
TEST_F(ExpressionParserTest, validExpressionWithOptionNameAndBin6) {
testValidExpression<Pkt6>(Option::V6,
"\"option[bootfile-url].text == 0x68756E6472656436\"",
"\"option[bootfile-url].bin == 0x68756E6472656436\"",
"hundred6");
}
......
......@@ -85,9 +85,9 @@
19. TokenPtr opt(new TokenOption($3, TokenOption::TEXTUAL));
20. ctx.expression.push_back(opt);
21. }
22. | OPTION '[' INTEGER ']' DOT HEX
22. | OPTION '[' INTEGER ']' DOT BIN
23. {
24. TokenPtr opt(new TokenOption($3, TokenOption::HEXADECIMAL));
24. TokenPtr opt(new TokenOption($3, TokenOption::BINARY));
25. ctx.expression.push_back(opt);
26. }
27. ;
......@@ -99,7 +99,7 @@ single token or an expression "token == token" (EQUAL has been defined as
"==" elsewhere). Token is further
defined in lines 7-22: it may either be a string (lines 7-11),
a hex string (lines 12-16), option in the textual format (lines 17-21)
or option in a hexadecimal format (lines 22-26).
or option in the binary format (lines 22-26).
When the actual case is determined, the respective C++ action
is executed. For example, if the token is a string, the TokenString class is
instantiated with the appropriate value and put onto the expression vector.
......
......@@ -18,7 +18,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#define YY_FLEX_SUBMINOR_VERSION 39
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
......@@ -72,7 +72,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
......@@ -80,7 +79,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
......@@ -111,6 +109,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
/* %endif */
......@@ -225,11 +225,18 @@ extern FILE *yyin, *yyout;
*/
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
#define YY_LINENO_REWIND_TO(dst) \
do {\
const char *p;\
for ( p = yy_cp-1; p >= (dst); --p)\
if ( *p == '\n' )\
--yylineno;\
}while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
......@@ -420,7 +427,7 @@ void yyfree (void * );
/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
/* Begin user sect3 */
#define yywrap(n) 1
#define yywrap() 1
#define YY_SKIP_YYWRAP
#define FLEX_DEBUG
......@@ -438,6 +445,8 @@ int yylineno = 1;
extern char *yytext;
#define yytext_ptr yytext
/* %% [1.5] DFA */
/* %if-c-only Standard (non-C++) definition */
static yy_state_type yy_get_previous_state (void );
......@@ -453,7 +462,7 @@ static void yy_fatal_error (yyconst char msg[] );
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
......@@ -469,27 +478,27 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_acclist[84] =
static yyconst flex_int16_t yy_acclist[90] =
{ 0,
21, 19, 20, 1, 19, 20, 2, 20, 19, 20,
13, 19, 20, 14, 19, 20, 17, 19, 20, 19,
20, 12, 19, 20, 5, 19, 20, 5, 19, 20,
19, 20, 19, 20, 15, 19, 20, 16, 19, 20,
19, 20, 19, 20, 19, 20, 19, 20, 19, 20,
1, 2, 3, 5, 6,16402,16402,16402,16402,16402,
16402, 4, 8210, 11,16402, 9,16402,16402,16402,16402,
16402,16402, 8,16402,16402,16402, 7,16402,16402,16402,
16402, 10,16402
14, 19, 20, 15, 19, 20, 18, 19, 20, 19,
20, 13, 19, 20, 5, 19, 20, 5, 19, 20,
19, 20, 19, 20,16390, 16, 19, 20, 17, 19,
20, 19, 20,16390, 19, 20,16390, 19, 20,16390,
19, 20,16390, 19, 20,16390, 1, 2, 3, 5,
7,16390, 8198,16390,16390,16390,16390,16390, 4, 12,
16390, 10,16390,16390,16390,16390,16390,16390, 9,16390,
16390,16390, 8,16390,16390,16390,16390, 11,16390
} ;
static yyconst flex_int16_t yy_accept[57] =
static yyconst flex_int16_t yy_accept[58] =
{ 0,
1, 1, 1, 2, 4, 7, 9, 11, 14, 17,
20, 22, 25, 28, 31, 33, 35, 38, 41, 43,
45, 47, 49, 51, 52, 53, 53, 54, 55, 55,
56, 57, 58, 59, 60, 61, 62, 63, 63, 64,
66, 68, 69, 70, 71, 72, 73, 75, 76, 77,
79, 80, 81, 82, 84, 84
20, 22, 25, 28, 31, 33, 36, 39, 42, 45,
48, 51, 54, 57, 58, 59, 59, 60, 61, 61,
62, 62, 62, 63, 64, 65, 66, 67, 68, 69,
70, 72, 74, 75, 76, 77, 78, 79, 81, 82,
83, 85, 86, 87, 88, 90, 90
} ;
static yyconst flex_int32_t yy_ec[256] =
......@@ -505,8 +514,8 @@ static yyconst flex_int32_t yy_ec[256] =
14, 14, 14, 14, 14, 14, 14, 15, 14, 14,
16, 1, 17, 1, 18, 1, 19, 20, 13, 13,
21, 13, 22, 23, 24, 14, 14, 25, 14, 26,
27, 28, 14, 29, 30, 31, 32, 14, 14, 33,
21, 13, 22, 14, 23, 14, 14, 24, 14, 25,
26, 27, 14, 28, 29, 30, 31, 14, 14, 32,
14, 14, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
......@@ -524,74 +533,72 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[34] =
static yyconst flex_int32_t yy_meta[33] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 3, 1, 4,
4, 1, 4, 3, 3, 1, 1, 3, 4, 4,
4, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3
1, 2, 3, 1, 1, 1, 1, 2, 1, 4,
4, 1, 4, 2, 2, 1, 2, 2, 4, 4,
4, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2
} ;
static yyconst flex_int16_t yy_base[59] =
static yyconst flex_int16_t yy_base[60] =
{ 0,
0, 0, 121, 122, 118, 116, 110, 122, 122, 122,
24, 122, 26, 28, 98, 0, 122, 122, 77, 79,
67, 61, 63, 68, 50, 47, 122, 32, 0, 122,
38, 43, 44, 45, 46, 47, 0, 48, 122, 50,
52, 54, 55, 56, 72, 73, 77, 79, 80, 81,
84, 86, 89, 90, 122, 112, 114, 40
0, 0, 113, 114, 110, 108, 106, 114, 114, 114,
23, 114, 25, 27, 97, 37, 114, 114, 56, 18,
19, 20, 26, 106, 104, 102, 114, 38, 0, 114,
50, 51, 81, 114, 80, 35, 32, 41, 39, 0,
79, 78, 46, 48, 52, 55, 54, 76, 61, 59,
73, 65, 66, 70, 69, 114, 94, 97, 62
} ;
static yyconst flex_int16_t yy_def[59] =
static yyconst flex_int16_t yy_def[60] =
{ 0,
55, 1, 55, 55, 55, 55, 56, 55, 55, 55,
55, 55, 55, 55, 55, 57, 55, 55, 57, 57,
57, 57, 57, 55, 55, 56, 55, 55, 58, 55,
57, 57, 57, 57, 57, 57, 58, 55, 55, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
57, 57, 57, 57, 0, 55, 55, 55
56, 1, 56, 56, 56, 56, 57, 56, 56, 56,
56, 56, 56, 56, 56, 58, 56, 56, 58, 19,
19, 19, 19, 56, 56, 57, 56, 56, 59, 56,
56, 19, 19, 56, 19, 19, 19, 19, 19, 59,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 0, 56, 56, 56
} ;
static yyconst flex_int16_t yy_nxt[156] =
static yyconst flex_int16_t yy_nxt[147] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 16, 16, 17, 18, 4, 19, 16,
16, 16, 20, 16, 16, 16, 21, 16, 16, 22,
23, 16, 16, 28, 28, 28, 28, 28, 28, 38,
29, 28, 28, 37, 38, 38, 38, 38, 38, 38,
27, 38, 25, 38, 39, 38, 38, 38, 29, 39,
39, 39, 39, 39, 39, 43, 39, 40, 39, 24,
39, 39, 39, 38, 38, 42, 41, 45, 38, 44,
38, 38, 38, 36, 46, 38, 47, 38, 39, 39,
38, 38, 35, 39, 34, 39, 39, 39, 48, 33,
39, 32, 39, 49, 50, 39, 39, 52, 51, 30,
54, 53, 26, 27, 26, 26, 31, 31, 25, 24,
55, 3, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55
14, 15, 16, 16, 16, 17, 18, 4, 19, 20,
16, 16, 16, 16, 16, 21, 16, 16, 22, 23,
16, 16, 28, 28, 28, 28, 28, 28, 31, 29,
36, 33, 33, 33, 32, 37, 39, 28, 28, 33,
38, 31, 56, 34, 32, 33, 29, 31, 33, 42,
44, 43, 33, 32, 33, 40, 34, 56, 46, 33,
45, 33, 34, 32, 33, 33, 47, 33, 33, 35,
49, 48, 33, 50, 33, 51, 52, 53, 33, 33,
54, 55, 33, 33, 26, 26, 33, 26, 33, 33,
33, 33, 33, 41, 33, 27, 25, 24, 30, 27,
25, 24, 56, 3, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56
} ;
static yyconst flex_int16_t yy_chk[156] =
static yyconst flex_int16_t yy_chk[147] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 11, 11, 13, 13, 14, 14, 31,
13, 28, 28, 58, 32, 33, 34, 35, 36, 38,
26, 40, 25, 41, 31, 42, 43, 44, 13, 32,
33, 34, 35, 36, 38, 35, 40, 32, 41, 24,
42, 43, 44, 45, 46, 34, 33, 42, 47, 36,
48, 49, 50, 23, 43, 51, 44, 52, 45, 46,
53, 54, 22, 47, 21, 48, 49, 50, 45, 20,
51, 19, 52, 46, 48, 53, 54, 51, 49, 15,
53, 52, 56, 7, 56, 56, 57, 57, 6, 5,
3, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55
1, 1, 11, 11, 13, 13, 14, 14, 16, 13,
20, 20, 21, 22, 16, 21, 23, 28, 28, 23,
22, 31, 32, 16, 16, 37, 13, 19, 36, 36,
38, 37, 39, 19, 38, 59, 31, 32, 43, 43,
39, 44, 19, 19, 32, 45, 44, 47, 46, 19,
46, 45, 50, 47, 49, 49, 50, 52, 52, 53,
53, 54, 55, 54, 57, 57, 51, 57, 58, 48,
58, 42, 41, 35, 33, 26, 25, 24, 15, 7,
6, 5, 3, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56
} ;
/* Table of booleans, true if rule could match eol. */
......@@ -605,8 +612,8 @@ int yy_flex_debug = 1;
static yyconst flex_int16_t yy_rule_linenum[20] =
{ 0,
83, 87, 93, 103, 109, 123, 124, 125, 126, 127,
128, 129, 130, 131, 132, 133, 134, 136, 143
83, 87, 93, 103, 109, 123, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 141, 143
} ;
static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
......@@ -688,7 +695,7 @@ static isc::eval::location loc;
// by moving it ahead by yyleng bytes. yyleng specifies the length of the
// currently matched token.
#define YY_USER_ACTION loc.columns(yyleng);
#line 692 "lexer.cc"
#line 699 "lexer.cc"
#define INITIAL 0
......@@ -806,7 +813,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( yytext, yyleng, 1, yyout )
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
......@@ -821,7 +828,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
......@@ -927,17 +934,6 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
/* %% [7.0] user's declarations go here */
#line 76 "lexer.ll"
// Code run each time yylex is called.
loc.step();
#line 940 "lexer.cc"
if ( !(yy_init) )
{
(yy_init) = 1;
......@@ -978,6 +974,18 @@ YY_DECL
yy_load_buffer_state( );
}
{
/* %% [7.0] user's declarations go here */
#line 76 "lexer.ll"
// Code run each time yylex is called.
loc.step();
#line 988 "lexer.cc"
while ( 1 ) /* loops until end-of-file is reached */
{
/* %% [8.0] yymore()-related code goes here */
......@@ -1000,24 +1008,23 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];