diff options
Diffstat (limited to 'crates/ide/src')
-rw-r--r-- | crates/ide/src/file_structure.rs | 14 | ||||
-rw-r--r-- | crates/ide/src/references.rs | 117 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting.rs | 52 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html | 2 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/highlight_strings.html | 6 | ||||
-rw-r--r-- | crates/ide/src/syntax_highlighting/test_data/highlighting.html | 6 |
6 files changed, 156 insertions, 41 deletions
diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index 415795e8c..c51531391 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs | |||
@@ -150,13 +150,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
150 | }; | 150 | }; |
151 | Some(node) | 151 | Some(node) |
152 | }, | 152 | }, |
153 | ast::MacroCall(it) => { | 153 | ast::MacroRules(it) => decl(it), |
154 | match it.path().and_then(|it| it.segment()).and_then(|it| it.name_ref()) { | ||
155 | Some(path_segment) if path_segment.text() == "macro_rules" | ||
156 | => decl(it), | ||
157 | _ => None, | ||
158 | } | ||
159 | }, | ||
160 | _ => None, | 154 | _ => None, |
161 | } | 155 | } |
162 | } | 156 | } |
@@ -380,7 +374,7 @@ fn very_obsolete() {} | |||
380 | label: "mc", | 374 | label: "mc", |
381 | navigation_range: 284..286, | 375 | navigation_range: 284..286, |
382 | node_range: 271..303, | 376 | node_range: 271..303, |
383 | kind: MACRO_CALL, | 377 | kind: MACRO_RULES, |
384 | detail: None, | 378 | detail: None, |
385 | deprecated: false, | 379 | deprecated: false, |
386 | }, | 380 | }, |
@@ -389,7 +383,7 @@ fn very_obsolete() {} | |||
389 | label: "mcexp", | 383 | label: "mcexp", |
390 | navigation_range: 334..339, | 384 | navigation_range: 334..339, |
391 | node_range: 305..356, | 385 | node_range: 305..356, |
392 | kind: MACRO_CALL, | 386 | kind: MACRO_RULES, |
393 | detail: None, | 387 | detail: None, |
394 | deprecated: false, | 388 | deprecated: false, |
395 | }, | 389 | }, |
@@ -398,7 +392,7 @@ fn very_obsolete() {} | |||
398 | label: "mcexp", | 392 | label: "mcexp", |
399 | navigation_range: 387..392, | 393 | navigation_range: 387..392, |
400 | node_range: 358..409, | 394 | node_range: 358..409, |
401 | kind: MACRO_CALL, | 395 | kind: MACRO_RULES, |
402 | detail: None, | 396 | detail: None, |
403 | deprecated: false, | 397 | deprecated: false, |
404 | }, | 398 | }, |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 7395b81bd..675957fff 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -97,6 +97,9 @@ pub(crate) fn find_all_refs( | |||
97 | get_struct_def_name_for_struct_literal_search(&sema, &syntax, position) | 97 | get_struct_def_name_for_struct_literal_search(&sema, &syntax, position) |
98 | { | 98 | { |
99 | (Some(name), ReferenceKind::StructLiteral) | 99 | (Some(name), ReferenceKind::StructLiteral) |
100 | } else if let Some(name) = get_enum_def_name_for_struct_literal_search(&sema, &syntax, position) | ||
101 | { | ||
102 | (Some(name), ReferenceKind::EnumLiteral) | ||
100 | } else { | 103 | } else { |
101 | ( | 104 | ( |
102 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, position.offset), | 105 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, position.offset), |
@@ -198,6 +201,33 @@ fn get_struct_def_name_for_struct_literal_search( | |||
198 | None | 201 | None |
199 | } | 202 | } |
200 | 203 | ||
204 | fn get_enum_def_name_for_struct_literal_search( | ||
205 | sema: &Semantics<RootDatabase>, | ||
206 | syntax: &SyntaxNode, | ||
207 | position: FilePosition, | ||
208 | ) -> Option<ast::Name> { | ||
209 | if let TokenAtOffset::Between(ref left, ref right) = syntax.token_at_offset(position.offset) { | ||
210 | if right.kind() != SyntaxKind::L_CURLY && right.kind() != SyntaxKind::L_PAREN { | ||
211 | return None; | ||
212 | } | ||
213 | if let Some(name) = | ||
214 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, left.text_range().start()) | ||
215 | { | ||
216 | return name.syntax().ancestors().find_map(ast::Enum::cast).and_then(|l| l.name()); | ||
217 | } | ||
218 | if sema | ||
219 | .find_node_at_offset_with_descend::<ast::GenericParamList>( | ||
220 | &syntax, | ||
221 | left.text_range().start(), | ||
222 | ) | ||
223 | .is_some() | ||
224 | { | ||
225 | return left.ancestors().find_map(ast::Enum::cast).and_then(|l| l.name()); | ||
226 | } | ||
227 | } | ||
228 | None | ||
229 | } | ||
230 | |||
201 | fn try_find_self_references( | 231 | fn try_find_self_references( |
202 | syntax: &SyntaxNode, | 232 | syntax: &SyntaxNode, |
203 | position: FilePosition, | 233 | position: FilePosition, |
@@ -357,6 +387,91 @@ fn main() { | |||
357 | } | 387 | } |
358 | 388 | ||
359 | #[test] | 389 | #[test] |
390 | fn test_enum_after_space() { | ||
391 | check( | ||
392 | r#" | ||
393 | enum Foo <|>{ | ||
394 | A, | ||
395 | B, | ||
396 | } | ||
397 | fn main() { | ||
398 | let f: Foo; | ||
399 | f = Foo::A; | ||
400 | } | ||
401 | "#, | ||
402 | expect![[r#" | ||
403 | Foo ENUM FileId(0) 0..26 5..8 Other | ||
404 | |||
405 | FileId(0) 63..66 EnumLiteral | ||
406 | "#]], | ||
407 | ); | ||
408 | } | ||
409 | |||
410 | #[test] | ||
411 | fn test_enum_before_space() { | ||
412 | check( | ||
413 | r#" | ||
414 | enum Foo<|> { | ||
415 | A, | ||
416 | B, | ||
417 | } | ||
418 | fn main() { | ||
419 | let f: Foo; | ||
420 | f = Foo::A; | ||
421 | } | ||
422 | "#, | ||
423 | expect![[r#" | ||
424 | Foo ENUM FileId(0) 0..26 5..8 Other | ||
425 | |||
426 | FileId(0) 50..53 Other | ||
427 | FileId(0) 63..66 EnumLiteral | ||
428 | "#]], | ||
429 | ); | ||
430 | } | ||
431 | |||
432 | #[test] | ||
433 | fn test_enum_with_generic_type() { | ||
434 | check( | ||
435 | r#" | ||
436 | enum Foo<T> <|>{ | ||
437 | A(T), | ||
438 | B, | ||
439 | } | ||
440 | fn main() { | ||
441 | let f: Foo<i8>; | ||
442 | f = Foo::A(1); | ||
443 | } | ||
444 | "#, | ||
445 | expect![[r#" | ||
446 | Foo ENUM FileId(0) 0..32 5..8 Other | ||
447 | |||
448 | FileId(0) 73..76 EnumLiteral | ||
449 | "#]], | ||
450 | ); | ||
451 | } | ||
452 | |||
453 | #[test] | ||
454 | fn test_enum_for_tuple() { | ||
455 | check( | ||
456 | r#" | ||
457 | enum Foo<|>{ | ||
458 | A(i8), | ||
459 | B(i8), | ||
460 | } | ||
461 | fn main() { | ||
462 | let f: Foo; | ||
463 | f = Foo::A(1); | ||
464 | } | ||
465 | "#, | ||
466 | expect![[r#" | ||
467 | Foo ENUM FileId(0) 0..33 5..8 Other | ||
468 | |||
469 | FileId(0) 70..73 EnumLiteral | ||
470 | "#]], | ||
471 | ); | ||
472 | } | ||
473 | |||
474 | #[test] | ||
360 | fn test_find_all_refs_for_local() { | 475 | fn test_find_all_refs_for_local() { |
361 | check( | 476 | check( |
362 | r#" | 477 | r#" |
@@ -655,7 +770,7 @@ fn foo() { | |||
655 | } | 770 | } |
656 | "#, | 771 | "#, |
657 | expect![[r#" | 772 | expect![[r#" |
658 | m1 MACRO_CALL FileId(0) 0..46 29..31 Other | 773 | m1 MACRO_RULES FileId(0) 0..46 29..31 Other |
659 | 774 | ||
660 | FileId(0) 63..65 StructLiteral | 775 | FileId(0) 63..65 StructLiteral |
661 | FileId(0) 73..75 StructLiteral | 776 | FileId(0) 73..75 StructLiteral |
diff --git a/crates/ide/src/syntax_highlighting.rs b/crates/ide/src/syntax_highlighting.rs index f5c6eabef..990b0f7d9 100644 --- a/crates/ide/src/syntax_highlighting.rs +++ b/crates/ide/src/syntax_highlighting.rs | |||
@@ -74,6 +74,7 @@ pub(crate) fn highlight( | |||
74 | let mut stack = HighlightedRangeStack::new(); | 74 | let mut stack = HighlightedRangeStack::new(); |
75 | 75 | ||
76 | let mut current_macro_call: Option<ast::MacroCall> = None; | 76 | let mut current_macro_call: Option<ast::MacroCall> = None; |
77 | let mut current_macro_rules: Option<ast::MacroRules> = None; | ||
77 | let mut format_string_highlighter = FormatStringHighlighter::default(); | 78 | let mut format_string_highlighter = FormatStringHighlighter::default(); |
78 | let mut macro_rules_highlighter = MacroRulesHighlighter::default(); | 79 | let mut macro_rules_highlighter = MacroRulesHighlighter::default(); |
79 | let mut inside_attribute = false; | 80 | let mut inside_attribute = false; |
@@ -106,28 +107,26 @@ pub(crate) fn highlight( | |||
106 | binding_hash: None, | 107 | binding_hash: None, |
107 | }); | 108 | }); |
108 | } | 109 | } |
109 | if let Some(name) = mc.is_macro_rules() { | ||
110 | macro_rules_highlighter.init(); | ||
111 | if let Some((highlight, binding_hash)) = highlight_element( | ||
112 | &sema, | ||
113 | &mut bindings_shadow_count, | ||
114 | syntactic_name_ref_highlighting, | ||
115 | name.syntax().clone().into(), | ||
116 | ) { | ||
117 | stack.add(HighlightedRange { | ||
118 | range: name.syntax().text_range(), | ||
119 | highlight, | ||
120 | binding_hash, | ||
121 | }); | ||
122 | } | ||
123 | } | ||
124 | current_macro_call = Some(mc.clone()); | 110 | current_macro_call = Some(mc.clone()); |
125 | continue; | 111 | continue; |
126 | } | 112 | } |
127 | WalkEvent::Leave(Some(mc)) => { | 113 | WalkEvent::Leave(Some(mc)) => { |
128 | assert!(current_macro_call == Some(mc)); | 114 | assert_eq!(current_macro_call, Some(mc)); |
129 | current_macro_call = None; | 115 | current_macro_call = None; |
130 | format_string_highlighter = FormatStringHighlighter::default(); | 116 | format_string_highlighter = FormatStringHighlighter::default(); |
117 | } | ||
118 | _ => (), | ||
119 | } | ||
120 | |||
121 | match event.clone().map(|it| it.into_node().and_then(ast::MacroRules::cast)) { | ||
122 | WalkEvent::Enter(Some(mac)) => { | ||
123 | macro_rules_highlighter.init(); | ||
124 | current_macro_rules = Some(mac); | ||
125 | continue; | ||
126 | } | ||
127 | WalkEvent::Leave(Some(mac)) => { | ||
128 | assert_eq!(current_macro_rules, Some(mac)); | ||
129 | current_macro_rules = None; | ||
131 | macro_rules_highlighter = MacroRulesHighlighter::default(); | 130 | macro_rules_highlighter = MacroRulesHighlighter::default(); |
132 | } | 131 | } |
133 | _ => (), | 132 | _ => (), |
@@ -163,6 +162,12 @@ pub(crate) fn highlight( | |||
163 | 162 | ||
164 | let range = element.text_range(); | 163 | let range = element.text_range(); |
165 | 164 | ||
165 | if current_macro_rules.is_some() { | ||
166 | if let Some(tok) = element.as_token() { | ||
167 | macro_rules_highlighter.advance(tok); | ||
168 | } | ||
169 | } | ||
170 | |||
166 | let element_to_highlight = if current_macro_call.is_some() && element.kind() != COMMENT { | 171 | let element_to_highlight = if current_macro_call.is_some() && element.kind() != COMMENT { |
167 | // Inside a macro -- expand it first | 172 | // Inside a macro -- expand it first |
168 | let token = match element.clone().into_token() { | 173 | let token = match element.clone().into_token() { |
@@ -173,9 +178,6 @@ pub(crate) fn highlight( | |||
173 | let parent = token.parent(); | 178 | let parent = token.parent(); |
174 | 179 | ||
175 | format_string_highlighter.check_for_format_string(&parent); | 180 | format_string_highlighter.check_for_format_string(&parent); |
176 | if let Some(tok) = element.as_token() { | ||
177 | macro_rules_highlighter.advance(tok); | ||
178 | } | ||
179 | 181 | ||
180 | // We only care Name and Name_ref | 182 | // We only care Name and Name_ref |
181 | match (token.kind(), parent.kind()) { | 183 | match (token.kind(), parent.kind()) { |
@@ -386,10 +388,14 @@ impl HighlightedRangeStack { | |||
386 | let mut res = self.stack.pop().unwrap(); | 388 | let mut res = self.stack.pop().unwrap(); |
387 | res.sort_by_key(|range| range.range.start()); | 389 | res.sort_by_key(|range| range.range.start()); |
388 | // Check that ranges are sorted and disjoint | 390 | // Check that ranges are sorted and disjoint |
389 | assert!(res | 391 | for (left, right) in res.iter().zip(res.iter().skip(1)) { |
390 | .iter() | 392 | assert!( |
391 | .zip(res.iter().skip(1)) | 393 | left.range.end() <= right.range.start(), |
392 | .all(|(left, right)| left.range.end() <= right.range.start())); | 394 | "left: {:#?}, right: {:#?}", |
395 | left, | ||
396 | right | ||
397 | ); | ||
398 | } | ||
393 | res | 399 | res |
394 | } | 400 | } |
395 | } | 401 | } |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 396fd46fb..920956b51 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html | |||
@@ -95,7 +95,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
95 | <span class="comment documentation">/// ```</span> | 95 | <span class="comment documentation">/// ```</span> |
96 | <span class="comment documentation">/// </span><span class="macro injected">noop!</span><span class="punctuation injected">(</span><span class="numeric_literal injected">1</span><span class="punctuation injected">)</span><span class="punctuation injected">;</span><span class="punctuation injected"> | 96 | <span class="comment documentation">/// </span><span class="macro injected">noop!</span><span class="punctuation injected">(</span><span class="numeric_literal injected">1</span><span class="punctuation injected">)</span><span class="punctuation injected">;</span><span class="punctuation injected"> |
97 | </span><span class="comment documentation">/// ```</span> | 97 | </span><span class="comment documentation">/// ```</span> |
98 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> | 98 | <span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> |
99 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span> | 99 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span> |
100 | <span class="punctuation">$</span>expr | 100 | <span class="punctuation">$</span>expr |
101 | <span class="punctuation">}</span> | 101 | <span class="punctuation">}</span> |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html index d398e1ec8..c843b5085 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html | |||
@@ -35,13 +35,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
35 | 35 | ||
36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } | 36 | .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } |
37 | </style> | 37 | </style> |
38 | <pre><code><span class="macro">macro_rules!</span> <span class="macro declaration">println</span> <span class="punctuation">{</span> | 38 | <pre><code><span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">println</span> <span class="punctuation">{</span> |
39 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>arg<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">(</span><span class="punctuation">{</span> | 39 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>arg<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">(</span><span class="punctuation">{</span> |
40 | <span class="punctuation">$</span>crate<span class="punctuation">:</span><span class="punctuation">:</span>io<span class="punctuation">:</span><span class="punctuation">:</span>_print<span class="punctuation">(</span><span class="punctuation">$</span>crate<span class="punctuation">:</span><span class="punctuation">:</span>format_args_nl<span class="punctuation">!</span><span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>arg<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation">;</span> | 40 | <span class="punctuation">$</span>crate<span class="punctuation">:</span><span class="punctuation">:</span>io<span class="punctuation">:</span><span class="punctuation">:</span>_print<span class="punctuation">(</span><span class="punctuation">$</span>crate<span class="punctuation">:</span><span class="punctuation">:</span>format_args_nl<span class="punctuation">!</span><span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>arg<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span><span class="punctuation">)</span><span class="punctuation">;</span> |
41 | <span class="punctuation">}</span><span class="punctuation">)</span> | 41 | <span class="punctuation">}</span><span class="punctuation">)</span> |
42 | <span class="punctuation">}</span> | 42 | <span class="punctuation">}</span> |
43 | #[rustc_builtin_macro] | 43 | <span class="attribute attribute">#</span><span class="attribute attribute">[</span><span class="function attribute">rustc_builtin_macro</span><span class="attribute attribute">]</span> |
44 | <span class="macro">macro_rules!</span> <span class="macro declaration">format_args_nl</span> <span class="punctuation">{</span> | 44 | <span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">format_args_nl</span> <span class="punctuation">{</span> |
45 | <span class="punctuation">(</span><span class="punctuation">$</span>fmt<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">{</span> <span class="comment">/* compiler built-in */</span> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">;</span> | 45 | <span class="punctuation">(</span><span class="punctuation">$</span>fmt<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">{</span> <span class="comment">/* compiler built-in */</span> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">;</span> |
46 | <span class="punctuation">(</span><span class="punctuation">$</span>fmt<span class="punctuation">:</span>expr<span class="punctuation">,</span> <span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>args<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">{</span> <span class="comment">/* compiler built-in */</span> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">;</span> | 46 | <span class="punctuation">(</span><span class="punctuation">$</span>fmt<span class="punctuation">:</span>expr<span class="punctuation">,</span> <span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>args<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">{</span> <span class="comment">/* compiler built-in */</span> <span class="punctuation">}</span><span class="punctuation">}</span><span class="punctuation">;</span> |
47 | <span class="punctuation">}</span> | 47 | <span class="punctuation">}</span> |
diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index a3b4f20e8..0569cf1e5 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html | |||
@@ -125,7 +125,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
125 | <span class="keyword">let</span> <span class="variable declaration">bar</span> <span class="operator">=</span> <span class="function">foobar</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> | 125 | <span class="keyword">let</span> <span class="variable declaration">bar</span> <span class="operator">=</span> <span class="function">foobar</span><span class="punctuation">(</span><span class="punctuation">)</span><span class="punctuation">;</span> |
126 | <span class="punctuation">}</span> | 126 | <span class="punctuation">}</span> |
127 | 127 | ||
128 | <span class="macro">macro_rules!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> | 128 | <span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">def_fn</span> <span class="punctuation">{</span> |
129 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">}</span> | 129 | <span class="punctuation">(</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">:</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span><span class="punctuation">$</span><span class="punctuation">(</span><span class="punctuation">$</span>tt<span class="punctuation">)</span><span class="punctuation">*</span><span class="punctuation">}</span> |
130 | <span class="punctuation">}</span> | 130 | <span class="punctuation">}</span> |
131 | 131 | ||
@@ -135,13 +135,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd | |||
135 | <span class="punctuation">}</span> | 135 | <span class="punctuation">}</span> |
136 | <span class="punctuation">}</span> | 136 | <span class="punctuation">}</span> |
137 | 137 | ||
138 | <span class="macro">macro_rules!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> | 138 | <span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">noop</span> <span class="punctuation">{</span> |
139 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span> | 139 | <span class="punctuation">(</span><span class="punctuation">$</span>expr<span class="punctuation">:</span>expr<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">{</span> |
140 | <span class="punctuation">$</span>expr | 140 | <span class="punctuation">$</span>expr |
141 | <span class="punctuation">}</span> | 141 | <span class="punctuation">}</span> |
142 | <span class="punctuation">}</span> | 142 | <span class="punctuation">}</span> |
143 | 143 | ||
144 | <span class="macro">macro_rules!</span> <span class="macro declaration">keyword_frag</span> <span class="punctuation">{</span> | 144 | <span class="keyword">macro_rules</span><span class="punctuation">!</span> <span class="macro declaration">keyword_frag</span> <span class="punctuation">{</span> |
145 | <span class="punctuation">(</span><span class="punctuation">$</span>type<span class="punctuation">:</span>ty<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">(</span><span class="punctuation">$</span>type<span class="punctuation">)</span> | 145 | <span class="punctuation">(</span><span class="punctuation">$</span>type<span class="punctuation">:</span>ty<span class="punctuation">)</span> <span class="operator">=</span><span class="punctuation">></span> <span class="punctuation">(</span><span class="punctuation">$</span>type<span class="punctuation">)</span> |
146 | <span class="punctuation">}</span> | 146 | <span class="punctuation">}</span> |
147 | 147 | ||