code, $this->cursor, 40), $this->states); parent::lexExpression(); // Last element parsed $last_element = end($this->tokens); /** * Check for old fashioned INCLUDE statements without enclosed quotes */ if ($last_element->getValue() === 'INCLUDE') { if (preg_match('#^\s*([a-zA-Z0-9_]+\.[a-zA-Z0-9]+)#', substr($this->code, $this->cursor), $match)) { $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); $this->moveCursor($match[0]); } } /** * This is some compatibility code to continue supporting expressions such as: * */ if ($last_element->getValue() === 'IF') { if (preg_match('#^\s*(not\s)?\.([a-zA-Z0-9_\.]+)#', substr($this->code, $this->cursor), $match)) { $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); $this->moveCursor($match[0]); } } /** * This is some compatibility code to continue supporting expressions such as: * */ if ($last_element->getValue() === 'DEFINE') { if (preg_match('#^\s*\$([A-Z0-9]+)#', substr($this->code, $this->cursor), $match)) { $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); $this->moveCursor($match[1]); } } /** * Check for old fashioned INCLUDE statements without enclosed quotes */ if ($last_element->getValue() === 'INCLUDE') { if (preg_match('#^\s*([a-zA-Z0-9_]+\.[a-zA-Z0-9]+)#', substr($this->code, $this->cursor), $match)) { $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); $this->moveCursor($match[0]); } } } }