feat(grammar): update tree-sitter grammar to v0.3.0

Updated tree-sitter grammar to match v0.3.0 LALRPOP parser:

Grammar updates:
- Schedule: block-based syntax with extends, override, recurrence
- Life arc: requires clause for field validation
- Template: uses behaviors/schedules syntax
- Behavior: correct keywords (choose/then/repeat with optional params)
- Type system: concept_comparison with any/is_condition
- Removed concept semicolon requirement

Query file updates:
- highlights.scm: updated node names to *_declaration
- outline.scm: updated for new declaration node names
- indents.scm: updated node names, removed concept semicolon

Corpus test updates:
- Created schedules.txt with v0.3.0 syntax tests
- Created highlights.txt for highlighting tests
- Updated type_system.txt for v0.3.0 type syntax
- Updated behaviors.txt for correct expression wrapping
- Updated declarations.txt to use correct node names
- Updated basic.txt to use character_declaration/character_body
- Deleted obsolete v0.2.0 syntax tests

Integration tests:
- Added tree_sitter_integration.rs test suite
- Fixed test_any_type to use correct v0.3.0 syntax
- Fixed test_tree_sitter_grammar_builds to use generate command
This commit is contained in:
2026-02-14 17:43:26 +00:00
parent 0c4994acd2
commit e6d297420c
15 changed files with 10449 additions and 7068 deletions

View File

@@ -69,30 +69,30 @@
(string) @string
; Identifiers in different contexts
(character name: (identifier) @type.character)
(template name: (identifier) @type.template)
(life_arc name: (identifier) @type.life_arc)
(schedule name: (identifier) @type.schedule)
(behavior name: (identifier) @type.behavior)
(institution name: (identifier) @type.institution)
(relationship name: (identifier) @type.relationship)
(location name: (identifier) @type.location)
(species name: (identifier) @type.species)
(character_declaration name: (identifier) @type.character)
(template_declaration name: (identifier) @type.template)
(life_arc_declaration name: (identifier) @type.life_arc)
(schedule_declaration name: (identifier) @type.schedule)
(behavior_declaration name: (identifier) @type.behavior)
(institution_declaration name: (identifier) @type.institution)
(relationship_declaration name: (identifier) @type.relationship)
(location_declaration name: (identifier) @type.location)
(species_declaration name: (identifier) @type.species)
(enum_declaration name: (identifier) @type.enum)
(arc_state name: (identifier) @type.state)
(state_block name: (identifier) @type.state)
(concept_declaration name: (identifier) @type.concept)
(sub_concept parent: (identifier) @type.concept)
(sub_concept name: (identifier) @type.sub_concept)
(concept_comparison name: (identifier) @type.concept_comparison)
(variant_pattern name: (identifier) @type.variant)
(template species: (identifier) @type.builtin)
(template_declaration species: (identifier) @type.builtin)
; Field names
(field name: (dotted_path) @property)
(sub_concept_field name: (identifier) @property)
; Species reference
(character species: (identifier) @type.builtin)
(character_declaration species: (identifier) @type.builtin)
; Paths and identifiers
(path) @namespace
@@ -148,7 +148,7 @@
(transition target: (identifier) @type.state)
; Schedule blocks
(schedule_block activity: (identifier) @function.activity)
(schedule_block name: (identifier) @function.schedule_block)
; Override operations
(override "@" @keyword.override)

View File

@@ -24,17 +24,17 @@
; Block structures that should indent their contents
[
(block)
(character)
(template)
(life_arc)
(arc_state)
(schedule)
(character_declaration)
(template_declaration)
(life_arc_declaration)
(state_block)
(schedule_declaration)
(schedule_block)
(behavior)
(institution)
(relationship)
(location)
(species)
(behavior_declaration)
(institution_declaration)
(relationship_declaration)
(location_declaration)
(species_declaration)
(enum_declaration)
(selector_node)
(sequence_node)
@@ -46,4 +46,3 @@
; Dedent after semicolon at top level
(use_declaration ";" @indent.end)
(concept_declaration ";" @indent.end)

View File

@@ -2,52 +2,52 @@
; Defines what symbols appear in the document outline
; Characters
(character
(character_declaration
name: (identifier) @name
) @symbol.character
; Templates
(template
(template_declaration
name: (identifier) @name
) @symbol.template
; Life arcs
(life_arc
(life_arc_declaration
name: (identifier) @name
) @symbol.life_arc
; Life arc states
(arc_state
(state_block
name: (identifier) @name
) @symbol.state
; Schedules
(schedule
(schedule_declaration
name: (identifier) @name
) @symbol.schedule
; Behaviors
(behavior
(behavior_declaration
name: (identifier) @name
) @symbol.behavior
; Institutions
(institution
(institution_declaration
name: (identifier) @name
) @symbol.institution
; Relationships
(relationship
(relationship_declaration
name: (identifier) @name
) @symbol.relationship
; Locations
(location
(location_declaration
name: (identifier) @name
) @symbol.location
; Species
(species
(species_declaration
name: (identifier) @name
) @symbol.species