feat(lang): rename concept_comparison to definition (v0.3.2)

Renames the `concept_comparison` keyword to `definition` across the
entire codebase for better readability and conciseness.

Changes:
- Tree-sitter grammar: `concept_comparison` node → `definition`
- Tree-sitter queries: highlights, outline, and indents updated
- Zed extension highlights.scm updated to match
- Lexer: `Token::ConceptComparison` → `Token::Definition`
- Parser: `ConceptComparisonDecl` rule → `DefinitionDecl`
- AST: `Declaration::ConceptComparison` → `Declaration::Definition`,
  `ConceptComparisonDecl` struct → `DefinitionDecl`
- All Rust source files updated (validate, names, convert, references,
  semantic_tokens, symbols, code_actions, hover, completion)
- `validate_concept_comparison_patterns` → `validate_definition_patterns`
- Example file and test corpus updated
- Spec docs: created SBIR-v0.3.2-SPEC.md, updated TYPE-SYSTEM.md,
  README.md, SBIR-CHANGELOG.md, SBIR-v0.3.1-SPEC.md
This commit is contained in:
2026-02-23 20:37:52 +00:00
parent 583cd485b9
commit 9c18bfa028
33 changed files with 4242 additions and 3061 deletions

View File

@@ -50,7 +50,7 @@ module.exports = grammar({
$.enum_declaration,
$.concept_declaration,
$.sub_concept,
$.concept_comparison
$.definition
),
// Use declarations
@@ -548,9 +548,9 @@ module.exports = grammar({
any_type: $ => 'any',
// Concept comparison - compile-time pattern matching
concept_comparison: $ => seq(
'concept_comparison',
// Definition - compile-time pattern matching
definition: $ => seq(
'definition',
field('name', $.identifier),
'{',
commaSep1($.variant_pattern),

View File

@@ -20,7 +20,7 @@
"state"
"concept"
"sub_concept"
"concept_comparison"
"definition"
] @keyword.declaration
; Keywords - Control flow and modifiers
@@ -83,7 +83,7 @@
(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)
(definition name: (identifier) @type.definition)
(variant_pattern name: (identifier) @type.variant)
(template_declaration species: (identifier) @type.builtin)

View File

@@ -40,7 +40,7 @@
(sequence_node)
(decorator_node)
(sub_concept)
(concept_comparison)
(definition)
(variant_pattern)
] @indent.begin

View File

@@ -66,7 +66,7 @@
name: (identifier) @name
) @symbol.sub_concept
; Concept comparisons
(concept_comparison
; Definitions
(definition
name: (identifier) @name
) @symbol.concept_comparison
) @symbol.definition

View File

@@ -103,7 +103,7 @@
},
{
"type": "SYMBOL",
"name": "concept_comparison"
"name": "definition"
}
]
},
@@ -2657,12 +2657,12 @@
"type": "STRING",
"value": "any"
},
"concept_comparison": {
"definition": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "concept_comparison"
"value": "definition"
},
{
"type": "FIELD",

View File

@@ -308,32 +308,6 @@
]
}
},
{
"type": "concept_comparison",
"named": true,
"fields": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "variant_pattern",
"named": true
}
]
}
},
{
"type": "concept_declaration",
"named": true,
@@ -383,11 +357,11 @@
"named": true
},
{
"type": "concept_comparison",
"type": "concept_declaration",
"named": true
},
{
"type": "concept_declaration",
"type": "definition",
"named": true
},
{
@@ -493,6 +467,32 @@
]
}
},
{
"type": "definition",
"named": true,
"fields": {
"name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "variant_pattern",
"named": true
}
]
}
},
{
"type": "dotted_path",
"named": true,
@@ -2104,11 +2104,11 @@
"named": false
},
{
"type": "concept_comparison",
"type": "cooldown",
"named": false
},
{
"type": "cooldown",
"type": "definition",
"named": false
},
{

File diff suppressed because it is too large Load Diff

View File

@@ -58,10 +58,10 @@ sub_concept BakedGood.Quality {
value: (float))))))
==================
Concept comparison
Definition
==================
concept_comparison SkillLevel {
definition SkillLevel {
Apprentice: { freshness: any },
Master: { freshness: Tier is Master }
}
@@ -70,7 +70,7 @@ concept_comparison SkillLevel {
(source_file
(declaration
(concept_comparison
(definition
name: (identifier)
(variant_pattern
name: (identifier)