Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
treesitter_parser
codeintel.parsers.treesitter_parser
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _callee | treesitter_parser.py | same file |
| _Def | treesitter_parser.py | same file |
| _field_text | treesitter_parser.py | same file |
| _Lang | treesitter_parser.py | same file |
| _last_segment | treesitter_parser.py | same file |
| _string_field | treesitter_parser.py | same file |
| _text | treesitter_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| _c_declarator_name | treesitter_parser.py | same file |
| _callee | treesitter_parser.py | same file |
| _clean_comment | treesitter_parser.py | same file |
| _Def | treesitter_parser.py | same file |
| _end_line | treesitter_parser.py | same file |
| _field_text | treesitter_parser.py | same file |
| _file_comment | treesitter_parser.py | same file |
| _get_parser | treesitter_parser.py | same file |
| _go_receiver_type | treesitter_parser.py | same file |
| _go_type_spec | treesitter_parser.py | same file |
| _js_require | treesitter_parser.py | same file |
| _js_variable_function | treesitter_parser.py | same file |
| _Lang | treesitter_parser.py | same file |
| _last_segment | treesitter_parser.py | same file |
| _leading_comment | treesitter_parser.py | same file |
| _named_with_body | treesitter_parser.py | same file |
| _rust_impl_name | treesitter_parser.py | same file |
| _rust_impl_type | treesitter_parser.py | same file |
| _signature | treesitter_parser.py | same file |
| _string_field | treesitter_parser.py | same file |
| _strip_quotes | treesitter_parser.py | same file |
| _text | treesitter_parser.py | same file |
| grammar_status | treesitter_parser.py | same file |
| parse_treesitter | treesitter_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| base | base.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| parsers | __init__.py | through an import |
codeintel.parsers.treesitter_parserbackend/app/codeintel/parsers/treesitter_parser.py, lines 1–40Open source
"""Tree-sitter symbol extraction for C, C++, Go, Rust, JavaScript, TypeScript and Java.The extractor walks the syntax tree once, iteratively (minified or deeplynested code must not hit Python's recursion limit), tracking the innermostenclosing definition so that calls and identifiers are attributed to theright symbol and methods are qualified by their class / impl / receiver.Grammars ship as separate pip packages (``tree-sitter-go`` etc.). A missingpackage is reported as ``fallback_reason="grammar_unavailable:<package>"``;it is never silently treated as a successful parse."""from __future__ import annotationsimport importlibimport loggingimport threadingfrom collections.abc import Callablefrom dataclasses import dataclass, fieldfrom .base import ( MAX_DOCSTRING_CHARS, MAX_SIGNATURE_CHARS, ParseResult, Symbol, clip,)logger = logging.getLogger(__name__)# grammar key -> (pip package, module, factory function)GRAMMAR_PACKAGES: dict[str, tuple[str, str, str]] = { "c": ("tree-sitter-c", "tree_sitter_c", "language"), "cpp": ("tree-sitter-cpp", "tree_sitter_cpp", "language"), "go": ("tree-sitter-go", "tree_sitter_go", "language"), "rust": ("tree-sitter-rust", "tree_sitter_rust", "language"), "javascript": ("tree-sitter-javascript", "tree_sitter_javascript", "language"), "typescript": ("tree-sitter-typescript", "tree_sitter_typescript", "language_typescript"), "tsx": ("tree-sitter-typescript", "tree_sitter_typescript", "language_tsx"), "java": ("tree-sitter-java", "tree_sitter_java", "language"),Shows the first 40 of 541 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.parsers.treesitter_parser- File
backend/app/codeintel/parsers/treesitter_parser.py- Lines
- 1–541
- Parser
- python-ast
- Git blob
bf0c9a8044cadd3452ebf5ffa82b866ae00395a9- Call sites
- 13 named, 7 resolved, 6 left unlinked
- Outside this subset
- 1 more edges reach code outside the graph shown here
