aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorSeivan Heidari <[email protected]>2019-12-23 14:35:31 +0000
committerSeivan Heidari <[email protected]>2019-12-23 14:35:31 +0000
commitb21d9337d9200e2cfdc90b386591c72c302dc03e (patch)
treef81f5c08f821115cee26fa4d3ceaae88c7807fd5 /crates/ra_syntax
parent18a0937585b836ec5ed054b9ae48e0156ab6d9ef (diff)
parentce07a2daa9e53aa86a769f8641b14c2878444fbc (diff)
Merge branch 'master' into feature/themes
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/Cargo.toml9
-rw-r--r--crates/ra_syntax/src/algo.rs12
-rw-r--r--crates/ra_syntax/src/ast/edit.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs34
-rw-r--r--crates/ra_syntax/src/ast/make.rs3
-rw-r--r--crates/ra_syntax/src/grammar.ron16
-rw-r--r--crates/ra_syntax/src/ptr.rs14
-rw-r--r--crates/ra_syntax/src/syntax_node.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt328
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt83
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt9
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.txt23
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt45
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt21
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs (renamed from crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs)0
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt176
20 files changed, 434 insertions, 354 deletions
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index 5db2b58c0..b6ebb129d 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -12,19 +12,20 @@ doctest = false
12 12
13[dependencies] 13[dependencies]
14itertools = "0.8.0" 14itertools = "0.8.0"
15rowan = "0.7.0" 15rowan = "0.8.0"
16rustc_lexer = "0.1.0" 16rustc_lexer = "0.1.0"
17rustc-hash = "1.0.1" 17rustc-hash = "1.0.1"
18arrayvec = "0.5.1" 18arrayvec = "0.5.1"
19once_cell = "1.2.0" 19once_cell = "1.2.0"
20 20
21ra_text_edit = { path = "../ra_text_edit" }
22ra_parser = { path = "../ra_parser" }
23
21# This crate transitively depends on `smol_str` via `rowan`. 24# This crate transitively depends on `smol_str` via `rowan`.
22# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here 25# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here
23# to reduce number of compilations 26# to reduce number of compilations
24smol_str = { version = "0.1.12", features = ["serde"] } 27smol_str = { version = "0.1.12", features = ["serde"] }
25 28serde = { version = "1", features = ["derive"] }
26ra_text_edit = { path = "../ra_text_edit" }
27ra_parser = { path = "../ra_parser" }
28 29
29[dev-dependencies] 30[dev-dependencies]
30test_utils = { path = "../test_utils" } 31test_utils = { path = "../test_utils" }
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs
index 1c075082a..e4061e994 100644
--- a/crates/ra_syntax/src/algo.rs
+++ b/crates/ra_syntax/src/algo.rs
@@ -140,13 +140,13 @@ pub fn insert_children(
140 }); 140 });
141 141
142 let new_children = match &position { 142 let new_children = match &position {
143 InsertPosition::First => to_insert.chain(old_children).collect::<Box<[_]>>(), 143 InsertPosition::First => to_insert.chain(old_children).collect::<Vec<_>>(),
144 InsertPosition::Last => old_children.chain(to_insert).collect::<Box<[_]>>(), 144 InsertPosition::Last => old_children.chain(to_insert).collect::<Vec<_>>(),
145 InsertPosition::Before(anchor) | InsertPosition::After(anchor) => { 145 InsertPosition::Before(anchor) | InsertPosition::After(anchor) => {
146 let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 }; 146 let take_anchor = if let InsertPosition::After(_) = position { 1 } else { 0 };
147 let split_at = position_of_child(parent, anchor.clone()) + take_anchor; 147 let split_at = position_of_child(parent, anchor.clone()) + take_anchor;
148 let before = old_children.by_ref().take(split_at).collect::<Vec<_>>(); 148 let before = old_children.by_ref().take(split_at).collect::<Vec<_>>();
149 before.into_iter().chain(to_insert).chain(old_children).collect::<Box<[_]>>() 149 before.into_iter().chain(to_insert).chain(old_children).collect::<Vec<_>>()
150 } 150 }
151 }; 151 };
152 152
@@ -174,7 +174,7 @@ pub fn replace_children(
174 .into_iter() 174 .into_iter()
175 .chain(to_insert.map(to_green_element)) 175 .chain(to_insert.map(to_green_element))
176 .chain(old_children.skip(end + 1 - start)) 176 .chain(old_children.skip(end + 1 - start))
177 .collect::<Box<[_]>>(); 177 .collect::<Vec<_>>();
178 with_children(parent, new_children) 178 with_children(parent, new_children)
179} 179}
180 180
@@ -187,7 +187,7 @@ pub fn replace_descendants(
187 map: &FxHashMap<SyntaxElement, SyntaxElement>, 187 map: &FxHashMap<SyntaxElement, SyntaxElement>,
188) -> SyntaxNode { 188) -> SyntaxNode {
189 // FIXME: this could be made much faster. 189 // FIXME: this could be made much faster.
190 let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Box<[_]>>(); 190 let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::<Vec<_>>();
191 return with_children(parent, new_children); 191 return with_children(parent, new_children);
192 192
193 fn go( 193 fn go(
@@ -211,7 +211,7 @@ pub fn replace_descendants(
211 211
212fn with_children( 212fn with_children(
213 parent: &SyntaxNode, 213 parent: &SyntaxNode,
214 new_children: Box<[NodeOrToken<rowan::GreenNode, rowan::GreenToken>]>, 214 new_children: Vec<NodeOrToken<rowan::GreenNode, rowan::GreenToken>>,
215) -> SyntaxNode { 215) -> SyntaxNode {
216 let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>(); 216 let len = new_children.iter().map(|it| it.text_len()).sum::<TextUnit>();
217 let new_node = 217 let new_node =
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 95bf9db14..ae5d63927 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -104,7 +104,7 @@ impl ast::ItemList {
104 } 104 }
105 }; 105 };
106 106
107 let indent = leading_indent(self.syntax()).unwrap_or("".into()); 107 let indent = leading_indent(self.syntax()).unwrap_or_default();
108 let ws = tokens::WsBuilder::new(&format!("\n{}", indent)); 108 let ws = tokens::WsBuilder::new(&format!("\n{}", indent));
109 let to_insert = iter::once(ws.ws().into()); 109 let to_insert = iter::once(ws.ws().into());
110 match existing_ws { 110 match existing_ws {
@@ -133,7 +133,7 @@ impl ast::RecordFieldList {
133 let space = if is_multiline { 133 let space = if is_multiline {
134 ws = tokens::WsBuilder::new(&format!( 134 ws = tokens::WsBuilder::new(&format!(
135 "\n{} ", 135 "\n{} ",
136 leading_indent(self.syntax()).unwrap_or("".into()) 136 leading_indent(self.syntax()).unwrap_or_default()
137 )); 137 ));
138 ws.ws() 138 ws.ws()
139 } else { 139 } else {
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index c06076e3d..9f9d6e63c 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -312,6 +312,7 @@ impl AstNode for Block {
312 } 312 }
313} 313}
314impl ast::AttrsOwner for Block {} 314impl ast::AttrsOwner for Block {}
315impl ast::ModuleItemOwner for Block {}
315impl Block { 316impl Block {
316 pub fn statements(&self) -> AstChildren<Stmt> { 317 pub fn statements(&self) -> AstChildren<Stmt> {
317 AstChildren::new(&self.syntax) 318 AstChildren::new(&self.syntax)
@@ -550,6 +551,36 @@ impl ConstDef {
550 } 551 }
551} 552}
552#[derive(Debug, Clone, PartialEq, Eq, Hash)] 553#[derive(Debug, Clone, PartialEq, Eq, Hash)]
554pub struct ConstParam {
555 pub(crate) syntax: SyntaxNode,
556}
557impl AstNode for ConstParam {
558 fn can_cast(kind: SyntaxKind) -> bool {
559 match kind {
560 CONST_PARAM => true,
561 _ => false,
562 }
563 }
564 fn cast(syntax: SyntaxNode) -> Option<Self> {
565 if Self::can_cast(syntax.kind()) {
566 Some(Self { syntax })
567 } else {
568 None
569 }
570 }
571 fn syntax(&self) -> &SyntaxNode {
572 &self.syntax
573 }
574}
575impl ast::NameOwner for ConstParam {}
576impl ast::AttrsOwner for ConstParam {}
577impl ast::TypeAscriptionOwner for ConstParam {}
578impl ConstParam {
579 pub fn default_val(&self) -> Option<Expr> {
580 AstChildren::new(&self.syntax).next()
581 }
582}
583#[derive(Debug, Clone, PartialEq, Eq, Hash)]
553pub struct ContinueExpr { 584pub struct ContinueExpr {
554 pub(crate) syntax: SyntaxNode, 585 pub(crate) syntax: SyntaxNode,
555} 586}
@@ -1425,6 +1456,9 @@ impl LambdaExpr {
1425 pub fn param_list(&self) -> Option<ParamList> { 1456 pub fn param_list(&self) -> Option<ParamList> {
1426 AstChildren::new(&self.syntax).next() 1457 AstChildren::new(&self.syntax).next()
1427 } 1458 }
1459 pub fn ret_type(&self) -> Option<RetType> {
1460 AstChildren::new(&self.syntax).next()
1461 }
1428 pub fn body(&self) -> Option<Expr> { 1462 pub fn body(&self) -> Option<Expr> {
1429 AstChildren::new(&self.syntax).next() 1463 AstChildren::new(&self.syntax).next()
1430 } 1464 }
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 40db570da..04a5408fe 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -168,8 +168,7 @@ pub fn let_stmt(pattern: ast::Pat, initializer: Option<ast::Expr>) -> ast::LetSt
168 168
169fn ast_from_text<N: AstNode>(text: &str) -> N { 169fn ast_from_text<N: AstNode>(text: &str) -> N {
170 let parse = SourceFile::parse(text); 170 let parse = SourceFile::parse(text);
171 let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap(); 171 parse.tree().syntax().descendants().find_map(N::cast).unwrap()
172 res
173} 172}
174 173
175pub mod tokens { 174pub mod tokens {
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index d1be40abe..08aafb610 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -94,7 +94,8 @@ Grammar(
94 "return", 94 "return",
95 "try", 95 "try",
96 "box", 96 "box",
97 "await" 97 "await",
98 "macro"
98 ], 99 ],
99 contextual_keywords: [ 100 contextual_keywords: [
100 "auto", 101 "auto",
@@ -140,6 +141,7 @@ Grammar(
140 "TYPE_ALIAS_DEF", 141 "TYPE_ALIAS_DEF",
141 "MACRO_CALL", 142 "MACRO_CALL",
142 "TOKEN_TREE", 143 "TOKEN_TREE",
144 "MACRO_DEF",
143 145
144 "PAREN_TYPE", 146 "PAREN_TYPE",
145 "TUPLE_TYPE", 147 "TUPLE_TYPE",
@@ -243,6 +245,7 @@ Grammar(
243 "TYPE_PARAM_LIST", 245 "TYPE_PARAM_LIST",
244 "LIFETIME_PARAM", 246 "LIFETIME_PARAM",
245 "TYPE_PARAM", 247 "TYPE_PARAM",
248 "CONST_PARAM",
246 "TYPE_ARG_LIST", 249 "TYPE_ARG_LIST",
247 "LIFETIME_ARG", 250 "LIFETIME_ARG",
248 "TYPE_ARG", 251 "TYPE_ARG",
@@ -426,7 +429,7 @@ Grammar(
426 "PathExpr": (options: ["Path"]), 429 "PathExpr": (options: ["Path"]),
427 "LambdaExpr": ( 430 "LambdaExpr": (
428 options: [ 431 options: [
429 "ParamList", 432 "ParamList", "RetType",
430 ["body", "Expr"], 433 ["body", "Expr"],
431 ] 434 ]
432 ), 435 ),
@@ -602,6 +605,10 @@ Grammar(
602 options: [("default_type", "TypeRef")], 605 options: [("default_type", "TypeRef")],
603 traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"], 606 traits: ["NameOwner", "AttrsOwner", "TypeBoundsOwner"],
604 ), 607 ),
608 "ConstParam": (
609 options: [("default_val", "Expr")],
610 traits: ["NameOwner", "AttrsOwner", "TypeAscriptionOwner"],
611 ),
605 "LifetimeParam": ( 612 "LifetimeParam": (
606 traits: ["AttrsOwner"], 613 traits: ["AttrsOwner"],
607 ), 614 ),
@@ -653,6 +660,7 @@ Grammar(
653 ], 660 ],
654 traits: [ 661 traits: [
655 "AttrsOwner", 662 "AttrsOwner",
663 "ModuleItemOwner",
656 ] 664 ]
657 ), 665 ),
658 "ParamList": ( 666 "ParamList": (
@@ -664,14 +672,14 @@ Grammar(
664 "SelfParam": ( 672 "SelfParam": (
665 traits: [ 673 traits: [
666 "TypeAscriptionOwner", 674 "TypeAscriptionOwner",
667 "AttrsOwner", 675 "AttrsOwner",
668 ] 676 ]
669 ), 677 ),
670 "Param": ( 678 "Param": (
671 options: [ "Pat" ], 679 options: [ "Pat" ],
672 traits: [ 680 traits: [
673 "TypeAscriptionOwner", 681 "TypeAscriptionOwner",
674 "AttrsOwner", 682 "AttrsOwner",
675 ] 683 ]
676 ), 684 ),
677 "UseItem": ( 685 "UseItem": (
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index e049fce61..db6230aab 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -1,6 +1,10 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::{iter::successors, marker::PhantomData}; 3use std::{
4 hash::{Hash, Hasher},
5 iter::successors,
6 marker::PhantomData,
7};
4 8
5use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange}; 9use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange};
6 10
@@ -43,7 +47,7 @@ impl SyntaxNodePtr {
43} 47}
44 48
45/// Like `SyntaxNodePtr`, but remembers the type of node 49/// Like `SyntaxNodePtr`, but remembers the type of node
46#[derive(Debug, Hash)] 50#[derive(Debug)]
47pub struct AstPtr<N: AstNode> { 51pub struct AstPtr<N: AstNode> {
48 raw: SyntaxNodePtr, 52 raw: SyntaxNodePtr,
49 _ty: PhantomData<fn() -> N>, 53 _ty: PhantomData<fn() -> N>,
@@ -64,6 +68,12 @@ impl<N: AstNode> PartialEq for AstPtr<N> {
64 } 68 }
65} 69}
66 70
71impl<N: AstNode> Hash for AstPtr<N> {
72 fn hash<H: Hasher>(&self, state: &mut H) {
73 self.raw.hash(state)
74 }
75}
76
67impl<N: AstNode> AstPtr<N> { 77impl<N: AstNode> AstPtr<N> {
68 pub fn new(node: &N) -> AstPtr<N> { 78 pub fn new(node: &N) -> AstPtr<N> {
69 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData } 79 AstPtr { raw: SyntaxNodePtr::new(node.syntax()), _ty: PhantomData }
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs
index b2f5b8c64..041c6ea8d 100644
--- a/crates/ra_syntax/src/syntax_node.rs
+++ b/crates/ra_syntax/src/syntax_node.rs
@@ -40,7 +40,7 @@ pub use rowan::{Direction, NodeOrToken};
40 40
41pub struct SyntaxTreeBuilder { 41pub struct SyntaxTreeBuilder {
42 errors: Vec<SyntaxError>, 42 errors: Vec<SyntaxError>,
43 inner: GreenNodeBuilder, 43 inner: GreenNodeBuilder<'static>,
44} 44}
45 45
46impl Default for SyntaxTreeBuilder { 46impl Default for SyntaxTreeBuilder {
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt b/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt
deleted file mode 100644
index c5be73a5a..000000000
--- a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.txt
+++ /dev/null
@@ -1,328 +0,0 @@
1SOURCE_FILE@[0; 349)
2 MACRO_CALL@[0; 41)
3 PATH@[0; 5)
4 PATH_SEGMENT@[0; 5)
5 NAME_REF@[0; 5)
6 IDENT@[0; 5) "macro"
7 WHITESPACE@[5; 6) " "
8 NAME@[6; 21)
9 IDENT@[6; 21) "parse_use_trees"
10 TOKEN_TREE@[21; 41)
11 L_PAREN@[21; 22) "("
12 DOLLAR@[22; 23) "$"
13 TOKEN_TREE@[23; 32)
14 L_PAREN@[23; 24) "("
15 DOLLAR@[24; 25) "$"
16 IDENT@[25; 26) "s"
17 COLON@[26; 27) ":"
18 IDENT@[27; 31) "expr"
19 R_PAREN@[31; 32) ")"
20 COMMA@[32; 33) ","
21 STAR@[33; 34) "*"
22 WHITESPACE@[34; 35) " "
23 DOLLAR@[35; 36) "$"
24 TOKEN_TREE@[36; 39)
25 L_PAREN@[36; 37) "("
26 COMMA@[37; 38) ","
27 R_PAREN@[38; 39) ")"
28 STAR@[39; 40) "*"
29 R_PAREN@[40; 41) ")"
30 WHITESPACE@[41; 42) " "
31 ERROR@[42; 93)
32 L_CURLY@[42; 43) "{"
33 WHITESPACE@[43; 48) "\n "
34 MACRO_CALL@[48; 91)
35 PATH@[48; 51)
36 PATH_SEGMENT@[48; 51)
37 NAME_REF@[48; 51)
38 IDENT@[48; 51) "vec"
39 EXCL@[51; 52) "!"
40 TOKEN_TREE@[52; 91)
41 L_BRACK@[52; 53) "["
42 WHITESPACE@[53; 62) "\n "
43 DOLLAR@[62; 63) "$"
44 TOKEN_TREE@[63; 84)
45 L_PAREN@[63; 64) "("
46 IDENT@[64; 78) "parse_use_tree"
47 TOKEN_TREE@[78; 82)
48 L_PAREN@[78; 79) "("
49 DOLLAR@[79; 80) "$"
50 IDENT@[80; 81) "s"
51 R_PAREN@[81; 82) ")"
52 COMMA@[82; 83) ","
53 R_PAREN@[83; 84) ")"
54 STAR@[84; 85) "*"
55 WHITESPACE@[85; 90) "\n "
56 R_BRACK@[90; 91) "]"
57 WHITESPACE@[91; 92) "\n"
58 R_CURLY@[92; 93) "}"
59 WHITESPACE@[93; 95) "\n\n"
60 FN_DEF@[95; 348)
61 ATTR@[95; 102)
62 POUND@[95; 96) "#"
63 L_BRACK@[96; 97) "["
64 PATH@[97; 101)
65 PATH_SEGMENT@[97; 101)
66 NAME_REF@[97; 101)
67 IDENT@[97; 101) "test"
68 R_BRACK@[101; 102) "]"
69 WHITESPACE@[102; 103) "\n"
70 FN_KW@[103; 105) "fn"
71 WHITESPACE@[105; 106) " "
72 NAME@[106; 125)
73 IDENT@[106; 125) "test_use_tree_merge"
74 PARAM_LIST@[125; 127)
75 L_PAREN@[125; 126) "("
76 R_PAREN@[126; 127) ")"
77 WHITESPACE@[127; 128) " "
78 BLOCK_EXPR@[128; 348)
79 BLOCK@[128; 348)
80 L_CURLY@[128; 129) "{"
81 WHITESPACE@[129; 134) "\n "
82 EXPR_STMT@[134; 139)
83 PATH_EXPR@[134; 139)
84 PATH@[134; 139)
85 PATH_SEGMENT@[134; 139)
86 NAME_REF@[134; 139)
87 IDENT@[134; 139) "macro"
88 WHITESPACE@[139; 140) " "
89 EXPR_STMT@[140; 154)
90 CALL_EXPR@[140; 154)
91 PATH_EXPR@[140; 150)
92 PATH@[140; 150)
93 PATH_SEGMENT@[140; 150)
94 NAME_REF@[140; 150)
95 IDENT@[140; 150) "test_merge"
96 ARG_LIST@[150; 154)
97 L_PAREN@[150; 151) "("
98 ARRAY_EXPR@[151; 154)
99 L_BRACK@[151; 152) "["
100 ERROR@[152; 153)
101 DOLLAR@[152; 153) "$"
102 PAREN_EXPR@[153; 154)
103 L_PAREN@[153; 154) "("
104 EXPR_STMT@[154; 155)
105 ERROR@[154; 155)
106 DOLLAR@[154; 155) "$"
107 EXPR_STMT@[155; 160)
108 PATH_EXPR@[155; 160)
109 PATH@[155; 160)
110 PATH_SEGMENT@[155; 160)
111 NAME_REF@[155; 160)
112 IDENT@[155; 160) "input"
113 EXPR_STMT@[160; 161)
114 ERROR@[160; 161)
115 COLON@[160; 161) ":"
116 EXPR_STMT@[161; 165)
117 PATH_EXPR@[161; 165)
118 PATH@[161; 165)
119 PATH_SEGMENT@[161; 165)
120 NAME_REF@[161; 165)
121 IDENT@[161; 165) "expr"
122 EXPR_STMT@[165; 166)
123 ERROR@[165; 166)
124 R_PAREN@[165; 166) ")"
125 EXPR_STMT@[166; 167)
126 ERROR@[166; 167)
127 COMMA@[166; 167) ","
128 EXPR_STMT@[167; 170)
129 PREFIX_EXPR@[167; 170)
130 STAR@[167; 168) "*"
131 WHITESPACE@[168; 169) " "
132 ERROR@[169; 170)
133 DOLLAR@[169; 170) "$"
134 EXPR_STMT@[170; 171)
135 PAREN_EXPR@[170; 171)
136 L_PAREN@[170; 171) "("
137 EXPR_STMT@[171; 172)
138 ERROR@[171; 172)
139 COMMA@[171; 172) ","
140 EXPR_STMT@[172; 173)
141 ERROR@[172; 173)
142 R_PAREN@[172; 173) ")"
143 EXPR_STMT@[173; 175)
144 PREFIX_EXPR@[173; 175)
145 STAR@[173; 174) "*"
146 ERROR@[174; 175)
147 R_BRACK@[174; 175) "]"
148 EXPR_STMT@[175; 176)
149 ERROR@[175; 176)
150 COMMA@[175; 176) ","
151 WHITESPACE@[176; 177) " "
152 EXPR_STMT@[177; 180)
153 ARRAY_EXPR@[177; 180)
154 L_BRACK@[177; 178) "["
155 ERROR@[178; 179)
156 DOLLAR@[178; 179) "$"
157 PAREN_EXPR@[179; 180)
158 L_PAREN@[179; 180) "("
159 EXPR_STMT@[180; 181)
160 ERROR@[180; 181)
161 DOLLAR@[180; 181) "$"
162 EXPR_STMT@[181; 187)
163 PATH_EXPR@[181; 187)
164 PATH@[181; 187)
165 PATH_SEGMENT@[181; 187)
166 NAME_REF@[181; 187)
167 IDENT@[181; 187) "output"
168 EXPR_STMT@[187; 188)
169 ERROR@[187; 188)
170 COLON@[187; 188) ":"
171 EXPR_STMT@[188; 192)
172 PATH_EXPR@[188; 192)
173 PATH@[188; 192)
174 PATH_SEGMENT@[188; 192)
175 NAME_REF@[188; 192)
176 IDENT@[188; 192) "expr"
177 EXPR_STMT@[192; 193)
178 ERROR@[192; 193)
179 R_PAREN@[192; 193) ")"
180 EXPR_STMT@[193; 194)
181 ERROR@[193; 194)
182 COMMA@[193; 194) ","
183 EXPR_STMT@[194; 197)
184 PREFIX_EXPR@[194; 197)
185 STAR@[194; 195) "*"
186 WHITESPACE@[195; 196) " "
187 ERROR@[196; 197)
188 DOLLAR@[196; 197) "$"
189 EXPR_STMT@[197; 198)
190 PAREN_EXPR@[197; 198)
191 L_PAREN@[197; 198) "("
192 EXPR_STMT@[198; 199)
193 ERROR@[198; 199)
194 COMMA@[198; 199) ","
195 EXPR_STMT@[199; 200)
196 ERROR@[199; 200)
197 R_PAREN@[199; 200) ")"
198 EXPR_STMT@[200; 202)
199 PREFIX_EXPR@[200; 202)
200 STAR@[200; 201) "*"
201 ERROR@[201; 202)
202 R_BRACK@[201; 202) "]"
203 EXPR_STMT@[202; 203)
204 ERROR@[202; 203)
205 R_PAREN@[202; 203) ")"
206 WHITESPACE@[203; 204) " "
207 BLOCK_EXPR@[204; 346)
208 BLOCK@[204; 346)
209 L_CURLY@[204; 205) "{"
210 WHITESPACE@[205; 214) "\n "
211 EXPR_STMT@[214; 340)
212 MACRO_CALL@[214; 339)
213 PATH@[214; 223)
214 PATH_SEGMENT@[214; 223)
215 NAME_REF@[214; 223)
216 IDENT@[214; 223) "assert_eq"
217 EXCL@[223; 224) "!"
218 TOKEN_TREE@[224; 339)
219 L_PAREN@[224; 225) "("
220 WHITESPACE@[225; 238) "\n "
221 IDENT@[238; 253) "merge_use_trees"
222 TOKEN_TREE@[253; 284)
223 L_PAREN@[253; 254) "("
224 IDENT@[254; 269) "parse_use_trees"
225 EXCL@[269; 270) "!"
226 TOKEN_TREE@[270; 283)
227 L_PAREN@[270; 271) "("
228 DOLLAR@[271; 272) "$"
229 TOKEN_TREE@[272; 281)
230 L_PAREN@[272; 273) "("
231 DOLLAR@[273; 274) "$"
232 IDENT@[274; 279) "input"
233 COMMA@[279; 280) ","
234 R_PAREN@[280; 281) ")"
235 STAR@[281; 282) "*"
236 R_PAREN@[282; 283) ")"
237 R_PAREN@[283; 284) ")"
238 COMMA@[284; 285) ","
239 WHITESPACE@[285; 298) "\n "
240 IDENT@[298; 313) "parse_use_trees"
241 EXCL@[313; 314) "!"
242 TOKEN_TREE@[314; 328)
243 L_PAREN@[314; 315) "("
244 DOLLAR@[315; 316) "$"
245 TOKEN_TREE@[316; 326)
246 L_PAREN@[316; 317) "("
247 DOLLAR@[317; 318) "$"
248 IDENT@[318; 324) "output"
249 COMMA@[324; 325) ","
250 R_PAREN@[325; 326) ")"
251 STAR@[326; 327) "*"
252 R_PAREN@[327; 328) ")"
253 COMMA@[328; 329) ","
254 WHITESPACE@[329; 338) "\n "
255 R_PAREN@[338; 339) ")"
256 SEMI@[339; 340) ";"
257 WHITESPACE@[340; 345) "\n "
258 R_CURLY@[345; 346) "}"
259 WHITESPACE@[346; 347) "\n"
260 R_CURLY@[347; 348) "}"
261 WHITESPACE@[348; 349) "\n"
262error 5: expected EXCL
263error 41: expected SEMI
264error 42: expected an item
265error 139: expected SEMI
266error 152: expected expression
267error 153: expected COMMA
268error 154: expected expression
269error 154: expected R_PAREN
270error 154: expected COMMA
271error 154: expected expression
272error 154: expected R_BRACK
273error 154: expected COMMA
274error 154: expected SEMI
275error 154: expected expression
276error 155: expected SEMI
277error 160: expected SEMI
278error 160: expected expression
279error 161: expected SEMI
280error 165: expected SEMI
281error 165: expected expression
282error 166: expected SEMI
283error 166: expected expression
284error 167: expected SEMI
285error 169: expected expression
286error 170: expected SEMI
287error 171: expected expression
288error 171: expected R_PAREN
289error 171: expected SEMI
290error 171: expected expression
291error 172: expected SEMI
292error 172: expected expression
293error 173: expected SEMI
294error 174: expected expression
295error 175: expected SEMI
296error 175: expected expression
297error 176: expected SEMI
298error 178: expected expression
299error 179: expected COMMA
300error 180: expected expression
301error 180: expected R_PAREN
302error 180: expected COMMA
303error 180: expected expression
304error 180: expected R_BRACK
305error 180: expected SEMI
306error 180: expected expression
307error 181: expected SEMI
308error 187: expected SEMI
309error 187: expected expression
310error 188: expected SEMI
311error 192: expected SEMI
312error 192: expected expression
313error 193: expected SEMI
314error 193: expected expression
315error 194: expected SEMI
316error 196: expected expression
317error 197: expected SEMI
318error 198: expected expression
319error 198: expected R_PAREN
320error 198: expected SEMI
321error 198: expected expression
322error 199: expected SEMI
323error 199: expected expression
324error 200: expected SEMI
325error 201: expected expression
326error 202: expected SEMI
327error 202: expected expression
328error 203: expected SEMI
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs
new file mode 100644
index 000000000..a2f74bd87
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rs
@@ -0,0 +1,5 @@
1fn foo() -> i32 {
2 [1, 2, 3].iter()
3 .map(|it|)
4 .max::<i32>();
5}
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt
new file mode 100644
index 000000000..d1544634c
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.txt
@@ -0,0 +1,83 @@
1SOURCE_FILE@[0; 83)
2 FN_DEF@[0; 82)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 8)
8 L_PAREN@[6; 7) "("
9 R_PAREN@[7; 8) ")"
10 WHITESPACE@[8; 9) " "
11 RET_TYPE@[9; 15)
12 THIN_ARROW@[9; 11) "->"
13 WHITESPACE@[11; 12) " "
14 PATH_TYPE@[12; 15)
15 PATH@[12; 15)
16 PATH_SEGMENT@[12; 15)
17 NAME_REF@[12; 15)
18 IDENT@[12; 15) "i32"
19 WHITESPACE@[15; 16) " "
20 BLOCK_EXPR@[16; 82)
21 BLOCK@[16; 82)
22 L_CURLY@[16; 17) "{"
23 WHITESPACE@[17; 22) "\n "
24 EXPR_STMT@[22; 80)
25 METHOD_CALL_EXPR@[22; 79)
26 METHOD_CALL_EXPR@[22; 57)
27 METHOD_CALL_EXPR@[22; 38)
28 ARRAY_EXPR@[22; 31)
29 L_BRACK@[22; 23) "["
30 LITERAL@[23; 24)
31 INT_NUMBER@[23; 24) "1"
32 COMMA@[24; 25) ","
33 WHITESPACE@[25; 26) " "
34 LITERAL@[26; 27)
35 INT_NUMBER@[26; 27) "2"
36 COMMA@[27; 28) ","
37 WHITESPACE@[28; 29) " "
38 LITERAL@[29; 30)
39 INT_NUMBER@[29; 30) "3"
40 R_BRACK@[30; 31) "]"
41 DOT@[31; 32) "."
42 NAME_REF@[32; 36)
43 IDENT@[32; 36) "iter"
44 ARG_LIST@[36; 38)
45 L_PAREN@[36; 37) "("
46 R_PAREN@[37; 38) ")"
47 WHITESPACE@[38; 47) "\n "
48 DOT@[47; 48) "."
49 NAME_REF@[48; 51)
50 IDENT@[48; 51) "map"
51 ARG_LIST@[51; 57)
52 L_PAREN@[51; 52) "("
53 LAMBDA_EXPR@[52; 56)
54 PARAM_LIST@[52; 56)
55 PIPE@[52; 53) "|"
56 PARAM@[53; 55)
57 BIND_PAT@[53; 55)
58 NAME@[53; 55)
59 IDENT@[53; 55) "it"
60 PIPE@[55; 56) "|"
61 R_PAREN@[56; 57) ")"
62 WHITESPACE@[57; 66) "\n "
63 DOT@[66; 67) "."
64 NAME_REF@[67; 70)
65 IDENT@[67; 70) "max"
66 TYPE_ARG_LIST@[70; 77)
67 COLONCOLON@[70; 72) "::"
68 L_ANGLE@[72; 73) "<"
69 TYPE_ARG@[73; 76)
70 PATH_TYPE@[73; 76)
71 PATH@[73; 76)
72 PATH_SEGMENT@[73; 76)
73 NAME_REF@[73; 76)
74 IDENT@[73; 76) "i32"
75 R_ANGLE@[76; 77) ">"
76 ARG_LIST@[77; 79)
77 L_PAREN@[77; 78) "("
78 R_PAREN@[78; 79) ")"
79 SEMI@[79; 80) ";"
80 WHITESPACE@[80; 81) "\n"
81 R_CURLY@[81; 82) "}"
82 WHITESPACE@[82; 83) "\n"
83error 56: expected expression
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt
index 4a714ad6b..b05ccc0ed 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.txt
@@ -16,11 +16,10 @@ SOURCE_FILE@[0; 33)
16 LET_KW@[16; 19) "let" 16 LET_KW@[16; 19) "let"
17 WHITESPACE@[19; 20) " " 17 WHITESPACE@[19; 20) " "
18 MACRO_CALL@[20; 25) 18 MACRO_CALL@[20; 25)
19 PATH_PAT@[20; 21) 19 PATH@[20; 21)
20 PATH@[20; 21) 20 PATH_SEGMENT@[20; 21)
21 PATH_SEGMENT@[20; 21) 21 NAME_REF@[20; 21)
22 NAME_REF@[20; 21) 22 IDENT@[20; 21) "m"
23 IDENT@[20; 21) "m"
24 EXCL@[21; 22) "!" 23 EXCL@[21; 22) "!"
25 TOKEN_TREE@[22; 25) 24 TOKEN_TREE@[22; 25)
26 L_PAREN@[22; 23) "(" 25 L_PAREN@[22; 23) "("
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rs b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rs
new file mode 100644
index 000000000..8cdb3b703
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rs
@@ -0,0 +1 @@
struct S<const N: u32>;
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.txt b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.txt
new file mode 100644
index 000000000..f81de7bac
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.txt
@@ -0,0 +1,23 @@
1SOURCE_FILE@[0; 24)
2 STRUCT_DEF@[0; 23)
3 STRUCT_KW@[0; 6) "struct"
4 WHITESPACE@[6; 7) " "
5 NAME@[7; 8)
6 IDENT@[7; 8) "S"
7 TYPE_PARAM_LIST@[8; 22)
8 L_ANGLE@[8; 9) "<"
9 CONST_PARAM@[9; 21)
10 CONST_KW@[9; 14) "const"
11 WHITESPACE@[14; 15) " "
12 NAME@[15; 16)
13 IDENT@[15; 16) "N"
14 COLON@[16; 17) ":"
15 WHITESPACE@[17; 18) " "
16 PATH_TYPE@[18; 21)
17 PATH@[18; 21)
18 PATH_SEGMENT@[18; 21)
19 NAME_REF@[18; 21)
20 IDENT@[18; 21) "u32"
21 R_ANGLE@[21; 22) ">"
22 SEMI@[22; 23) ";"
23 WHITESPACE@[23; 24) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs
new file mode 100644
index 000000000..319a4e2aa
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.rs
@@ -0,0 +1,2 @@
1macro m { ($i:ident) => {} }
2macro m($i:ident) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt
new file mode 100644
index 000000000..3556099bd
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_macro_def.txt
@@ -0,0 +1,45 @@
1SOURCE_FILE@[0; 50)
2 MACRO_DEF@[0; 28)
3 MACRO_KW@[0; 5) "macro"
4 WHITESPACE@[5; 6) " "
5 NAME@[6; 7)
6 IDENT@[6; 7) "m"
7 WHITESPACE@[7; 8) " "
8 TOKEN_TREE@[8; 28)
9 L_CURLY@[8; 9) "{"
10 WHITESPACE@[9; 10) " "
11 TOKEN_TREE@[10; 20)
12 L_PAREN@[10; 11) "("
13 DOLLAR@[11; 12) "$"
14 IDENT@[12; 13) "i"
15 COLON@[13; 14) ":"
16 IDENT@[14; 19) "ident"
17 R_PAREN@[19; 20) ")"
18 WHITESPACE@[20; 21) " "
19 EQ@[21; 22) "="
20 R_ANGLE@[22; 23) ">"
21 WHITESPACE@[23; 24) " "
22 TOKEN_TREE@[24; 26)
23 L_CURLY@[24; 25) "{"
24 R_CURLY@[25; 26) "}"
25 WHITESPACE@[26; 27) " "
26 R_CURLY@[27; 28) "}"
27 WHITESPACE@[28; 29) "\n"
28 MACRO_DEF@[29; 49)
29 MACRO_KW@[29; 34) "macro"
30 WHITESPACE@[34; 35) " "
31 NAME@[35; 36)
32 IDENT@[35; 36) "m"
33 TOKEN_TREE@[36; 49)
34 TOKEN_TREE@[36; 46)
35 L_PAREN@[36; 37) "("
36 DOLLAR@[37; 38) "$"
37 IDENT@[38; 39) "i"
38 COLON@[39; 40) ":"
39 IDENT@[40; 45) "ident"
40 R_PAREN@[45; 46) ")"
41 WHITESPACE@[46; 47) " "
42 TOKEN_TREE@[47; 49)
43 L_CURLY@[47; 48) "{"
44 R_CURLY@[48; 49) "}"
45 WHITESPACE@[49; 50) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs
new file mode 100644
index 000000000..3b2be597f
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.rs
@@ -0,0 +1 @@
pub macro m($:ident) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt
new file mode 100644
index 000000000..cfd79d9c2
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0148_pub_macro_def.txt
@@ -0,0 +1,21 @@
1SOURCE_FILE@[0; 24)
2 MACRO_DEF@[0; 23)
3 VISIBILITY@[0; 3)
4 PUB_KW@[0; 3) "pub"
5 WHITESPACE@[3; 4) " "
6 MACRO_KW@[4; 9) "macro"
7 WHITESPACE@[9; 10) " "
8 NAME@[10; 11)
9 IDENT@[10; 11) "m"
10 TOKEN_TREE@[11; 23)
11 TOKEN_TREE@[11; 20)
12 L_PAREN@[11; 12) "("
13 DOLLAR@[12; 13) "$"
14 COLON@[13; 14) ":"
15 IDENT@[14; 19) "ident"
16 R_PAREN@[19; 20) ")"
17 WHITESPACE@[20; 21) " "
18 TOKEN_TREE@[21; 23)
19 L_CURLY@[21; 22) "{"
20 R_CURLY@[22; 23) "}"
21 WHITESPACE@[23; 24) "\n"
diff --git a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
index 781047ba1..781047ba1 100644
--- a/crates/ra_syntax/test_data/parser/err/0028_macro_2.0.rs
+++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rs
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt
new file mode 100644
index 000000000..2be523fc3
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.txt
@@ -0,0 +1,176 @@
1SOURCE_FILE@[0; 349)
2 MACRO_DEF@[0; 93)
3 MACRO_KW@[0; 5) "macro"
4 WHITESPACE@[5; 6) " "
5 NAME@[6; 21)
6 IDENT@[6; 21) "parse_use_trees"
7 TOKEN_TREE@[21; 93)
8 TOKEN_TREE@[21; 41)
9 L_PAREN@[21; 22) "("
10 DOLLAR@[22; 23) "$"
11 TOKEN_TREE@[23; 32)
12 L_PAREN@[23; 24) "("
13 DOLLAR@[24; 25) "$"
14 IDENT@[25; 26) "s"
15 COLON@[26; 27) ":"
16 IDENT@[27; 31) "expr"
17 R_PAREN@[31; 32) ")"
18 COMMA@[32; 33) ","
19 STAR@[33; 34) "*"
20 WHITESPACE@[34; 35) " "
21 DOLLAR@[35; 36) "$"
22 TOKEN_TREE@[36; 39)
23 L_PAREN@[36; 37) "("
24 COMMA@[37; 38) ","
25 R_PAREN@[38; 39) ")"
26 STAR@[39; 40) "*"
27 R_PAREN@[40; 41) ")"
28 WHITESPACE@[41; 42) " "
29 TOKEN_TREE@[42; 93)
30 L_CURLY@[42; 43) "{"
31 WHITESPACE@[43; 48) "\n "
32 IDENT@[48; 51) "vec"
33 EXCL@[51; 52) "!"
34 TOKEN_TREE@[52; 91)
35 L_BRACK@[52; 53) "["
36 WHITESPACE@[53; 62) "\n "
37 DOLLAR@[62; 63) "$"
38 TOKEN_TREE@[63; 84)
39 L_PAREN@[63; 64) "("
40 IDENT@[64; 78) "parse_use_tree"
41 TOKEN_TREE@[78; 82)
42 L_PAREN@[78; 79) "("
43 DOLLAR@[79; 80) "$"
44 IDENT@[80; 81) "s"
45 R_PAREN@[81; 82) ")"
46 COMMA@[82; 83) ","
47 R_PAREN@[83; 84) ")"
48 STAR@[84; 85) "*"
49 WHITESPACE@[85; 90) "\n "
50 R_BRACK@[90; 91) "]"
51 WHITESPACE@[91; 92) "\n"
52 R_CURLY@[92; 93) "}"
53 WHITESPACE@[93; 95) "\n\n"
54 FN_DEF@[95; 348)
55 ATTR@[95; 102)
56 POUND@[95; 96) "#"
57 L_BRACK@[96; 97) "["
58 PATH@[97; 101)
59 PATH_SEGMENT@[97; 101)
60 NAME_REF@[97; 101)
61 IDENT@[97; 101) "test"
62 R_BRACK@[101; 102) "]"
63 WHITESPACE@[102; 103) "\n"
64 FN_KW@[103; 105) "fn"
65 WHITESPACE@[105; 106) " "
66 NAME@[106; 125)
67 IDENT@[106; 125) "test_use_tree_merge"
68 PARAM_LIST@[125; 127)
69 L_PAREN@[125; 126) "("
70 R_PAREN@[126; 127) ")"
71 WHITESPACE@[127; 128) " "
72 BLOCK_EXPR@[128; 348)
73 BLOCK@[128; 348)
74 L_CURLY@[128; 129) "{"
75 WHITESPACE@[129; 134) "\n "
76 MACRO_DEF@[134; 346)
77 MACRO_KW@[134; 139) "macro"
78 WHITESPACE@[139; 140) " "
79 NAME@[140; 150)
80 IDENT@[140; 150) "test_merge"
81 TOKEN_TREE@[150; 346)
82 TOKEN_TREE@[150; 203)
83 L_PAREN@[150; 151) "("
84 TOKEN_TREE@[151; 175)
85 L_BRACK@[151; 152) "["
86 DOLLAR@[152; 153) "$"
87 TOKEN_TREE@[153; 166)
88 L_PAREN@[153; 154) "("
89 DOLLAR@[154; 155) "$"
90 IDENT@[155; 160) "input"
91 COLON@[160; 161) ":"
92 IDENT@[161; 165) "expr"
93 R_PAREN@[165; 166) ")"
94 COMMA@[166; 167) ","
95 STAR@[167; 168) "*"
96 WHITESPACE@[168; 169) " "
97 DOLLAR@[169; 170) "$"
98 TOKEN_TREE@[170; 173)
99 L_PAREN@[170; 171) "("
100 COMMA@[171; 172) ","
101 R_PAREN@[172; 173) ")"
102 STAR@[173; 174) "*"
103 R_BRACK@[174; 175) "]"
104 COMMA@[175; 176) ","
105 WHITESPACE@[176; 177) " "
106 TOKEN_TREE@[177; 202)
107 L_BRACK@[177; 178) "["
108 DOLLAR@[178; 179) "$"
109 TOKEN_TREE@[179; 193)
110 L_PAREN@[179; 180) "("
111 DOLLAR@[180; 181) "$"
112 IDENT@[181; 187) "output"
113 COLON@[187; 188) ":"
114 IDENT@[188; 192) "expr"
115 R_PAREN@[192; 193) ")"
116 COMMA@[193; 194) ","
117 STAR@[194; 195) "*"
118 WHITESPACE@[195; 196) " "
119 DOLLAR@[196; 197) "$"
120 TOKEN_TREE@[197; 200)
121 L_PAREN@[197; 198) "("
122 COMMA@[198; 199) ","
123 R_PAREN@[199; 200) ")"
124 STAR@[200; 201) "*"
125 R_BRACK@[201; 202) "]"
126 R_PAREN@[202; 203) ")"
127 WHITESPACE@[203; 204) " "
128 TOKEN_TREE@[204; 346)
129 L_CURLY@[204; 205) "{"
130 WHITESPACE@[205; 214) "\n "
131 IDENT@[214; 223) "assert_eq"
132 EXCL@[223; 224) "!"
133 TOKEN_TREE@[224; 339)
134 L_PAREN@[224; 225) "("
135 WHITESPACE@[225; 238) "\n "
136 IDENT@[238; 253) "merge_use_trees"
137 TOKEN_TREE@[253; 284)
138 L_PAREN@[253; 254) "("
139 IDENT@[254; 269) "parse_use_trees"
140 EXCL@[269; 270) "!"
141 TOKEN_TREE@[270; 283)
142 L_PAREN@[270; 271) "("
143 DOLLAR@[271; 272) "$"
144 TOKEN_TREE@[272; 281)
145 L_PAREN@[272; 273) "("
146 DOLLAR@[273; 274) "$"
147 IDENT@[274; 279) "input"
148 COMMA@[279; 280) ","
149 R_PAREN@[280; 281) ")"
150 STAR@[281; 282) "*"
151 R_PAREN@[282; 283) ")"
152 R_PAREN@[283; 284) ")"
153 COMMA@[284; 285) ","
154 WHITESPACE@[285; 298) "\n "
155 IDENT@[298; 313) "parse_use_trees"
156 EXCL@[313; 314) "!"
157 TOKEN_TREE@[314; 328)
158 L_PAREN@[314; 315) "("
159 DOLLAR@[315; 316) "$"
160 TOKEN_TREE@[316; 326)
161 L_PAREN@[316; 317) "("
162 DOLLAR@[317; 318) "$"
163 IDENT@[318; 324) "output"
164 COMMA@[324; 325) ","
165 R_PAREN@[325; 326) ")"
166 STAR@[326; 327) "*"
167 R_PAREN@[327; 328) ")"
168 COMMA@[328; 329) ","
169 WHITESPACE@[329; 338) "\n "
170 R_PAREN@[338; 339) ")"
171 SEMI@[339; 340) ";"
172 WHITESPACE@[340; 345) "\n "
173 R_CURLY@[345; 346) "}"
174 WHITESPACE@[346; 347) "\n"
175 R_CURLY@[347; 348) "}"
176 WHITESPACE@[348; 349) "\n"