source_paths.l0
Module: source_paths
Source: compiler/stage2_l0/src/source_paths.l0 Language: Dea/L0
Imports / Includes
util.stringsutil.diagstd.vectorstd.textstd.systemstd.pathstd.stringstd.fssys.rt
Symbols
- sp_create
- sp_free
- sp_add_system_root
- sp_add_project_root
- sp_system_root_count
- sp_project_root_count
- sp_system_root_get
- sp_project_root_get
- sp_format_root_list
- sp_module_relpath
- sp_resolve
- sp_is_valid_ident_component
- sp_is_valid_module_name
- sp_apply_default_project_roots
- sp_append_env_sys_roots
- sp_apply_default_sys_roots_env
- sp_apply_default_sys_roots
- sp_build_from_roots
- sp_normalize_entry_target
- SourceSearchPaths
Function sp_create
1
func sp_create() -> SourceSearchPaths*
Create an empty source search-path collection.
Returns: New search-path set with separate system and project root vectors.
Function sp_free
1
func sp_free(self: SourceSearchPaths*)
Free a source search-path collection.
Parameters:
self: Search paths to free.
Function sp_add_system_root
1
func sp_add_system_root(self: SourceSearchPaths*, root: string)
Append a system root directory.
Parameters:
self: Search paths to update.root: Root directory to search before project roots.
Function sp_add_project_root
1
func sp_add_project_root(self: SourceSearchPaths*, root: string)
Append a project root directory.
Parameters:
self: Search paths to update.root: Project root directory to search.
Function sp_system_root_count
1
func sp_system_root_count(self: SourceSearchPaths*) -> int
Return the number of configured system roots.
Parameters:
self: Search paths to inspect.
Returns: Number of system root directories.
Function sp_project_root_count
1
func sp_project_root_count(self: SourceSearchPaths*) -> int
Return the number of configured project roots.
Parameters:
self: Search paths to inspect.
Returns: Number of project root directories.
Function sp_system_root_get
1
func sp_system_root_get(self: SourceSearchPaths*, index: int) -> string
Return a system root by index.
Parameters:
self: Search paths to inspect.index: Zero-based system-root index.
Returns: System root at index.
Function sp_project_root_get
1
func sp_project_root_get(self: SourceSearchPaths*, index: int) -> string
Return a project root by index.
Parameters:
self: Search paths to inspect.index: Zero-based project-root index.
Returns: Project root at index.
Function sp_format_root_list
1
func sp_format_root_list(roots: StringVector*) -> string
Format one root list using the Stage 1 verbose display contract.
Parameters:
roots: Root vector to format.
Returns: Comma-joined quoted roots, or <none> when empty.
Function sp_module_relpath
1
func sp_module_relpath(module_name: string) -> string
Convert a dotted module name to its relative .l0 path.
Parameters:
module_name: Dotted module name such asfoo.bar.
Returns: Relative source path such as foo/bar.l0.
Function sp_resolve
1
func sp_resolve(self: SourceSearchPaths*, module_name: string) -> string?
Resolve a module name against configured search roots.
Parameters:
self: Search paths to inspect.module_name: Dotted module name to resolve.
Returns: First matching source path, or null if the module is not found.
Function sp_is_valid_ident_component
1
func sp_is_valid_ident_component(component: string) -> bool
Check whether a module-name component is a valid identifier.
Parameters:
component: Module-name component to validate.
Returns: true if the component matches identifier rules.
Function sp_is_valid_module_name
1
func sp_is_valid_module_name(module_name: string) -> bool
Check whether a dotted module name is valid.
Parameters:
module_name: Module name to validate.
Returns: true if every component is a valid identifier.
Function sp_apply_default_project_roots
1
func sp_apply_default_project_roots(project_roots: StringVector*)
Ensure a default project root exists.
Parameters:
project_roots: Project-root vector to update.
Function sp_append_env_sys_roots
1
func sp_append_env_sys_roots(sys_roots: StringVector*, env_value: string)
Append system roots from a split environment-style path string.
Parameters:
sys_roots: System-root vector to update.env_value: Colon- or semicolon-separated root list.
Function sp_apply_default_sys_roots_env
1
func sp_apply_default_sys_roots_env(sys_roots: StringVector*, l0_system: string?, l0_home: string?)
Populate default system roots from effective environment values when needed.
Parameters:
sys_roots: System-root vector to update.l0_system: EffectiveL0_SYSTEMvalue, if any.l0_home: EffectiveL0_HOMEvalue, if any.
Function sp_apply_default_sys_roots
1
func sp_apply_default_sys_roots(sys_roots: StringVector*)
Populate default system roots from L0_SYSTEM when needed.
Parameters:
sys_roots: System-root vector to update.
Function sp_build_from_roots
1
func sp_build_from_roots(project_roots: StringVector*, sys_roots: StringVector*) -> SourceSearchPaths*
Build a search-path collection from explicit root vectors.
Parameters:
project_roots: Project roots to copy.sys_roots: System roots to copy.
Returns: New search-path collection containing both root sets.
Function sp_normalize_entry_target
1
func sp_normalize_entry_target(target: string, project_roots: StringVector*, diags: DiagCollector*) -> string?
Normalize a CLI entry target to a module name.
Parameters:
target: CLI target, either a module name or a path-like input.project_roots: Project-root vector to extend whentargetincludes a parent path.diags: Diagnostic collector for validation errors.
Returns: Normalized module name, or null if validation fails.
Struct SourceSearchPaths
Represents the SourceSearchPaths structure.
SourceSearchPaths Field system_roots
1
system_roots: StringVector*
SourceSearchPaths Field project_roots
1
project_roots: StringVector*