aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2013-02-10 22:18:28 +0000
committerMike Buland <eichlan@xagasoft.com>2013-02-10 22:18:28 +0000
commit47bace8952ae618e2ad03c2cf2eeca69dd050563 (patch)
treecde27f04fb92be5ab7fad01a92f58cbd53df4f00
parent0cce7a054ba818227494f4e48c129dde2cfc0e45 (diff)
downloadlibgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.gz
libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.bz2
libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.xz
libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.zip
GatsTxt now supports comments, both C and C++ style.
-rw-r--r--c++-libbu++/src/object.cpp33
-rw-r--r--support/vim/syntax/gatstxt.vim5
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 )
82 82
83void Gats::Object::skipWs( Gats::Object::StrPos &i ) 83void Gats::Object::skipWs( Gats::Object::StrPos &i )
84{ 84{
85 for(; *i == ' ' || *i == '\t' || *i == '\r' || *i == '\n'; i++ ) { } 85 for(; *i == ' ' || *i == '\t' || *i == '\r' || *i == '\n' || *i == '/'; i++ )
86 {
87 if( *i == '/' )
88 {
89 i++;
90 if( *i == '/' )
91 for(i++; *i != '\n' && *i != '\r'; i++ ) { }
92 else if( *i == '*' )
93 {
94 for(i++; i; i++ )
95 {
96 if( *i == '*' )
97 {
98 i++;
99 if( *i == '/' )
100 {
101 i++;
102 break;
103 }
104 }
105 }
106 }
107 else
108 return;
109 }
110 }
86} 111}
87 112
88Bu::String Gats::Object::token( Gats::Object::StrPos &i ) 113Bu::String Gats::Object::token( Gats::Object::StrPos &i )
@@ -94,7 +119,7 @@ Bu::String Gats::Object::token( Gats::Object::StrPos &i )
94 { 119 {
95 if( *i == '\\' ) 120 if( *i == '\\' )
96 i++; 121 i++;
97 sRet += i; 122 sRet += *i;
98 } 123 }
99 i++; 124 i++;
100 } 125 }
@@ -102,9 +127,9 @@ Bu::String Gats::Object::token( Gats::Object::StrPos &i )
102 { 127 {
103 for(; i && *i != ' ' && *i != '\t' && *i != '\r' && *i != '\n' && 128 for(; i && *i != ' ' && *i != '\t' && *i != '\r' && *i != '\n' &&
104 *i != ',' && *i != ']' && *i != '}' && *i != '[' && 129 *i != ',' && *i != ']' && *i != '}' && *i != '[' &&
105 *i != '{'; i++ ) 130 *i != '{' && *i != '/'; i++ )
106 { 131 {
107 sRet += i; 132 sRet += *i;
108 } 133 }
109 } 134 }
110 135
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
26 26
27sy match Ops '[{[:}\],]' 27sy match Ops '[{[:}\],]'
28 28
29" sy region Comment start=+//+ end=+$+ 29sy region Comment start=+//+ end=+$+
30" sy region Comment start=+/\*+ end=+\*/+ 30sy region Comment start=+/\*+ end=+\*/+
31
32 31
33hi def link Ops Operator 32hi def link Ops Operator
34hi def link Str String 33hi def link Str String