much more of sweet parser

This commit is contained in:
Dick Hollenbeck
2011-02-27 02:16:05 -06:00
parent bc16d9d7c3
commit 03495698cf
6 changed files with 409 additions and 36 deletions
+14 -10
View File
@@ -20,15 +20,7 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
while( (cc = *aSource++) != 0 && aDest < limit )
{
if( cc == '\\' )
{
cc = *aSource++;
if( inside )
*aDest++ = cc;
}
else if( cc == '"' )
if( cc == '"' )
{
if( inside )
break; // 2nd double quote is end of delimited text
@@ -38,7 +30,19 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
else if( inside )
{
*aDest++ = cc;
if( cc == '\\' )
{
cc = *aSource++;
// do no copy the escape byte if it is followed by \ or "
if( cc != '"' && cc != '\\' )
*aDest++ = '\\';
if( aDest < limit )
*aDest++ = cc;
}
else
*aDest++ = cc;
}
}