Page 1 of 1

var names: bug or not?

PostPosted: Thu Nov 06, 2008 5:30 pm
by relez
this is trivial but....
i cannot define vars with name int1 or int001... example:

Code: Select all
class Test
   def main is shared
      int01 as int
      intb as int


intb is ok but compiler refuses int01 and also int001, or int0007 etc.... and complains:
Unsupported integer size.....
If this is by design i think that we might need a different compiler message, such as "incorrect var name...." or similar.

Re: var names: bug or not?

PostPosted: Thu Nov 06, 2008 5:56 pm
by Charles
Interesting. Cobra has types:

-- int8, int16, int32, int64
-- uint8, uint16, uint32, uint64

The tokenizer picks up on any int<NN> and reports it as an integer type of size NN. The parser then complains if the size is not in {8, 16, 32, 64}. This will remain since it would be confusing to have an int8 type and an int4 var name. I have updated the error message in the parser to read:

error: Unsupported integer size: 1. Try int8, int16, int32 or int64. Or, for non-types, use a name different than the form "intNN" which is reserved for integer types.

Re: var names: bug or not?

PostPosted: Thu Nov 06, 2008 6:02 pm
by relez
Ok, thk u ;)