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
01ef70a6
Commit
01ef70a6
authored
Jun 28, 2008
by
Jesse Beder
Browse files
Fixed complex keys.
parent
c63ebbd8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
103 deletions
+11
-103
scanner.cpp
scanner.cpp
+3
-3
scantoken.cpp
scantoken.cpp
+4
-2
test.yaml
test.yaml
+4
-98
No files found.
scanner.cpp
View file @
01ef70a6
...
...
@@ -229,14 +229,14 @@ namespace YAML
Eat
(
1
);
// then eat a comment
if
(
Exp
::
Comment
.
Matches
(
INPUT
.
peek
()
))
{
if
(
Exp
::
Comment
.
Matches
(
INPUT
))
{
// eat until line break
while
(
INPUT
&&
!
Exp
::
Break
.
Matches
(
INPUT
.
peek
()
))
while
(
INPUT
&&
!
Exp
::
Break
.
Matches
(
INPUT
))
Eat
(
1
);
}
// if it's NOT a line break, then we're done!
if
(
!
Exp
::
Break
.
Matches
(
INPUT
.
peek
()
))
if
(
!
Exp
::
Break
.
Matches
(
INPUT
))
break
;
// otherwise, let's eat the line break and keep going
...
...
scantoken.cpp
View file @
01ef70a6
...
...
@@ -204,7 +204,8 @@ namespace YAML
template
<
>
PlainScalarToken
*
Scanner
::
ScanToken
(
PlainScalarToken
*
pToken
)
{
// insert a potential simple key
InsertSimpleKey
();
if
(
m_simpleKeyAllowed
)
InsertSimpleKey
();
m_simpleKeyAllowed
=
false
;
// now eat and store the scalar
...
...
@@ -279,7 +280,8 @@ namespace YAML
template
<
>
QuotedScalarToken
*
Scanner
::
ScanToken
(
QuotedScalarToken
*
pToken
)
{
// insert a potential simple key
InsertSimpleKey
();
if
(
m_simpleKeyAllowed
)
InsertSimpleKey
();
m_simpleKeyAllowed
=
false
;
// eat single or double quote
...
...
test.yaml
View file @
01ef70a6
---
model
:
file
:
data/models/compound.model
textures
:
data/materials/compound
rooms
:
-
name
:
"
Room
#1"
pos
:
[
0
,
0
,
0
]
size
:
[
1000
,
1000
,
500
]
height
:
500
stairtype
:
none
display
:
[]
pathfinding
:
tilesize
:
50
size
:
[
24
,
24
]
map
:
-----------------------
-+++++++++++++++++++++-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+---------------------
-+---------------------
-+---------------------
-+---------------------
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+++++++++++++++++++++-
-----------------------
-
name
:
Doorway
pos
:
[
1000
,
400
,
0
]
size
:
[
50
,
200
,
500
]
height
:
500
stairtype
:
none
display
:
[]
pathfinding
:
tilesize
:
50
size
:
[
5
,
9
]
map
:
-----
-+++-
-----
-----
-----
-----
-----
-+++-
-----
-
name
:
"
Room
#2"
pos
:
[
1050
,
0
,
0
]
size
:
[
1000
,
1000
,
500
]
height
:
500
stairtype
:
none
display
:
[]
pathfinding
:
tilesize
:
50
size
:
[
24
,
24
]
map
:
-----------------------
-+++++++++++++++++++++-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
---------------------+-
---------------------+-
---------------------+-
---------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+-------------------+-
-+++++++++++++++++++++-
-----------------------
exits
:
-
room1
:
"
Room
#1"
room2
:
"
Room
#2"
dir
:
e
pos
:
[
400
,
600
]
...
{
a simple key
:
a value
,
?
a complex key
:
another value
,
}
\ No newline at end of file
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