about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/comments.rs4
-rw-r--r--src/libsyntax/parse/lexer.rs21
-rw-r--r--src/libsyntax/parse/mod.rs8
-rw-r--r--src/libsyntax/parse/parser.rs4
4 files changed, 19 insertions, 18 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 5b9725ec6a0..9a9164f5102 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -267,7 +267,7 @@ fn read_block_comment(rdr: @mut StringReader,
         while level > 0 {
             debug!("=== block comment level %d", level);
             if is_eof(rdr) {
-                (rdr as @reader).fatal(~"unterminated block comment");
+                (rdr as @mut reader).fatal(~"unterminated block comment");
             }
             if rdr.curr == '\n' {
                 trim_whitespace_prefix_and_push_line(&mut lines, curr_line,
@@ -334,7 +334,7 @@ pub struct lit {
 // it appears this function is called only from pprust... that's
 // probably not a good thing.
 pub fn gather_comments_and_literals(span_diagnostic:
-                                    @diagnostic::span_handler,
+                                    @mut diagnostic::span_handler,
                                     path: @str,
                                     srdr: @io::Reader)
                                  -> (~[cmnt], ~[lit]) {
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index bde568b2610..d0041021f7c 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -28,9 +28,9 @@ pub trait reader {
     fn is_eof(@mut self) -> bool;
     fn next_token(@mut self) -> TokenAndSpan;
     fn fatal(@mut self, ~str) -> !;
-    fn span_diag(@mut self) -> @span_handler;
+    fn span_diag(@mut self) -> @mut span_handler;
     fn peek(@mut self) -> TokenAndSpan;
-    fn dup(@mut self) -> @reader;
+    fn dup(@mut self) -> @mut reader;
 }
 
 #[deriving(Clone, Eq)]
@@ -40,7 +40,7 @@ pub struct TokenAndSpan {
 }
 
 pub struct StringReader {
-    span_diagnostic: @span_handler,
+    span_diagnostic: @mut span_handler,
     src: @str,
     // The absolute offset within the codemap of the next character to read
     pos: BytePos,
@@ -56,7 +56,7 @@ pub struct StringReader {
     peek_span: span
 }
 
-pub fn new_string_reader(span_diagnostic: @span_handler,
+pub fn new_string_reader(span_diagnostic: @mut span_handler,
                          filemap: @codemap::FileMap)
                       -> @mut StringReader {
     let r = new_low_level_string_reader(span_diagnostic, filemap);
@@ -65,13 +65,14 @@ pub fn new_string_reader(span_diagnostic: @span_handler,
 }
 
 /* For comments.rs, which hackily pokes into 'pos' and 'curr' */
-pub fn new_low_level_string_reader(span_diagnostic: @span_handler,
+pub fn new_low_level_string_reader(span_diagnostic: @mut span_handler,
                                    filemap: @codemap::FileMap)
                                 -> @mut StringReader {
     // Force the initial reader bump to start on a fresh line
     let initial_char = '\n';
     let r = @mut StringReader {
-        span_diagnostic: span_diagnostic, src: filemap.src,
+        span_diagnostic: span_diagnostic,
+        src: filemap.src,
         pos: filemap.start_pos,
         last_pos: filemap.start_pos,
         col: CharPos(0),
@@ -116,7 +117,7 @@ impl reader for StringReader {
     fn fatal(@mut self, m: ~str) -> ! {
         self.span_diagnostic.span_fatal(self.peek_span, m)
     }
-    fn span_diag(@mut self) -> @span_handler { self.span_diagnostic }
+    fn span_diag(@mut self) -> @mut span_handler { self.span_diagnostic }
     fn peek(@mut self) -> TokenAndSpan {
         // XXX(pcwalton): Bad copy!
         TokenAndSpan {
@@ -124,7 +125,7 @@ impl reader for StringReader {
             sp: self.peek_span,
         }
     }
-    fn dup(@mut self) -> @reader { dup_string_reader(self) as @reader }
+    fn dup(@mut self) -> @mut reader { dup_string_reader(self) as @mut reader }
 }
 
 impl reader for TtReader {
@@ -137,14 +138,14 @@ impl reader for TtReader {
     fn fatal(@mut self, m: ~str) -> ! {
         self.sp_diag.span_fatal(self.cur_span, m);
     }
-    fn span_diag(@mut self) -> @span_handler { self.sp_diag }
+    fn span_diag(@mut self) -> @mut span_handler { self.sp_diag }
     fn peek(@mut self) -> TokenAndSpan {
         TokenAndSpan {
             tok: self.cur_tok.clone(),
             sp: self.cur_span,
         }
     }
-    fn dup(@mut self) -> @reader { dup_tt_reader(self) as @reader }
+    fn dup(@mut self) -> @mut reader { dup_tt_reader(self) as @mut reader }
 }
 
 // EFFECT: advance peek_tok and peek_span to refer to the next token.
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 1731a587a8e..23c6a8b9720 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -43,7 +43,7 @@ pub mod obsolete;
 pub struct ParseSess {
     cm: @codemap::CodeMap, // better be the same as the one in the reader!
     next_id: NodeId,
-    span_diagnostic: @span_handler, // better be the same as the one in the reader!
+    span_diagnostic: @mut span_handler, // better be the same as the one in the reader!
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: ~[Path],
 }
@@ -58,7 +58,7 @@ pub fn new_parse_sess(demitter: Option<Emitter>) -> @mut ParseSess {
     }
 }
 
-pub fn new_parse_sess_special_handler(sh: @span_handler,
+pub fn new_parse_sess_special_handler(sh: @mut span_handler,
                                       cm: @codemap::CodeMap)
                                    -> @mut ParseSess {
     @mut ParseSess {
@@ -306,7 +306,7 @@ pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
     // parsing tt's probably shouldn't require a parser at all.
     let cfg = ~[];
     let srdr = lexer::new_string_reader(sess.span_diagnostic, filemap);
-    let p1 = Parser(sess, cfg, srdr as @reader);
+    let p1 = Parser(sess, cfg, srdr as @mut reader);
     p1.parse_all_token_trees()
 }
 
@@ -315,7 +315,7 @@ pub fn tts_to_parser(sess: @mut ParseSess,
                      tts: ~[ast::token_tree],
                      cfg: ast::CrateConfig) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);
-    Parser(sess, cfg, trdr as @reader)
+    Parser(sess, cfg, trdr as @mut reader)
 }
 
 // abort if necessary
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 59db1a3cfa2..27e339f000c 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -265,7 +265,7 @@ struct ParsedItemsAndViewItems {
 
 pub fn Parser(sess: @mut ParseSess,
               cfg: ast::CrateConfig,
-              rdr: @reader)
+              rdr: @mut reader)
            -> Parser {
     let tok0 = rdr.next_token();
     let interner = get_ident_interner();
@@ -315,7 +315,7 @@ pub struct Parser {
     tokens_consumed: @mut uint,
     restriction: @mut restriction,
     quote_depth: @mut uint, // not (yet) related to the quasiquoter
-    reader: @reader,
+    reader: @mut reader,
     interner: @token::ident_interner,
     /// The set of seen errors about obsolete syntax. Used to suppress
     /// extra detail when the same error is seen twice