flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > macro argument angle brackets - bug?

Author
Thread Post new topic Reply to topic
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 27 Sep 2017, 17:47
fasmg manual wrote:
If an argument to macroinstruction needs to contain a comma character, the
entire argument must be enclosed between the "<" and ">" characters (they do
not become a part of the value). If another "<" character is encountered inside
such value, it must be balanced with corresponding ">" character inside the
same value.
Nested angle brackets is an Error: invalid expression.
Code:
  some_macro <1,<2,3>>    
fasmg hxhsr and fasm 1.71.64.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Post 27 Sep 2017, 17:47
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 27 Sep 2017, 19:04
This works with no problem for me:
Code:
macro some_macro arg
        display `arg
end macro

some_macro <1,<2,3>>    
Code:
flat assembler  version g.hxhsr
1,<2,3>
1 pass, 0 bytes.    


The nesting is only needed when there is another, deeper layer of macros that need inner enclosing. This is how it works:
Code:
macro some_macro arg
        outer_list_macro arg
end macro

macro outer_list_macro args&
        iterate arg, args
                inner_list_macro arg
        end iterate
end macro

macro inner_list_macro args&
        display 'inner list: ',`args,13,10
        iterate arg, args
                db arg
        end iterate
end macro


some_macro <1,<2,3>>    
Post 27 Sep 2017, 19:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.