diff options
| author | Kevin Cantu <me@kevincantu.org> | 2012-02-23 01:44:04 -0800 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-23 17:00:19 +0100 |
| commit | 7782f5d6926be7970ec474b74302f2298ceccd13 (patch) | |
| tree | c05d8ace8e1398de239c130643d18c1bc5e77d81 /src/comp/syntax | |
| parent | 1b957c0942007e60ec9ea6773c964ea7bdc199af (diff) | |
| download | rust-7782f5d6926be7970ec474b74302f2298ceccd13.tar.gz rust-7782f5d6926be7970ec474b74302f2298ceccd13.zip | |
(core::str) remove len_bytes alias
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/codemap.rs | 5 | ||||
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 14 | ||||
| -rw-r--r-- | src/comp/syntax/print/pp.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 6 |
4 files changed, 13 insertions, 14 deletions
diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index e9b4569df6c..c8b33687abe 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -157,10 +157,9 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines { fn get_line(fm: filemap, line: int) -> str unsafe { let begin: uint = fm.lines[line].byte - fm.start_pos.byte; - let end = alt str::index_from(*fm.src, '\n', begin, - str::len_bytes(*fm.src)) { + let end = alt str::index_from(*fm.src, '\n', begin, str::len(*fm.src)) { some(e) { e } - none { str::len_bytes(*fm.src) } + none { str::len(*fm.src) } }; str::slice(*fm.src, begin, end) } diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 0328afc9f20..86d925e87e6 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -64,7 +64,7 @@ fn new_reader(cm: codemap::codemap, itr: @interner::interner<str>) -> reader { let r = @{cm: cm, span_diagnostic: span_diagnostic, - src: filemap.src, len: str::len_bytes(*filemap.src), + src: filemap.src, len: str::len(*filemap.src), mutable col: 0u, mutable pos: 0u, mutable curr: -1 as char, mutable chpos: filemap.start_pos.ch, mutable strs: [], filemap: filemap, interner: itr}; @@ -163,7 +163,7 @@ fn scan_exponent(rdr: reader) -> option<str> { rdr.bump(); } let exponent = scan_digits(rdr, 10u); - if str::len_bytes(exponent) > 0u { + if str::len(exponent) > 0u { ret some(rslt + exponent); } else { rdr.fatal("scan_exponent: bad fp literal"); } } else { ret none::<str>; } @@ -226,7 +226,7 @@ fn scan_number(c: char, rdr: reader) -> token::token { tp = if signed { either::left(ast::ty_i64) } else { either::right(ast::ty_u64) }; } - if str::len_bytes(num_str) == 0u { + if str::len(num_str) == 0u { rdr.fatal("no valid digits found for number"); } let parsed = option::get(u64::from_str(num_str, base as u64)); @@ -273,7 +273,7 @@ fn scan_number(c: char, rdr: reader) -> token::token { ret token::LIT_FLOAT(interner::intern(*rdr.interner, num_str), ast::ty_f); } else { - if str::len_bytes(num_str) == 0u { + if str::len(num_str) == 0u { rdr.fatal("no valid digits found for number"); } let parsed = option::get(u64::from_str(num_str, base as u64)); @@ -610,8 +610,8 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) unsafe { let s1; if all_whitespace(s, 0u, col) { - if col < str::len_bytes(s) { - s1 = str::slice(s, col, str::len_bytes(s)); + if col < str::len(s) { + s1 = str::slice(s, col, str::len(s)); } else { s1 = ""; } } else { s1 = s; } log(debug, "pushing line: " + s1); @@ -651,7 +651,7 @@ fn read_block_comment(rdr: reader, code_to_the_left: bool) -> cmnt { } } } - if str::len_bytes(curr_line) != 0u { + if str::len(curr_line) != 0u { trim_whitespace_prefix_and_push_line(lines, curr_line, col); } let style = if code_to_the_left { trailing } else { isolated }; diff --git a/src/comp/syntax/print/pp.rs b/src/comp/syntax/print/pp.rs index 9114caea2d4..3ee31314299 100644 --- a/src/comp/syntax/print/pp.rs +++ b/src/comp/syntax/print/pp.rs @@ -491,7 +491,7 @@ fn end(p: printer) { p.pretty_print(END); } fn eof(p: printer) { p.pretty_print(EOF); } fn word(p: printer, wrd: str) { - p.pretty_print(STRING(wrd, str::len_bytes(wrd) as int)); + p.pretty_print(STRING(wrd, str::len(wrd) as int)); } fn huge_word(p: printer, wrd: str) { diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 288d8a38dda..76ab2b4ecb5 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -204,7 +204,7 @@ fn head(s: ps, w: str) { // outer-box is consistent cbox(s, indent_unit); // head-box is inconsistent - ibox(s, str::len_bytes(w) + 1u); + ibox(s, str::len(w) + 1u); // keyword that starts the head word_nbsp(s, w); } @@ -1465,7 +1465,7 @@ fn print_ty_fn(s: ps, opt_proto: option<ast::proto>, popen(s); fn print_arg(s: ps, input: ast::arg) { print_arg_mode(s, input.mode); - if str::len_bytes(input.ident) > 0u { + if str::len(input.ident) > 0u { word_space(s, input.ident + ":"); } print_type(s, input.ty); @@ -1647,7 +1647,7 @@ fn print_string(s: ps, st: str) { fn escape_str(st: str, to_escape: char) -> str { let out: str = ""; - let len = str::len_bytes(st); + let len = str::len(st); let i = 0u; while i < len { alt st[i] as char { |
