Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Rust Syntax Highlighting: Attribute in Proc Macro Breaks Syntax Highlighting if  #20897

@slightknack

Description

@slightknack

Prerequisites

Description

Including an assignment attribute inside a proc. macro (i.e. #[x(y = z)]) followed by a string literal breaks the current rust syntax parser.

Steps to Reproduce

  1. Open a new file, with the syntax highlighter set to Rust.
  2. Enter the following code:
    #[x(y = z)]
    struct W();
    
    let x = "hello";
    
  3. After the introduction of the string literal, the highlighting breaks.

Expected behavior:

The syntax highlighting should continue to work.

Actual behavior:

It reproduces 100% of the time, even in more complex situations.

Versions

Atom    : 1.47.0
Electron: 5.0.13
Chrome  : 73.0.3683.121
Node    : 12.0.0
MacOS   : 10.15.5 

Additional Information

I suspect that the parser is looking for a string literal in the attribute in a greedy manner and gets confused when it encounters one later.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions