I would like to categorize 'bad characters in token names' ranging from really, reasonable, possibly bad. 'Bad' in the sense that if they are used in a macro, they can screw things up.
Reason
I already have a diagnose macro that checks for these things, I'm currently building a general 'fix token names' macro to substitute all these but I want to give the user some sense of what is really necessary to fix and what not.
Code: Select all
&+:;=?@#|'<>.-, trailingSpace leadingSpace
code
Code: Select all
<!-- check the tokens for any illegal character -->
[h:tokList = getTokenNames("json", '{layer:["TOKEN","GM","OBJECT","BACKGROUND"]}')]
<!-- in another routine the tokens with a , in the name are removed first -->
[h:hasWrongTokName ="[]"]
[h:regResult = strfind(tokList,"[^,]*([&+:;=?@#|'<>.-]+)[^,]*")]
[h:numWrong = min(1000,getFindCount(regResult))]
[h,if(numWrong), CODE:{
[count(numWrong): hasWrongTokName = json.append(hasWrongTokName, getGroup(regResult, roll.count+1,0))]
}]
[r:json.toList(hasWrongTokName)]
spaces are done seperately
Code: Select all
$\/^~
3 questions:
1. do you know how I can add one or more of the 'tried to add but failed' characters to the entire list
2. did I miss any (important) characters
3. how would you categorize the characters over the three groups?
My take:
Really
, : '
Reasonably
& ? @ ; trailing/leading space
Possibly
+ = # | < > . -
, : '
Reasonably
& ? @ ; trailing/leading space
Possibly
+ = # | < > . -