Skip to content

Make top-level matcher optional #10

@tadeuzagallo

Description

@tadeuzagallo

Right now, the grammar requires that you have a rule, and within a rule you can have multiple provider_matchers. A provider matcher is a combination of the provider to be used and a first matcher, e.g.

rule "example" {
  Swift::ClassDeclaration {
     // ...
  }
}

However, this doesn't allow matching multiple top-level siblings, e.g. in #9 where a rule is needed to match both a top-level protocol and a top-level class.

I think the most straight forward solution is to make the top level matcher optional, e.g.

rule "example" {
  Swift {
    var top_level_var := false

    ClassDeclaration {
      // ...
    }

    ProtocolDeclaration {
      // ...
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions