From 47bace8952ae618e2ad03c2cf2eeca69dd050563 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 10 Feb 2013 22:18:28 +0000 Subject: GatsTxt now supports comments, both C and C++ style. --- c++-libbu++/src/object.cpp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'c++-libbu++') diff --git a/c++-libbu++/src/object.cpp b/c++-libbu++/src/object.cpp index faeca16..073d31d 100644 --- a/c++-libbu++/src/object.cpp +++ b/c++-libbu++/src/object.cpp @@ -82,7 +82,32 @@ Gats::Object *Gats::Object::read( Bu::Stream &rIn ) void Gats::Object::skipWs( Gats::Object::StrPos &i ) { - for(; *i == ' ' || *i == '\t' || *i == '\r' || *i == '\n'; i++ ) { } + for(; *i == ' ' || *i == '\t' || *i == '\r' || *i == '\n' || *i == '/'; i++ ) + { + if( *i == '/' ) + { + i++; + if( *i == '/' ) + for(i++; *i != '\n' && *i != '\r'; i++ ) { } + else if( *i == '*' ) + { + for(i++; i; i++ ) + { + if( *i == '*' ) + { + i++; + if( *i == '/' ) + { + i++; + break; + } + } + } + } + else + return; + } + } } Bu::String Gats::Object::token( Gats::Object::StrPos &i ) @@ -94,7 +119,7 @@ Bu::String Gats::Object::token( Gats::Object::StrPos &i ) { if( *i == '\\' ) i++; - sRet += i; + sRet += *i; } i++; } @@ -102,9 +127,9 @@ Bu::String Gats::Object::token( Gats::Object::StrPos &i ) { for(; i && *i != ' ' && *i != '\t' && *i != '\r' && *i != '\n' && *i != ',' && *i != ']' && *i != '}' && *i != '[' && - *i != '{'; i++ ) + *i != '{' && *i != '/'; i++ ) { - sRet += i; + sRet += *i; } } -- cgit v1.2.3