Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Support attributes in function definitions (parameter attributes) #148

@peterhuene

Description

@peterhuene

Now that Rust 1.39.0 supports attributes on parameters, the grammar should be updated to allow attributes when parsing function definitions.

Example:

#[attr(foo = "bar")]
fn foo(#[attr(foo = "bar")] p: u32) {
    println!("hi");
}

Notice that "bar" is not highlighted as a string, which is an included pattern in the attribute grammar.

Additionally, parsing breaks when the attribute string has characters that are interpreted as Rust tokens:

#[attr(foo = "bar")]
fn foo(#[attr(foo = "{")] p: u32) {
  println!("hi");
}

Note that here { is being matched as the opening bracket of the function, causing the closing " to be matched as the start of a string (the remainder of the function is considered to be in the string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions