':' syntax -> Macro Name(Arg): CodeLine

Post bugs related to the IDE here
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

':' syntax -> Macro Name(Arg): CodeLine

Post by Olliv »

Code: Select all

;{
Macro Quote:"
EndMacro
Macro FuncDef(x):Func(UCase(Quote#x#Quote) ) = @x()
EndMacro
Global NewMap Func()
Macro FuncCall(Name, Arg1 =, Arg2 =)
CompilerIf Quote#Arg1#Quote = ""
CallFunctionFast(Func(UCase(Quote#Name#Quote) ) )
CompilerElse
CompilerIf Quote#Arg2#Quote = ""
CallFunctionFast(Func(UCase(Quote#Name#Quote) ),
Arg1)
CompilerElse
CallFunctionFast(Func(UCase(Quote#Name#Quote) ),
Arg1, Arg2)
CompilerEndIf
CompilerEndIf
EndMacro
;}
Procedure Test()
MessageRequester("", "")
EndProcedure
FuncDef(Test)
FuncCall(Test)
Why this first line below is crashing? And...

Code: Select all

Macro FuncDef(x):Func(UCase(Quote#x#Quote) ) = @x()
EndMacro
...and why just this change (replace ':' by carriage return) is okay?

(or is it a native rule I miss?)

(right code below)

Code: Select all

;{
Macro Quote:"
EndMacro
Macro FuncDef(x)
Func(UCase(Quote#x#Quote) ) = @x()
EndMacro
Global NewMap Func()
Macro FuncCall(Name, Arg1 =, Arg2 =)
CompilerIf Quote#Arg1#Quote = ""
CallFunctionFast(Func(UCase(Quote#Name#Quote) ) )
CompilerElse
CompilerIf Quote#Arg2#Quote = ""
CallFunctionFast(Func(UCase(Quote#Name#Quote) ),
Arg1)
CompilerElse
CallFunctionFast(Func(UCase(Quote#Name#Quote) ),
Arg1, Arg2)
CompilerEndIf
CompilerEndIf
EndMacro
;}
Procedure Test()
MessageRequester("", "")
EndProcedure
FuncDef(Test)
FuncCall(Test)
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ':' syntax -> Macro Name(Arg): CodeLine

Post by mk-soft »

Macros don´t like colon ':'

Code: Select all

;{
Macro Quote
  "
EndMacro
Macro FuncDef(x)
  Func(UCase(Quote#x#Quote) ) = @x()
EndMacro
Global NewMap Func()
Macro FuncCall(Name, Arg1 =, Arg2 =)
  CompilerIf Quote#Arg1#Quote = ""
    CallFunctionFast(Func(UCase(Quote#Name#Quote) ) )
  CompilerElse
    CompilerIf Quote#Arg2#Quote = ""
      CallFunctionFast(Func(UCase(Quote#Name#Quote) ), Arg1)
    CompilerElse
      CallFunctionFast(Func(UCase(Quote#Name#Quote) ), Arg1, Arg2)
    CompilerEndIf
  CompilerEndIf
EndMacro
;}
Procedure Test()
  MessageRequester("", "")
EndProcedure
FuncDef(Test)
FuncCall(Test)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: ':' syntax -> Macro Name(Arg): CodeLine

Post by Olliv »

mk-soft wrote:Macros don´t like colon ':'
Thank you for this poetic answer.

There is no detailed rule about what it is supported and what it is not supported.

Also, error message does not tell a macro error, what it causes a little bit of wasted time.

To prevent this for now, I ll exclude this availability of colon in macros.

Thank you again.
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ':' syntax -> Macro Name(Arg): CodeLine

Post by mk-soft »

Only at first line

Code: Select all

Macro foo(a,b)
  a = 10 : b = 20
EndMacro
no problem
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: ':' syntax -> Macro Name(Arg): CodeLine

Post by Olliv »

mk-soft wrote:Only at first line
(in the context where macros does not support colon char ':' on the 1st line.)

Thank you for this precision. I observed ':' colon chars were not compiled on the same manner from one pb version to an other one. Old versions had more
Post Reply