My little contribution to 1.10 users ...
In as_tokenizer.cpp in bool asCTokenizer::IsConstant() line 257 :
// String constant between double-quotes if( source[0] == '"' || source[0] == '\'' ) { bool evenSlashes = true; int n, l; for( l = 0, n = 1; n < sourceLength; n++ ) { if( source[n] == '\n' ) break; if(source[0] == source[n] && evenSlashes ) { if (source[0] == '"') { tokenType = ttStringConstant; tokenLength = n+1; return true; } else { // Char type if (l == 1) { tokenType = ttIntConstant; tokenLength = n+1; return true; } return false; } } if( source[n] == '\\' ) evenSlashes = !evenSlashes; else evenSlashes = true; l += (evenSlashes ? 1 : 0); } tokenType = ttNonTerminatedStringConstant; tokenLength = n-1; return true; }
and in as_compiler.cpp in void asCCompiler::CompileExpressionValue(asCScriptNode *node, asCByteCode *bc, asCTypeInfo *type) line 3159
// TODO: Check for overflow asDWORD val; if (value[0] != '\'') { val = asStringScanUInt(value, 10, 0); } else { int n, l; val = 0x00; for( l = 0, n = 1; n < vnode->tokenLength; n++ ) { if(value[0] == value[n]) { break; } if( value[n] == '\\' ) { n++; switch (value[n]) { // \a Bell (alert) case 'a' : val = '\a'; break; // \b Backspace case 'b' : val = '\b'; break; // \f Formfeed case 'f' : val = '\f'; break; // \n New line case 'n' : val = '\n'; break; // \r Carriage return case 'r' : val = '\r'; break; // \t Horizontal tab case 't' : val = '\t'; break; // \v Vertical tab case 'v' : val = '\v'; break; default : val = value[n]; } } else { val = value[n]; } } } bc->InstrDWORD(BC_SET4, val);
This will allow to get 'x' in scripts. Those chars will then be treaten in AS as const int.
AbrKen.
EDIT : Change return true to true/false in IsConstant.
[Edited by - abrken on December 8, 2005 2:14:11 AM]