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 +++++++++++++++++++++++++++++---- support/vim/syntax/gatstxt.vim | 5 ++--- 2 files changed, 31 insertions(+), 7 deletions(-) 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; } } diff --git a/support/vim/syntax/gatstxt.vim b/support/vim/syntax/gatstxt.vim index 6722e8a..9319636 100644 --- a/support/vim/syntax/gatstxt.vim +++ b/support/vim/syntax/gatstxt.vim @@ -26,9 +26,8 @@ sy keyword Null null sy match Ops '[{[:}\],]' -" sy region Comment start=+//+ end=+$+ -" sy region Comment start=+/\*+ end=+\*/+ - +sy region Comment start=+//+ end=+$+ +sy region Comment start=+/\*+ end=+\*/+ hi def link Ops Operator hi def link Str String -- cgit v1.2.3