Closed tajmone closed 6 years ago
Valid macro names are made of letters, digits and underscores (a-zA-Z0-9_
). You can define (this is a bug!) macros with any characters but you won't be able to use these macros). pp should report an error if the macro name is invalid.
Also if you define a macro with a builtin name, it won't be usable.
The parser is not based on regular expressions but on functions.
Macro names are case-sensitive.
bug fixed. pp will now print an error message is the name is invalid or built-in.
Can we reopen this please:
Why not allow the dash -
as a macro name character?
Is there a real need for this? I guess it would break existing documents and the dash is rarely used in identifiers (which language does this?). dash is already used in expression.
For example when using the macro: !define(my_special_symbol)
then in my markdown document the word special
gets syntax highlighted as italics in my editor (only in the source document of course).
But this is really the only issue I can think off.
And now I realize that you can change the syntax highlighting in your code editor to remedy this, though its a bit of work, too (on my side)
This is a more general problem when mixing different syntax in a single file. e.g. if I use wildcards (*
) in shell macro parameters, the rest of the document is rendered as italic or bold text in vim. I also think the solution is to change the syntax highlighting but it's specific to:
Specific workaround for your case: don't use underscores ;-) (e.g.: mySpecialSymbol
).
Alright, then this issue should be closed again.
I've looked at the source code but couldn't find any references (RegEx, etc) to what constitutes a valid macro name.
Which characters can be used in a macro's name? I assume the usual
a-zA-Z0-9_-
, but what about special chars (like:$#@;:
and so on)?If I've understood correctly, macro's names are case sensitive; therefore
!hello
and!Hello
would be two distinct macros.And (I assum) user defined macros can't take the name of a built-in macro (at least not with the same letter casing).
Are these last two assumptions correct?