mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Ignore third punct in 2-composite punct
This commit is contained in:
parent
0fd75c98ac
commit
26e1f7696a
2 changed files with 36 additions and 20 deletions
|
@ -240,26 +240,26 @@ impl<'a> TtIter<'a> {
|
||||||
let tt3 = self.next().unwrap().clone();
|
let tt3 = self.next().unwrap().clone();
|
||||||
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into())
|
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2, tt3] }.into())
|
||||||
}
|
}
|
||||||
('-', '=', None)
|
('-', '=', _)
|
||||||
| ('-', '>', None)
|
| ('-', '>', _)
|
||||||
| (':', ':', None)
|
| (':', ':', _)
|
||||||
| ('!', '=', None)
|
| ('!', '=', _)
|
||||||
| ('.', '.', None)
|
| ('.', '.', _)
|
||||||
| ('*', '=', None)
|
| ('*', '=', _)
|
||||||
| ('/', '=', None)
|
| ('/', '=', _)
|
||||||
| ('&', '&', None)
|
| ('&', '&', _)
|
||||||
| ('&', '=', None)
|
| ('&', '=', _)
|
||||||
| ('%', '=', None)
|
| ('%', '=', _)
|
||||||
| ('^', '=', None)
|
| ('^', '=', _)
|
||||||
| ('+', '=', None)
|
| ('+', '=', _)
|
||||||
| ('<', '<', None)
|
| ('<', '<', _)
|
||||||
| ('<', '=', None)
|
| ('<', '=', _)
|
||||||
| ('=', '=', None)
|
| ('=', '=', _)
|
||||||
| ('=', '>', None)
|
| ('=', '>', _)
|
||||||
| ('>', '=', None)
|
| ('>', '=', _)
|
||||||
| ('>', '>', None)
|
| ('>', '>', _)
|
||||||
| ('|', '=', None)
|
| ('|', '=', _)
|
||||||
| ('|', '|', None) => {
|
| ('|', '|', _) => {
|
||||||
let tt2 = self.next().unwrap().clone();
|
let tt2 = self.next().unwrap().clone();
|
||||||
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into())
|
Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into())
|
||||||
}
|
}
|
||||||
|
|
|
@ -991,6 +991,22 @@ fn test_tt_composite2() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tt_with_composite_without_space() {
|
||||||
|
parse_macro(
|
||||||
|
r#"
|
||||||
|
macro_rules! foo {
|
||||||
|
($ op:tt, $j:path) => (
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
// Test macro input without any spaces
|
||||||
|
// See https://github.com/rust-analyzer/rust-analyzer/issues/6692
|
||||||
|
.assert_expand_items("foo!(==,Foo::Bool)", "0");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_underscore() {
|
fn test_underscore() {
|
||||||
parse_macro(
|
parse_macro(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue