Class: Element

mmir.parser. Element

new mmir.parser.Element()

Members

static,constantmmir.parser.Element.ARGUMENT_ARGUMENT_NAMEString

Constant for the name of the reserved argument variable: some template expressions have an (optional) argument argument, which can be accessed using the variable name within the template expressions inner content-/code-blocks.

static,constantmmir.parser.Element.BLOCKNumber

Constant for template expression type code block.

The template expression represents a compiled code block (script).

Properties of mmir.parser.ParsingResult objects with type BLOCK:

  • scriptContent {String}: OPTIONALLY the script code as a String
  • scriptEval {Function}: the compiled script code in form of a function. The function takes one argument: the current data-object.

static,constantmmir.parser.Element.COMMENTNumber

Constant for template expression type comment.

The template expression represents a template-comment: the content of the comment will be ignored (that is: removed during processing of the template).

static,constantmmir.parser.Element.DATA_ARGUMENT_NAMEString

Constant for the name of the reserved data variable: the optional data argument is passed in into rendering-calls for views, layouts etc. (see PresentationManager)

static,constantmmir.parser.Element.DATA_NAMEString

Constant for data name that is used to hold the current data: this name will be used for the argument name of generated/compiled Functions, and in the Function code block appropriate getter/setter expression will be inserted.

static,constantmmir.parser.Element.ELSENumber

Constant for template expression type else.

The template expression represents an else-expression (including its content-block); an else-expression may occur in combination with an if-expression, see mmir.parser.Element.IF.

Properties of mmir.parser.ParsingResult objects with type ELSE:

  • content {ContentElement}: the HTML / template content that should be render, in case the if-expression (to which the else-expression belongs) evaluates to false.

static,constantmmir.parser.Element.ESCAPE_ENTERNumber

Constant for template expression type escape enter.

The template expression represents an escape statement (when entering a template expression); escaping means, that the following sequence is not interpreted as template expression.

Properties of mmir.parser.ParsingResult objects with type ESCAPE_ENTER:

  • text {String}: the text that will be rendered (i.e. without the escape-character(s) itself).

static,constantmmir.parser.Element.ESCAPE_EXITNumber

Constant for template expression type escape exit.

The template expression represents an escape statement (when exiting a template expression); escaping means, that the following sequence is not interpreted as template expression.

Properties of mmir.parser.ParsingResult objects with type ESCAPE_EXIT:

  • text {String}: the text that will be rendered (i.e. without the escape-character(s) itself).

static,constantmmir.parser.Element.FORNumber

Constant for template expression type for.

The template expression represents for-expression (including its content-block);

Properties of mmir.parser.ParsingResult objects with type FOR:

  • forControlType {String}: the type of for-loop, either FORITER or FORSTEP
  • forInitEval {Function}: the initialization statement of the for-expression, compiled into a Function. The function takes one argument: the current data-object.
  • FORITER: @for(PROP in OBJ){ ... }@
    • forIterator {Object}: an iterator object with functions hasNext() : Boolean and next() : String (which returns the name of the property currently iterated).
    • forPropName {String}: the variable name for the property which is currently iterated over.
  • FORSTEP: @for(INIT; CONDITION; INCREMENT){ ... }@
    • forConditionEval {Function}: the condition statement of the for-expression, compiled into a Function. The function takes one argument: the current data-object.
    • forIncrementEval {Function}: the increment statement of the for-expression, compiled into a Function. The function takes one argument: the current data-object.
  • content {ContentElement}: the HTML / template content that should be rendered during each iteration of the for-loop.

static,constantmmir.parser.Element.FOR_TYPE_ITERNumber

Constant for for-expression type iter ("iteration").

This type identifies an ITERATION type for-expression.

See:
  • parser.element.FOR

static,constantmmir.parser.Element.FOR_TYPE_STEPNumber

Constant for for-expression type step ("step-wise").

This type identifies an STEP-wise type for-expression.

See:
  • parser.element.FOR

static,constantmmir.parser.Element.HELPERNumber

Constant for template expression type helper.

