Back to the room

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 symbols

Loading

Calls (7)
SymbolFileResolved by
_calleetreesitter_parser.pysame file
_Deftreesitter_parser.pysame file
_field_texttreesitter_parser.pysame file
_Langtreesitter_parser.pysame file
_last_segmenttreesitter_parser.pysame file
_string_fieldtreesitter_parser.pysame file
_texttreesitter_parser.pysame file
Contains (24)
SymbolFileResolved by
_c_declarator_nametreesitter_parser.pysame file
_calleetreesitter_parser.pysame file
_clean_commenttreesitter_parser.pysame file
_Deftreesitter_parser.pysame file
_end_linetreesitter_parser.pysame file
_field_texttreesitter_parser.pysame file
_file_commenttreesitter_parser.pysame file
_get_parsertreesitter_parser.pysame file
_go_receiver_typetreesitter_parser.pysame file
_go_type_spectreesitter_parser.pysame file
_js_requiretreesitter_parser.pysame file
_js_variable_functiontreesitter_parser.pysame file
_Langtreesitter_parser.pysame file
_last_segmenttreesitter_parser.pysame file
_leading_commenttreesitter_parser.pysame file
_named_with_bodytreesitter_parser.pysame file
_rust_impl_nametreesitter_parser.pysame file
_rust_impl_typetreesitter_parser.pysame file
_signaturetreesitter_parser.pysame file
_string_fieldtreesitter_parser.pysame file
_strip_quotestreesitter_parser.pysame file
_texttreesitter_parser.pysame file
grammar_statustreesitter_parser.pysame file
parse_treesittertreesitter_parser.pysame file
Imports (1)
SymbolFileResolved by
basebase.pythrough an import
Imported by (1)
SymbolFileResolved by
parsers__init__.pythrough 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

Read it on GitHub at this commit