Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
416
Issues
416
List
Boards
Labels
Service Desk
Milestones
Merge Requests
66
Merge Requests
66
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
a435de0e
Commit
a435de0e
authored
Dec 17, 2012
by
Michal 'vorner' Vaner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2427] Find INITIAL_WS even at the beginning of file
parent
f74f25e7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
9 deletions
+10
-9
src/lib/dns/master_lexer.cc
src/lib/dns/master_lexer.cc
+1
-1
src/lib/dns/master_lexer.h
src/lib/dns/master_lexer.h
+2
-1
src/lib/dns/tests/master_lexer_state_unittest.cc
src/lib/dns/tests/master_lexer_state_unittest.cc
+4
-1
src/lib/dns/tests/master_lexer_unittest.cc
src/lib/dns/tests/master_lexer_unittest.cc
+1
-3
src/lib/dns/tests/master_loader_unittest.cc
src/lib/dns/tests/master_loader_unittest.cc
+2
-3
No files found.
src/lib/dns/master_lexer.cc
View file @
a435de0e
...
@@ -37,7 +37,7 @@ using namespace master_lexer_internal;
...
@@ -37,7 +37,7 @@ using namespace master_lexer_internal;
struct
MasterLexer
::
MasterLexerImpl
{
struct
MasterLexer
::
MasterLexerImpl
{
MasterLexerImpl
()
:
source_
(
NULL
),
token_
(
MasterToken
::
NOT_STARTED
),
MasterLexerImpl
()
:
source_
(
NULL
),
token_
(
MasterToken
::
NOT_STARTED
),
paren_count_
(
0
),
last_was_eol_
(
fals
e
),
paren_count_
(
0
),
last_was_eol_
(
tru
e
),
has_previous_
(
false
),
has_previous_
(
false
),
previous_paren_count_
(
0
),
previous_paren_count_
(
0
),
previous_was_eol_
(
false
)
previous_was_eol_
(
false
)
...
...
src/lib/dns/master_lexer.h
View file @
a435de0e
...
@@ -54,7 +54,8 @@ public:
...
@@ -54,7 +54,8 @@ public:
END_OF_LINE
,
///< End of line detected
END_OF_LINE
,
///< End of line detected
END_OF_FILE
,
///< End of file detected
END_OF_FILE
,
///< End of file detected
INITIAL_WS
,
///< White spaces at the beginning of a line after an
INITIAL_WS
,
///< White spaces at the beginning of a line after an
///< end of line (if asked for detecting it)
///< end of line or at the beginning of file (if asked
// for detecting it)
NOVALUE_TYPE_MAX
=
INITIAL_WS
,
///< Max integer corresponding to
NOVALUE_TYPE_MAX
=
INITIAL_WS
,
///< Max integer corresponding to
/// no-value (type only) types.
/// no-value (type only) types.
/// Mainly for internal use.
/// Mainly for internal use.
...
...
src/lib/dns/tests/master_lexer_state_unittest.cc
View file @
a435de0e
...
@@ -190,13 +190,16 @@ TEST_F(MasterLexerStateTest, unbalancedParentheses) {
...
@@ -190,13 +190,16 @@ TEST_F(MasterLexerStateTest, unbalancedParentheses) {
}
}
TEST_F
(
MasterLexerStateTest
,
startToComment
)
{
TEST_F
(
MasterLexerStateTest
,
startToComment
)
{
// Begin with 'start',
skip
space, then encounter a comment. Skip
// Begin with 'start',
detect
space, then encounter a comment. Skip
// the rest of the line, and recognize the new line. Note that the
// the rest of the line, and recognize the new line. Note that the
// second ';' is simply ignored.
// second ';' is simply ignored.
ss
<<
" ;a;
\n
"
;
ss
<<
" ;a;
\n
"
;
ss
<<
";a;"
;
// Likewise, but the comment ends with EOF.
ss
<<
";a;"
;
// Likewise, but the comment ends with EOF.
lexer
.
pushSource
(
ss
);
lexer
.
pushSource
(
ss
);
// Initial whitespace (asked for in common_options)
EXPECT_EQ
(
s_null
,
State
::
start
(
lexer
,
common_options
));
EXPECT_EQ
(
Token
::
INITIAL_WS
,
s_crlf
.
getToken
(
lexer
).
getType
());
// Comment ending with EOL
// Comment ending with EOL
EXPECT_EQ
(
s_null
,
State
::
start
(
lexer
,
common_options
));
EXPECT_EQ
(
s_null
,
State
::
start
(
lexer
,
common_options
));
EXPECT_EQ
(
Token
::
END_OF_LINE
,
s_crlf
.
getToken
(
lexer
).
getType
());
EXPECT_EQ
(
Token
::
END_OF_LINE
,
s_crlf
.
getToken
(
lexer
).
getType
());
...
...
src/lib/dns/tests/master_lexer_unittest.cc
View file @
a435de0e
...
@@ -238,10 +238,8 @@ TEST_F(MasterLexerTest, ungetToken) {
...
@@ -238,10 +238,8 @@ TEST_F(MasterLexerTest, ungetToken) {
// Check ungetting token without overriding the start method. We also
// Check ungetting token without overriding the start method. We also
// check it works well with changing options between the calls.
// check it works well with changing options between the calls.
TEST_F
(
MasterLexerTest
,
ungetRealOptions
)
{
TEST_F
(
MasterLexerTest
,
ungetRealOptions
)
{
ss
<<
"
\n
\n
"
;
ss
<<
"
\n
"
;
lexer
.
pushSource
(
ss
);
lexer
.
pushSource
(
ss
);
// Skip the first newline
EXPECT_EQ
(
MasterToken
::
END_OF_LINE
,
lexer
.
getNextToken
().
getType
());
// If we call it the usual way, it skips up to the newline and returns
// If we call it the usual way, it skips up to the newline and returns
// it
// it
...
...
src/lib/dns/tests/master_loader_unittest.cc
View file @
a435de0e
...
@@ -789,9 +789,8 @@ TEST_F(MasterLoaderTest, noPreviousName) {
...
@@ -789,9 +789,8 @@ TEST_F(MasterLoaderTest, noPreviousName) {
loader_
->
load
();
loader_
->
load
();
EXPECT_FALSE
(
loader_
->
loadedSucessfully
());
EXPECT_FALSE
(
loader_
->
loadedSucessfully
());
EXPECT_EQ
(
1
,
errors_
.
size
());
EXPECT_EQ
(
1
,
errors_
.
size
());
checkCallbackMessage
(
errors_
.
at
(
0
),
checkCallbackMessage
(
errors_
.
at
(
0
),
"No previous name to use in place of "
"x"
,
"initial whitespace"
,
1
);
1
);
EXPECT_TRUE
(
warnings_
.
empty
());
EXPECT_TRUE
(
warnings_
.
empty
());
}
}
...
...
Write
Preview
Markdown
is supported
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