txt.item[txt.size] = 0;
//convert the line start offsets to pointers
- array_for(i, tlines, *i = txt.item + (size_t)*i);
+ array_for_t(i, tlines, const char *, *i = txt.item + (size_t)*i);
tl->olines = olines.item;
tl->olines_size = olines.size;
s = tl->txt;
e = s + tl->txt_size;
- array_appends(array, {
+ array_appends_t(array, struct token, {
.type = TOK_STARTLINE,
.txt = s,
.txt_size = 0
add(.type = type,
{.include = include});
+
} else if (c=='\'' || c=='\"') { //character or string literal
array_char string = array_new(tl);
s = read_cstring(&string, s, e, c, mq);
if (s<e) s++; //advance past endquote (if available)
add(.type = c=='\'' ? TOK_CHAR : TOK_STRING,
{.string = string});
+
+ if (c=='\'' && string.size==0) {
+ tok_msg_error(empty_char_constant, orig,
+ "Empty character constant");
+ }
+
} else if (c=='/' && s<e && (*s=='*' || *s=='/')) { //comment
if (*s++ == '*') { /* C-style comment */
const char *comment_start = s-2;