Sorry, I was only focusing on the example by skywalk which did not use variable naming.
Your example doesn't make sense as it is.
The constant's name isn't actually known until the macro is called (unlike in skywalk's example).
So when you add that, the compiler would need to expand the macro. It's not as easy as changing the "scope", but not as time consuming as you might think either. The macro doesn't need to be compiled or anything. Upon calling, the constants, variables and procedure names just need to be expanded and added to the list.
It requires some parsing, yes, but I don't think it will steal too much CPU.
Also, what would still be easily possible is to offer an autocomlete list or status bar help
up until the variable point. That would require no further parsing.
Code: Select all
Macro x(_name_)
#c_in_macro_#_name_ = 1
EndMacro
#c_in ;would expand to #c_in_macro_ and you'd only have to type the "name"