Closed ericoporto closed 3 months ago
Found a little time and managed to fix this!
Edit: minor note the test below fails
[Test]
public void NonLatinUnicodeInMacroName()
{
// Non-latin unicode characters in macro names raises an error (maybe? not sure)
IPreprocessor preprocessor = CompilerFactory.CreatePreprocessor(AGS.Types.Version.AGS_EDITOR_VERSION);
string script = $@"
#define MACROИह€한𐍈 10
int i = MACROИह€한𐍈;
";
preprocessor.Preprocess(script, "ScriptName");
Assert.That(preprocessor.Results.Count, Is.EqualTo(1));
Assert.That(preprocessor.Results[0].Code, Is.EqualTo(ErrorCode.InvalidCharacter));
}
Because macros are not passed forward to the compiler perhaps this is alright? I wasn't sure so I didn't do anything on this, not sure if some TO-DO comment should be added at least.
Edit2: probably the cpp version of the preprocessor also needs both the change and the tests too.
possible fix #2480
It would certainly be nice to have more tests to add here.