The template expression will invoke a function in the mmir.ctrl.Helper instance (depending of the mmir.ctrl.Controller, in which's view definition this template expression is used).

Properties of mmir.parser.ParsingResult objects with type HELPER:

  • helper: the name of the helper function
  • helperType: the type of the helper field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart
  • argsEval {Function}: OPTIONALLY compiled getter Function for retrieving the current ARGS (optional argument) of the helper expression. The function takes one argument: the current data-object.

static,constantmmir.parser.Element.IFNumber

Constant for template expression type if.

The template expression represents an if-expression, including the content-block that follows the condition-statement of the if-expression.

Properties of mmir.parser.ParsingResult objects with type IF:

  • ifEval {Function}: the condition statement, that was compiled into a Function. The function takes one argument: the current data-object.
  • content {ContentElement}: the HTML / template content that should be render, in case the if-expression evaluates to true.
  • elseContent mmir.parser.ParsingResult: OPTIONALLY a ParsingResult representing an else-expression, see mmir.parser.Element.ELSE.

static,constantmmir.parser.Element.INCLUDE_SCRIPTNumber

Constant for template expression type include script.

The template expression generates a script TAG.

Properties of mmir.parser.ParsingResult objects with type INCLUDE_SCRIPT:

  • scriptPath: the path / URL to the resource
  • scriptPathType: the type of the scriptPath field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart

static,constantmmir.parser.Element.INCLUDE_STYLENumber

Constant for template expression type include style.

The template expression generates a style reference, i.e. a link TAG with rel attribute stylesheet.

Properties of mmir.parser.ParsingResult objects with type INCLUDE_STYLE:

  • stylePath:
  • stylePathType: the type of the stylePath field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart

static,constantmmir.parser.Element.LOCALIZENumber

Constant for template expression type localize.

The template expression inserts a localized String.

Properties of mmir.parser.ParsingResult objects with type LOCALIZE:

  • name: the name/identifier for the localized String
  • nameType: the type of the name field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart

static,constantmmir.parser.Element.RENDERNumber

Constant for template expression type render.

The template expression renders a partial view into a view.

Properties of mmir.parser.ParsingResult objects with type RENDER:

  • partial: the name of the partial view
  • partialType: the type of the partial field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart
  • controller: the name of the controller, to which the partial view definition belongs
  • controllerType: the type of the controller field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart
  • argsEval {Function}: OPTIONALLY compiled getter Function for retrieving the current ARGS (optional argument) of the render expression. The function takes one argument: the current data-object.

static,constantmmir.parser.Element.STATEMENTNumber

Constant for template expression type code statement.

The template expression represents a compiled code statement (script).

Properties of mmir.parser.ParsingResult objects with type STATEMENT:

  • scriptContent {String}: OPTIONALLY the script code as a String
  • scriptEval {Function}: the compiled script code in form of a function. The function takes one argument: the current data-object.

static,constantmmir.parser.Element.VAR_DECLARATIONNumber

Constant for template expression type variable declaration.

The template expression represents a variable declaration.

Properties of mmir.parser.ParsingResult objects with type VAR_DECLARATION:

  • name: the name for the variable (without the leading @ of template variables)
  • nameType: the type of the name field: StringLiteral

static,constantmmir.parser.Element.VAR_REFERENCENumber

Constant for template expression type variable reference.

This template expression is used within JavaScript code blocks / statements, in order to replace the occurrence of the template variable by an appropriate getter function, that retrieves the current value of the variable during the execution of the script code.

NOTE: this is used during compilation of the Function objects, used e.g. by BLOCK, STATEMENT, FOR etc.

NOTE: the name of the variable is extracted from the raw-template text during processing/compilation of the Functions.

static,constantmmir.parser.Element.YIELD_CONTENTNumber

Constant for template expression type yield content.

The template expression specifies the content of a yield section.

A yield section corresponds to a mmir.view.ContentElement: Its content can itself contain HTML content as well as template expressions.

static,constantmmir.parser.Element.YIELD_DECLARATIONNumber

Constant for template expression type yield declaration.

The template expression declares a yield section.

Properties of mmir.parser.ParsingResult objects with type YIELD_DECLARATION:

  • name: the name/identifier for the yield section
  • nameType: the type of the name field: one of StringLiteral, Identifier, IdentifierNameAmpersatStart