# Known Bugs
-## .scc ' ' does not work
-`.scc ' ' = 100` results in an error. The expected result is for it to re-map the space character.
-
-## Slash char literal parsing error
-'/' char literal is broken
#define ULAS_TOKISTERM write
#define ULAS_TOKCOND (i < n && write < n && line[i])
+#define ULAS_QUOTED_TOKEN(quote_char) { \
+ dst->buf[write++] = line[i++];\
+ int last_escape = 0;\
+ while (ULAS_TOKCOND && (line[i] != (quote_char) || last_escape)) {\
+ last_escape = line[i] == '\\';\
+ dst->buf[write++] = line[i];\
+ i++;\
+ }\
+ dst->buf[write++] = line[i++];\
+ }
int ulas_tok(struct ulas_str *dst, const char **out_line, unsigned long n) {
const char *line = *out_line;
// string token
if (line[i] == '"') {
- dst->buf[write++] = line[i++];
- int last_escape = 0;
- while (ULAS_TOKCOND && (line[i] != '\"' || last_escape)) {
- last_escape = line[i] == '\\';
- dst->buf[write++] = line[i];
- i++;
- }
- dst->buf[write++] = line[i++];
- } else {
+ ULAS_QUOTED_TOKEN('\"');
+ } else if (line[i] == '\'') {
+ ULAS_QUOTED_TOKEN('\'');
+ } else {
while (ULAS_TOKCOND) {
char c = line[i];