syntax: Move is_lit to mod token
This commit is contained in:
parent
fa86b5d67f
commit
92b2113583
2 changed files with 11 additions and 11 deletions
|
@ -148,16 +148,6 @@ fn consume_comment(rdr: reader, code_to_the_left: bool, &comments: [cmnt]) {
|
||||||
#debug("<<< consume comment");
|
#debug("<<< consume comment");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_lit(t: token::token) -> bool {
|
|
||||||
ret alt t {
|
|
||||||
token::LIT_INT(_, _) { true }
|
|
||||||
token::LIT_UINT(_, _) { true }
|
|
||||||
token::LIT_FLOAT(_, _) { true }
|
|
||||||
token::LIT_STR(_) { true }
|
|
||||||
_ { false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type lit = {lit: str, pos: uint};
|
type lit = {lit: str, pos: uint};
|
||||||
|
|
||||||
fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
|
fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
|
||||||
|
@ -186,7 +176,7 @@ fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let tok = next_token(rdr);
|
let tok = next_token(rdr);
|
||||||
if is_lit(tok.tok) {
|
if token::is_lit(tok.tok) {
|
||||||
let s = rdr.get_str_from(tok.bpos);
|
let s = rdr.get_str_from(tok.bpos);
|
||||||
literals += [{lit: s, pos: tok.chpos}];
|
literals += [{lit: s, pos: tok.chpos}];
|
||||||
log(debug, "tok lit: " + s);
|
log(debug, "tok lit: " + s);
|
||||||
|
|
|
@ -187,6 +187,16 @@ pure fn can_begin_expr(t: token) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_lit(t: token::token) -> bool {
|
||||||
|
ret alt t {
|
||||||
|
token::LIT_INT(_, _) { true }
|
||||||
|
token::LIT_UINT(_, _) { true }
|
||||||
|
token::LIT_FLOAT(_, _) { true }
|
||||||
|
token::LIT_STR(_) { true }
|
||||||
|
_ { false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn is_ident(t: token::token) -> bool {
|
fn is_ident(t: token::token) -> bool {
|
||||||
alt t { token::IDENT(_, _) { ret true; } _ { } }
|
alt t { token::IDENT(_, _) { ret true; } _ { } }
|
||||||
ret false;
|
ret false;
|
||||||
|
|
Loading…
Reference in a new issue