Merge pull request #4 from alexcrichton/strnom
Drop dependency on synom
diff --git a/src/lib.rs b/src/lib.rs
index 7a2f5b6..571ecf6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,7 +18,7 @@
#[cfg(feature = "unstable")]
mod imp;
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct TokenStream(imp::TokenStream);
#[derive(Debug)]
@@ -84,7 +84,7 @@
}
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub struct Span(imp::Span);
impl Default for Span {
@@ -99,7 +99,7 @@
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct TokenTree {
pub span: Span,
pub kind: TokenKind,
@@ -111,7 +111,7 @@
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub enum TokenKind {
Sequence(Delimiter, TokenStream),
Word(Symbol),
@@ -119,7 +119,7 @@
Literal(Literal),
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub enum Delimiter {
Parenthesis,
Brace,
@@ -127,7 +127,7 @@
None,
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub struct Symbol(imp::Symbol);
impl<'a> From<&'a str> for Symbol {
@@ -148,13 +148,13 @@
}
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub enum OpKind {
Alone,
Joint,
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct Literal(imp::Literal);
impl fmt::Display for Literal {
@@ -209,6 +209,7 @@
f32, f64, char, &'a str,
}
+#[derive(Debug)]
pub struct TokenIter(imp::TokenIter);
impl Iterator for TokenIter {
diff --git a/src/stable.rs b/src/stable.rs
index 042816a..bfc3dc1 100644
--- a/src/stable.rs
+++ b/src/stable.rs
@@ -15,7 +15,7 @@
use {TokenTree, TokenKind, Delimiter, OpKind};
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct TokenStream {
inner: Vec<TokenTree>,
}
@@ -136,7 +136,7 @@
}
}
-#[derive(Clone, Copy, Default)]
+#[derive(Clone, Copy, Default, Debug)]
pub struct Span;
impl Span {
@@ -145,7 +145,7 @@
}
}
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, Debug)]
pub struct Symbol(usize);
thread_local!(static SYMBOLS: RefCell<Interner> = RefCell::new(Interner::new()));
@@ -207,7 +207,7 @@
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct Literal(String);
impl Literal {
@@ -821,6 +821,8 @@
|
tag!("i64") => { |_| () }
|
+ tag!("i128") => { |_| () }
+ |
tag!("usize") => { |_| () }
|
tag!("u8") => { |_| () }
@@ -831,6 +833,8 @@
|
tag!("u64") => { |_| () }
|
+ tag!("u128") => { |_| () }
+ |
epsilon!()
) >>
(())
@@ -850,7 +854,6 @@
10
};
- let mut value = 0u64;
let mut len = 0;
let mut empty = true;
for b in input.bytes() {
@@ -870,14 +873,6 @@
if digit >= base {
return IResult::Error;
}
- value = match value.checked_mul(base) {
- Some(value) => value,
- None => return IResult::Error,
- };
- value = match value.checked_add(digit) {
- Some(value) => value,
- None => return IResult::Error,
- };
len += 1;
empty = false;
}
@@ -1087,6 +1082,7 @@
8u8
9
0
+ 0xffffffffffffffffffffffffffffffff
");
}
}