MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / skip

Method skip

extern/cloop/src/cloop/Lexer.cpp:194–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void Lexer::skip(Char& ch) // skip spaces and comments
195{
196 while (true)
197 {
198 while (getChar(ch).c == ' ' || ch.c == '\t' || ch.c == '\r' || ch.c == '\n')
199 ;
200
201 // check for comments
202
203 if (ch.c != '/')
204 return;
205
206 Char firstCh = ch;
207 getChar(ch);
208
209 switch (ch.c)
210 {
211 case '*':
212 {
213 bool inComment = true;
214
215 while (inComment)
216 {
217 while (getChar(ch).c != '*' && ch.c != -1)
218 ;
219
220 if (ch.c == -1)
221 {
222 char buffer[1024];
223 sprintf(buffer, "%s:%i:%i: error: Unterminated comment.",
224 filename.c_str(),
225 firstCh.line, firstCh.column);
226 throw runtime_error(buffer);
227 }
228 else
229 {
230 getChar(ch);
231
232 if (ch.c == '/')
233 inComment = false;
234 else
235 ungetChar(ch);
236 }
237 }
238
239 break;
240 }
241
242 case '/':
243 while (getChar(ch).c != '\n' && ch.c != -1)
244 ;
245
246 break;
247
248 default: // not a comment
249 ch = firstCh;
250 break;
251 }

Callers

nothing calls this directly

Calls 2

getCharFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected