Macro-Parameter with Code and using as Keyword.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Macro-Parameter with Code and using as Keyword.

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Code: Select all

Macro Call(ProcedureName, Header)
  ProcedureName#Header
EndMacro

Debug Call(RGB, (255, 255, 255))
this works.
quidquid Latine dictum sit altum videtur
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Post by Leonhard »

yes, but i would have Macros for Keywords
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

your second example is just ugly syntax imho :P
quidquid Latine dictum sit altum videtur
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Post by Leonhard »

How can it have a better syntax?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

arguments for procedures/functions in PB are always included in brackets.
if you want no brackets, write a complete parser...
oh... and have a nice day.
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Post 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´)
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post by Michael Vogel »

Leonhard, what's about your third (or fourth?) example?
Leonhard
User
User
Posts: 55
Joined: Fri Jun 16, 2006 7:43 am

Post 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 } .
Post Reply