Class JSCompiler
Implements a DecisionModel compiler for expressions in the JavaScript language for processing by a JSProcessor instance.
Implements
Inherited Members
Namespace: Quantellia.WMServer.Execution.JS
Assembly: WMServer.dll
Syntax
public class JSCompiler : ICompiler
Remarks
The following keywords may not be used as element names:
abstract | break | char | debugger | double | export | finally |
in | let | null | public | super | throw | try |
volatile | arguments | byte | class | default | else | extends |
float | if | instanceof | long | package | return | switch |
throws | typeof | while | await | case | const | delete |
enum | FALSE | for | implements | int | native | private |
short | synchronized | transient | var | with | boolean | catch |
continue | do | eval | final | function | import | interface |
new | protected | static | this | TRUE | void | yield |
JavaScript Math Library Support
All static functions and values defined in the JavaScript Math library may be used. Note that the World Modeler parser does not resolve dot-separated namespaces in qualified names. Calls to Math library functions must be made without any spaces.Math.exp(x)
will work but Math . exp(x)
, although it is legal JavaScript, will not be recognized by
the World Modeler Parser and "Symbol not found" errors will be genrerated.
Supported Math library functions are:
Math.E | Math.LN10 | Math.LN2 | Math.LOG10E | Math.LOG2E | Math.PI | Math.SQRT1_2 | Math.SQRT2 | |
Math.abs | Math.acos | Math.acosh | Math.asin | Math.asinh | Math.atan | Math.atan2 | Math.atanh | |
Math.cbrt | Math.ceil | Math.clz32 | Math.cos | Math.cosh | Math.exp | Math.expm1 | Math.floor | |
Math.fround | Math.hypot | Math.imul | Math.log | Math.log10 | Math.log1p | Math.log2 | Math.max | |
Math.min | Math.pow | Math.random | Math.round | Math.sign | Math.sin | Math.sinh | Math.sqrt | |
Math.tan | Math.tanh | Math.trunc |
Methods
Compile(string)
Declaration
public object Compile(string sourceCode)
Parameters
Type | Name | Description |
---|---|---|
string | sourceCode |
Returns
Type | Description |
---|---|
object |
GenerateSourceCode(DecisionModel)
Declaration
public string GenerateSourceCode(DecisionModel model)
Parameters
Type | Name | Description |
---|---|---|
DecisionModel | model |
Returns
Type | Description |
---|---|
string |
IdentifierToName(string)
Declaration
public static string IdentifierToName(string identifier)
Parameters
Type | Name | Description |
---|---|---|
string | identifier |
Returns
Type | Description |
---|---|
string |
NameToIdentifier(string)
Converts provided fully qualified name to a string that is an acceptable identifier name in coding languages.
Declaration
public static string NameToIdentifier(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
string |
Remarks
The following characters (shown as enclosed in single quote) are replaced with character \255 (0xFF):
' ' '-' ':' ';' '.' '!' '@' '#' '$' '%' '&' '*' '%' '(' ')' ',' '+' '=' '/' '\\' '<' '>' '?'