@ -202,6 +202,7 @@ void SpaceParser::Parse()
line = 1 ;
status = ok ;
space = root_space ;
reading_commentary = false ;
ReadChar ( ) ;
SkipWhiteLines ( ) ;
@ -300,13 +301,15 @@ return false;
}
void SpaceParser : : SkipWhite ( )
/*
skip_lines is default false
*/
void SpaceParser : : SkipWhite ( bool skip_lines )
{
while ( IsWhite ( lastc ) | | lastc = = commentary )
while ( IsWhite ( lastc ) | | lastc = = commentary | | ( skip_lines & & lastc = = ' \n ' ) )
{
if ( lastc = = commentary )
Skip Line ( ) ;
Skip Comment ( ) ;
else
ReadChar ( ) ;
}
@ -315,16 +318,13 @@ void SpaceParser::SkipWhite()
void SpaceParser : : SkipWhiteLines ( )
{
while ( IsWhite ( lastc ) | | lastc = = commentary | | lastc = = ' \n ' )
{
if ( lastc = = commentary )
SkipLine ( ) ;
else
ReadChar ( ) ;
}
SkipWhite ( true ) ;
}
/*
do not skip the last \ n character
*/
void SpaceParser : : SkipLine ( )
{
while ( lastc ! = - 1 & & lastc ! = ' \n ' )
@ -332,6 +332,17 @@ void SpaceParser::SkipLine()
}
/*
do not skip the last \ n character
*/
void SpaceParser : : SkipComment ( )
{
reading_commentary = true ;
SkipLine ( ) ;
reading_commentary = false ;
}
void SpaceParser : : Trim ( std : : wstring & s )
{
@ -411,7 +422,7 @@ void SpaceParser::ReadTokenSingle(bool white_delimit, bool new_line_delimit, int
while ( true )
{
if ( lastc = = commentary )
Skip Line ( ) ;
Skip Comment ( ) ;
if ( lastc = = - 1 | |
( ! char_was_escaped & &
@ -662,7 +673,7 @@ int SpaceParser::ReadChar()
char_was_escaped = false ;
ReadCharNoEscape ( ) ;
if ( use_escape_char & & lastc = = ' \\ ' )
if ( ! reading_commentary & & use_escape_char & & lastc = = ' \\ ' )
{
char_was_escaped = true ;
ReadCharNoEscape ( ) ;