openddlparser: latest greatest ( contains fix for correct handling of data array lists ).
Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/501/merge
parent
6573bf08c6
commit
11b9d83d4c
|
@ -856,6 +856,14 @@ char *OpenDDLParser::parseDataList( char *in, char *end, Value **data, size_t &n
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataArrayList *createDataArrayList( Value *currentValue, size_t numValues ) {
|
||||||
|
DataArrayList *dataList = new DataArrayList;
|
||||||
|
dataList->m_dataList = currentValue;
|
||||||
|
dataList->m_numItems = numValues;
|
||||||
|
|
||||||
|
return dataList;
|
||||||
|
|
||||||
|
}
|
||||||
char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **dataList ) {
|
char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **dataList ) {
|
||||||
*dataList = ddl_nullptr;
|
*dataList = ddl_nullptr;
|
||||||
if( ddl_nullptr == in || in == end ) {
|
if( ddl_nullptr == in || in == end ) {
|
||||||
|
@ -865,20 +873,19 @@ char *OpenDDLParser::parseDataArrayList( char *in, char *end, DataArrayList **da
|
||||||
in = lookForNextToken( in, end );
|
in = lookForNextToken( in, end );
|
||||||
if( *in == Grammar::OpenBracketToken[ 0 ] ) {
|
if( *in == Grammar::OpenBracketToken[ 0 ] ) {
|
||||||
in++;
|
in++;
|
||||||
Value *current( ddl_nullptr );
|
Value *currentValue( ddl_nullptr );
|
||||||
Reference *refs( ddl_nullptr );
|
Reference *refs( ddl_nullptr );
|
||||||
DataArrayList *prev( ddl_nullptr ), *currentDataList( ddl_nullptr );
|
DataArrayList *prev( ddl_nullptr ), *currentDataList( ddl_nullptr );
|
||||||
do {
|
do {
|
||||||
size_t numRefs( 0 ), numValues( 0 );
|
size_t numRefs( 0 ), numValues( 0 );
|
||||||
in = parseDataList( in, end, ¤t, numValues, &refs, numRefs );
|
currentValue = ddl_nullptr;
|
||||||
if( ddl_nullptr != current ) {
|
in = parseDataList( in, end, ¤tValue, numValues, &refs, numRefs );
|
||||||
|
if( ddl_nullptr != currentValue ) {
|
||||||
if( ddl_nullptr == prev ) {
|
if( ddl_nullptr == prev ) {
|
||||||
*dataList = new DataArrayList;
|
*dataList = createDataArrayList( currentValue, numValues );
|
||||||
( *dataList )->m_dataList = current;
|
|
||||||
( *dataList )->m_numItems = numValues;
|
|
||||||
prev = *dataList;
|
prev = *dataList;
|
||||||
} else {
|
} else {
|
||||||
currentDataList = new DataArrayList;
|
currentDataList = createDataArrayList( currentValue, numValues );
|
||||||
if( ddl_nullptr != prev ) {
|
if( ddl_nullptr != prev ) {
|
||||||
prev->m_next = currentDataList;
|
prev->m_next = currentDataList;
|
||||||
prev = currentDataList;
|
prev = currentDataList;
|
||||||
|
|
Loading…
Reference in New Issue