lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


This patch in llex.c no longer drops characters in comments:

$ diff llex.c,orig llex.c
448d447
<           luaZ_resetbuffer(ls->buff);  /* 'skip_sep' may dirty the buffer */
450c449
<             read_long_string(ls, NULL, sep);  /* skip long comment */
---
>             read_long_string(ls, seminfo, sep);  /* skip long comment */
452c451
<             break;
---
>             return 'C';
457,458c456,459
<           next(ls);  /* skip until end of line (or end of file) */
<         break;
---
>           save_and_next(ls); /* skip until end of line (or end of file) */
>         seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
>                                   luaZ_bufflen(ls->buff));
>         return 'c';

As before, the patched code returns 'C' for a long comment and 'c' for a short
comment, with the contents of the comment in seminfo->ts.
 
Again, adding support for this in ltokenp is just adding two lines in proxy.c:
    switch (t)
    {
      case 'C':
      case 'c':
      case TK_STRING:
      case TK_NAME:
       lua_pushstring(L,getstr(seminfo->ts));
       break;
       ...

All feedback welcome.