flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasmg] macro parameter grouping

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 2800
Location: dank orb
bitRAKE
Code:
macro DisplayList list
        iterate L,list
                display `L
        end iterate
        display 13,10
end macro

DisplayList <1,<4,2>,"three">    
The string keeps it's quotes, but the grouping looses it's <>. Is this the intended result? Just seems inconsistent, and no way to detect between 1 and <1>? Probably iterate stripping them?

Code:
macro DisplayList list
        iterate L,<list>
                display `L
        end iterate
        display 13,10
end macro    
and
Code:
macro DisplayList list&
        iterate L,list
                display `L
        end iterate
        display 13,10
end macro    
...produce the expected output.

_________________
¯\(°_o)/¯ unlicense.org
Post 21 May 2019, 17:49
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7498
Location: Kraków, Poland
Tomasz Grysztar
Yes, it's ITERATE that strips them. The outer ones are stripped by DisplayList macro call, the inner ones are stripped by ITERATE. A greedy argument (one followed by "&") is a way to avoid stripping.
Post 21 May 2019, 17:55
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2800
Location: dank orb
bitRAKE
I was wrong the "&" and <> causes the individual items not to be processed by ITERATE. (Hence the commas in the output.) If iterate always strips the inner <> then I'll need to find another way.

_________________
¯\(°_o)/¯ unlicense.org
Post 21 May 2019, 18:15
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7498
Location: Kraków, Poland
Tomasz Grysztar
Yeah, once you're out of fasm 1 syntax territory, manual processing with looped MATCH is most likely the only way to go (obviously slow). I've been considering various kinds of directives that could help with specific cases or perhaps make my bracket balancing macros obsolete, but I still did not find that perfect design that I would like.
Post 22 May 2019, 08:29
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2800
Location: dank orb
bitRAKE
I can modify my approach to use what is available.

That thread is quite helpful thank you.

_________________
¯\(°_o)/¯ unlicense.org
Post 23 May 2019, 00:42
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-2019, Tomasz Grysztar.

Powered by rwasa.