Menu

#55 add support for %< to perform token concatenation

open
nobody
None
1
2003-11-10
2003-11-10
No

As of filing this request NASM does perform token
concatenation at the end of expand_smacro(), but
said code is broken -- see SF #821975 and #839189
for details.

In my local forked version -- which was branched
from NASM 0.98, and thus didn't have the broken
code to begin with -- I have implemented support
for %<, to perform token concatenation, similar
to the one that has always been performed at the
end of expand_mmac_params().

I chose %< instead of %+, because the latter is
already used by %+n, i.e. references to a multi-
line macro parameter which must also be a valid
x86 condition code. (And on top of that, in my
version %> has a meaning too. But that's another
item, for another day.)

The attached file contains the diffs showing the
required changes. (While they aren't suitable for
direct application to NASM 0.98.38, they should
be easy to "port".)

Discussion

  • nasm64developer

    nasm64developer - 2003-11-10
     
  • nasm64developer

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

    nasm64developer - 2003-11-24

    Logged In: YES
    user_id=804543

    My previously attached diff should be modified
    slightly to allow TOK_PREPROC_ID and TOK_NUMBER
    tokens to be concatenated, if they reside left
    and right of a TOK_CAT token (%<), respectively.

    This is "required" because the %# functionality
    which I've proposed in SF #829879 can be used to
    prevent %$ID from being converted to ..@<num>.ID
    and thus opens the possibility of concatenating
    %$ID with a subsequent number, e.g. into %$ID123.

    The necessary changes are simple:

    1. Add "case TOK_PREPROC_ID:" either just before
    or just after "case TOK_NUMBER:".

    2. Modify the corresponding error message: make
    it indicate whether concatenation failed after
    a number of after a preprocessor identifier.

    - err ( ERR_TYPE_ERROR, "failed to concatenate after
    number" );
    + err ( ERR_TYPE_ERROR, "failed to concatenate after %s",
    t->type == TOK_NUMBER ? "number" : "preprocessor identifier"
    );

     
  • nasm64developer

    nasm64developer - 2003-11-24

    Logged In: YES
    user_id=804543

    I have filed SF #848424, requesting the same change
    for expand_mmac_params().

    That way the concatenation code in expand_smacro()
    and expand_mmac_params() will match.

     

Log in to post a comment.