all repos — min @ 4aff02bcad5fcd090c4464533fcc80a07ba655c8

A small but practical concatenative programming language.

Improved handling of hash bang.
h3rald h3rald@h3rald.com
Wed, 03 Jun 2026 10:55:45 +0200
commit

4aff02bcad5fcd090c4464533fcc80a07ba655c8

parent

4dda393d93d1c99e7f658f66f5e415b5699f6672

2 files changed, 8 insertions(+), 10 deletions(-)

jump to
M min.nimmin.nim

@@ -109,19 +109,16 @@

proc minStr*(buffer: string) = minStream(newStringStream(buffer), "input") -proc minFile*(fn: string, op = "interpret", main = true): seq[ - string] {.discardable.} = - var fileLines = newSeq[string](0) - var contents = "" +proc minFile*(fn: string, op = "interpret", main = true): seq[string] {.discardable.} = + var contents: string try: - fileLines = fn.readFile().splitLines() + contents = fn.readFile() except CatchableError: logging.fatal("Cannot read from file: " & fn) terminate(3) - if fileLines[0].len >= 2 and fileLines[0][0..1] == "#!": - contents = ";;\n" & fileLines[1..fileLines.len-1].join("\n") - else: - contents = fileLines.join("\n") + if contents.len >= 2 and contents[0] == '#' and contents[1] == '!': + contents[0] = ';' + contents[1] = ';' minStream(newStringStream(contents), fn, op, main) when isMainModule:
M next-release.mdnext-release.md

@@ -4,11 +4,12 @@ * By default, nimble builds are no longer statically linking other libraries.

### Fixes and Improvements -* Ensure the relevant procs are gcsafe. +* Ensured that all the relevant procs are gcsafe. * No longer using ref for `MinValue` objects. * No longer performing a deep copy when dequoting. * Optimized the way debug information is stored to reduce memory usage. * Avoiding creating unnecessary scopes when possible (withScope macro already creates a scope). * Fixed `setSigil` incorrectly calling `setSymbol`. +* Improved handling of hash bang.