Span was using the auto-implemented PartialCmp during testing, which was
interfering with the new "source" member, causing test failures.
PartialCmp of a Span during testing is now always true.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Positions were being calculated by looking at the *first* character,
which would cause the same character to be visited twice. Now, if the
character is a null byte (\0), it won't advance the position at all.
The null byte should be a safe sentinel value to use because it
(hypothetically) shouldn't be showing up in a source file. This will
probably cause a hang if a file that starts with null bytes, but that's
a problem for future me.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
* RuntimeSpanError was an extraneous solution to adding spans to the
errors; so instead this behavior has been delegated to the
RuntimeError itself.
* Usage of Inst has mostly been replaced with SpInst so if an error is
encountered, we can spit out where it happened in the source code
(hopefully with a stack trace).
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This allows us to write out errors that follow the call stack and give
locations to where errors originated.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This is the path to the location that this span is pointing to. This is
usually going to be a file path, but it can really be anything you want.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This helps split up expressions, meta calls (like includes) that can be
expanded into more expressions.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
We're turing-complete, babey!
* Call stack for functions now differentiates between native and quote
calls
* Better API for builtin functions allowing for more control
* Example showing off branches
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
* crate::scope instead of crate::syn::word, which makes more sense
because scopes are not really used in syntax at all
* Reference-counted BuiltinFn values are available for creation now
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
Nothing fancy yet. This commit adds a bunch of stuff (oops):
* compiling code
* VM with instructions
* remove eval.rs and just eval in the Machine struct itself
* squash most warnings now that we're using stuff here
And probably more. But that's all for now folks
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
We're not compiling yet and mostly want to get the name stuff figured
out. Also may switch to using anyhow error handling.
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>