You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Revise LANGUAGE_SUPPORT.md for clarity and updates
Updated the language support documentation to include additional notes and clarifications for each supported language. Revised the structure and formatting for consistency and clarity.
| Go |`.go`| tree-sitter-go | function, method, type, constant | — |`//` comments | No class hierarchy (language limitation) |
11
+
| Rust |`.rs`| tree-sitter-rust | function, type (struct/enum/trait), impl, constant |`#[attr]`|`///`and`//!` comments | Macro-generated symbols are not visible to the parser |
12
+
| Java |`.java`| tree-sitter-java | method, class, type (interface/enum), constant |`@Annotation`|`/** */` Javadoc | Deep inner-class nesting may be flattened |
13
13
14
-
## Parser: tree-sitter
14
+
---
15
15
16
-
All parsing uses [tree-sitter](https://tree-sitter.github.io/) via the `tree-sitter-language-pack` Python package. This provides:
16
+
## Parser Engine
17
17
18
-
- Incremental, error-tolerant parsing
19
-
- Consistent AST representation across languages
20
-
- Pre-compiled bindings for all 6 languages
18
+
All language parsing is powered by **tree-sitter** via the `tree-sitter-language-pack` Python package, providing:
19
+
20
+
* Incremental, error-tolerant parsing
21
+
* Uniform AST representation across languages
22
+
* Pre-compiled grammars for supported languages
21
23
22
24
**Dependency:**`tree-sitter-language-pack>=0.7.0` (pinned in `pyproject.toml`)
23
25
26
+
---
27
+
24
28
## Adding a New Language
25
29
26
-
1.**Create a `LanguageSpec`** in `src/jcodemunch_mcp/parser/languages.py`:
30
+
1.**Define a `LanguageSpec`** in `src/jcodemunch_mcp/parser/languages.py`:
27
31
28
32
```python
29
33
NEW_LANG_SPEC= LanguageSpec(
30
-
ts_language="new_language",# tree-sitter grammar name
31
-
symbol_node_types={# AST node type -> symbol kind
34
+
ts_language="new_language",
35
+
symbol_node_types={
32
36
"function_definition": "function",
33
37
"class_definition": "class",
34
38
},
35
-
name_fields={# How to extract names
39
+
name_fields={
36
40
"function_definition": "name",
37
41
"class_definition": "name",
38
42
},
39
-
param_fields={# Parameter extraction
43
+
param_fields={
40
44
"function_definition": "parameters",
41
45
},
42
-
return_type_fields={},# Return type extraction
43
-
docstring_strategy="preceding_comment",# or "next_sibling_string"
44
-
decorator_node_type=None,# Decorator node type if any
0 commit comments