File tree Expand file tree Collapse file tree 5 files changed +83
-13
lines changed
branches/auto/src/libsyntax/parse Expand file tree Collapse file tree 5 files changed +83
-13
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
- refs/heads/auto: 2985f74ff345638af2391a74b60e8e949691e694
17
+ refs/heads/auto: 41af2792333fe739abb899c6815005b08674ff21
18
18
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
19
19
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
Original file line number Diff line number Diff line change 15
15
use ast;
16
16
use codemap;
17
17
18
+ // does this expression require a semicolon to be treated
19
+ // as a statement? The negation of this: 'can this expression
20
+ // be used as a statement without a semicolon' -- is used
21
+ // as an early-bail-out in the parser so that, for instance,
22
+ // 'if true {...} else {...}
23
+ // |x| 5 '
24
+ // isn't parsed as (if true {...} else {...} | x) | 5
18
25
pub fn expr_requires_semi_to_be_stmt ( e : @ast:: expr ) -> bool {
19
26
match e. node {
20
27
ast:: expr_if( * )
@@ -40,6 +47,9 @@ pub fn expr_is_simple_block(e: @ast::expr) -> bool {
40
47
}
41
48
}
42
49
50
+ // this statement requires a semicolon after it.
51
+ // note that in one case (stmt_semi), we've already
52
+ // seen the semicolon, and thus don't need another.
43
53
pub fn stmt_ends_with_semi ( stmt : & ast:: stmt ) -> bool {
44
54
return match stmt. node {
45
55
ast:: stmt_decl( d, _) => {
Original file line number Diff line number Diff line change @@ -309,6 +309,8 @@ pub struct lit {
309
309
pos: BytePos
310
310
}
311
311
312
+ // it appears this function is called only from pprust... that's
313
+ // probably not a good thing.
312
314
pub fn gather_comments_and_literals(span_diagnostic:
313
315
@diagnostic::span_handler,
314
316
path: ~str,
Original file line number Diff line number Diff line change @@ -286,6 +286,8 @@ fn consume_any_line_comment(rdr: @mut StringReader)
286
286
}
287
287
} else if rdr. curr == '#' {
288
288
if nextch ( rdr) == '!' {
289
+ // I guess this is the only way to figure out if
290
+ // we're at the beginning of the file...
289
291
let cmap = @CodeMap :: new ( ) ;
290
292
( * cmap) . files . push ( rdr. filemap ) ;
291
293
let loc = cmap. lookup_char_pos_adj ( rdr. last_pos ) ;
You can’t perform that action at this time.
0 commit comments