I searched but couldn't find exactly what I was looking for. I normally wouldn't be so detailed about this question, but I'm having to write a regular expression to tag routines in PB with my editor. What I want to make sure of is the exact requirements for Function, Sub, Method, and Property names.
1) First, I'm assuming the naming requirements for Function Sub Method and Property are the same, correct?
2) The docs say that the first character of the name must be alphabetic. Yes, that's pretty clear - but I want to make sure that _ or $ or no other character is allowed. I've never used it, but I would have thought something like "function $X" or "sub _Y" would have been legal. Is it really alpha [A-Za-z] only?
3) I know that a type specifier can be appended. As far as I can tell, the list of valid type specifiers is [%&?!#@$]. Correct, or did I miss some? (note that I realize the type specifiers can appear multiple times, as in "sub mysub&&&")
4) As for all chars between the 1st and (possible but not required) type specifier(s), I know that [A-Za-z0-9_] are all valid. Are any other chars valid? For example, can type specifiers appear in the middle of a function name (as in "My$Function$")? Are there any other valid characters that can appear in the middle part of a name?
Oh, and do the same rules for names also apply to the names of Type, Union, Class, Interface, Macro, Macro Function, and Declare?
Thanks
1) First, I'm assuming the naming requirements for Function Sub Method and Property are the same, correct?
2) The docs say that the first character of the name must be alphabetic. Yes, that's pretty clear - but I want to make sure that _ or $ or no other character is allowed. I've never used it, but I would have thought something like "function $X" or "sub _Y" would have been legal. Is it really alpha [A-Za-z] only?
3) I know that a type specifier can be appended. As far as I can tell, the list of valid type specifiers is [%&?!#@$]. Correct, or did I miss some? (note that I realize the type specifiers can appear multiple times, as in "sub mysub&&&")
4) As for all chars between the 1st and (possible but not required) type specifier(s), I know that [A-Za-z0-9_] are all valid. Are any other chars valid? For example, can type specifiers appear in the middle of a function name (as in "My$Function$")? Are there any other valid characters that can appear in the middle part of a name?
Oh, and do the same rules for names also apply to the names of Type, Union, Class, Interface, Macro, Macro Function, and Declare?
Thanks
Comment