-
Notifications
You must be signed in to change notification settings - Fork 12
Cht api
Please note that this page describes high-level and low-level facilities alike. In order to better understand the efficient ways of building your Web applications with CHT, refer to the Concepts section of this Wiki.
dojo.require( 'dojox.jtlc.compile' );
var evaluator = dojox.jtlc.compile( input, language, compile_time_options );
Invokes the jtlc compiler, producing a Javascript function object evaluator from the abstract syntax tree described by the input.
Due to the distributed nature of jtlc language definitions, the output is determined primarily by the types of the AST nodes while the language argument affects the interpretation of untyped nodes of the tree (values, objects that don’t define a compile() method, arrays) as well as provides a set of global options available to all node types. At present, jtlc language objects can be constructed by instantiating one of the following classes: dojox.jtlc.JXL, dojox.jtlc.qplus and dojox.jtlc.CHT.
Additionally, the optional argument compile_time_options may serve to pass in a dictionary of options to the specific compilation. These options are dependent on the nature of the language and node types used; for examle, CHT uses this mechanism to provide localization dictionaries to templates.
dojo.require( 'dojox.jtlc.JXL' );
Class encapsulating the global options for the Javascript Transformation Language. Note that JXL itself is mostly defined by the AST node types in the module dojox.jtlc.tags that are described in the JXL primitives section of this Wiki.
var jxl = new dojox.jtlc.JXL( options );
Instantiates language description for JXL that can be customized by specifying the following settings:
-
elideNulls: When true,nullvalues are not placed into array or dictionary sinks but are thrown away instead (with their corresponding keys in case of a dictionary); -
failOnDuplicateKeys: When true, an attempt to insert a duplicate key into the dictionary sink results in an exception; -
queryLanguage: By default this option is set todojox.json.query. You may substitute another query language compiler with a compatible API; -
replaceLanguage: By default this option is set todojo.replace. You may substitute a formatting function of your own with compatible API.