void test_tok(void) {
TESTBEGIN("tok");
- assert_tok(
- " test tokens with line / * + - , ;",
- {"test", "tokens", "with", "line", "/", "*", "+", "-", ",", ";", NULL});
+ assert_tok(" test tokens with line / * + - , ; \\1",
+ {"test", "tokens", "with", "line", "/", "*", "+", "-", ",", ";",
+ "\\1", NULL});
TESTEND("tok");
}
case '-':
case '*':
case '/':
- case '\\':
case ULAS_TOK_COMMENT:
// single char tokens
dst->buf[write++] = line[i++];
break;
- // consume rest of the line but do not write anything to tokens
- i = (int)n;
+ case '\\':
+ // make sure we have enough space in buffer
+ ulas_strensr(dst, write + 2);
+ // escape char tokens
+ dst->buf[write++] = line[i++];
+ dst->buf[write++] = line[i++];
break;
default:
while (weld_tokcond) {