Added support for operator.itemgetter
.
Changed ItemAST
logic to work via the type objects.
Make the timer an instance variable within EvaluationContext
to properly
clean its resources and make it a user thread instead of a daemon thread.
When an UL4 template finishes normally without exceeding the maximum allowed runtime cancel the timer task instead of the timer.
Fixed XML escaping logic, which resulted in the escaping happening twice when
renders()
was called during a renderx
(or renderx_or_print
or
renderx_or_printx
) call.
Fixed the regular expression that is used for tokenizing the template source
code to reject <?endif?>
as a proper end tag.
Add a new BoundArguments
constructor that gets the signature and the name
from a Template
.
Fix stack traces containing objects that implement UL4GetAttr.renderAttrUL4()
.
Now objects that get called/rendered or whose attributes get called/rendered
that should appear in the UL4 stack trace must implement the marker interface
UL4AddStackFrame
. Template
, TemplateClosure
and BoundTemplate
do
implement that marker interface.
Templates can now be used as bound methods. Calling/rendering the template will pass the bound object as first argument.
In UL4 <?doc?>
and <?note?>
can now be nested, and otherwise can
contain anything up to the matching <?end doc?>
or <?end note?>
tag,
but only if the initial <?doc?>
or <?note?>
tag contains only
whitespace (e.g. <?doc ?>
etc.). This makes it possible to have source
code examples in <?doc?>
or <?note?>
tags.
UL4Render
now is a sub interface of UL4Call
.
Add namespace
attribute to Template
class.
The UL4 type datetime
has a new method timestamp
which returns the seconds
since epoch with microseconds resolution.
Transfer test output as hex dumps to workaround a problem with gradle.
Added UL4 attribute Template.version
(the UL4 API version) and
ul4.__version__
(the version of this software package).
Prevent NullPointerException
in Utils.addExceptionHTML2Buffer()
.
Avoid calling java.sql.Date::toInstant()
in Utils.toLocalDate*()
methods.
GenericType
now subclasses AbstractType
. This adds the UL4 attributes
__module__
, __name__
and __doc__
to generic instances (e.g.
exception objects).
Add missing method DateTime.date(Date)
.
Don't include class name twice in Utils.addExceptionHTML2Buffer()
.
Add Utils.toLocalDate()
method.
Add DuplicateParameterException
. Throw it when a parameter with the same
name is added to a Signature
twice.
Update to jdk 17.
Implement format()
for floating point numbers. Currently only the
formats e
, E
, f
, and F
are supported.
Update version of Apache Commons Text to 1.10.0 for security reasons (CVE-2022-42889) which doesn't affect UL4.
For UL4ON decoders make to list of backreferences accessible via
Decoder.getBackReferences()
.
Switch to gradle as the build infrastructure.
Switch naming schema for versions/tags to use the bare version number.
Add infrastructure for building the jar in gitlab.
Reverted to use Java 1.8 for compiling, since we need backwards compatibility.
Updated to use Java 17 for compiling.
Fixed german date formatting tests where the output differs between
java.util.Date
and java.time.LocalTime
objects (but only on Java 17).
Implemented AbstractMapChain.values()
.
Limiting the maximum runtime is now no longer done via checking
System.currentTimeMillis
, but via an additional timer thread that interrupts
the main thread. This results in a 20-fold speedup on some hardware/OS
constellations (e.g. running in a Docker container etc.).
When loading an UL4 template from source, don't incorparate the loaded signature again in the source. We assume that the signature was specified in the source anyway.
Performance and memory optimizations:
TextAST
instances now always store their own copy of the string.
String offsets into the template source code are now no longer stored as Slice` objects. Instead we simply use two ints. This reduces memory usage.
Most strings are now interned.
BoundArguments
now uses an array for argumentsByPosition
.
UL4GetAttr.getAttrUL4()
now should return an UndefinedAttribute
object instead of raising an AttributeError
. Unfortunately this makes
non-existant attributes indistinguishable from attributes that happen to
be UndefinedAttribute
objects without calling hasAttrUL4()
, but this
istinction can't be made in UL4 anyway (without calling hasattr()
).
BoundArguments
objects are now no longer autocloseable. Instead we let
the garbage collector clean them up naturally. Previously the
EvaluationContext
kept some of the BoundArguments
objects alive until
the end of the template call. Now they can die sooner.
All versions of FunctionRound.call()
now try to return the narrowest
possible type (which means that the most generic version still returns a
Number
instead of an Object
).
Add method Utils.toLocalDateTime(java.util.Date)
.
Add new classes RenderOrPrintAST
, RenderOrPrintXAST
,
RenderXOrPrintAST
, RenderXOrPrintXAST
.
Add method Utils.toLocalDateTime(java.util.Date)
.
Add methods to BoundArguments
for converting arguments to bool
.
Add methods to BoundArguments
for checking arguments for their type and
returning the converted value.
Updated HTML produced by Utils.getExceptionChainAsHTML()
for better
compatibility with WAF stack traces.
Fixed HTML for UL4 stacktrace produced by Utils.getExceptionChainAsHTML()
.
Enhance CSS markup.
Fixed UL4ON serialization of *
and **
arguments in template signatures.
Added Color methods withhue()
and withsat()
to the output of the
dir()
function.
Added the missing Color methods withhue()
and withsat()
.
Added the missing dict
method keys()
.
The UL4 function urlquote()
now will encode the space character as %20
instead of +
.
Added support for the <?ignore?>
/<?end ignore?>
tag.
It is now possible to implement method calls without having to create bound method objects. (Of course when the method is fetched without being called directly, a bound method object is still required.)
For classes that implement UL4GetAttr
this can be done by overwriting
the default implementation of UL4GetAttr.callAttrUL4()
. The default
implementation calls UL4GetAttr.getAttrUL4()
and then calls
CallAST.call()
for the result.
For classes that can't implement UL4GetAttr
this can be done by overwriting
UL4Type.callAttr()
in the type class for the class.
For examples how this is done see the class Color
(for the UL4GetAttr
based version), or Str
(for the non-UL4GetAttr
based version).
For all interfaces and abstract classes where there's a version with and one
without support for passing an EvaluationContext
, there is only one version
now, and this version does support passing an EvaluationContext
. (So the
implementation is the one from UL4FooWithContext
, but the name is UL4Foo
).
This affects the following interfaces: UL4RenderWithContext
, UL4SetItem
,
UL4GetItem
, UL4Len
, UL4SetAttr
, UL4Bool
, UL4Dir
,
UL4GetAttr
, UL4Call
, UL4Abs
, Function
, FunctionWithContext
,
BoundMethod
, BoundMethodWithContext
and UL4SetItemWithContext
.
Support for constant folding has been dropped.
UndefinedKey
objects now remember which object created them and they will
only be used for item access. Attribute access uses the new
UndefinedAttribute
class.
Added a date
method to date
and datetime
objects.
Added Utils.toBigDecimal(int)
and Utils.toBigDecimal(long)
.
Always raise an ArithmeticException
when dividing by zero.
Implemented support for timedelta // timedelta
.
Added a convenience method UL4Repr.repr()
.
Added methods Connection.commit()
and Connection.rollback()
.
com.livinglogic.ul4.utils.formatMessage()
now supports argument indexes in
the placeholder strings, i.e. you can use {0}
instead of {}
to output
the first argument. This makes it possible to output the argument in a different
order.
Updated Apache Commons Lang to 3.11 and use Apache Commons Text 1.9.
Added methods Color.fromCSS(String)
and Color.fromCSS(String, Color)
.
Added type objects. type(obj)
now returns a type object instead of a string.
Some type objects can be called to create an instance.
Add function isinstance()
for instance checking against type objects.
The following builtins are type objects now: bool
, int
, float
,
str
, date
, datetime
, timedelta
, monthdelta
, list
,
set
, dict
and color.Color
(new).
Add support for UL4 modules. Add the modules ul4
, math
, operator
and color
(and ul4on
, which existed before). A module has attributes
__name__
and __doc__
as well as additional attributes.
The module ul4
contains all the types required for UL4 syntax trees. The
type ul4.Template
is callable to create a new UL4 template from source.
The module ul4on
contains the functions loads()
and dumps()
and
the types Encoder
and Decoder
.
The module operator
contains one type: attrgetter
.
The module color
contains the type Color
and the functions css()
and mix()
.
math
contains the constants e
, pi
and tau
as well as the
functions cos()
, sin()
, tan()
, sqrt()
and isclose()
.
Add support for positional-only and keyword-only arguments in the Signature
API (but not in UL4 itself, i.e. currently it's not possible to define local
templates with positional-only or keyword-only arguments).
Add functions floor()
and ceil()
.
Template
objects no longer have startdelim
and enddelim
attributes.
The tag delimiters are now always <?
and ?>
.
The color method abslum()
has been renamed to abslight()
and
rellum()
has been renamed to rellight()
.
The following methods have been added to color.Color
: hue()
,
light()
, sat()
, withhue()
, withsat()
, withlum()
,
ablum()
, rellum()
, invert()
and combine()
.
Internal unpublished version.
Exceptions can now be logged for all logging levels in EvaluationContext
(i.e. an exception can be logged as a wrning). Logging exceptions per se is
gone now.
Arrays are now dumped as lists by the UL4ON machinery (Note that this means that they don't roundtrip, as they will be deserialized as lists again.)
Implemented a "module" ul4on
with the attributes loads
, dumps
,
Encoder
and Decoder
. Encoder
and Decoder
can be used to
dump/load multiple objects/dumps using the same encoding/decoding context.
Implemented InterpretedTemplate.reader(globalVariables, variables)
.
Add methods logDebug
, logInfo
, logNotice
, logWarning
,
logError
and logException
to EvaluationContext
. With this UL4
clients can log deprecations. To really have an effect, a subclass of
EvaluationContext
must be used that overwrites these methods.
Added support for global variables.
The set of variants of the methods renders
, render
and call
in
InterpretedTemplate
has changed.
Actually clip the stack trace in
com.livinglogic.ul4.Utils.getStacktraceAsMarkdown()
.
Added version of com.livinglogic.ul4.Utils.getStacktraceAsText()
and
com.livinglogic.ul4.Utils.getStacktraceAsMarkdown()
where the number of
lines can be limited.
Added com.livinglogic.ul4.Utils.getStacktraceAsText()
and
com.livinglogic.ul4.Utils.getStacktraceAsMarkdown()
for returning a
complete Java stacktrace as a plain text or Markdown string.
Fixed duplicate class name in
com.livinglogic.ul4.Utils.getExceptionChainAsMarkdown()
.
Added com.livinglogic.ul4.Utils.getExceptionChainAsMarkdown()
which returns
an UL4 stacktrace in Markdown format.
Added an (UL4 accessible) method queryone
to
com.livinglogic.dbutils.Connection
.
com.livinglogic.dbutils.Connection
now implements AutoCloseable
.
Removed the "type name" from nameUL4
for all bound methods.
Implemented the dict method pop()
.
Implemented the function scrypt()
.
Make the following methods in Utils
public: getExceptionChainAsList()
,
getExceptionChainAsJSON()
, getExceptionChainAsText()
and
getExceptionChainAsHTML()
.
Implemented or exposed the following methods in the Utils
class:
exceptionAsMap()
, getExceptionChainAsList()
,
getExceptionChainAsJSON()
, getExceptionChainAsText()
and
getExceptionChainAsHTML()
.
Added the following methods to the class AST
:
getTemplateDescriptionText()
, getTemplateDescriptionHTML()
,
getLocationDescriptionText()
, getLocationDescriptionHTML()
,
getSourceSnippetText()
and getSourceSnippetHTML()
.
Make the method AST.getPos()
public.
Fix test.
Fixed version number in pom.xml
.
Fixed a NullPointerException
in InterpretedTemplate.Block.setIndent
.
Added the following UL4 attributes to AST
: startpos
, startline
,
stopcol
, startsource
, startsourceprefix
and startsourcesuffix
.
Added the following UL4 attributes to block like AST nodes: stoppos
,
stopline
, stopcol
, stopsource
, stopsourceprefix
and
stopsourcesuffix
.
Expose the attribute items
of com.livinglogic.ul4.SetAST
to UL4.
Added com.livinglogic.utils.ArrayUtils
(with the method
makeExtendedStringArray
).
Added com.livinglogic.utils.ListUtils
(with the method makeExtendedList
).
Type names are now "interned" when writing an UL4ON dump.
Fixed the UL4 attribute context
for LocationException
to use
getInnerException
instead of getCause
.
Fixed exception decoration in CallRenderAST
: Even if the call is not from a
template, the decorating must be done when the innermost exception is not a
LocationException, because this is the original location of the error.
If constant folding in the compiler fails, the compiler will now create an AST node for the original operator (which means that the error will only surface when the template gets executed, not when it gets compiled).
Exception chaining has been changed from chaining the exception object via
initCause()
to do it via addSuppressed()
. The reason is that there might
be exceptions that already have a cause, so calling initCause
again will
fail. Using addSuppressed()
should work in much more cases.
Fix typo in InterpretedTemplate
.
Add method InterpretedTemplate.getParentTemplate()
.
Add method LocationException.getLocation()
.
Move information required for printing UL4 exceptions into the base class
AST
.
The chaining of UL4 exceptions has been inverted. This means that the exception
that will get raised from the UL4 template is the original innermost exception.
LocationException
instances will be added as the "cause" of each exception
to specify the exact location in the UL4 source.
The structure of compiled UL4 templates has been simplified internally: Each
AST
instance has attributes template
and pos
that directly reference
the template and the source code location of the AST
node. The Tag
objects are gone (they will only be used internally during compilation).
Also AST
nodes have gained a source
property which returns the source
code of the node itself.
Code in AttrAST
and ItemAST
has been reordered so that implementations
of the UL4GetAttrWithContext
, UL4GetAttr
, UL4GetItemWithContext
and
UL4GetItem
interfaces are preferred over implementation of the Map
interface.
For backwards compatibility reasons the UL4 function date
now accepts
3-7 arguments again (and returns a datetime
object when non-zero hours,
minutes, seconds or microsecond are passed in).
Split date object into date and datetime objects and support LocalDate
and
LocalDatetime
Java objects. Add today()
function.
Added support for loading the content of an object in an UL4ON dump iteratively.
Added support for <?renderblock?>
and <?renderblocks?>
.
Added support for <?renderx?>
.
Fixed an off-by-one error in smart whitespace handling.
The string methods startswith()
and endswith()
now support list of
strings as arguments.
Use LinkedHashMap
in CallAST
and RenderAST
to preserve the order
of keyword arguments.
Arrays.asList()
returns immutables lists, and those don't support the
UL4 method pop()
for example. Creating a new mutable list from the array
should fix that problem.
To help will XSS prevention <
will now be escaped as \u003c
in JSON
output and as \x3c
in UL4ON output.
UL4 now longer tries a disguise objects as dictionaries. I.e. for objects
implementing UL4GetItemString
the methods items()
, keys()
,
values()
and get()
are no longer synthesized. This also means that
len()
, list()
, item access and containment test no longer work on
objects.
New functions getattr()
, setattr()
, hasattr()
and dir()
have
been added, to work with attributes of objects.
A few interfaces (and their methods) have been renamed: UL4GetItemString
to UL4GetAttr
, UL4GetItemStringWithContext
to UL4GetAttrWithContext
and UL4Attributes
to UL4Dir
.
The AttributeException
constructor now has two arguments: The object and
the key.
When deeserializing UL4ON dumps it's now possible to pass in a "custom type registry" to customize which object get created.
When compiling the template signature in an <?ul4?>
tag fails the
exception will now be properly wrapped to show the <?ul4?>
tag in which
the exception happened.
Rendering or calling null
now reliably produces a
NotRenderableException
/NotCallableException
.
Fixed a minor bug when loading an UL4ON dump of a template in source form.
Implementations of UL4GetItem
, UL4GetItemString
,
UL4GetItemWithContext
and UL4GetItemStringWithContext
are now
required to throw an AttributeException
when the attribute doesn't exist
(instead of returning an UndefinedKey
object).
Added <?doc?>
tag which is available as via the Java method
InterpretedTemplate.getDoc()
or the doc
attribute in UL4.
The template signature is now accessible as the signature
attribute
(and supports str()
and repr()
).
Fixed asjson()
output of BigDecimal
objects.
UL4ON dumps can now contain UL4 templates in "source" format, i.e. the template will be compiled when it is loaded. This is implemented to give the Oracle PL/SQL version a chance to put UL4 templates into a UL4ON dump.
Compiling an UL4 template will wrap the RecognitionException
in a
RuntimeException
, so that the RecognitionException
no longer has to
be declared (or wrapped) by calling code.
Dictionaries generated by dictionary literals and dictionary comprehensions
are now ordered. Also the order of (key, value) pairs passed into an **
parameter will now be preserved.
Calling the InterpretedTemplate
constructor with the Signature
argument no longer overwrites a signature specified via an <?ul4?>
tag.
Fixed a off-by-one bug in Utils.unescapeUL4String()
with \x
and
\u
escapes.
The UL4ON decoder now records the stream position, so it can be show in exception messages.
(Re)implemented the render
method for templates (for backwards
compatibility). This method will go away again eventually.
Enhanced error messages in the UL4ON decoder.
UL4ON now supports ordered maps (typecode e
/E
) for the Java type
LinkedHashMap
.
Optimize output of color alpha values in CSS format (limit to 3 decimal places).
Fixed alpha handling (byte
/double
) in Color.withlum()
.
Added dictionary and set method clear
.
Added function md5
.
Expose attributes of DictItemAST
, ListAST
, SeqItemAST
,
UnpackDictItemAST
and UnpackSeqItemAST
to UL4.
Added support for exception objects (i.e. the function isexception
and
exception attributes).
- Added the
count
method for strings and lists.
istemplate()
has been changed to return true if both of these interfaces
are implemented: UL4CallWithContext
and UL4RenderWithContext
.
Implemented changes from XIST 5.17: UL4 texts/tags now reference the template.
sorted()
now supports the key
and reverse
arguments.
Sets now have a method add
.
Support for iterable unpacking in list and set literals has been added.
Support for dict/iterable unpacking in dict literals has been added.
Support for multiple uses of *
and **
arguments in calls has been added.
repr()
now produces the same output for strings as the Python version.
Support for the function ascii()
has been added.
A string method splitlines()
has been added.
Merged in the List
/UL4Attributes
fix from exp-99-8.
repr()
will now fall back to return "<classname>"
for unknown instances.
Added repr
support for AST
, TextAST
, CodeAST
and
InterpretedTemplate
.
Whitespace is now allowed before the tagname in UL4 tag, i.e. <? print 42 ?>
will work.
Parsing json is now done with json-simple (https://code.google.com/p/json-simple/)
Closures no longer see a frozen version of the variables at the time of the
<?def?>
tag, but the final state of the variables (like many other
programming languages do).
Updated for compatibility with XIST 5.14: smart whitespace handling and related stuff has been implemented.
Changed the order of tests in the implementation of len()
so that
collections are checked first. This gives consistent results for len()
and iterating an object if it implements both List
and UL4Attributes
.
Fixed a bug in the changes from exp-99-6.
Added support for UL4GetItemString
to ItemAST
.
Added AbstractCombiningMapChain
.
Fixed AttrAST
: The code path for UL4GetItemWithContext
and
UL4GetItemStringWithContext
was wrong.
The "combined" interfaces UL4GetAttributes
, UL4GetSetAttributes
,
UL4GetSetItem
and UL4GetSetItemString
have been removed.
Two new interfaces UL4GetItemWithContext
and UL4GetItemStringWithContext
have been added. They allow to implement "dynamic attributes", i.e.
attributes whose values depend on the local variables. E.g. it would be
possible to implement an object double
, such that double.x
returns
2*x
.
Fixed pom file from exp-99-1.
Fixed handling of signatures when calling local templates.
Calling Function
and FunctionWithContent
objects now destroys the
intermediate list objects that get created. This should help the Java GC
clean up unused objects.
A TemplateClosure
no longer can reference itself via the variables from
its parents.
UL4Repr.Formatter
no longer calls the visit
method in the constructor.
This makes it possible to subclass UL4Repr.Formatter
for special output.
To use the Formatter
use the following code:
new UL4Repr.Formatter().visit(obj).toString()
An InterpretedTemplate
can now have a signature. Calling or rendering the
template will now check the variables passed in against the signature. This
also works for subtemplates.
List slices now return new independent lists instead of views into the original one.
UL4ON now uses an IdentityHashMap
for recording serialized objects. This
allows to serialize object loops.
Updated UL4ON to the more human readable version from XIST 5.12.
Implement support for sets in UL4 and UL4ON.
Enhance FunctionRepr
: Now cycles will be detected automatically even for
classes that implement reprUL4()
themselves.
Only create an exception object in BoundDictMethodUpdate.call()
when
necessary.
Fixed typo in CLOBVar.fetch()
.
Free CLOB
s in CLOBVar.fetch()
.
Free CLOB
s in ResultSetMapIterator.fetch()
.
Fixed the precedence of the boolean not
operator: Now it has a lower
precedence than the comparison operators. i.e. not x in y
is parsed
as not (x in y)
.
com.livinglogic.dbutils.Connection
now has a new method execute()
for executing database code that doesn't return a ResultSet
.
com.livinglogic.dbutils.Connection
has new methods int()
, number()
,
str()
, clob()
and date()
that return variable objects that can be
used in query()
, queryargs()
and execute()
to receive out parameters.
The value returned is available in the value
attribute.
com.livinglogic.dbutils.Connection.queryargs()
no longer supports keyword
arguments.
A problem with the evaluation order of arguments in calls has been fixed.
Speed up FunctionAsJSON
: Instead of creating many temporary strings, the
code now formats the complete object into a StringBuilder
.
Fixed UL4 implementation of queryargs()
method in
com.livinglogic.dbutils.Connection
.
Fixed comparisons involving BigDecimal
objects to ignore the scale.
Moved the code that registers the UL4 AST object for UL4ON into a static
method register4UL4ON()
.
Added support for list(Iterable)
.
Added while
loop.
The maximum runtime of templates can now be limited by using an
EvaluationContext
object with a milliseconds value > 0.
Merged in exp-81-3 which fixes '
-escaping in JSON strings.
Fixed version number.
Slices are now handled by passing Slice
objects as the index in Item
.
The bitwise operators &
, |
, ^
, ~
, <<
and >>
(and their augmented assigment counterparts &=
, |=
, ^=
, <<=
and
>>=
) have been added.
If expressions have been added.
com.livinglogic.dbutils.ResultSetMapIterator
now returns the records as a
org.apache.commons.collections.map.CaseInsensitiveMap
, i.e. keys are case
insensitive.
Add support for attribute, item and slice assignment.
Added bound methods. Instead of implementing UL4MethodCall
/UL4MethodCallWithContext
,
simply return BoundMethod
objects from getItemStringUL4()
.
Added the UL4 functions first()
and last()
.
Connection.query()
has been renamed to Connection.queryargs()
.
Connection.query()
now requires at least one positional argument. Arguments
alternate between fragments of the SQL query and parameters that will be
embedded in the query.
Make SetUtils
methods generic.
Add start
argument to FunctionSum
.
Add FunctionSum
.
Add method SetUtils.makeExtendedSet()
.
Expose the text of Text
nodes to templates.
Object arrays are now supported everywhere List
objects are.
Fixed FunctionJSON.call()
: '
may not be escaped in JSON strings
according to json.org (and jQuery).
Add missing Javascript escape for JSON output of templates.
Fixed JSON output of templates.
Fixed a bug in CallMeth.evaluate()
, that surfaced when a *
argument was
present.
Added methods abslum()
and rellum()
to Color.
Fixed a comparison bug in Utils.narrowBigInteger()
.
int(string)
now returns a Long
/BigInteger
if the value overflows.
int()
and com.livinglogic.dbutils.Connection
now try to convert
BigInteger
s to a narrower format (Integer
/Long
) if possible.
Added support for positional parameters in com.livinglogic.dbutils.Connection
.
Fixed strange ANTLR problems with triple quoted strings in various situations (function calls etc.)
Keys in database records are now converted to lower case.
Added support for triple quoted strings.
Exception chains for compiler error now have an additional stack level that shows the tag the compile error happened in.
Fixed a bug in the signature for Connection.query()
.
FunctionAsJSON
now handles UL4Attributes
objects.
Implemented function slice()
.
Added interface UL4Attributes
that extends UL4GetItemString
and allows
map style access to the attributes of an object.
Added interfaces UL4MethodCall
and UL4MethodCallWithContext
that allow
implementing arbitrary method calls.
Renamed package com.livinglogic.oracleutils
to com.livinglogic.dbutils
,
since it is no longer Oracle specific.
Added function list()
.
Implemented support for custom methods via the interface UL4MethodCall
and
UL4MethodCallWithContext
.
Added support for resource cleanup in EvaluationContext
.
Added utilities for exposing database connections to UL4 templates.
removeWhitespace
no longer removes the initial spaces in a string, but only
the whitespace after a linefeed.
Moved removeWhitespace
into InterpretedTemplate
, as it's only used there
to avoid package name conflicts.
Implemented UL4 functions.
Removed builtin UL4 functions vars
and get
.
Added methods append
, insert
, pop
and update
.
Removed JavaSource4Template
and JavascriptSource4Template
(as this was
basically just a call to dumps()
anyway).
Removed CompiledTemplate
.
Removed ChainedHashMap
, as MapChain
can be used instead now.
Removed EvaluationContext.keepWhitespace
, as this would be used for all
templates called, even if their value is different.
Formatting literal text is now done by the currently running template.
Added support for the whitespace
flag.
Added support classes AbstractMapChain
and MapChain
.
Added support for the automatic variable stack.
Added support for nested scopes/closures.
Added support for calling functions with a mixture of positional and keyword arguments.
Fixed FunctionBool
for BigInteger
and BigDecimal
objects.
To improve UL4 exception messages there are now several undefined objects, which give information about which key/name/index resulted in the undefined object being created.
AST nodes below the level of the tag now no longer have any location information. This information is added when the exception bubbling reaches a tag node.
Added functions any()
and all()
.
format()
now works for integers.
Use StringBuilder
instead of StringBuffer
everywhere.
FunctionSort
can now sort collections (lexicographically).
Added values
method.
Merged constant loading AST classes into one class: Const
.
UL4ON can now read/write TimeDelta
and MonthDelta
objects.
Added the Undefined
singleton.
Implemented constant folding for binary and unary operators and GetSlice
.
Added support for list/dict comprehension, generator expressions and the date
function.
Added language argument to format
function.
Added support for the week
method.
Added support for timedelta
and monthdelta
objects.
Added support for the functions timedelta
, istimedelta
, monthdelta
and ismonthdelta
.
Variable unpacking is now supported for assignment too.
Variable unpacking in for loops can now be nested arbitrarily deep.
Fixed implementation of And
to try the first operand first.
Added the functions min()
and max()
.
Added a proper (threaded) implementation of InterpretedTemplate.reader()
.
The UL4 parser has been ported to ANTLR. The final jar doesn't contain any Python/Jython any longer.
Moving to ANTLR made several syntax changes necessary:
-
@2012-04-16
becomes@(2012-04-16)
; -
<?render x()?>
becomes<?print x.render()?>
; -
<?print x.render()?>
becomes<?print x.renders()?>
.
UL4 templates now support the functions fromjson
, asul4on
, fromul4on
.
The function json
has been renamed to asjson
.
Added support for templates and floats to UL4ON.
Now the new style Javascript code generation is used (i.e. the code is generated by Javascript itself).
Renamed the function first
, last
and firstlast
to isfirst
,
islast
and isfirstlast
.
Added support for the new UL4ON object serialization format (via the
class com.livinglogic.ul4on.Utils
).
Added support for the new UL4 functions first()
, last()
, firstlast()
and enumfl()
.
Added new utility classes MapUtils
, ChainedHashMap
and ObjectAsMap
.
Template
, Opcode
and Location
now expose their attributes via a
Map
interface.
Enhanced Location.toString()
for literals.
Fixed TagException.toString()
for parsing errors.
Fixed location handling bugs with subtemplates.
Sub templates are now created by annotate()
.
Updated to match the implementation in XIST 3.23 (i.e. names for templates).
Added a new method Color.fromrepr()
.
Fixed offsets into the source and the opcodes list for subtemplates.
Updated Jython to version 2.5.2.
Fixed comparison operator when only one of the arguments is null
.
The functionality for generating Javscript source from a template has been
moved to a separate class JavascriptSource4Template
.
Fixed many bugs that were detected by running the XIST test suite with templates converted to Java.
Updated commons-lang.jar
to version 2.6 (StringEscapeUtils.escapeJava()
was escaping '/'
in version 2.4).
InterpretedTemplate
now has a new method compileToJava()
that can be
used to compile the template into native Java code. (This generates Java source
code for the template and compiles this with the help of the Java compiler).
Sets can now be sorted.
Iterators can now be sorted.
Update file format to be compatible with XIST 3.15.
Added InterpretedTemplate.reader()
that returns a java.io.Reader
object
for reading the template output.
Removed all versions of the render
methods that didn't have a variables
argument.
Added missing implementation for the contains
opcode in
InterpretedTemplate.Renderer()
.
Added two methods InterpretedTemplate.render()
that render the template
output to a java.io.Writer
.
Fixed InterpretedTemplate.load()
to conform to the format produced by Pythons
version.
Fixed problems with linefeeds in comments for tag code in
Template.javascriptSource()
.
Added a new method InterpretedTemplate.javascriptSource()
that generates
Javascript source from the template.
Updated date literals to used a @
suffix.
Fixed various bugs.
Support for the UL4 methods startswith
and endswith
has been added.
Support for the UL4 function randchoice
has been added.
Support for the following new date methods has been added: day
, month
,
year
, hour
, minute
, second
, microsecond
, weekday
and
yearday
.
Date parsing has been enhanced (microseconds are still not supported).
Support for the UL4 functions random
and randrange
has been added.
Add support for more number types in the 1 and 2 arg version of toInteger()
.
Add support for more number types to toFloat()
.
Add support for more number types to repr()
.
repr()
of BigInteger
s now ensures that the result contains a decimal
point.
Add support for more number types and Color
objects to json()
.
Add support for more number types to chr()
.
Add support for more number types to hex()
/oct()
/bin()
and fixed
the result for negative values.
Added the UL4 function utcnow()
and the support method Utils.utcnow()
.
Added the UL4 method mimeformat()
and the support method Utils.mimeformat()
.
The JSP render method has a Writer
as argument instead of a JSPWriter
.
The build file now forces compilation with Java 1.5.
Now Utils.format()
can be called without a locale argument (which is
useful for the JSP code generated by the XIST function
ll.xist.ns.jsp.fromul4()
.
Utils.sub()
, Utils.mul()
, Utils.truediv()
and Utils.floordiv()
now support all valid combinations of bool/int/float/string operands.
type()
now returns the correct type for all Number
subclasses.
Added function abs()
.
Utils.add()
now supports all combinations of bool/int/float operands.
Utils.xmlescape()
now uses ObjectUtils.toString()
to support null
.
Fixed error for unsupported operations.
Utils.iterator()
now supports Iterable
not just Collection
.
Fixed bug in the block nesting check logic.
Reverted the fix to the rgb()
function (arguments are float values between
0 and 1).
Fixed the rgb()
function.
Updated to use Jython 2.5 (i.e. Java 1.5).
All that's needed to use Jython is now in ul4jython.jar
(which is generated
by makejar.sh
).
Added float()
and iscolor()
functions.
Added join()
method.
Added reversed()
function.
Added int()
with two arguments.
Added render
method.
Added support for Long
in a few spots in Utils.java
.
Added interface JSPTemplate
for an UL4 template converted to JSP.
Added <?note?>
tag.
Added functions type()
, vars()
, zip()
.
Added one-arg find
and rfind
methods.
Added support for **
in dict literals and render calls.
Added Template
method pythonSource()
.
Added support for color objects.
Added printx
tag/opcode.
Added string method capitalize()
.
Enhanced exceptions for unclosed blocks.
Added function get()
and dictionary method get()
.
Fixed jump calculation for break
s and continue
s in for
blocks.
Added support for a csvescape()
function.
The org.apache.commons
package is now used to implement some of the
operations.
Added support for a string method replace()
.
Added support for a repr()
function.
Added break
and continue
tags/opcodes.
Initial version.