-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to Panel Parsers #597
Conversation
Now in the Panel2 parser. |
147de4f
to
7ee4f70
Compare
Rebased and squashed. Integrating this would really help too, in making everything a lot more readable. The essential trouble is that BVE has always been incredibly loose with it's number parsing, and just spits out an error, whilst it'd probably be more conventional to throw an error. Another option might be a wrapper struct e.g. strut ParseResult
{
Vector3 Result;
bool errorX;
bool errorY;
bool errorZ;
} This seems like a complete waste of a struct to me though :/ |
Spent this morning playing with a block based parser, based heavily on my existing block based implementation for use in the internal formats. This initially seems to work quite well, although it uses generics a little too much for my taste & would require the sound parser keys etc. converting int enums to use everywhere. Azure build failure seems unrelated (git checkout failed) & this isn't finished enough to bother kicking it. |
Hmm, do we need a langversion tag? |
The panel.cfg and panel2.cfg parsers both make heavy use of text comparisons to determine the section / key within the section.
These can be converted into enum values for much better readability.
n.b.
This takes advantage of the C# feature that 2 members of an enum may have the same integral value. When converted to bytecode, the integral value is used as opposed to the textual representation.
https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1069
May need disabling if strict code analysis is enabled (it doesn't trip ReSharper or the default VS2019 rules), or possibly the way duplicate entries are declared to match Microsoft's preferences, although personally I think it's better this way.
CHECK / TODO:
Port to Panel2 parser.