Commit a671c41
Use MacroInvocLexer in AttributeParser
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>1 parent 6f1f7c7 commit a671c41
2 files changed
+51
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
3508 | 3509 | | |
3509 | 3510 | | |
3510 | 3511 | | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
3511 | 3523 | | |
3512 | 3524 | | |
3513 | 3525 | | |
| |||
3549 | 3561 | | |
3550 | 3562 | | |
3551 | 3563 | | |
3552 | | - | |
| 3564 | + | |
3553 | 3565 | | |
3554 | 3566 | | |
3555 | 3567 | | |
| |||
3566 | 3578 | | |
3567 | 3579 | | |
3568 | 3580 | | |
3569 | | - | |
3570 | | - | |
| 3581 | + | |
| 3582 | + | |
3571 | 3583 | | |
3572 | 3584 | | |
3573 | 3585 | | |
3574 | 3586 | | |
3575 | | - | |
3576 | | - | |
3577 | | - | |
3578 | 3587 | | |
3579 | | - | |
| 3588 | + | |
3580 | 3589 | | |
3581 | 3590 | | |
3582 | 3591 | | |
| |||
3728 | 3737 | | |
3729 | 3738 | | |
3730 | 3739 | | |
3731 | | - | |
3732 | 3740 | | |
3733 | 3741 | | |
3734 | 3742 | | |
| |||
3739 | 3747 | | |
3740 | 3748 | | |
3741 | 3749 | | |
3742 | | - | |
| 3750 | + | |
| 3751 | + | |
3743 | 3752 | | |
3744 | 3753 | | |
3745 | 3754 | | |
| |||
3788 | 3797 | | |
3789 | 3798 | | |
3790 | 3799 | | |
3791 | | - | |
| 3800 | + | |
3792 | 3801 | | |
3793 | 3802 | | |
3794 | 3803 | | |
3795 | 3804 | | |
3796 | | - | |
| 3805 | + | |
3797 | 3806 | | |
3798 | 3807 | | |
3799 | | - | |
3800 | | - | |
| 3808 | + | |
3801 | 3809 | | |
3802 | 3810 | | |
3803 | | - | |
| 3811 | + | |
3804 | 3812 | | |
3805 | 3813 | | |
3806 | | - | |
| 3814 | + | |
3807 | 3815 | | |
3808 | 3816 | | |
3809 | 3817 | | |
3810 | | - | |
| 3818 | + | |
3811 | 3819 | | |
3812 | 3820 | | |
3813 | 3821 | | |
3814 | | - | |
| 3822 | + | |
3815 | 3823 | | |
3816 | 3824 | | |
3817 | | - | |
| 3825 | + | |
3818 | 3826 | | |
3819 | 3827 | | |
3820 | 3828 | | |
| |||
3872 | 3880 | | |
3873 | 3881 | | |
3874 | 3882 | | |
3875 | | - | |
| 3883 | + | |
3876 | 3884 | | |
3877 | 3885 | | |
3878 | 3886 | | |
3879 | 3887 | | |
3880 | | - | |
| 3888 | + | |
3881 | 3889 | | |
3882 | 3890 | | |
3883 | 3891 | | |
| |||
3911 | 3919 | | |
3912 | 3920 | | |
3913 | 3921 | | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
3914 | 3934 | | |
3915 | 3935 | | |
3916 | 3936 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
1116 | 1121 | | |
1117 | 1122 | | |
1118 | 1123 | | |
1119 | | - | |
1120 | | - | |
| 1124 | + | |
| 1125 | + | |
1121 | 1126 | | |
1122 | 1127 | | |
1123 | 1128 | | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
| 1129 | + | |
1127 | 1130 | | |
1128 | | - | |
| 1131 | + | |
1129 | 1132 | | |
1130 | 1133 | | |
1131 | 1134 | | |
| |||
1146 | 1149 | | |
1147 | 1150 | | |
1148 | 1151 | | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
| 1152 | + | |
1153 | 1153 | | |
1154 | | - | |
| 1154 | + | |
1155 | 1155 | | |
1156 | 1156 | | |
1157 | 1157 | | |
| |||
0 commit comments