Skip to content

Formatting causing error parsing #92

@sbdchd

Description

@sbdchd

Thank you for building this project, it's been super useful!

I noticed when running the formatter over https://github.com/rust-lang/rust-analyzer/blob/4afe0d5393cdedde58881295752fe68acb3148ae/crates/syntax/rust.ungram

PathSegment =
  '::'? NameRef
| NameRef GenericArgList?
| NameRef ParamList RetType?
| '<' Type ('as' PathType)? '>'


//*************************//
//        Generics         //
//*************************//

gets transformed into:

PathSegment =
  //*************************//
  //        Generics         //
  //*************************//
| '::'? NameRef
| NameRef GenericArgList?
| NameRef ParamList RetType?
| '<' Type ('as' PathType)? '>'

//*************************//
//        Generics         //
//*************************//

which causes an error about the extra leading |

The first element in a sequence of productions or alternatives must not have a leading pipe (`|`)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions