Skip to content

Parse error on $ in macro invocations #95

@ninevra

Description

@ninevra

Example:

use syn::Token;
use quote::ToTokens;

fn main() {
    let dollar_sign: Token![$] = Default::default();
    println!("{}", dollar_sign.into_token_stream());
}

This is valid, runnable rust code, but does not parse.

This occurs because the macro_invocation grammar production ultimately delegates to _non_special_token, which excludes $. This is the desired bevarior when parsing macro_rules! declarations, where $ is assigned special meaning, but not when parsing other macro invocations, where $ is just a normal token.

This currently breaks Atom rust syntax highlighting for the scope containing the macro invocation and the rest of the document thereafter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions