This commit is contained in:
2026-07-13 14:08:52 +02:00
parent 6455df52b4
commit de56dc7315
5 changed files with 15 additions and 5 deletions
+9
View File
@@ -0,0 +1,9 @@
.PHONY: build install
build:
mkdir -p build
odin build . -out:build/brolang
install: build
install -d "$(HOME)/.brolang/bin"
install -m 755 build/brolang "$(HOME)/.brolang/bin/bro"
+1 -1
View File
@@ -165,7 +165,7 @@ backend failures return status `2`.
Top-level function bodies are semantically checked lazily when a concrete Top-level function bodies are semantically checked lazily when a concrete
specialization is demanded. specialization is demanded.
Every immediate `.bro` file in the input directory belongs to the root Every immediate `.bro` or `.hon` file in the input directory belongs to the root
package. Imports are relative directory paths and are local to the file that package. Imports are relative directory paths and are local to the file that
declares them. Imports beginning with `@` resolve from the project root: declares them. Imports beginning with `@` resolve from the project root:
+3 -2
View File
@@ -87,7 +87,8 @@ read_package_files :: proc(state: ^State, path: string) -> ([]os.File_Info, bool
files: [dynamic]os.File_Info files: [dynamic]os.File_Info
files.allocator = state.allocator files.allocator = state.allocator
for entry in entries { for entry in entries {
if !entry.is_dir && filepath.ext(entry.name) == ".bro" { extension := filepath.ext(entry.name)
if !entry.is_dir && (extension == ".bro" || extension == ".hon") {
append(&files, entry) append(&files, entry)
} else { } else {
os.file_info_delete(entry, state.allocator) os.file_info_delete(entry, state.allocator)
@@ -1170,7 +1171,7 @@ load_package :: proc(state: ^State, path: string, import_span: source.Span, is_r
if is_root { if is_root {
state.root_failed = true state.root_failed = true
} else { } else {
source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro files", canonical) source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro or .hon files", canonical)
state.module.packages[pkg_id].available = false state.module.packages[pkg_id].available = false
} }
os.file_info_slice_delete(files, state.allocator) os.file_info_slice_delete(files, state.allocator)
+2 -2
View File
@@ -855,7 +855,7 @@ lexer_diagnoses_invalid_import_strings :: proc(t: ^testing.T) {
} }
@(test) @(test)
package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) { package_loader_discovers_lexical_immediate_source_files :: proc(t: ^testing.T) {
sources := source.init_store() sources := source.init_store()
defer source.destroy_store(&sources) defer source.destroy_store(&sources)
diagnostics := source.init_store_diagnostics(&sources) diagnostics := source.init_store_diagnostics(&sources)
@@ -870,7 +870,7 @@ package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) {
testing.expect_value(t, len(module.packages), 2) testing.expect_value(t, len(module.packages), 2)
testing.expect_value(t, len(module.files), 3) testing.expect_value(t, len(module.files), 3)
testing.expect(t, strings.has_suffix(sources.items[module.files[0].source].path, "/main.bro")) testing.expect(t, strings.has_suffix(sources.items[module.files[0].source].path, "/main.bro"))
testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.bro")) testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.hon"))
testing.expect(t, strings.has_suffix(sources.items[module.files[2].source].path, "/math.bro")) testing.expect(t, strings.has_suffix(sources.items[module.files[2].source].path, "/math.bro"))
} }