Skip to content
JP edited this page Feb 19, 2021 · 5 revisions

Morestachio can parse single expressions that contains ether a string or an full data expression.

The ExpressionParser allows to input a string such as "Test this is a string \"T\"" or an expression in any form like:

  • Data.Data
  • .Format() or Format()
  • Data.Format()
  • Data.Format(Data.Other)
  • Data.Format(Data.Format())

To parse an expression you can directly call the ExpressionParser.ParseExpression method. The result will be an object of type IMorestachioExpression.

The Interface contains a single method and the location within the given string where the expression starts. Use the IMorestachioExpression.GetValue method to execute the Expression and obtain the value. You have to supply a ContextObject for this call.

All Expressions support the Visitor pattern for rendering and you can use the ToParsableStringExpressionVisitor to convert an expression back to a string that can be reparsed. (Caution Whitespace chars are removed and only one space between argument seperators (,) are added if not present).

Clone this wiki locally