-
Notifications
You must be signed in to change notification settings - Fork 83
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
Parser chokes on paths containing "operator" #374
Comments
Unfortunately it's difficult to adapt the parser to allow both of the following to work: /datum/operator/()
// this is the overload for `/` division operator for `/datum`
/datum/operator/unrelated_proc()
// this is an unrelated proc on `/datum/operator` So I may leave this as a won't-fix. |
Adding context for how BYOND's parser works: There are different modes the parser can be in, one of which is reading path tokens. A path token is either of the When the As an example of a normal case without rewinding: If Rewinding after
|
I appreciate the in-depth explanation. SpacemanDMM's parser is fairly different to the official DM parser - it's not built to be able to rewind, but it's split into a lexing and parsing phase, so it can make decisions by looking one whole token ahead, rather than just one character. This gap does mean I've had to add special cases for certain things (like the difference between SpacemanDMM's tree path parsing basically alternates between reading identifiers and reading Previously, if it saw The fix is to not bail immediately. Instead, if the parser is in the state where it's just read a |
It is perhaps unwise to include
operator
in a path, but BYOND accepts it.This emits a warning that the proc is relatively-pathed, and confuses the language server into thinking the proc is global. If you leave out the first line, it also emits a "bad parent type" error.
This causes a fatal error in the parser.
It would not be unreasonable to just treat
operator
as a reserved word and disallow its use in paths. OpenDream does this by default. It shouldn't break the parser, though.The text was updated successfully, but these errors were encountered: