Project

General

Profile

Feature #17536 » patch_heredoc_v2.txt

Administrator Admin, 2007-08-16 15:05

 
--- class.t3lib_tsparser.php Thu Aug 16 12:21:20 2007 UTC
+++ class.t3lib_tsparser.php Thu Aug 16 12:21:59 2007 UTC
@@ -89,6 +89,7 @@
var $multiLineEnabled=0; // Internally set, when multiline value is accumulated
var $multiLineObject=''; // Internally set, when multiline value is accumulated
var $multiLineValue=array(); // Internally set, when multiline value is accumulated
+ var $multiLineHeredoc=FALSE; // Internally set, when multiline value is accumulated
var $inBrace = 0; // Internally set, when in brace. Counter.
var $lastConditionTrue = 1; // For each condition this flag is set, if the condition is true, else it's cleared. Then it's used by the [ELSE] condition to determine if the next part should be parsed.
var $sections=array(); // Tracking all conditions found
@@ -203,9 +204,10 @@
if (!$this->commentSet && ($line || $this->multiLineEnabled)) { // If $this->multiLineEnabled we will go and get the line values here because we know, the first if() will be true.
if ($this->multiLineEnabled) { // If multiline is enabled. Escape by ')'
- if (substr($line,0,1)==')') { // Multiline ends...
+ if (($this->multiLineHeredoc === FALSE && substr($line,0,1)==')') || ($this->multiLineHeredoc !== FALSE && substr($line,0,strlen($this->multiLineHeredoc . ";")) === ($this->multiLineHeredoc . ";"))) { // Multiline ends...
if ($this->syntaxHighLight) $this->regHighLight("operator",$lineP,strlen($line)-1);
$this->multiLineEnabled=0; // Disable multiline
+ $this->multiLineHeredoc = FALSE;
$theValue = implode($this->multiLineValue,chr(10));
if (strstr($this->multiLineObject,'.')) {
$this->setVal($this->multiLineObject,$setup,array($theValue)); // Set the value deeper.
@@ -331,6 +333,12 @@
$this->multiLineValue=array();
break;
case '<':
+ if(substr($line, 0, 3) === "<<<") {
+ $this->multiLineObject = $objStrName;
+ $this->multiLineEnabled=1;
+ $this->multiLineValue=array();
+ $this->multiLineHeredoc = trim(substr($line, 3));
+ } else {
if ($this->syntaxHighLight) $this->regHighLight("value_copy", $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1))));
$theVal = trim(substr($line,1));
if (substr($theVal,0,1)=='.') {
@@ -339,6 +347,7 @@
$res = $this->getVal($theVal,$this->setup);
}
$this->setVal($objStrName,$setup,unserialize(serialize($res)),1); // unserialize(serialize(...)) may look stupid but is needed because of some reference issues. See Kaspers reply to "[TYPO3-core] good question" from December 15 2005.
+ }
break;
case '>':
if ($this->syntaxHighLight) $this->regHighLight("value_unset", $lineP, strlen(ltrim(substr($line,1)))-strlen(trim(substr($line,1))));
(2-2/3)