Age | Commit message (Collapse) | Author | Files | Lines |
|
Previously two adjacent terms were incorrectly accepted, such as in
pow(2 3)
Correctly generate an error in this case and improve the error
message when an expression fails to parse correctly.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Previously math functions with multiple arguments were handling poorly.
For example: pow(1.0 + 3.0 - 2, .8 * 5)
was evaluated as: pow(1.0 + 3.0, 2 - .8 * 5)
Now commas correctly separate function parameters.
Also, the error messages are more consistent and informative in the case
of an invalid expression.
Update and re-enable tests in tests/expr-old.test accordingly
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And enable some more math tests
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
* named boolean values in `expr` are internally converted to int
* named constants are lower-case only
|
|
null
|
|
|
|
Rather than taking a string and a length, it is simpler and more efficient
to take a Jim_Obj
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
As identified by frgm
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
|
|
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
|
|
Add comment to highlight that fall through is the
desired behaviour for cases ending without break.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
|
|
"does not exists" => "does not exist"
|
|
|
|
Reported-by: Svyatoslav Mishyn <juef@openmailbox.org>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
There is no need to protect against merging tailcalls across
uplevel since any tailcalls should already be fully resolved.
This fixes a problem with the following only running one loop:
foreach a {b c d} {
command-with-tailcall $a
}
In particular:
dict for {a b} {1 2 3 4} { puts $a,$b }
Reported-by: Jon Povey <jon.povey@emsolutions.com.au>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Commit 7edde0797 inadvertently reduced performance of the
script evaluation fast path.
Rename Jim_GetScript() to JimGetScript() - always returns a script, even on parse failure.
Now JimValidScript() checks the script for parse error and generates the error message if necessary.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
If a script has a missing bracket (for example), currently
it is silently ignored, except by [source]
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Allows a script to be created with explicit source info
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
- Add wide() function to [expr] (same as int())
- Small error message changes
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Change the error message to match Tcl 8.6
"expected floating-point number" instead of "expected number"
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
It is possible for the alias prefix to shimmer, especially
if the prefix is a list with a single element
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This approach avoids a coverity warning
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
In this invalid script:
foreach a {0 1 2} {} {3 4 5} {
# ...
}
Courtesy of coverity
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Courtesy of coverity
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Courtesy of coverity
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Courtesy of coverity
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Jim_EvalFile() needs to explictly add an error stack frame.
Reported-by: Florian Schäfer <florian.schaefer+github@gmail.com>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Throw an error if a script or expression is missing a trailing bracket, brace
or quote rather than simply ignoring the error.
Reported-by: Florian Schäfer <florian.schaefer+github@gmail.com>
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Preserve the source info for an interpolated script where possible.
e.g.
set script "puts $x"
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Commit 87ea45c91e removed the code to free cached callframes
when the interpreter is freed. Restore that code.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Sweep through and clean up all (most) of the comments in the code.
While there, adjust some variable and function names to be more consistent,
and make a few small code changes - again, mostly for consistency.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Only do fast dict->list conversion if there is no string rep
When converting list->dict, generate the string rep of a shared list to avoid
loss of info when converting to dict.
Also add a relevent test to dict.test
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And clean up expr parsing slightly
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
And use it from the expr evaluator
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Less manual handling of reference counts means less chance of
error and less code.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
If both a val dup and a val destructor exist, need to
dup before destroying.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Probably only developers care about reference count mismatches
at exit.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Instead of an explicit call in jim.c, store load
handles as AssocData so that it is automatically cleaned up.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
This reverts commit 5155f363872af642ade631396d1d7303285c3481.
It seems that this change has made dict element addition slower,
so revert it.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|
|
Resolve the tailcall command immediately in [tailcall] and stash it.
If a tailcall is currently being evaluated, new tailcalls in the same
frame are merged/deferred to evaluate in the same C stack frame.
Can't merge tailcall evaluations across uplevel.
Add some tests for these cases
Signed-off-by: Steve Bennett <steveb@workware.net.au>
|