Skip to content

Commit 2728fbe

Browse files
committed
Rename op -> punct
1 parent 4e42b88 commit 2728fbe

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/parse.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn leaf_token(input: Cursor) -> PResult<TokenTree> {
228228
if let Ok((input, l)) = literal(input) {
229229
// must be parsed before ident
230230
Ok((input, TokenTree::Literal(crate::Literal::_new_stable(l))))
231-
} else if let Ok((input, p)) = op(input) {
231+
} else if let Ok((input, p)) = punct(input) {
232232
Ok((input, TokenTree::Punct(p)))
233233
} else if let Ok((input, i)) = ident(input) {
234234
Ok((input, TokenTree::Ident(i)))
@@ -729,8 +729,8 @@ fn digits(mut input: Cursor) -> Result<Cursor, LexError> {
729729
}
730730
}
731731

732-
fn op(input: Cursor) -> PResult<Punct> {
733-
match op_char(input) {
732+
fn punct(input: Cursor) -> PResult<Punct> {
733+
match punct_char(input) {
734734
Ok((rest, '\'')) => {
735735
if ident_any(rest)?.0.starts_with("'") {
736736
Err(LexError)
@@ -739,7 +739,7 @@ fn op(input: Cursor) -> PResult<Punct> {
739739
}
740740
}
741741
Ok((rest, ch)) => {
742-
let kind = match op_char(rest) {
742+
let kind = match punct_char(rest) {
743743
Ok(_) => Spacing::Joint,
744744
Err(LexError) => Spacing::Alone,
745745
};
@@ -749,9 +749,9 @@ fn op(input: Cursor) -> PResult<Punct> {
749749
}
750750
}
751751

752-
fn op_char(input: Cursor) -> PResult<char> {
752+
fn punct_char(input: Cursor) -> PResult<char> {
753753
if input.starts_with("//") || input.starts_with("/*") {
754-
// Do not accept `/` of a comment as an op.
754+
// Do not accept `/` of a comment as a punct.
755755
return Err(LexError);
756756
}
757757

src/wrapper.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ fn into_compiler_token(token: TokenTree) -> proc_macro::TokenTree {
150150
Spacing::Joint => proc_macro::Spacing::Joint,
151151
Spacing::Alone => proc_macro::Spacing::Alone,
152152
};
153-
let mut op = proc_macro::Punct::new(tt.as_char(), spacing);
154-
op.set_span(tt.span().inner.unwrap_nightly());
155-
op.into()
153+
let mut punct = proc_macro::Punct::new(tt.as_char(), spacing);
154+
punct.set_span(tt.span().inner.unwrap_nightly());
155+
punct.into()
156156
}
157157
TokenTree::Ident(tt) => tt.inner.unwrap_nightly().into(),
158158
TokenTree::Literal(tt) => tt.inner.unwrap_nightly().into(),

tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ fn no_panic() {
293293
}
294294

295295
#[test]
296-
fn op_before_comment() {
296+
fn punct_before_comment() {
297297
let mut tts = TokenStream::from_str("~// comment").unwrap().into_iter();
298298
match tts.next().unwrap() {
299299
TokenTree::Punct(tt) => {

0 commit comments

Comments
 (0)