/** * Parses the comment by looking for the end marker * + }. * * @param ezcTemplateCursor $cursor * @return bool */ protected function parseCurrent(ezcTemplateCursor $cursor) { $cursor->advance(); if ($cursor->atEnd()) { return false; } $checkInlineComment = false; // Check for a slash after the asterix, this typically means a typo for an inline comment // Better give an error for this to warn the user. if ($cursor->current() == '/') { $checkInlineComment = true; } $endPosition = $cursor->findPosition('*}'); if ($endPosition === false) { return false; } // If we found an end for an inline comment we need to check if there // is an end for an inline comment if ($checkInlineComment) { $commentCursor = $cursor->cursorAt($cursor->position, $endPosition); $commentCursor->advance(); $inlineCommentPosition = $commentCursor->findPosition('*/'); // We found the end of the inline comment, this is most likely a user error if ($inlineCommentPosition !== false) { $cursor->gotoPosition($inlineCommentPosition); return false; } } // reached end of comment $cursor->gotoPosition($endPosition + 2); $commentBlock = new ezcTemplateDocCommentTstNode($this->parser->source, clone $this->startCursor, clone $cursor); $commentBlock->commentText = substr($commentBlock->text(), 2, -2); $this->appendElement($commentBlock); return true; }