slackhq / tree-sitter-hack

Hack grammar for tree-sitter
MIT License
33 stars 15 forks source link

[BUG] Module-level attributes are not parsed correctly #58

Closed andryak closed 6 months ago

andryak commented 1 year ago

Describe the bug

This is valid Hack code that declares a module-level attribute:

<?hh

<<file: SomeClass(SomeOtherClass::class)>>

Yet, the parser does not recognize the syntax:

(script
      (ERROR
        (attribute_modifier
          (ERROR
            (identifier))
          (qualified_identifier
            (identifier))
          (arguments
            (argument
              (scoped_identifier
                (qualified_identifier
                  (identifier))
                (identifier)))))))

Requirements

To Reproduce

Add a new test with content <<file: SomeClass(SomeOtherClass::class)>> in test/corpus/declarations.txt, then run tree-sitter test.

Expected behavior

No errors are reported in the syntax tree.