Skip to content

Commit e9e56e8

Browse files
committed
---
yaml --- r: 152615 b: refs/heads/try2 c: 8de2618 h: refs/heads/master i: 152613: c6a99cd 152611: 602a94a 152607: d404430 v: v3
1 parent 2bc9d8b commit e9e56e8

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 612bbaf7a07fe247e5e2d057cc4f10742918ead0
8+
refs/heads/try2: 8de2618182f14bb2245e8e89f171aaf9b2f29690
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/parse/lexer/mod.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,9 @@ impl<'a> StringReader<'a> {
906906
// Byte offsetting here is okay because the
907907
// character before position `start` are an
908908
// ascii single quote and ascii 'b'.
909+
let last_pos = self_.last_pos;
909910
self_.fatal_span_verbose(
910-
start - BytePos(2), self_.last_pos,
911+
start - BytePos(2), last_pos,
911912
"unterminated byte constant".to_string());
912913
}
913914
self_.bump(); // advance curr past token
@@ -920,7 +921,8 @@ impl<'a> StringReader<'a> {
920921
let mut value = Vec::new();
921922
while !self_.curr_is('"') {
922923
if self_.is_eof() {
923-
self_.fatal_span(start, self_.last_pos,
924+
let last_pos = self_.last_pos;
925+
self_.fatal_span(start, last_pos,
924926
"unterminated double quote byte string");
925927
}
926928

@@ -944,20 +946,25 @@ impl<'a> StringReader<'a> {
944946
}
945947

946948
if self_.is_eof() {
947-
self_.fatal_span(start_bpos, self_.last_pos, "unterminated raw string");
949+
let last_pos = self_.last_pos;
950+
self_.fatal_span(start_bpos, last_pos, "unterminated raw string");
948951
} else if !self_.curr_is('"') {
949-
self_.fatal_span_char(start_bpos, self_.last_pos,
952+
let last_pos = self_.last_pos;
953+
let ch = self_.curr.unwrap();
954+
self_.fatal_span_char(start_bpos, last_pos,
950955
"only `#` is allowed in raw string delimitation; \
951956
found illegal character",
952-
self_.curr.unwrap());
957+
ch);
953958
}
954959
self_.bump();
955960
let content_start_bpos = self_.last_pos;
956961
let mut content_end_bpos;
957962
'outer: loop {
958963
match self_.curr {
959-
None => self_.fatal_span(start_bpos, self_.last_pos,
960-
"unterminated raw string"),
964+
None => {
965+
let last_pos = self_.last_pos;
966+
self_.fatal_span(start_bpos, last_pos, "unterminated raw string")
967+
},
961968
Some('"') => {
962969
content_end_bpos = self_.last_pos;
963970
for _ in range(0, hash_count) {
@@ -969,8 +976,9 @@ impl<'a> StringReader<'a> {
969976
break;
970977
},
971978
Some(c) => if c > '\x7F' {
972-
self_.err_span_char(self_.last_pos, self_.last_pos,
973-
"raw byte string must be ASCII", c);
979+
let last_pos = self_.last_pos;
980+
self_.err_span_char(
981+
last_pos, last_pos, "raw byte string must be ASCII", c);
974982
}
975983
}
976984
self_.bump();

0 commit comments

Comments
 (0)