MCPcopy Create free account
hub / github.com/GJDuck/e9patch / getToken

Method getToken

src/e9tool/e9parser.cpp:461–665  ·  view source on GitHub ↗

* Get the next token. */

Source from the content-addressed store, hash-verified

459 * Get the next token.
460 */
461int Parser::getToken()
462{
463 prev = pos;
464 if (peek != TOKEN_ERROR)
465 {
466 int t = peek;
467 peek = TOKEN_ERROR;
468 return t;
469 }
470 char c = buf[pos];
471 while (isspace(c))
472 c = buf[++pos];
473
474 // Operators:
475 switch (c)
476 {
477 case '\0':
478 strcpy(s, "<end-of-input>");
479 return TOKEN_EOF;
480 case '[': case ']': case '@': case ',': case '(': case ')':
481 case '&': case '.': case ':': case '+': case '{': case '}':
482 case '*': case '|': case '~': case '^':
483 s[0] = c; s[1] = '\0';
484 pos++;
485 switch (c)
486 {
487 case '&': case '|': case '.':
488 if (buf[pos] == c)
489 {
490 s[1] = c; s[2] = '\0';
491 pos++;
492 }
493 break;
494 default:
495 break;
496 }
497 return getTokenFromName(s);
498 case '!': case '<': case '>': case '=':
499 s[0] = c; s[1] = '\0';
500 pos++;
501 if (buf[pos] == '=')
502 {
503 s[1] = '='; s[2] = '\0';
504 pos++;
505 }
506 else if ((c == '<' || c == '>') && buf[pos] == c)
507 {
508 s[1] = c; s[2] = '\0';
509 pos++;
510 }
511 return getTokenFromName(s);
512 case '-':
513 s[0] = c; s[1] = '\0';
514 pos++;
515 if (buf[pos] == '-' || buf[pos] == 'w')
516 {
517 s[1] = buf[pos]; s[2] = '\0';
518 pos++;

Callers 9

parseIndexFunction · 0.80
parseSymbolFunction · 0.80
parseMemOpFunction · 0.80
parseMatchArgFunction · 0.80
parseMatchExprFunction · 0.80
parsePatchArgFunction · 0.80
parsePatchFunction · 0.80
parseExcludeBoundFunction · 0.80
parseExcludeFunction · 0.80

Calls 8

isspaceFunction · 0.85
strcpyFunction · 0.85
isxdigitFunction · 0.85
errorFunction · 0.85
strtoullFunction · 0.85
isalphaFunction · 0.85
isalnumFunction · 0.85
isdigitFunction · 0.50

Tested by

no test coverage detected