-
Notifications
You must be signed in to change notification settings - Fork 16
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
Line breaks in GUI Data Functions break Parser #164
Comments
Thiscis tricky because "quoted string not closed" is a helpful warning in other contexts and I hate to lose it. I wonder if there's a way to detect that it's on purpose here |
Yeah the best solution would probably be to have the parser "search" for the closing quote over multiple lines. But I don't know if that is feasible with the current design. |
Technically it's easy :) The parser already looks for the closing quote over multiple lines. We would just have to delete the warning. It's just that this warning is very helpful if you accidentally leave out a closing quote, so I hate to lose it. The vast majority of quoted strings are intended to be only one line. I wonder if there's a heuristic that would let the parser detect that intent. Without this warning... Since most files have multiple quoted strings, the parser will usually find a quote mark to pair up with (namely the one starting the next quoted string), all the way to the end of the file where it will emit an unexpected eof warning. Unless you forgot TWO closing quotes, in which case it will silently mismatch them. You'll probably get other validation errors, but none of them will say "hey you forgot to close the string on this line". |
Hi, I think I have two potential solutions.
I suppose solution 1 will be much easier to implement, but solution 2 will be more extensible for the future. |
The second one is already there with the robust filtering system. Yes it can not be as specific as ignoring a line but still I don't think that one would be necessary. |
As far as I know, the filtering system can only be used from config file instead of any inplace think like an comment. This is useful when you want to filter out lots of warnings, but it may filter out too much and hide the real error. Meanwhile, using an inplace comment is like an explicit declaration that causes far less misuse. |
I would like both solutions. Since one can be used for future false positives and one solves this specific issue. |
I like solution 1. Solution 2, lint suppression, is a big topic of its own. I was thinking of block-scoped suppression like Rust has, but line by line suppression like you suggest here would be easier to implement. It's out of scope for this issue though. |
Hi @amtep,
I have found an issue with the GUI Data Function parser when having line breaks in it.
Example
This is valid in Victoria 3 GUIs and helps massively with readability:
Errors
Below are the errors for the particular example above, but I also noticed these ones for other occurances:
Unexpected character '.', expected ']'
Unexpected character '.', expected ')'
Regards,
Chris
The text was updated successfully, but these errors were encountered: