private function parse_text($text) { if (!empty($text)) { if ($this->current->allowsChildren()) { $sPos = 0; //process data bindings while (preg_match(self::PARSE_DATABINDINGS, $text, $match, PREG_OFFSET_CAPTURE, $sPos)) { list(list($brData, $brPos)) = $match; if ($brPos > $sPos) { //append previous literal content $this->text_addComponent(substr($text, $sPos, $brPos - $sPos), self::TRIM_LEFT); } //create databound literal $l = strlen($brData); $this->text_addComponent($brData); $sPos = $brPos + $l; } //append remaining literal content $this->text_addComponent(substr($text, $sPos), self::TRIM_RIGHT); } else { $props = $this->current->supportsProperties() ? $this->current->props->getPropertyNames() : []; $s = $props ? '<' . join('>, <', array_map('ucfirst', $props)) . '>' : 'none'; throw new ParseException("\n<h4>You may not define literal content at this location.</h4>\n<table>\n <tr><th>Component:<td class='fixed'><{$this->current->getTagName()}>\n <tr><th>Expected tags:<td class='fixed'>{$s}\n</table>", $this->source, $this->prevTagEnd, $this->currentTagStart - 1); } } }