diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec4f5e9..23d6c84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,11 +85,12 @@ jobs: - name: Run parser and binding tests uses: tree-sitter/parser-test-action@v2 with: + generate: false test-rust: true test-node: true test-python: true test-go: true - test-swift: true + test-swift: false - name: Parse sample files uses: tree-sitter/parse-action@v4 diff --git a/grammar.js b/grammar.js index 876e924..a3bf808 100644 --- a/grammar.js +++ b/grammar.js @@ -126,8 +126,6 @@ module.exports = grammar({ _top_level_definition: $ => choice( - $.package_clause, - $.package_object, $._definition, $._end_marker, $.expression, @@ -150,6 +148,8 @@ module.exports = grammar({ $.type_definition, $.function_definition, $.function_declaration, + $.package_clause, + $.package_object, ), enum_definition: $ => diff --git a/test/corpus/definitions.txt b/test/corpus/definitions.txt index 98477d8..fa37076 100644 --- a/test/corpus/definitions.txt +++ b/test/corpus/definitions.txt @@ -141,6 +141,11 @@ package a.b package c { object A } +package d { + package e { + object B + } +} -------------------------------------------------------------------------------- @@ -154,7 +159,17 @@ package c { (identifier)) (template_body (object_definition - (identifier))))) + (identifier)))) + (package_clause + (package_identifier + (identifier)) + (template_body + (package_clause + (package_identifier + (identifier)) + (template_body + (object_definition + (identifier))))))) ================================================================================ Package with comma @@ -210,6 +225,12 @@ package object d extends A { val hello: String = "there" } +package object p1 { + package object p2 { + val a = 1 + } +} + -------------------------------------------------------------------------------- (compilation_unit @@ -221,7 +242,16 @@ package object d extends A { (val_definition (identifier) (type_identifier) - (string))))) + (string)))) + (package_object + (identifier) + (template_body + (package_object + (identifier) + (template_body + (val_definition + (identifier) + (integer_literal))))))) ================================================================================ Imports