Skip to main content

Module julia

Module julia 

Source
Expand description

Julia language parser.

Backed by the official tree-sitter/tree-sitter-julia grammar (0.23). Julia has no per-file namespace: module coordinates come from module X … end blocks, and files are stitched together textually via include("relative/path.jl"). That split drives the import model:

  • include("…") is a file path — recorded verbatim in FileInfo.imports and resolved by the builder’s path-import route (registry::uses_path_imports("julia")), which checks candidates against the real file set and so cannot invent a target.
  • using Foo / import Foo.Bar are module references — recorded as their dotted text so the dependency is visible on the File node, but they are namespace-shaped: julia is deliberately NOT in the file-anchored allowlist of other_edges.rs’s raw prefix walk, so a using of an external package whose name collides with a project file can never manufacture a File→File edge.

Coverage:

  • function f() … end, short-form f(x) = … (an assignment whose LHS is a call), function foo end stubs, typed (f(x)::T = …) and where-clause signatures → FunctionInfo. Multiple dispatch (same name, different signatures) is preserved by the builder’s overload pass, which decorates colliding qualified names with a signature hash.
  • Qualified extension methods (function Base.show(io, x) … end) keep the leaf name (show), so same-file calls resolve to them.
  • struct / mutable struct → ClassInfo kind=“struct” (Struct nodes) with fields (typed, untyped, defaulted) as AttributeInfo; abstract type → ClassInfo kind=“abstract_type”; <: supertypes → extends TypeRelationships (EXTENDS edges).
  • module X … end → members qualified as <file-module>.X.<name>; top-level modules are recorded as submodule declarations (Module HAS_SUBMODULE Module).
  • const NAME = … → ConstantInfo; export a, b → FileInfo.exports.
  • Call sites (identifier and receiver.method field calls) → FunctionInfo.calls; cyclomatic branch metrics; docstrings from the immediately preceding string literal; TODO/FIXME comment annotations.
  • One level of macro unwrapping: a definition inside a top-level macro call (@inline f(x) = …, Base.@kwdef struct …) is extracted as if unwrapped.

Deliberately out of scope (recorded here so absence reads as a decision, not an accident): macro definitions get no nodes; anonymous functions (x -> …) and do-blocks get no nodes (calls inside them belong to the enclosing function, mirroring the Rust-closure/Go-func-literal rule); nested/local named functions get no nodes and their bodies’ calls are excluded from the parent; non-const global assignments, primitive type, selective-import symbols (using Foo: bar records only Foo), import aliases (import JSON as J records JSON), and inner constructors are not extracted; &&/|| do not count toward branch metrics.

Structs§

JuliaParser

Constants§

JULIA_NOISE_NAMES
Base builtins that would otherwise dominate CALLS noise. Deliberately omits show, print, string and parse: extending Base.show / Base.print is the standard user pattern, and suppressing the bare name would orphan calls to those user-defined methods.