| %d | ", lineno);
}
break;
case T_SPACE:
buff_puts(&buff, str + tokens[i].off, tokens[i].len);
break;
case T_TAB:
for(int j = 0; j < tokens[i].len; j += 1)
buff_printf(&buff, " ");
break;
case T_KWORD:
buff_printf(&buff, "%.*s",
prefix, prefix,
tokens[i].len, str + tokens[i].off,
tokens[i].len, str + tokens[i].off);
break;
case T_VSTR:
buff_printf(&buff, "", prefix);
print_escaped(&buff, str + tokens[i].off, tokens[i].len);
buff_printf(&buff, "");
break;
case T_VCHAR:
buff_printf(&buff, "", prefix);
print_escaped(&buff, str + tokens[i].off, tokens[i].len);
buff_printf(&buff, "");
break;
case T_VINT:
buff_printf(&buff, "%.*s",
prefix, tokens[i].len, str + tokens[i].off);
break;
case T_VFLT:
buff_printf(&buff, "%.*s",
prefix, tokens[i].len, str + tokens[i].off);
break;
case T_FDECLNAME:
buff_printf(&buff, "%.*s",
prefix, prefix, tokens[i].len, str + tokens[i].off);
break;
case T_FCALLNAME:
buff_printf(&buff, "%.*s",
prefix, prefix, tokens[i].len, str + tokens[i].off);
break;
case T_IDENTIFIER:
buff_printf(&buff, "%.*s",
prefix, tokens[i].len, str + tokens[i].off);
break;
case T_COMMENT:
{
long j = tokens[i].off;
long end = j + tokens[i].len;
while(1) {
long line_off = j;
while(j < end && str[j] != '\n')
j += 1;
long line_len = j - line_off;
buff_printf(&buff, "");
if(j == end)
break;
j += 1; // Skip the '\n'.
lineno += 1;
buff_printf(&buff, " |
\n | %d | ", lineno);
}
break;
}
case T_OPERATOR:
buff_printf(&buff, "", prefix);
print_escaped(&buff, str + tokens[i].off, tokens[i].len);
buff_printf(&buff, "");
break;
case T_DIRECTIVE:
buff_printf(&buff, "", prefix);
print_escaped(&buff, str + tokens[i].off, tokens[i].len);
buff_printf(&buff, "");
break;
default:
buff_printf(&buff, "%c", str[tokens[i].off]);
break;
}
}
buff_printf(&buff,
" |
\n"
"