MCPcopy Index your code
hub / github.com/IBM/Project_CodeNet / unget

Function unget

tools/tokenizer/libtoken.c:387–406  ·  view source on GitHub ↗

Undo action of a get() lookahead call. An attempt at undoing an EOF read has no effect. Since get() encodes logical line endings with \n and continuation line endings with \r, both could be subject to an unget(). */

Source from the content-addressed store, hash-verified

385 line endings with \r, both could be subject to an unget().
386*/
387void unget(int cc)
388{
389 if (cc == EOF) return;
390 if (buffered < MAX_BUF) {
391 if (cc == '\n' || cc == '\r') {
392 linenr--;
393 // column was 0 right after getting the \n
394 // hopefully there are no multiple ungets of \n
395 column = saved_col;
396 }
397 else
398 column--;
399 char_count--;
400 buffer[buffered++] = cc;
401 }
402 else {
403 fprintf(stderr, "(F): Lookahead buffer overflow (MAX=%u).\n", MAX_BUF);
404 exit(2);
405 }
406}
407
408/* Either set this file's input language explicitly via a string or
409 use the filename extension to determine the language.

Callers 3

tokenizeFunction · 0.70
C_tokenize_intFunction · 0.70
tokenizeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected