This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > ENSLIB namespace > Ens.Rule.ExpressionParser


abstract class Ens.Rule.ExpressionParser extends %Library.RegisteredObject

Expression Parser for RuleSets.

Method Inventory


parameter DOMAIN = Ensemble;
Use our own domain for localization


classmethod Evaluate(pExpr As %String, pContextObj As %RegisteredObject = "", Output pErrorMsg As %String) as %String
Evaluate the given expression using the given context object
classmethod GenExpression(ByRef pErr As %String, pContext As %String, ByRef tree As %String, node As %String = "") as %String
Generate an executable COS expression for part of the parse tree
context is the name of the object variable containing runtime context.
Returns "" for error (assumes that parse tree has already been checked)
classmethod GenSetCode(Output pCode As %String, pProperty As %String, pValue As %String) as %Status
Generate a statement that sets a given property to a given value
classmethod GenerateCode(pExpr As %String, Output pCode As %String, Output pErrorMsg As %String) as %Status
Returns executable code (a single expression) for the given expression.
classmethod GetArguments(ByRef tree As %String, el As %Integer, ByRef args As %String)
Get a list of the arguments for element el in a parse tree
classmethod GetListOfMethods(ByRef tree As %String, ByRef list As %String)
Generate list of functions used by the parse tree
classmethod GetOpType(pExpr As %String, Output pToken As %String) as %String
Returns the type of an expression (used by the value editor).
classmethod GetXPathValues(pStream, pExpression, pValSepString As %String = "<>", Output pStatus As %Status) as %String
classmethod IsBinaryOperator(token As %String) as %Boolean
Test if token is a binary operator
classmethod IsIdentChar(char As %String) as %Boolean
Test if char can be part of an identifier
classmethod IsOperatorChar(char As %String) as %Boolean
Test if char is a part of an operator name
classmethod IsSpecialChar(char As %String) as %Boolean
Test if char is a special character "(" ")" or ","
classmethod IsUnaryOperator(token As %String) as %Boolean
Test if token is a unary operator
classmethod IsUnaryOperatorChar(char As %String) as %Boolean
Test if char is a part of an unary operator name
classmethod IsWhiteSpace(char As %String) as %Boolean
Test if char is a whitespace character
classmethod Parse(expr As %String, Output tree As %String, Output pPropList As %String, Output pFuncList As %String) as %String
Parse the expr into a parse tree tree
Returns "" if ok or else an error message.
pPropList returns an array of properties referenced by the expression. pFuncList returns an array of functions referenced by the expression.
classmethod PrintParseNode(ByRef tree, node As %Integer, level As %Integer = 0)
classmethod Test(expr As %String, ByRef tree)
classmethod TestPrecedence(op1 As %String, op2 As %String) as %Boolean
Returns true if op1 has precedence over op2.
classmethod TestTokenize(expr As %String, pQuotedIdent As %Boolean = 0)
classmethod Tokenize(expr As %String, ByRef tokens As %String, pQuotedIdent As %Boolean = 0) as %String
Split the formula expr into a token list:
tokens(n,"token") = token
tokens(n,"pos") = position in expr
tokens(n,"type") = string | number | ident | func |op |unary | ( | ) | , | end Returns "" if the formula is correct else an error message. If pQuotedIdent, then support {ident},[ident], as ident
classmethod Validate(pExpr As %String, Output pMsg As %String, pContextClass As %String = "", pDocumentClass As %String = "") as %Boolean
Validate the given expression. If pContextClass is provided, make sure properties exist in it.

Inherited Members

Inherited Methods

FeedbackOpens in a new window