Releases: killme2008/aviatorscript
[Deprecated] AviatorScript 5.0.1
Main changes:
- Tweak variable accessing performance #238
- Fixed can't overload assignment/define operator #245
- Fixed function arguments( enabled by
Opitons.CAPTURE_FUNCTION_ARGS
) are wrong when invoking more than one functions.#236 - Fixed array accessing operator can't work with
Options.ALWAYS_PARSE_INTEGRAL_NUMBER_INTO_DECIMAL
#237 - Adds new function
eval(script, [bindings], [cached])
to execute a script text string with binding map in scripts. - Adds overload functions
reader(input_stream, [charset])
andwriter(output_stream, [charset])
to IO module.
[Deprecated] Aviator 5.0.0 releases
Deprecated, please use 5.2.6 and above versions.
I am happy to announce that AviatorScript 5.0.0 is released. Main changes since 5.0.0-RC2:
- Adds main class
com.googlecode.aviator.Main
to execute aviator scripts. - Adds bootstrap shell script aviator to wrap the main class and download/upgrade logics. See doc how to use it.
count(nil)
returns 0 instead of throwing an exception.AviatorFunction
extends javaRunnable
andCallable
interface, now you can pass a aviator function toThread
constructor:
let t = new Thread(lambda() -> p('run'); end);
start(t);
- Fixed some bugs:
try
statement can't only be withfinally
withoutcatch
statements.- NPE in parser.
[Deprecated] AviatorScript 5.0.0-RC2
Main changes:
new Class(args)
statement to create an instance of special class with arguments, for example:
let s = new String("test");
p(type(s)); ## print string
throw exception
statement to throw an exception.try
/catch
/finally
statement to handle exceptions, for example:
try {
throw "an exception";
} catch(e) {
pst(e);
} finally {
p("finally");
}
- Fixed #228 can't run on IBM jdk.
- Fixed
Opitons.MAX_LOOP_COUNT
. - Make
seq.get
to supportList
. AviatorEvaluatorInstance#aliasFunction(name, alias)
to alias a function.- New function
pst(e)
to print stacktrace of an exception. - Alias function
println
top
. - Every statement has a value:
let a = if(true) {
2
};
p(a); ## print 2
- Breaking changes:
- Checking equality of two different types
x == y
orx !=y
doesn't throw an exception any more but returns false.
- Checking equality of two different types
[Deprecated] AviatorScript 5.0.0-RC1
Main changes since 5.0.0-beta2:
- Release Programming AviatorScript 5.0 doc in chinese.
Options. MAX_LOOP_COUNT
to control max loop count in for/while/sequence-iterate loop, default zero means no limitation.- Fixed
__MODULE__.exports
can't be assigned. - Use absolute file path as module caching key.
- Fixed number overflow parsing error #219, thanks to @H123R
seq.get
supportsjava.util.Set
, return the element itself if it is in set, otherwise returns nil.- Reset classloader when calling
AviatorEvaluatorInstance#clearExpressionCache()
. - Adds new method to set classloader
AviatorEvaluatorInstance#setAviatorClassLoader(classloader)
- Adds LRU cache for expression caching, enable it by
AviatorEvaluatorInstance#useLRUExpressionCache(capacity)
. - Make parser token and avaitor objects implements
Serializable
interface #209 - Remove global lock in
BeanUtilsBean.getInstance
by a bean cache. #222 - Impl java scripting SPI #198 , supports
Invocable
and refactor script engine, see the programming doc. - New option
Options.FEATURE_SET
to set engine's syntax feature, valid features are listed in Feature enum.Default set is full feature set. - New functions:
seq.entry(key, value)
to create aMap.Entry
.into(to_coll, from_coll)
to add all elements infrom_coll
intoto_coll
byseq.add(to_coll, element)
.bigint(x)
to cast a value into bigint type.decimal(x)
to cast a value into decimal type.
- Breaking changes:
- Remove
Options.ALWAYS_USE_DOUBLE_AS_DECIMAL
, already replaced byOptions. ALWAYS_USE_DECIMAL_AS_FLOATING_POINT_NUMBER
. - Remove
Options.TRACE
, not supported any more. - Remove
Options.DISABLE_ASSIGNMENT
, please use feature API. - Default syntax feature set is full-featured, if you want to be compatible with old versions(before 5.0.0), please
setOption(Options.FEATURE_SET, Feature.getCompatibleFeatures())
, then the engine only supports assignment, lambda and internal variables,if/for/while/let
etc. features are disabled.
- Remove
AviatorScript 5.0.0-beta2
Main changes:
- More examples for AviatorScript.
- Fixed issue #212 in scopes for variable assignment.
- A simple IO module, see example file_io.av.
- A new method
AviatorEvaluatorInstance#addModule
to register custom modules. - Refactor sequence/reducer impl, and now string is a sequence too:
let s = "hello";
for c in s {
println(c);
}
println(filter(s, seq.eq('l')));
- New functions:
type(x)
to return x's type,is_def(x)
returns true when variable x is defined,undef(x)
to forgot a defined variable. - Performance turning: almost 60% speedup in quick-sort benchmark.
include(seq, x)
is O(1) time complexity forjava.util.Set
now #214
AviatorScript 5.0.0-beta1
Since 5.0.0, aviator becomes a general-purpose scripting language, new features:
• Lexical scope by { }
• return
statement to return a value in a function or script.
• if/elsif/else
statement
• for
loop statement and supports break
, continue
• while
loop statement
• let
to define lexical variable
• fn
syntax to define named function
• ## a comment
for single line comment
Please see the documents AviatorScript UserGuide (in progress).
Breaking changes: TODO
You can try the examples by running RunScriptExample. All the examples are under examples folder.
Aviator 4.2.10 released
Main changes:
- Added a new helper method
AviatorEvaluator.newEnv(k1, v1, k2, v2, ...)
to create an environment map. - Supports assigning value to object's property such as
bean.x = y
. - FIxed parsing scientific notation number error with
Options.ALWAYS_PARSE_FLOATING_POINT_NUM
#191 - Allows new line(
\r
or\r\n
) breaker in expression. #191 - Function can be found by object's property syntax #191 , for example
m = seq.map('square', lambda(x)-> x*x end);
m.square(100.0)
Aviator 4.2.9 released
Aviator 4.2.8 released
Main changes:
- Fixed #181
- Wraps function returned value to ensure it's not null (replaced by
AviatorNil
automatically). For example, it will throw aNullPointerException
on runtime if the custom function returns java's null right now, you should returnAviatorNil.Nil
instead. But with this improvement, you can just return thenull
in custom functions, aviator will replace thenull
withAviatorNil
automatically for you.
Aviator 4.2.7 released
Main changes:
- Fixed parser bug #177