Rename Cursor methods to match TokenTree
diff --git a/src/buffer.rs b/src/buffer.rs
index d84fed2..d695c77 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -370,7 +370,7 @@
/// If the cursor is pointing at a `Ident`, returns it along with a cursor
/// pointing at the next `TokenTree`.
- pub fn term(mut self) -> Option<(Ident, Cursor<'a>)> {
+ pub fn ident(mut self) -> Option<(Ident, Cursor<'a>)> {
self.ignore_none();
match *self.entry() {
Entry::Ident(ref term) => Some((term.clone(), unsafe { self.bump() })),
@@ -380,7 +380,7 @@
/// If the cursor is pointing at an `Punct`, returns it along with a cursor
/// pointing at the next `TokenTree`.
- pub fn op(mut self) -> Option<(Punct, Cursor<'a>)> {
+ pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> {
self.ignore_none();
match *self.entry() {
Entry::Punct(ref op) => Some((op.clone(), unsafe { self.bump() })),
diff --git a/src/lifetime.rs b/src/lifetime.rs
index 9a2bec4..bf8147b 100644
--- a/src/lifetime.rs
+++ b/src/lifetime.rs
@@ -118,7 +118,7 @@
impl Synom for Lifetime {
fn parse(input: Cursor) -> PResult<Self> {
let (apostrophe, rest) = Apostrophe::parse(input)?;
- let (ident, rest) = match rest.term() {
+ let (ident, rest) = match rest.ident() {
Some(pair) => pair,
None => return parse_error(),
};
diff --git a/src/lit.rs b/src/lit.rs
index e31dd62..76df32a 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -429,7 +429,7 @@
Ok((Lit::new(lit), rest))
}
}
- _ => match input.term() {
+ _ => match input.ident() {
Some((term, rest)) => Ok((
Lit::Bool(LitBool {
value: if term == "true" {
diff --git a/src/synom.rs b/src/synom.rs
index b68b07f..5f0bf78 100644
--- a/src/synom.rs
+++ b/src/synom.rs
@@ -216,7 +216,7 @@
impl Synom for proc_macro2::Ident {
fn parse(input: Cursor) -> PResult<Self> {
- let (term, rest) = match input.term() {
+ let (term, rest) = match input.ident() {
Some(term) => term,
_ => return parse_error(),
};
diff --git a/src/token.rs b/src/token.rs
index 7f2ebd7..40e2dce 100644
--- a/src/token.rs
+++ b/src/token.rs
@@ -349,7 +349,7 @@
#[cfg(feature = "parsing")]
impl ::Synom for Underscore {
fn parse(input: ::buffer::Cursor) -> ::synom::PResult<Underscore> {
- match input.term() {
+ match input.ident() {
Some((term, rest)) => {
if term == "_" {
Ok((Underscore([term.span()]), rest))
@@ -384,7 +384,7 @@
#[cfg(feature = "parsing")]
impl ::Synom for Apostrophe {
fn parse(input: ::buffer::Cursor) -> ::synom::PResult<Apostrophe> {
- match input.op() {
+ match input.punct() {
Some((op, rest)) => {
if op.as_char() == '\'' && op.spacing() == ::proc_macro2::Spacing::Joint {
Ok((Apostrophe([op.span()]), rest))
@@ -768,7 +768,7 @@
let chars = s.chars();
for (i, (ch, slot)) in chars.zip(&mut spans).enumerate() {
- match tokens.op() {
+ match tokens.punct() {
Some((op, rest)) => {
if op.as_char() == ch {
if i != s.len() - 1 {
@@ -794,7 +794,7 @@
tokens: Cursor<'a>,
new: fn(Span) -> T,
) -> PResult<'a, T> {
- if let Some((term, rest)) = tokens.term() {
+ if let Some((term, rest)) = tokens.ident() {
if term == keyword {
return Ok((new(term.span()), rest));
}