Page 1 of 1

Macro-Parameter with Code and using as Keyword.

Posted: Fri Jun 22, 2007 1:21 pm
by Leonhard
I need Macro-Parameters with ',' and would make Keywords with Macros.

So I wrote there examples:

Code: Select all

Macro Call(ProcedureName, Header)
  ProcedureName(Header)
EndMacro

Debug Call(RGB, {255, 255, 255})

Code: Select all

Macro ConsoleColor CharacterColor, BackgroundColor = 0
  ConsoleColor(CharacterColor, BackgroundColor)
EndMacro

ConsoleColor 7

Posted: Fri Jun 22, 2007 1:24 pm
by freak

Code: Select all

Macro Call(ProcedureName, Header)
  ProcedureName#Header
EndMacro

Debug Call(RGB, (255, 255, 255))
this works.

Posted: Fri Jun 22, 2007 1:26 pm
by Leonhard
yes, but i would have Macros for Keywords

Posted: Fri Jun 22, 2007 1:28 pm
by freak
your second example is just ugly syntax imho :P

Posted: Fri Jun 22, 2007 1:31 pm
by Leonhard
How can it have a better syntax?

Posted: Fri Jun 22, 2007 6:36 pm
by Kaeru Gaman
arguments for procedures/functions in PB are always included in brackets.
if you want no brackets, write a complete parser...

Posted: Mon Jun 25, 2007 2:52 pm
by Leonhard
freak wrote:your second example is just ugly syntax imho :P
is this better?

Code: Select all

Macro Call(ProcedureName, Header)
  ProcedureName(Header)
EndMacro

Debug Call(RGB, ´255, 255, 255´)

Posted: Tue Jun 26, 2007 11:41 am
by Michael Vogel
Leonhard, what's about your third (or fourth?) example?

Posted: Tue Jun 26, 2007 6:09 pm
by Leonhard
Michael Vogel wrote:Leonhard, what's about your third (or fourth?) example?
Is a other syntax-unsing to the first example.
I use ´ in place of { and } .