Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
7db39e66
"examples/vscode:/vscode.git/clone" did not exist on "cdadb023a298674239561d0395db2056b4f1d7d7"
Commit
7db39e66
authored
Sep 29, 2009
by
Jesse Beder
Browse files
Updated signature of Parser::GetNextDocument (issue 45)
parent
94eb7f1d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
include/parser.h
include/parser.h
+1
-1
src/parser.cpp
src/parser.cpp
+4
-2
util/parse.cpp
util/parse.cpp
+2
-3
No files found.
include/parser.h
View file @
7db39e66
...
@@ -25,7 +25,7 @@ namespace YAML
...
@@ -25,7 +25,7 @@ namespace YAML
operator
bool
()
const
;
operator
bool
()
const
;
void
Load
(
std
::
istream
&
in
);
void
Load
(
std
::
istream
&
in
);
void
GetNextDocument
(
Node
&
document
);
bool
GetNextDocument
(
Node
&
document
);
void
PrintTokens
(
std
::
ostream
&
out
);
void
PrintTokens
(
std
::
ostream
&
out
);
private:
private:
...
...
src/parser.cpp
View file @
7db39e66
...
@@ -33,7 +33,7 @@ namespace YAML
...
@@ -33,7 +33,7 @@ namespace YAML
// GetNextDocument
// GetNextDocument
// . Reads the next document in the queue (of tokens).
// . Reads the next document in the queue (of tokens).
// . Throws a ParserException on error.
// . Throws a ParserException on error.
void
Parser
::
GetNextDocument
(
Node
&
document
)
bool
Parser
::
GetNextDocument
(
Node
&
document
)
{
{
// clear node
// clear node
document
.
Clear
();
document
.
Clear
();
...
@@ -43,7 +43,7 @@ namespace YAML
...
@@ -43,7 +43,7 @@ namespace YAML
// we better have some tokens in the queue
// we better have some tokens in the queue
if
(
m_pScanner
->
empty
())
if
(
m_pScanner
->
empty
())
return
;
return
false
;
// first eat doc start (optional)
// first eat doc start (optional)
if
(
m_pScanner
->
peek
().
type
==
Token
::
DOC_START
)
if
(
m_pScanner
->
peek
().
type
==
Token
::
DOC_START
)
...
@@ -58,6 +58,8 @@ namespace YAML
...
@@ -58,6 +58,8 @@ namespace YAML
// clear anchors from the scanner, which are no longer relevant
// clear anchors from the scanner, which are no longer relevant
m_pScanner
->
ClearAnchors
();
m_pScanner
->
ClearAnchors
();
return
true
;
}
}
// ParseDirectives
// ParseDirectives
...
...
util/parse.cpp
View file @
7db39e66
...
@@ -11,9 +11,8 @@ int main(int argc, char **argv)
...
@@ -11,9 +11,8 @@ int main(int argc, char **argv)
std
::
istream
&
input
=
(
argc
>
1
?
fin
:
std
::
cin
);
std
::
istream
&
input
=
(
argc
>
1
?
fin
:
std
::
cin
);
try
{
try
{
YAML
::
Parser
parser
(
input
);
YAML
::
Parser
parser
(
input
);
while
(
parser
)
{
YAML
::
Node
doc
;
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
)
;
while
(
parser
.
GetNextDocument
(
doc
)
)
{
YAML
::
Emitter
emitter
;
YAML
::
Emitter
emitter
;
emitter
<<
doc
;
emitter
<<
doc
;
std
::
cout
<<
emitter
.
c_str
()
<<
"
\n
"
;
std
::
cout
<<
emitter
.
c_str
()
<<
"
\n
"
;
...
...
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