polterguy/lizzie

Should have stricter checking of symbol names

Closed this issue · 1 comments

Current code checks only that symbol names cannot contain whitespace.

It seems to me that you should also exclude punctuation symbols used by the Lizzie language: (){} and comma.

Actually, in regards to the (){}, characters, finding one of these in the place where I suspect you're looking (SanityCheckSymbolName?) would be theoretically impossible, since at this point if the code contained such characters, the tokenizer would have create a new token - So adding a check for these characters would be a redundant check, and simply use additional CPU, for no purpose - Unless somebody have create their own Tokenizer, which is possible though, but highly unlikely, and if they do, they'll probably tokenize similarly according to these characters ...

Basically, checking for anything we're checking for here, is due to Lizzie's tokens definition redundant, since it would be logically impossible to encounter any of these characters as a part of a symbol name, since the tokenizer would then have stopped interpreting it as a single token, and declared it as three tokens (separated by the special character, e.g. {)

E.g.

foo{bar

Becomes 3 tokens ...

  1. foo
  2. {
  3. bar

So a symbol could never, not even in theory, contain such characters ... :)