Duke3D/CON: It is possible to define variables that start with digits
In most programming languages, defining variable names that start with digits is forbidden, for reasons such as the lexer running into problems distinguishing constants and variables from each other.
In eduke32's CON, defining variables that start with digits is currently possible, but functionally useless as the parser will treat any used token that starts with digits as a constant in other locations. Any letter characters that follow the digits will simply be ignored, up to the end of the token. The CON compiler will not raise an error for defining a variable using digits as the first character, nor will it raise an error for appending letters after a constant token.
For example, the following code compiles under current eduke32:
var TEMP 0 0
var 123hello 10 0
onevent EVENT_ALTFIRE
set TEMP 123hello
al TEMP
endevent
The result is that TEMP = 123 instead of 10. While the set
command raises a warning when used in this way, there are other commands such as rotatesprite
that will not warn the user at all if such tokens appear as arguments. Defining variables in this fashion also does not raise a warning nor an error.
In short, defining variables in such a fashion should probably raise an error, and there should be additional checks such that having characters appended to tokens that start with digits raises at least a warning.