Back to list
mcclowes

textmate-grammar

by mcclowes

A pipe-oriented functional programming language with a tree-walk interpreter written in TypeScript.

3🍴 0📅 Jan 12, 2026

SKILL.md


name: textmate-grammar

prettier-ignore

description: Use when authoring TextMate grammars for syntax highlighting - covers scopes, patterns, and language injection

TextMate Grammar Authoring

Quick Start

{
  "scopeName": "source.lea",
  "patterns": [
    { "include": "#comments" },
    { "include": "#keywords" },
    { "include": "#strings" }
  ],
  "repository": {
    "comments": {
      "name": "comment.line.double-dash.lea",
      "match": "--.*$"
    }
  }
}

Core Concepts

Scope Naming Convention

comment.line          - Line comments
comment.block         - Block comments
keyword.control       - if, else, match, return
keyword.operator      - +, -, *, /, />
storage.type          - let, maybe, context
entity.name.function  - Function names
variable.other        - Variables
string.quoted.double  - "strings"
constant.numeric      - Numbers
constant.language     - true, false

Pattern Types

Match Pattern

{
  "name": "keyword.control.lea",
  "match": "\\b(if|else|match|return)\\b"
}

Begin/End Pattern

{
  "name": "string.quoted.double.lea",
  "begin": "\"",
  "end": "\"",
  "patterns": [
    {
      "name": "constant.character.escape.lea",
      "match": "\\\\."
    }
  ]
}

Captures

{
  "match": "\\b(let)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*=",
  "captures": {
    "1": { "name": "storage.type.lea" },
    "2": { "name": "entity.name.function.lea" }
  }
}

Lea-Specific Patterns

Pipe Operators

{
  "name": "keyword.operator.pipe.lea",
  "match": "/>|/>>>|\\\\>|</"
}

Decorators

{
  "name": "entity.name.decorator.lea",
  "match": "#[a-zA-Z_][a-zA-Z0-9_]*"
}

Type Annotations

{
  "match": "(::)\\s*([A-Z][a-zA-Z0-9]*)\\s*(:>)\\s*([A-Z][a-zA-Z0-9]*)",
  "captures": {
    "1": { "name": "keyword.operator.type.lea" },
    "2": { "name": "entity.name.type.lea" },
    "3": { "name": "keyword.operator.return-type.lea" },
    "4": { "name": "entity.name.type.lea" }
  }
}

Functions

{
  "begin": "\\(",
  "end": "\\)\\s*(->)",
  "endCaptures": {
    "1": { "name": "storage.type.function.arrow.lea" }
  },
  "patterns": [
    { "include": "#parameters" }
  ]
}

Testing

Use VSCode's "Developer: Inspect Editor Tokens and Scopes" command to verify tokenization.

Reference Files

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon