diff options
author | Mike Buland <eichlan@xagasoft.com> | 2013-02-10 22:18:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2013-02-10 22:18:28 +0000 |
commit | 47bace8952ae618e2ad03c2cf2eeca69dd050563 (patch) | |
tree | cde27f04fb92be5ab7fad01a92f58cbd53df4f00 /c++-libbu++ | |
parent | 0cce7a054ba818227494f4e48c129dde2cfc0e45 (diff) | |
download | libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.gz libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.bz2 libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.tar.xz libgats-47bace8952ae618e2ad03c2cf2eeca69dd050563.zip |
GatsTxt now supports comments, both C and C++ style.
Diffstat (limited to 'c++-libbu++')
-rw-r--r-- | c++-libbu++/src/object.cpp | 33 |
1 files changed, 29 insertions, 4 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 | ||
83 | void Gats::Object::skipWs( Gats::Object::StrPos &i ) | 83 | void 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 | ||
88 | Bu::String Gats::Object::token( Gats::Object::StrPos &i ) | 113 | Bu::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 | ||