An implementation of the standard Unix editor "ed", written in Lua
martinwguy/lua-ed
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
This is a version of the standard Unix editor "ed", implemented in Lua.
It was written by translating the sources of GNU ed 1.5 into Lua, but using
the Lua search-and-replace patterns instead of standard regex.
CHANGES
- Patterns for search and replace are Lua 5.1 patterns (as used in string.gsub)
which has different syntax for matching and replacing, including:
- s/foo/bar/3 replaces the first three occurrences of foo instead of the
third because that is how the Lua "snum" parameter works.
However, the replacement pattern "%" (the same as the previous substitution)
is recognized.
- The contents of the yank buffer remain intact when editing a different file
so you can yank lines from one file and put them into another.
- The 'l' command lists control characters as \nnn in decimal, not octal
(to follow the Lua convention).
- The 'P' command can be followed by an optional parameter after a space to set
the prompt string. Trailing spaces are recognized and preserved. e.g.:
P >>>
- Prompt and error message printing are on by default.
BUGS
- Shell escapes and piping are not implemented
- The pattern cannot contain the search pattern delimiter,
which should be able to occur inside character ranges "/[/]/
or if quoted as "\/" (or maybe "%/").
- Unbalanced square brackets in patterns are not an error here.
(e.g. testsuite s10 succeeds when it should fail)
- There are some rare cases (bugs) when an error value (nil) is returned from
below without having printed (or set) an error message.
In these cases we print "Something went wrong". This should never happen...
- NUL characters in files are not handled. They have the effect of truncating
the line at that character. This is due to the Lua 5.1 string library
failing to handle NULs (and is fixed in Lua 5.2 but untested here).
It passes the GNU ed 1.5 test suite, modulo scripts that use shell escapes
and modulo the different regular expression syntax.
In the copy of "testsuite" here, the regex syntax for runnable tests has been
modified to use the Lua syntax.
Enjoy
Martin Guy <martinwguy@gmail.com>, March 2011
About
An implementation of the standard Unix editor "ed", written in Lua
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published