Skip to content

struct's modifiers are too sensitive to order #361

@danzat

Description

@danzat

For example, the following generates a parse error (ref is not adjacent to struct):

ref partial struct S {}

Error:

compilation_unit [0, 0] - [2, 0]
  ERROR [0, 0] - [0, 20]
    variable_declaration [0, 0] - [0, 18]
      type: ref_type [0, 0] - [0, 11]
        type: identifier [0, 4] - [0, 11]
      variable_declarator [0, 12] - [0, 18]
        name: identifier [0, 12] - [0, 18]
  global_statement [0, 21] - [0, 23]
    block [0, 21] - [0, 23]

Whereas (ref is adjacent to struct):

partial ref struct S {}

Is fine:

compilation_unit [0, 0] - [1, 0]
  struct_declaration [0, 0] - [0, 23]
    modifier [0, 0] - [0, 7]
    name: identifier [0, 19] - [0, 20]
    body: declaration_list [0, 21] - [0, 23]

It's enough to have just one such error in a file to completely mess up its parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions