Skip to content

Lexer refactoring #15152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,9 @@ impl<'a> StrSlice<'a> for &'a str {

#[inline]
fn slice(&self, begin: uint, end: uint) -> &'a str {
assert!(self.is_char_boundary(begin) && self.is_char_boundary(end));
assert!(self.is_char_boundary(begin) && self.is_char_boundary(end),
"index {} or {} in `{}` do not lie on character boundary", begin,
end, *self);
unsafe { raw::slice_bytes(*self, begin, end) }
}

Expand All @@ -1743,7 +1745,8 @@ impl<'a> StrSlice<'a> for &'a str {

#[inline]
fn slice_to(&self, end: uint) -> &'a str {
assert!(self.is_char_boundary(end));
assert!(self.is_char_boundary(end), "index {} in `{}` does not lie on \
a character boundary", end, *self);
unsafe { raw::slice_bytes(*self, 0, end) }
}

Expand Down
21 changes: 8 additions & 13 deletions src/libsyntax/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ pub struct AbiData {
}

pub enum AbiArchitecture {
RustArch, // Not a real ABI (e.g., intrinsic)
AllArch, // An ABI that specifies cross-platform defaults (e.g., "C")
Archs(u32) // Multiple architectures (bitset)
/// Not a real ABI (e.g., intrinsic)
RustArch,
/// An ABI that specifies cross-platform defaults (e.g., "C")
AllArch,
/// Multiple architectures (bitset)
Archs(u32)
}

static AbiDatas: &'static [AbiData] = &[
Expand All @@ -84,21 +87,13 @@ static AbiDatas: &'static [AbiData] = &[
AbiData {abi: RustIntrinsic, name: "rust-intrinsic", abi_arch: RustArch},
];

/// Iterates through each of the defined ABIs.
fn each_abi(op: |abi: Abi| -> bool) -> bool {
/*!
*
* Iterates through each of the defined ABIs.
*/

AbiDatas.iter().advance(|abi_data| op(abi_data.abi))
}

/// Returns the ABI with the given name (if any).
pub fn lookup(name: &str) -> Option<Abi> {
/*!
*
* Returns the ABI with the given name (if any).
*/

let mut res = None;

each_abi(|abi| {
Expand Down
Loading