for (int ofs = 0; ofs < n; ofs += mblen)
{
ucs4_t uc;
- mblen = u8_mbtouc (&uc, input, n);
+ mblen = u8_mbtouc (&uc, input + ofs, n - ofs);
if (!lex_uc_is_space (uc))
return false;
}
{
s->nest--;
if (!s->nest)
- s->state = S_DEFINE_3;
+ {
+ s->state = S_DEFINE_3;
+ s->substate = 0;
+ }
return ofs;
}
The line might be blank, whether completely empty or just spaces and
comments. That's OK: we need to report blank lines because they can
- have significance. */
- *type = SEG_MACRO_BODY;
+ have significance.
+
+ However, if the first line of the macro body (the same line as the
+ closing parenthesis in the argument definition) is blank, we just
+ report it as spaces because it's not significant. */
+ *type = (s->substate == 0 && is_all_spaces (input, ofs)
+ ? SEG_SPACES : SEG_MACRO_BODY);
s->state = S_DEFINE_4;
+ s->substate = 1;
return ofs;
}
else