diff options
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r-- | crates/ra_mbe/src/lib.rs | 130 |
1 files changed, 63 insertions, 67 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index ee5c6866c..eedc0c5dd 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs | |||
@@ -943,75 +943,71 @@ MACRO_ITEMS@[0; 40) | |||
943 | r#"{let mut v = Vec :: new () ; v . push (1u32) ; v . push (2) ; v}"#, | 943 | r#"{let mut v = Vec :: new () ; v . push (1u32) ; v . push (2) ; v}"#, |
944 | ); | 944 | ); |
945 | 945 | ||
946 | println!("{}", expand_to_expr(&rules, r#"vec![1u32,2]"#).syntax().debug_dump().trim()); | ||
947 | |||
948 | assert_eq!( | 946 | assert_eq!( |
949 | expand_to_expr(&rules, r#"vec![1u32,2]"#).syntax().debug_dump().trim(), | 947 | expand_to_expr(&rules, r#"vec![1u32,2]"#).syntax().debug_dump().trim(), |
950 | r#"MACRO_STMTS@[0; 45) | 948 | r#"BLOCK_EXPR@[0; 45) |
951 | EXPR_STMT@[0; 45) | 949 | BLOCK@[0; 45) |
952 | BLOCK_EXPR@[0; 45) | 950 | L_CURLY@[0; 1) "{" |
953 | BLOCK@[0; 45) | 951 | LET_STMT@[1; 20) |
954 | L_CURLY@[0; 1) "{" | 952 | LET_KW@[1; 4) "let" |
955 | LET_STMT@[1; 20) | 953 | BIND_PAT@[4; 8) |
956 | LET_KW@[1; 4) "let" | 954 | MUT_KW@[4; 7) "mut" |
957 | BIND_PAT@[4; 8) | 955 | NAME@[7; 8) |
958 | MUT_KW@[4; 7) "mut" | 956 | IDENT@[7; 8) "v" |
959 | NAME@[7; 8) | 957 | EQ@[8; 9) "=" |
960 | IDENT@[7; 8) "v" | 958 | CALL_EXPR@[9; 19) |
961 | EQ@[8; 9) "=" | 959 | PATH_EXPR@[9; 17) |
962 | CALL_EXPR@[9; 19) | 960 | PATH@[9; 17) |
963 | PATH_EXPR@[9; 17) | 961 | PATH@[9; 12) |
964 | PATH@[9; 17) | 962 | PATH_SEGMENT@[9; 12) |
965 | PATH@[9; 12) | 963 | NAME_REF@[9; 12) |
966 | PATH_SEGMENT@[9; 12) | 964 | IDENT@[9; 12) "Vec" |
967 | NAME_REF@[9; 12) | 965 | COLONCOLON@[12; 14) "::" |
968 | IDENT@[9; 12) "Vec" | 966 | PATH_SEGMENT@[14; 17) |
969 | COLONCOLON@[12; 14) "::" | 967 | NAME_REF@[14; 17) |
970 | PATH_SEGMENT@[14; 17) | 968 | IDENT@[14; 17) "new" |
971 | NAME_REF@[14; 17) | 969 | ARG_LIST@[17; 19) |
972 | IDENT@[14; 17) "new" | 970 | L_PAREN@[17; 18) "(" |
973 | ARG_LIST@[17; 19) | 971 | R_PAREN@[18; 19) ")" |
974 | L_PAREN@[17; 18) "(" | 972 | SEMI@[19; 20) ";" |
975 | R_PAREN@[18; 19) ")" | 973 | EXPR_STMT@[20; 33) |
976 | SEMI@[19; 20) ";" | 974 | METHOD_CALL_EXPR@[20; 32) |
977 | EXPR_STMT@[20; 33) | 975 | PATH_EXPR@[20; 21) |
978 | METHOD_CALL_EXPR@[20; 32) | 976 | PATH@[20; 21) |
979 | PATH_EXPR@[20; 21) | 977 | PATH_SEGMENT@[20; 21) |
980 | PATH@[20; 21) | 978 | NAME_REF@[20; 21) |
981 | PATH_SEGMENT@[20; 21) | 979 | IDENT@[20; 21) "v" |
982 | NAME_REF@[20; 21) | 980 | DOT@[21; 22) "." |
983 | IDENT@[20; 21) "v" | 981 | NAME_REF@[22; 26) |
984 | DOT@[21; 22) "." | 982 | IDENT@[22; 26) "push" |
985 | NAME_REF@[22; 26) | 983 | ARG_LIST@[26; 32) |
986 | IDENT@[22; 26) "push" | 984 | L_PAREN@[26; 27) "(" |
987 | ARG_LIST@[26; 32) | 985 | LITERAL@[27; 31) |
988 | L_PAREN@[26; 27) "(" | 986 | INT_NUMBER@[27; 31) "1u32" |
989 | LITERAL@[27; 31) | 987 | R_PAREN@[31; 32) ")" |
990 | INT_NUMBER@[27; 31) "1u32" | 988 | SEMI@[32; 33) ";" |
991 | R_PAREN@[31; 32) ")" | 989 | EXPR_STMT@[33; 43) |
992 | SEMI@[32; 33) ";" | 990 | METHOD_CALL_EXPR@[33; 42) |
993 | EXPR_STMT@[33; 43) | 991 | PATH_EXPR@[33; 34) |
994 | METHOD_CALL_EXPR@[33; 42) | 992 | PATH@[33; 34) |
995 | PATH_EXPR@[33; 34) | 993 | PATH_SEGMENT@[33; 34) |
996 | PATH@[33; 34) | 994 | NAME_REF@[33; 34) |
997 | PATH_SEGMENT@[33; 34) | 995 | IDENT@[33; 34) "v" |
998 | NAME_REF@[33; 34) | 996 | DOT@[34; 35) "." |
999 | IDENT@[33; 34) "v" | 997 | NAME_REF@[35; 39) |
1000 | DOT@[34; 35) "." | 998 | IDENT@[35; 39) "push" |
1001 | NAME_REF@[35; 39) | 999 | ARG_LIST@[39; 42) |
1002 | IDENT@[35; 39) "push" | 1000 | L_PAREN@[39; 40) "(" |
1003 | ARG_LIST@[39; 42) | 1001 | LITERAL@[40; 41) |
1004 | L_PAREN@[39; 40) "(" | 1002 | INT_NUMBER@[40; 41) "2" |
1005 | LITERAL@[40; 41) | 1003 | R_PAREN@[41; 42) ")" |
1006 | INT_NUMBER@[40; 41) "2" | 1004 | SEMI@[42; 43) ";" |
1007 | R_PAREN@[41; 42) ")" | 1005 | PATH_EXPR@[43; 44) |
1008 | SEMI@[42; 43) ";" | 1006 | PATH@[43; 44) |
1009 | PATH_EXPR@[43; 44) | 1007 | PATH_SEGMENT@[43; 44) |
1010 | PATH@[43; 44) | 1008 | NAME_REF@[43; 44) |
1011 | PATH_SEGMENT@[43; 44) | 1009 | IDENT@[43; 44) "v" |
1012 | NAME_REF@[43; 44) | 1010 | R_CURLY@[44; 45) "}""# |
1013 | IDENT@[43; 44) "v" | ||
1014 | R_CURLY@[44; 45) "}""# | ||
1015 | ); | 1011 | ); |
1016 | } | 1012 | } |
1017 | 1013 | ||