@@ -47,9 +47,9 @@ pub struct ParseSess {
47
47
included_mod_stack : RefCell < ~[ Path ] > ,
48
48
}
49
49
50
- pub fn new_parse_sess ( demitter : Option < @Emitter > ) -> @mut ParseSess {
50
+ pub fn new_parse_sess ( demitter : Option < @Emitter > ) -> @ParseSess {
51
51
let cm = @CodeMap :: new ( ) ;
52
- @mut ParseSess {
52
+ @ParseSess {
53
53
cm : cm,
54
54
span_diagnostic : mk_span_handler ( mk_handler ( demitter) , cm) ,
55
55
included_mod_stack : RefCell :: new ( ~[ ] ) ,
@@ -58,8 +58,8 @@ pub fn new_parse_sess(demitter: Option<@Emitter>) -> @mut ParseSess {
58
58
59
59
pub fn new_parse_sess_special_handler ( sh : @mut SpanHandler ,
60
60
cm : @codemap:: CodeMap )
61
- -> @mut ParseSess {
62
- @mut ParseSess {
61
+ -> @ParseSess {
62
+ @ParseSess {
63
63
cm : cm,
64
64
span_diagnostic : sh,
65
65
included_mod_stack : RefCell :: new ( ~[ ] ) ,
@@ -74,7 +74,7 @@ pub fn new_parse_sess_special_handler(sh: @mut SpanHandler,
74
74
pub fn parse_crate_from_file (
75
75
input : & Path ,
76
76
cfg : ast:: CrateConfig ,
77
- sess : @mut ParseSess
77
+ sess : @ParseSess
78
78
) -> ast:: Crate {
79
79
new_parser_from_file ( sess, /*bad*/ cfg. clone ( ) , input) . parse_crate_mod ( )
80
80
// why is there no p.abort_if_errors here?
@@ -83,7 +83,7 @@ pub fn parse_crate_from_file(
83
83
pub fn parse_crate_attrs_from_file (
84
84
input : & Path ,
85
85
cfg : ast:: CrateConfig ,
86
- sess : @mut ParseSess
86
+ sess : @ParseSess
87
87
) -> ~[ ast:: Attribute ] {
88
88
let mut parser = new_parser_from_file ( sess, cfg, input) ;
89
89
let ( inner, _) = parser. parse_inner_attrs_and_next ( ) ;
@@ -94,7 +94,7 @@ pub fn parse_crate_from_source_str(
94
94
name : @str ,
95
95
source : @str ,
96
96
cfg : ast:: CrateConfig ,
97
- sess : @mut ParseSess
97
+ sess : @ParseSess
98
98
) -> ast:: Crate {
99
99
let mut p = new_parser_from_source_str ( sess,
100
100
/*bad*/ cfg. clone ( ) ,
@@ -107,7 +107,7 @@ pub fn parse_crate_attrs_from_source_str(
107
107
name : @str ,
108
108
source : @str ,
109
109
cfg : ast:: CrateConfig ,
110
- sess : @mut ParseSess
110
+ sess : @ParseSess
111
111
) -> ~[ ast:: Attribute ] {
112
112
let mut p = new_parser_from_source_str ( sess,
113
113
/*bad*/ cfg. clone ( ) ,
@@ -121,7 +121,7 @@ pub fn parse_expr_from_source_str(
121
121
name : @str ,
122
122
source : @str ,
123
123
cfg : ast:: CrateConfig ,
124
- sess : @mut ParseSess
124
+ sess : @ParseSess
125
125
) -> @ast:: Expr {
126
126
let mut p = new_parser_from_source_str ( sess, cfg, name, source) ;
127
127
maybe_aborted ( p. parse_expr ( ) , p)
@@ -132,7 +132,7 @@ pub fn parse_item_from_source_str(
132
132
source : @str ,
133
133
cfg : ast:: CrateConfig ,
134
134
attrs : ~[ ast:: Attribute ] ,
135
- sess : @mut ParseSess
135
+ sess : @ParseSess
136
136
) -> Option < @ast:: item > {
137
137
let mut p = new_parser_from_source_str ( sess, cfg, name, source) ;
138
138
maybe_aborted ( p. parse_item ( attrs) , p)
@@ -142,7 +142,7 @@ pub fn parse_meta_from_source_str(
142
142
name : @str ,
143
143
source : @str ,
144
144
cfg : ast:: CrateConfig ,
145
- sess : @mut ParseSess
145
+ sess : @ParseSess
146
146
) -> @ast:: MetaItem {
147
147
let mut p = new_parser_from_source_str ( sess, cfg, name, source) ;
148
148
maybe_aborted ( p. parse_meta_item ( ) , p)
@@ -153,7 +153,7 @@ pub fn parse_stmt_from_source_str(
153
153
source : @str ,
154
154
cfg : ast:: CrateConfig ,
155
155
attrs : ~[ ast:: Attribute ] ,
156
- sess : @mut ParseSess
156
+ sess : @ParseSess
157
157
) -> @ast:: Stmt {
158
158
let mut p = new_parser_from_source_str (
159
159
sess,
@@ -168,7 +168,7 @@ pub fn parse_tts_from_source_str(
168
168
name : @str ,
169
169
source : @str ,
170
170
cfg : ast:: CrateConfig ,
171
- sess : @mut ParseSess
171
+ sess : @ParseSess
172
172
) -> ~[ ast:: token_tree ] {
173
173
let mut p = new_parser_from_source_str (
174
174
sess,
@@ -192,7 +192,7 @@ pub fn parse_from_source_str<T>(
192
192
ss : codemap:: FileSubstr ,
193
193
source : @str ,
194
194
cfg : ast:: CrateConfig ,
195
- sess : @mut ParseSess )
195
+ sess : @ParseSess )
196
196
-> T {
197
197
let mut p = new_parser_from_source_substr ( sess, cfg, name, ss, source) ;
198
198
let r = f ( & mut p) ;
@@ -203,7 +203,7 @@ pub fn parse_from_source_str<T>(
203
203
}
204
204
205
205
// Create a new parser from a source string
206
- pub fn new_parser_from_source_str ( sess : @mut ParseSess ,
206
+ pub fn new_parser_from_source_str ( sess : @ParseSess ,
207
207
cfg : ast:: CrateConfig ,
208
208
name : @str ,
209
209
source : @str )
@@ -213,7 +213,7 @@ pub fn new_parser_from_source_str(sess: @mut ParseSess,
213
213
214
214
// Create a new parser from a source string where the origin
215
215
// is specified as a substring of another file.
216
- pub fn new_parser_from_source_substr ( sess : @mut ParseSess ,
216
+ pub fn new_parser_from_source_substr ( sess : @ParseSess ,
217
217
cfg : ast:: CrateConfig ,
218
218
name : @str ,
219
219
ss : codemap:: FileSubstr ,
@@ -225,7 +225,7 @@ pub fn new_parser_from_source_substr(sess: @mut ParseSess,
225
225
/// Create a new parser, handling errors as appropriate
226
226
/// if the file doesn't exist
227
227
pub fn new_parser_from_file (
228
- sess : @mut ParseSess ,
228
+ sess : @ParseSess ,
229
229
cfg : ast:: CrateConfig ,
230
230
path : & Path
231
231
) -> Parser {
@@ -236,7 +236,7 @@ pub fn new_parser_from_file(
236
236
/// the file at the given path to the codemap, and return a parser.
237
237
/// On an error, use the given span as the source of the problem.
238
238
pub fn new_sub_parser_from_file (
239
- sess : @mut ParseSess ,
239
+ sess : @ParseSess ,
240
240
cfg : ast:: CrateConfig ,
241
241
path : & Path ,
242
242
sp : Span
@@ -245,15 +245,15 @@ pub fn new_sub_parser_from_file(
245
245
}
246
246
247
247
/// Given a filemap and config, return a parser
248
- pub fn filemap_to_parser ( sess : @mut ParseSess ,
248
+ pub fn filemap_to_parser ( sess : @ParseSess ,
249
249
filemap : @FileMap ,
250
250
cfg : ast:: CrateConfig ) -> Parser {
251
251
tts_to_parser ( sess, filemap_to_tts ( sess, filemap) , cfg)
252
252
}
253
253
254
254
// must preserve old name for now, because quote! from the *existing*
255
255
// compiler expands into it
256
- pub fn new_parser_from_tts ( sess : @mut ParseSess ,
256
+ pub fn new_parser_from_tts ( sess : @ParseSess ,
257
257
cfg : ast:: CrateConfig ,
258
258
tts : ~[ ast:: token_tree ] ) -> Parser {
259
259
tts_to_parser ( sess, tts, cfg)
@@ -264,7 +264,7 @@ pub fn new_parser_from_tts(sess: @mut ParseSess,
264
264
265
265
/// Given a session and a path and an optional span (for error reporting),
266
266
/// add the path to the session's codemap and return the new filemap.
267
- pub fn file_to_filemap ( sess : @mut ParseSess , path : & Path , spanopt : Option < Span > )
267
+ pub fn file_to_filemap ( sess : @ParseSess , path : & Path , spanopt : Option < Span > )
268
268
-> @FileMap {
269
269
let err = |msg : & str | {
270
270
match spanopt {
@@ -293,20 +293,20 @@ pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>)
293
293
294
294
// given a session and a string, add the string to
295
295
// the session's codemap and return the new filemap
296
- pub fn string_to_filemap ( sess : @mut ParseSess , source : @str , path : @str )
296
+ pub fn string_to_filemap ( sess : @ParseSess , source : @str , path : @str )
297
297
-> @FileMap {
298
298
sess. cm . new_filemap ( path, source)
299
299
}
300
300
301
301
// given a session and a string and a path and a FileSubStr, add
302
302
// the string to the CodeMap and return the new FileMap
303
- pub fn substring_to_filemap ( sess : @mut ParseSess , source : @str , path : @str ,
303
+ pub fn substring_to_filemap ( sess : @ParseSess , source : @str , path : @str ,
304
304
filesubstr : FileSubstr ) -> @FileMap {
305
305
sess. cm . new_filemap_w_substr ( path, filesubstr, source)
306
306
}
307
307
308
308
// given a filemap, produce a sequence of token-trees
309
- pub fn filemap_to_tts ( sess : @mut ParseSess , filemap : @FileMap )
309
+ pub fn filemap_to_tts ( sess : @ParseSess , filemap : @FileMap )
310
310
-> ~[ ast:: token_tree ] {
311
311
// it appears to me that the cfg doesn't matter here... indeed,
312
312
// parsing tt's probably shouldn't require a parser at all.
@@ -317,7 +317,7 @@ pub fn filemap_to_tts(sess: @mut ParseSess, filemap: @FileMap)
317
317
}
318
318
319
319
// given tts and cfg, produce a parser
320
- pub fn tts_to_parser ( sess : @mut ParseSess ,
320
+ pub fn tts_to_parser ( sess : @ParseSess ,
321
321
tts : ~[ ast:: token_tree ] ,
322
322
cfg : ast:: CrateConfig ) -> Parser {
323
323
let trdr = lexer:: new_tt_reader ( sess. span_diagnostic , None , tts) ;
0 commit comments