Since it seems like the DayZ Team is trying to improve their compiler and is actively trying to push modders to a more uniform coding style by adding new warnings for missing semicolons or other things, I thought I would share my findings from my own compiler I have written in ANTL4. I linked the 1.27 experimental scripts (which already had a lot of improvements from 1.26) with my changes and the original scripts they are based off of, so there can be an easy git diff done to see what I changed.
Here is a short summary of the most common issues, which are not reported by the compiler:
- Still a lot of missing Semicolons (especially after variable definitions) int abc
- missing or too many commas in list definitions TStringArray arr = {"abc",} or TStringArray arr = {"abc", "cde"\n"adf"} (\n being a new line in the file)
- comma at the end of a method parameter list void test (int a, int b,) {}
- commas missing after return or break
- too many closing brackets or missing closing brackets return ((a == 0) | b; or return a == 0)
- too many angle brackets in generic class definitions map<int, string>> theMap = new map<int, string>>
- ref after new ref Timer = new ref Timer();
- semicolon after if, even though the if would have a body, causing the body to always execute, regardless of the if (can be very annoying!!) if (ctx.Read(count)); {return count;} (should at least be a warning, modders should just have an empty body instead)
- for loops not initializing their counter value (not quite an error, but it should always be initialized) for (int i; i < 4; ++i) {} missing the int i = 0;
- missing semicolon after typedef typedef map<string, ref array<ref CarContactData>> CarContactCache
- : instead of ; return "HEAVY":
- variable definitions can miss the equal sign (this treats it as if the value is not assigned!) float f 4.0; instead of float f = 4.0;
- constructor parameters can be used as values in class variables (see ScriptConsoleWeatherPreset class float WOvercast = overcast;
- double semicolons (also not really an error, but not needed to have ;;) or empty lines with just a semicolon (should at least be a warning)
- preprocessor would cut the whole line after the end of the command is reached, instead of continuing reading the rest of the line #ifdef HEATBUFFER_IND ICATOR_DEBUG ignores the ICATOR_DEBUG, causing it to not be detected, that there is a tab in the name of the ifdef check