Something not working with Macros

Just starting out? Need help? Post your questions and find answers here.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Something not working with Macros

Post by es_91 »

Code: Select all

macro  declareClass

	declareModule

endMacro

macro  endDeclareClass

	endDeclareModule

endMacro


declareClass  test

	declare  hello()

endDeclareClass


module  test

	procedure hello ()
	
		debug 1
	
	endProcedure

endModule


test::hello()
PB Compiler wrote:Line 18: Syntax error.
:mrgreen:
User_Russian
Addict
Addict
Posts: 1584
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Something not working with Macros

Post by User_Russian »

This is probably not a bug.
You are calling a macro inside the module declaration, but macro located outside the module.
Little John
Addict
Addict
Posts: 4802
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Something not working with Macros

Post by Little John »

User_Russian wrote: Sat Apr 26, 2025 8:28 pm This is probably not a bug.
You are calling a macro inside the module declaration, but macro located outside the module.
Yep.
User avatar
STARGÅTE
Addict
Addict
Posts: 2259
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Something not working with Macros

Post by STARGÅTE »

Code: Select all

DeclareModule Class
	
	Macro  declareClass
	
		DeclareModule
	
	EndMacro
	
	Macro  endDeclareClass
	
		EndDeclareModule
	
	EndMacro

EndDeclareModule

Module Class

EndModule


Class::declareClass  test

	Declare  hello()

Class::endDeclareClass


Module  test

	Procedure hello ()
	
		Debug 1
	
	EndProcedure

EndModule


test::hello()
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: Something not working with Macros

Post by es_91 »

Special thanks, STARGATE !!
:mrgreen:
Post Reply