Page 1 of 1
Tag a file with "unsigned" variables...
Posted: Tue Feb 17, 2009 6:53 pm
by Nova
Hello, everybody
I just downloaded CodeLite, and I have to say I love it!
I just have one question: it seems that CodeLite is not able to parse a variable, if the variable name is declared as "unsigned", as in the example below:
Code: Select all
void Test()
{
static int8 u8VarA;
int8 u8VarB;
unsigned int8 u8VarC;
}
This will autocomplete only u8VarA and u8VarB, since u8VarC is not "seen".
Any idea on why this happens, and any workaroud available?
Thanks and kind regards
Marco Novaro
Re: Tag a file with "unsigned" variables...
Posted: Tue Feb 17, 2009 7:08 pm
by eranif
The long answer:
My grammar file contains this rule:
Code: Select all
basic_type_name_inter: LE_INT { $$ = $1; }
| LE_CHAR { $$ = $1; }
| LE_SHORT { $$ = $1; }
| LE_LONG { $$ = $1; }
| LE_FLOAT { $$ = $1; }
| LE_DOUBLE { $$ = $1; }
| LE_SIGNED { $$ = $1; }
| LE_UNSIGNED { $$ = $1; }
| LE_VOID { $$ = $1; }
;
basic_type_name: LE_UNSIGNED basic_type_name_inter { $$ = $1 + " " + $2; }
| LE_SIGNED basic_type_name_inter { $$ = $1 + " " + $2; }
| LE_LONG LE_LONG { $$ = $1 + " " + $2; }
| LE_LONG LE_INT { $$ = $1 + " " + $2; }
| basic_type_name_inter { $$ = $1; }
;
Which basically means that only the basic types are supported with unsgned.
To overcome this limitation, you could also do this:
Code: Select all
typedef unsigned int8 uint8;
uint8 u8VarC;
Eran
Re: Tag a file with "unsigned" variables...
Posted: Tue Feb 17, 2009 7:36 pm
by Nova
..I see.
...and I know this is a "strange" C syntax (it's actually written for the Freescale eTPU, where BTW I also have the type int24 -24 bits).
But, I can't understand why the "static int8" works fine and, at the end, why you can't just manage "unsigned" the same way.
Thanks for the fast and accurate reply.
Marco
Re: Tag a file with "unsigned" variables...
Posted: Tue Feb 17, 2009 7:47 pm
by eranif
Nova wrote:But, I can't understand why the "static int8" works fine and, at the end, why you can't just manage "unsigned" the same way.
This is because the 'static' is not part of the variable type, while unsigned *is* part of the type.
CodeLite currently simply ignores the 'static' variable by not including it as part of the grammar - this can not be dont for the 'unsigned'
For example, doing what you suggested ("ignoring" the unsigned) will cause wrong code completion:
If you have a method with such signature:
by ignoring the 'unsigned', codelite will provide the following as calltip:
since the 'unsigned' will be omitted - which is wrong.
Eran