MCPcopy Create free account
hub / github.com/dillo-browser/dillo / nextToken

Method nextToken

src/cssparser.cc:522–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520}
521
522void CssParser::nextToken()
523{
524 int c, c1, d, j;
525 char hexbuf[5];
526 int i = 0;
527
528 ttype = CSS_TK_CHAR; /* init */
529 spaceSeparated = false;
530
531 while (true) {
532 c = getChar();
533 if (isspace(c)) { // ignore whitespace
534 spaceSeparated = true;
535 } else if (skipString(c, "/*")) { // ignore comments
536 do {
537 c = getChar();
538 } while (c != EOF && ! skipString(c, "*/"));
539 } else if (skipString(c, "<!--")) { // ignore XML comment markers
540 } else if (skipString(c, "-->")) {
541 } else {
542 break;
543 }
544 }
545
546 // handle negative numbers
547 if (c == '-') {
548 if (i < maxStrLen - 1)
549 tval[i++] = c;
550 c = getChar();
551 }
552
553 if (isdigit(c)) {
554 ttype = CSS_TK_DECINT;
555 do {
556 if (i < maxStrLen - 1) {
557 tval[i++] = c;
558 }
559 /* else silently truncated */
560 c = getChar();
561 } while (isdigit(c));
562 if (c != '.')
563 ungetChar();
564
565 /* ...but keep going to see whether it's really a float */
566 }
567
568 if (c == '.') {
569 c = getChar();
570 if (isdigit(c)) {
571 ttype = CSS_TK_FLOAT;
572 if (i < maxStrLen - 1)
573 tval[i++] = '.';
574 do {
575 if (i < maxStrLen - 1)
576 tval[i++] = c;
577 /* else silently truncated */
578 c = getChar();
579 } while (isdigit(c));

Callers 1

parseMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected