Skip to content

Commit 92b2113

Browse files
committed
syntax: Move is_lit to mod token
1 parent fa86b5d commit 92b2113

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/librustsyntax/parse/comments.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,6 @@ fn consume_comment(rdr: reader, code_to_the_left: bool, &comments: [cmnt]) {
148148
#debug("<<< consume comment");
149149
}
150150

151-
fn is_lit(t: token::token) -> bool {
152-
ret alt t {
153-
token::LIT_INT(_, _) { true }
154-
token::LIT_UINT(_, _) { true }
155-
token::LIT_FLOAT(_, _) { true }
156-
token::LIT_STR(_) { true }
157-
_ { false }
158-
}
159-
}
160-
161151
type lit = {lit: str, pos: uint};
162152

163153
fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
@@ -186,7 +176,7 @@ fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
186176
break;
187177
}
188178
let tok = next_token(rdr);
189-
if is_lit(tok.tok) {
179+
if token::is_lit(tok.tok) {
190180
let s = rdr.get_str_from(tok.bpos);
191181
literals += [{lit: s, pos: tok.chpos}];
192182
log(debug, "tok lit: " + s);

src/librustsyntax/parse/token.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ pure fn can_begin_expr(t: token) -> bool {
187187
}
188188
}
189189

190+
fn is_lit(t: token::token) -> bool {
191+
ret alt t {
192+
token::LIT_INT(_, _) { true }
193+
token::LIT_UINT(_, _) { true }
194+
token::LIT_FLOAT(_, _) { true }
195+
token::LIT_STR(_) { true }
196+
_ { false }
197+
}
198+
}
199+
190200
fn is_ident(t: token::token) -> bool {
191201
alt t { token::IDENT(_, _) { ret true; } _ { } }
192202
ret false;

0 commit comments

Comments
 (0)