Use MacroInvocLexer in AttributeParser#3890
Merged
Merged
Conversation
This should make it easier for us to handle attribute meta items of the form <SimplePath> '=' <Expression> where the expression isn't a literal. Some low hanging fruit remains here, but I think I should keep this patch small as I had some trouble debugging it as-is (see: Rust::Token::as_string vs Rust::Token::get_str vs Rust::AST::Token::as_string). gcc/rust/ChangeLog: * ast/rust-ast.cc: Include "rust-macro-invoc-lexer.h". (AttributeParser::~AttributeParser): Move function definition here. (AttributeParser::AttributeParser): Likewise and adjust member initialization. (AttributeParser::parse_meta_item_inner): Handle changes to peek_token. (AttributeParser::parse_literal): Likewise. (AttributeParser::parse_simple_path_segment): Likewise. (AttributeParser::parse_meta_item_seq): Handle changes to AttributeParser fields. (AttributeParser::peek_token): Move function definition here and wrap MacroInvocLexer. (AttributeParser::skip_token): Likewise. * ast/rust-macro.h (class MacroInvocLexer): Forward declare. (class Parser): Likewise. (AttributeParser::token_stream): Remove field. (AttributeParser::stream_pos): Likewise. (AttributeParser::lexer): New field. (AttributeParser::parser): Likewise. (AttributeParser::AttributeParser): Move definition to "rust-ast.cc". (AttributeParser::~AttributeParser): Likewise. (AttributeParser::peek_token): Likewise. (AttributeParser::skip_token): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Member
|
aaaah that's amazing, thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should make it easier for us to handle attribute meta items of the form
<SimplePath> '=' <Expression>where the expression isn't a literal. Some low hanging fruit remains here, but I think I should keep this patch small as I had some trouble debugging it as-is (see:Rust::Token::as_stringvsRust::Token::get_strvsRust::AST::Token::as_string).