-
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
Implements parsing for #pragma, handles the multiple case niavely #372
Conversation
I'm using a second hashmap to track multiple'd files. Not sure that this is the best way of going about it, but it's a living
@@ -952,6 +967,18 @@ impl<'ctx> Preprocessor<'ctx> { | |||
expect_token!((text) = Token::String(text)); | |||
self.context.register_error(DMError::new(self.last_input_loc, format!("#{} {}", ident, text))); | |||
} | |||
"pragma" if disabled => {} | |||
"pragma" => { | |||
expect_token!((text) = Token::String(text)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably mean Ident here, not String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it, but are you sure? #warn uses String() and its input isn't "'d at all, it's just the text after the #warn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's stupid, but there's a hack in lexer.rs for this: if ident == "warn" || ident == "error" {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fucking tears
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I add to that or just keep as is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As written is fine. The reason is that #warn and #error want to treat the whole rest of the line as one big string. #pragma is (for now...) followed by ordinary tokens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright. is there anything else you want me to do here?
…agma args as an ident instead of a string
I'm using a second hashmap to track multiple'd files. Not sure that this is the best way of going about it, but it's a living