alandipert / gherkin

a functional programming language and interpreter written in GNU Bash 4
https://tailrecursion.com/~alan/Lisp/GherkinHistory.html
BSD 3-Clause "New" or "Revised" License
522 stars 31 forks source link

File reading dropping t characters #35

Closed quoll closed 10 years ago

quoll commented 10 years ago

Commit 394942138fa72f387dd93b6f1b393477cc005e45 on Dec 6 caused a break that I haven't tracked down yet.

Before this commit, the following worked:

> (load-file "core")
comp
> (or t)
t
> (some identity '(t))
t

After the commit, we get this:

> (load-file "core")
nil
> (or t)
nil
> (some identity '(t))
nil
quoll commented 10 years ago

Most of the changes in this commit involve reading a file, so I tried defining each function at the repl and they work. So the issue is in load-file.

quoll commented 10 years ago

Turns out it's a Mac-only problem.

The "sed" commands on lines 87 and 89 use a regex to match tabs with \t. Bizarrely, on a Mac the "\t" string in sed is matching 't' characters and not tabs (contradicting the man pages on the Mac). [:space:] is more compatible, and more flexible than the current [ \t] anyway.