aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parser/event.rs4
-rw-r--r--src/parser/grammar/items/mod.rs2
-rw-r--r--src/parser/input.rs5
-rw-r--r--src/parser/parser.rs1
-rw-r--r--tools/src/bin/gen.rs4
5 files changed, 7 insertions, 9 deletions
diff --git a/src/parser/event.rs b/src/parser/event.rs
index 64d751d63..e97350c89 100644
--- a/src/parser/event.rs
+++ b/src/parser/event.rs
@@ -1,4 +1,4 @@
1use {File, FileBuilder, Sink, SyntaxKind, Token, TextUnit}; 1use {File, FileBuilder, Sink, SyntaxKind, TextUnit, Token};
2use syntax_kinds::TOMBSTONE; 2use syntax_kinds::TOMBSTONE;
3use super::is_insignificant; 3use super::is_insignificant;
4 4
@@ -139,7 +139,7 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> Fil
139 idx += 1; 139 idx += 1;
140 } 140 }
141 builder.leaf(kind, len); 141 builder.leaf(kind, len);
142 }, 142 }
143 &Event::Error { ref message } => builder.error().message(message.clone()).emit(), 143 &Event::Error { ref message } => builder.error().message(message.clone()).emit(),
144 } 144 }
145 } 145 }
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs
index 588fca4c6..37f2ab132 100644
--- a/src/parser/grammar/items/mod.rs
+++ b/src/parser/grammar/items/mod.rs
@@ -122,7 +122,7 @@ fn item(p: &mut Parser) {
122 if !p.at(FN_KW) { 122 if !p.at(FN_KW) {
123 item.abandon(p); 123 item.abandon(p);
124 p.error().message("expected function").emit(); 124 p.error().message("expected function").emit();
125 return 125 return;
126 } 126 }
127 fn_item(p); 127 fn_item(p);
128 FN_ITEM 128 FN_ITEM
diff --git a/src/parser/input.rs b/src/parser/input.rs
index 2ad621166..4d74ac1b1 100644
--- a/src/parser/input.rs
+++ b/src/parser/input.rs
@@ -46,10 +46,7 @@ impl<'t> ParserInput<'t> {
46 if !(idx < self.tokens.len()) { 46 if !(idx < self.tokens.len()) {
47 return ""; 47 return "";
48 } 48 }
49 let range = TextRange::from_len( 49 let range = TextRange::from_len(self.start_offsets[idx], self.tokens[idx].len);
50 self.start_offsets[idx],
51 self.tokens[idx].len
52 );
53 &self.text[range] 50 &self.text[range]
54 } 51 }
55} 52}
diff --git a/src/parser/parser.rs b/src/parser/parser.rs
index 53a116fb7..752d532d0 100644
--- a/src/parser/parser.rs
+++ b/src/parser/parser.rs
@@ -169,7 +169,6 @@ impl<'t> Parser<'t> {
169 self.nth(0) 169 self.nth(0)
170 } 170 }
171 171
172
173 fn event(&mut self, event: Event) { 172 fn event(&mut self, event: Event) {
174 self.events.push(event) 173 self.events.push(event)
175 } 174 }
diff --git a/tools/src/bin/gen.rs b/tools/src/bin/gen.rs
index c71e6da73..7cb164316 100644
--- a/tools/src/bin/gen.rs
+++ b/tools/src/bin/gen.rs
@@ -39,7 +39,9 @@ impl Grammar {
39 acc.push_str("use tree::SyntaxInfo;\n"); 39 acc.push_str("use tree::SyntaxInfo;\n");
40 acc.push_str("\n"); 40 acc.push_str("\n");
41 41
42 let syntax_kinds: Vec<String> =self.tokens.iter().cloned() 42 let syntax_kinds: Vec<String> = self.tokens
43 .iter()
44 .cloned()
43 .chain(self.keywords.iter().map(|kw| kw_token(kw))) 45 .chain(self.keywords.iter().map(|kw| kw_token(kw)))
44 .chain(self.contextual_keywords.iter().map(|kw| kw_token(kw))) 46 .chain(self.contextual_keywords.iter().map(|kw| kw_token(kw)))
45 .chain(self.nodes.iter().cloned()) 47 .chain(self.nodes.iter().cloned())