Beispiel #1
0
 public function active(IObject $aParent, string $aSource, $nPosition)
 {
     $sStartMacro = $this->determineMacroBorder($aSource, $nPosition);
     $aMacro = new Macro($aSource->byte($nPosition + strlen($sStartMacro)), $nPosition, 0, ObjectBase::getLine($aSource, $nPosition), '');
     $aMacro->setBorder($sStartMacro, $this->arrMacroBorder[$sStartMacro]);
     $aParent->add($aMacro);
     return $aMacro;
 }
Beispiel #2
0
 public function complete(IObject $aObject, string $aSource, $nPosition)
 {
     $aHead = $aObject->headTag();
     $aTail = $aObject->tailTag() ?: $aObject->headTag();
     $sSource = $aSource->substr($aHead->position(), $aTail->endPosition() - $aHead->position() + 1);
     $aObject->setSource($sSource);
     return $aObject->parent();
 }
Beispiel #3
0
 public function active(IObject $aParent, string $aSource, &$nPosition)
 {
     $nLine = ObjectBase::getLine($aSource, $nPosition);
     $nStartPos = $nPosition;
     // 标签名称
     if (!($sTagName = $this->parseTagName($aSource, $nPosition))) {
         throw new Exception("UI引擎在分析模板时遇到无效的xhtml节点:缺少节点名称(位置:%d行)", $nLine);
     }
     $aTag = new Tag($sTagName, null, 0, $nStartPos, 0, $nLine, '');
     // 尾标签
     if ($sTagName[0] == '/') {
         if (!$aParent instanceof Node) {
             throw new Exception("错误类型");
         }
         $aTag->setTagType(Tag::TYPE_TAIL);
         $aTag->setName(substr($sTagName, 1));
         $aParent->setTailTag($aTag);
     } else {
         $aTag->setTagType(Tag::TYPE_HEAD);
         $aNode = new Node($aTag);
         $aParent->add($aNode);
     }
     return $aTag;
 }
Beispiel #4
0
 public function active(IObject $aParent, string $aSource, $nPosition)
 {
     $aText = new Text($nPosition, 0, ObjectBase::getLine($aSource, $nPosition), '');
     $aParent->add($aText);
     return $aText;
 }