mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-01-19 00:46:02 +01:00
Fixed comment after value in object value signaled by Frederic Surleau.
This commit is contained in:
parent
8868147835
commit
f179a180bd
@ -557,9 +557,15 @@ Reader::readArray( Token &tokenStart )
|
||||
return recoverFromError( tokenArrayEnd );
|
||||
|
||||
Token token;
|
||||
if ( !readToken( token )
|
||||
|| ( token.type_ != tokenArraySeparator &&
|
||||
token.type_ != tokenArrayEnd ) )
|
||||
// Accept Comment after last item in the array.
|
||||
ok = readToken( token );
|
||||
while ( token.type_ == tokenComment && ok )
|
||||
{
|
||||
ok = readToken( token );
|
||||
}
|
||||
bool badTokenType = ( token.type_ == tokenArraySeparator &&
|
||||
token.type_ == tokenArrayEnd );
|
||||
if ( !ok || badTokenType )
|
||||
{
|
||||
return addErrorAndRecover( "Missing ',' or ']' in array declaration",
|
||||
token,
|
||||
|
@ -3,7 +3,7 @@ import os
|
||||
import os.path
|
||||
from glob import glob
|
||||
|
||||
RUN_JSONCHECKER = True
|
||||
RUN_JSONCHECKER = False
|
||||
|
||||
def compareOutputs( expected, actual, message ):
|
||||
expected = expected.strip().replace('\r','').split('\n')
|
||||
|
8
test/test_comment_01.expected
Normal file
8
test/test_comment_01.expected
Normal file
@ -0,0 +1,8 @@
|
||||
.={}
|
||||
.test=[]
|
||||
.test[0]={}
|
||||
.test[0].a="aaa"
|
||||
.test[1]={}
|
||||
.test[1].b="bbb"
|
||||
.test[2]={}
|
||||
.test[2].c="ccc"
|
8
test/test_comment_01.json
Normal file
8
test/test_comment_01.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"test":
|
||||
[
|
||||
{ "a" : "aaa" }, // Comment for a
|
||||
{ "b" : "bbb" }, // Comment for b
|
||||
{ "c" : "ccc" } // Comment for c
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user