mmir.parser.ParserUtils
A Utility class for parsing (eHTML) templates.
Utility functions for parsing templates (and template elements, e.g. JS-parts of template expressions)
Utility functions for parsing templates (and template elements, e.g. JS-parts of template expressions)
Example
mmir.require('mmirf/parseUtils').parse(str, view)
Members
-
private_currentParsedViewmmir.view.View
-
-
privateerrorLevel
-
-2: internal debug -1: interanl info 0: debug 1: info 2: warn 3: error TODO make this set-able (export getter/setter? use configurationManager?)
-
privateinstanceParserUtils
-
Object containing the instance of the class ParserUtils
-
privateisDebug
-
Methods
-
private_attachInternalPrintFunc()
-
HELPER: attach internal print-functions to all classes (ie. prototypes) in the list
-
private_parserPrintDebug()
-
HELPER print debug messages during parsing
-
private_parserPrintError()
-
HELPER print errors during parsing
-
private_parserPrintInfo()
-
HELPER print informational messages during parsing
-
private_parserPrintWarning()
-
HELPER print warnings during parsing
-
private_print()
-
HELPER print internal debug messages during parsing (VERY VERBOSE)
-
private_printInfo()
-
HELPER print internal, informational messages during parsing (VERBOSE)
-
privateinternalParse()
-
-
privateinternalParseJS()
-
-
parse(rawTemplateString, view){mmir.parser.ParsingResult}
-
Parse a text as view template (e.g. *.ehtml files).
Name Type Description rawTemplateString
String the text that should be parsed view
Object optional (optional) the view to which the rawTemplateString belongs (only used for error messages) Returns:
Type Description mmir.parser.ParsingResult the parsing result -
parseJS(rawTemplateString, parseEntryRuleName, view){mmir.parser.ParsingResult}
-
Parse a text as JavaScript.
Name Type Description rawTemplateString
String the text that should be parsed parseEntryRuleName
String optional (optional) specifies the JavaScript element that should be parsed for view
Object optional (optional) the view to which the rawTemplateString belongs (only used for error messages) Returns:
Type Description mmir.parser.ParsingResult the parsing result -
privateparserCreatePrintMessage(prefix, msg, tokenSource, viewObj)
-
Creates a message with parsing-information. In case the
msg
is an error message containing relative/incorrect location information, an heuristic will be used to fix the location information; in addition the references location will be extracted from the source-String and a "pointer-String" will be generated, e.g.source: " @{ mmmm.['sd']=wer ;}@" pointer: " ^"
Name Type Description prefix
String a prefix for the message msg
String the original message (may contain location-information "line : ") tokenSource
Object optional OPTIONAL the token-source, from where the error/message was triggered If the argument has the field tokenSource.offset
(Number) if will be used to correct/fix the location information in the original message. If the argument has the fieldstokenSource.start
(Number) andtokenSource.end
(Number), then this will be used to correct/fix the location information in the original message text.viewObj
Object optional OPTIONAL currently not used! (will replace _currentParsedView in the future!)