-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (71 loc) · 2.48 KB
/
Makefile
File metadata and controls
83 lines (71 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.PHONY: all generate build test inject tmgrammar monarch validate clean help
# Variables
PYTHON := python -X utf8
TREE_SITTER := node_modules/tree-sitter-cli/tree-sitter.exe
help:
@echo "Tree-sitter Multilingual Grammar - Available Targets"
@echo ""
@echo " generate Run tree-sitter generate to compile the grammar"
@echo " build Generate and build the parser with node-gyp"
@echo " test Run Tree-sitter corpus tests"
@echo " inject Inject keyword aliases from keywords.yaml into grammar.js"
@echo " tmgrammar Generate TextMate grammar from keywords.yaml"
@echo " monarch Generate Monaco Editor Monarch tokenizer from keywords.yaml"
@echo " validate Validate keyword.yaml coverage and completeness"
@echo " all Run: inject -> generate -> build -> tmgrammar -> monarch -> validate"
@echo " clean Remove generated files and build artifacts"
@echo ""
# Inject aliases from keywords.yaml into grammar.js
inject:
@echo "Injecting keyword aliases..."
@$(PYTHON) scripts/inject_aliases.py
@echo "OK: aliases injected"
# Generate parser from grammar.js
generate: inject
@echo "Generating parser from grammar.js..."
@$(TREE_SITTER) generate
@echo "OK: parser generated"
# Build the native module
build: generate
@echo "Building native module..."
@npx node-gyp rebuild
@echo "OK: native module built"
# Run tests
test:
@echo "Running corpus tests..."
@$(TREE_SITTER) test
@echo "OK: tests passed"
# Generate TextMate grammar
tmgrammar:
@echo "Generating TextMate grammar..."
@$(PYTHON) scripts/build_tmgrammar.py
@echo "OK: TextMate grammar generated"
# Generate Monaco Monarch tokenizer
monarch:
@echo "Generating Monaco Monarch grammar..."
@$(PYTHON) scripts/build_monarch.py
@echo "OK: Monaco Monarch grammar generated"
# Validate keyword coverage
validate:
@echo "Validating keyword coverage..."
@$(PYTHON) scripts/validate_coverage.py
@echo "OK: validation complete"
# Full build pipeline
all: inject generate build tmgrammar monarch validate
@echo ""
@echo "OK: build complete"
@echo " - Grammar injected"
@echo " - Parser generated and built"
@echo " - TextMate grammar generated"
@echo " - Monaco Monarch grammar generated"
@echo " - Keywords validated"
# Clean generated files
clean:
@echo "Cleaning build artifacts..."
@rm -rf build
@rm -rf generated
@find . -name "*.node" -delete
@find . -name "*.so" -delete
@find . -name "*.dylib" -delete
@echo "OK: clean complete"
.DEFAULT_GOAL := help