mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
NFA parser for mbe matcher
This commit is contained in:
parent
7f57a01b3d
commit
cff2201c30
9 changed files with 592 additions and 175 deletions
|
@ -456,6 +456,17 @@ fn test_match_group_with_multichar_sep() {
|
|||
.assert_expand_items("foo! (fn baz {true true} );", "fn baz () -> bool {true &&true}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_match_group_with_multichar_sep2() {
|
||||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
(fn $name:ident {$($i:literal)&&*} ) => ( fn $name() -> bool { $($i)&&*} );
|
||||
}"#,
|
||||
)
|
||||
.assert_expand_items("foo! (fn baz {true && true} );", "fn baz () -> bool {true &&true}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_match_group_zero_match() {
|
||||
parse_macro(
|
||||
|
@ -1267,6 +1278,18 @@ macro_rules! m {
|
|||
.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_match_is_not_greedy() {
|
||||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($($i:ident $(,)*),*) => {};
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.assert_expand_items(r#"foo!(a,b);"#, r#""#);
|
||||
}
|
||||
|
||||
// The following tests are based on real world situations
|
||||
#[test]
|
||||
fn test_vec() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue