aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-02-04 14:06:43 +0000
committerAleksey Kladov <[email protected]>2018-02-04 14:06:43 +0000
commit351107d0b143e2c3497bd0f424f0d76bc51df0c0 (patch)
treea7759795877d2d5fef25915997c2679af0cd3e94 /src/parser
parentc119e8fd8b0106bb2e031e76ac1be89bd10a0674 (diff)
Reformat
Diffstat (limited to 'src/parser')
-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
4 files changed, 4 insertions, 8 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 }