BR 3392207: preproc: Rewrite paste_tokens routine
commit1cf9b31d5513e71ba6fc01cccd22bcf0de8eb445
authorCyrill Gorcunov <gorcunov@gmail.com>
Sat, 4 Aug 2012 06:51:58 +0000 (4 10:51 +0400)
committerCyrill Gorcunov <gorcunov@gmail.com>
Tue, 7 Aug 2012 07:27:17 +0000 (7 11:27 +0400)
treed1f6793b3120d6466ae5839ff23168cca02c03b5
parenteb867fe78e2ac71256ded5559f04a899ae93ab89
BR 3392207: preproc: Rewrite paste_tokens routine

This should make it easier to read and moreover
now we're able to preprocess pasting as

%define N 1e%++%+ 5
dd N, 1e+5

Note that N should be expanded as series of pasting
to 1e+5 term, but before this patch we were ending
up in 1e+%+ 5 which is wrong.

In other words the fixed version output is

dd 1e+5, 1e+5

while broken one was

dd 1e+%+ 5, 1e+5

This patch also fixes nil dereferences in case if
there is no left or right token around pasting term.

http://bugzilla.nasm.us/show_bug.cgi?id=3392207

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
preproc.c