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

Function get_literal

extern/btyacc/reader.c:493–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493bucket *get_literal()
494{
495 register int c, quote;
496 register int i;
497 register int n;
498 register char *s;
499 register bucket *bp;
500 int s_lineno = lineno;
501 char *s_line = dup_line();
502 char *s_cptr = s_line + (cptr - line);
503
504 quote = *cptr++;
505 cinc = 0;
506 for (;;) {
507 c = *cptr++;
508 if (c == quote) break;
509 if (c == '\n') unterminated_string(s_lineno, s_line, s_cptr);
510 if (c == '\\') {
511 char *c_cptr = cptr - 1;
512 c = *cptr++;
513 switch (c) {
514 case '\n':
515 get_line();
516 if (line == 0) unterminated_string(s_lineno, s_line, s_cptr);
517 continue;
518 case '0': case '1': case '2': case '3':
519 case '4': case '5': case '6': case '7':
520 n = c - '0';
521 c = *cptr;
522 if (IS_OCTAL(c)) {
523 n = (n << 3) + (c - '0');
524 c = *++cptr;
525 if (IS_OCTAL(c)) {
526 n = (n << 3) + (c - '0');
527 ++cptr; } }
528 if (n > MAXCHAR) illegal_character(c_cptr);
529 c = n;
530 break;
531 case 'x':
532 c = *cptr++;
533 n = hexval(c);
534 if (n < 0 || n >= 16)
535 illegal_character(c_cptr);
536 for (;;) {
537 c = *cptr;
538 i = hexval(c);
539 if (i < 0 || i >= 16) break;
540 ++cptr;
541 n = (n << 4) + i;
542 if (n > MAXCHAR) illegal_character(c_cptr); }
543 c = n;
544 break;
545 case 'a': c = 7; break;
546 case 'b': c = '\b'; break;
547 case 'f': c = '\f'; break;
548 case 'n': c = '\n'; break;
549 case 'r': c = '\r'; break;
550 case 't': c = '\t'; break;

Callers 4

declare_tokensFunction · 0.85
declare_typesFunction · 0.85
add_symbolFunction · 0.85
mark_symbolFunction · 0.85

Calls 8

dup_lineFunction · 0.85
unterminated_stringFunction · 0.85
illegal_characterFunction · 0.85
hexvalFunction · 0.85
cachecFunction · 0.85
no_spaceFunction · 0.85
get_lineFunction · 0.70
lookupFunction · 0.70

Tested by

no test coverage detected