Code Monkey Dialect

Alexandru Ciobanu edited this page Aug 31, 2015 · 4 revisions

This section describes the properties and behavior of the Code Monkey Dialect

This dialect is a derivative of Standard Dialect with less emphasis on verbosity. It is designed for use by primarily be software developers (as a replacement for the good-old String.Format).

The Code Monkey dialect is culture insensitive as to cover development-only needs. It supports three casing options:

  • Case-insensitive, all keywords, variables and properties are matched regardless of case.
  • Upper-case, all keywords are expected to be upper-case, while variables and properties are case-sensitive.
  • Lower-case, all keywords are expected to be lower-case, while variables and properties are case-sensitive.
Core dialect characters:
  • Tag start ({),
  • Tag end (}),
  • String literal start and end ('),
  • String literal escape (\),
  • Numeric literal decimal point (.).

To insert a literal value of { a sequence of two consecutive {{ characters is required.

The following operators are supposed by the standard dialect:
  • Arithmetic neutral (+),
  • Arithmetic negation (-),
  • Arithmetic addition (+),
  • Arithmetic subtraction (-),
  • Arithmetic multiplication (*),
  • Arithmetic division (/),
  • Arithmetic modulo (%),
  • Bitwise complement of two (~),
  • Bitwise and (&),
  • Bitwise or (|),
  • Bitwise xor (^),
  • Bitwise shift left (<<),
  • Bitwise shift right (>>),
  • Logical not (!),
  • Logical and (&&),
  • Logical or (||),
  • Relational equals (==),
  • Relational not equals (!=),
  • Relational greater than (>),
  • Relational greater than or equals (>=),
  • Relational less than (<),
  • Relational less than or equals (<=),
  • Sequence (..),
  • Format (:).

For more details see Standard Operators.

The following expression flow characters are used in the standard dialect:
  • Group open ((),
  • Group close ()),
  • Group separator (,),
  • Member access (.).

For more details see Standard Operators.

The following directives are supported:
  • Interpolation ({$}),
  • Conditional Interpolation ({$ IF $}),
  • Preserve Formatting ({PRE}...{END}),
  • Conditional Evaluation ({IF $}...{END}),
  • Conditional Evaluation with Alternative ({IF $}...{ELSE}...{END}),
  • Temporary Variable ({? AS $}...{END}).
  • Sequence Enumeration ({FOR ? IN $}...{END}).
  • Sequence Enumeration (short form) ({FOR $}...{END}).
  • Sequence Enumeration (with join) ({FOR ? IN $}...{WITH}...{END}).

For more details see Standard Directives.

The following special constants are defined:
  • True with a value of True.
  • False with a value of False.
  • NaN with a value of NaN.
  • Infinite with a value of Infinite.
  • Undefined with a value of Undefined.
Un-parsed text default behavior

The default is to trim excessive white-space characters for all un-parsed text. That means that all non-space characters will be replaced by space characters, and all adjacent white-spaces will be trimmed.

The {PRE}...{END} directive can be used to disable this behavior for parts of the template.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.