Skip to content

Commit a1a6a42

Browse files
committed
---
yaml --- r: 140175 b: refs/heads/try2 c: 41af279 h: refs/heads/master i: 140173: 88d497a 140171: 8c57e9f 140167: de6fe63 140159: 8831bdf v: v3
1 parent 214784d commit a1a6a42

File tree

5 files changed

+83
-13
lines changed

5 files changed

+83
-13
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: 2985f74ff345638af2391a74b60e8e949691e694
8+
refs/heads/try2: 41af2792333fe739abb899c6815005b08674ff21
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/classify.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
use ast;
1616
use codemap;
1717

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
1825
pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
1926
match e.node {
2027
ast::expr_if(*)
@@ -40,6 +47,9 @@ pub fn expr_is_simple_block(e: @ast::expr) -> bool {
4047
}
4148
}
4249

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.
4353
pub fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
4454
return match stmt.node {
4555
ast::stmt_decl(d, _) => {

branches/try2/src/libsyntax/parse/comments.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ pub struct lit {
309309
pos: BytePos
310310
}
311311
312+
// it appears this function is called only from pprust... that's
313+
// probably not a good thing.
312314
pub fn gather_comments_and_literals(span_diagnostic:
313315
@diagnostic::span_handler,
314316
path: ~str,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ fn consume_any_line_comment(rdr: @mut StringReader)
286286
}
287287
} else if rdr.curr == '#' {
288288
if nextch(rdr) == '!' {
289+
// I guess this is the only way to figure out if
290+
// we're at the beginning of the file...
289291
let cmap = @CodeMap::new();
290292
(*cmap).files.push(rdr.filemap);
291293
let loc = cmap.lookup_char_pos_adj(rdr.last_pos);

0 commit comments

Comments
 (0)