Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[887] ZScript scanner bug

3 replies · 1,251 views · Started 18 November 2008

global script slot2 {
void run() {
int _test = 123;
int test = 456;
Trace(_test);
}
}

This gives a "duplicate symbol" error:

ZQuest wrote:Pass 1: Parsing
Pass 2: Preprocessing
Scanner: lexical error '_'.

Scanner: lexical error '_'.

Pass 3: Building symbol tables
quest2.z, line 4: Error S08: There is already a variable with name test defined in this scope.

If an underscore is not a valid token to start a symbol off with, then this should be a syntax error. Otherwise, the error is in the scanner, ignoring the underscore.

Do to what I'm assuming an oversight, variables weren't allowed to begin with underscores, even though underscores are allowed anywhere else in the variable name. Fixed.

actually, that's a fairly common restriction. I think it has something to do with C compilers generating symbols that start with an underscore, and avoiding conflicts. Or something.