From d416848a9c212bf0503ec5b9de4cd23449ecd73c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 14 Apr 2008 22:36:34 +0000 Subject: The Bu::TafReader parser now knows about \\, \t, and \n escape sequences. The writer also knows about \\, but will not insert \t or \n for now. It just uses a tab and newline for those. --- src/tafreader.cpp | 6 ++++++ src/tafwriter.cpp | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/tafreader.cpp b/src/tafreader.cpp index 7b5e65d..db2e9f5 100644 --- a/src/tafreader.cpp +++ b/src/tafreader.cpp @@ -146,6 +146,12 @@ Bu::FString Bu::TafReader::readStr() } else if( c == '"' ) c = '"'; + else if( c == '\\' ) + c = '\\'; + else if( c == 'n' ) + c = '\n'; + else if( c == 't' ) + c = '\t'; else throw TafException("Invalid escape sequence at %d:%d.", iLine, iCol ); } diff --git a/src/tafwriter.cpp b/src/tafwriter.cpp index 8dcde86..c30bc67 100644 --- a/src/tafwriter.cpp +++ b/src/tafwriter.cpp @@ -97,6 +97,8 @@ void Bu::TafWriter::writeString( const Bu::FString &str ) { if( *s == '\"' ) sOut.write("\\\"", 2 ); + else if( *s == '\\' ) + sOut.write("\\\\", 2 ); else sOut.write( s, 1 ); } -- cgit v1.2.3