Menu

#141 TOK_WHITESPACE concatenation is broken

open-works-for-me
nobody
None
1
2003-10-30
2003-10-30
No

At the end of its expand_mmac_params()
function the preprocessor concatenates
successive TOK_WHITESPACE tokens into
a single TOK_WHITESPACE token.

However, instead of concatenating the
actual text of both tokens, the text
of the second token is discarded.

For example:

%macro m 0-1+ ; call to perform
%1 ; TOK_WHITESPACE
%endmacro ; concatenation

%push c
%define %$d ; expands into nothing
%define %$q '

db %$q%$d %$d %$d%$q ; 2x " "
m db %$q%$d %$d %$d%$q ; 1x " "

db %$q%$d %$d %$d %$d%$q ; 3x " "
m db %$q%$d %$d %$d %$d%$q ; 2x " "

%pop

This should be fixed.

Discussion

  • nasm64developer

    nasm64developer - 2003-10-30
    • priority: 5 --> 1
     
  • nasm64developer

    nasm64developer - 2003-10-30

    Logged In: YES
    user_id=804543

    The following diff would solve the problem, if it
    weren't for SF bug #833425. (Said bug causes the
    nasm_strcat() to fail, due to t->text and tt->text
    being NULL, instead of pointers to strings which
    contain the actual isspace() characters).

    --- preproc.c.0.98.38
    +++ preproc.c.fixed
    @@ -3303,6 +3303,9 @@
    case TOK_WHITESPACE:
    if (tt->type == TOK_WHITESPACE)
    {
    + char *tmp = nasm_strcat(t->text,
    tt->text);
    + nasm_free(t->text);
    + t->text = tmp;
    t->next = delete_Token(tt);
    }
    break;

     
  • nasm64developer

    nasm64developer - 2003-10-30
    • status: open --> open-works-for-me
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.