Move class constants to their logical places.

This commit is contained in:
Justin Hileman
2010-12-08 08:28:51 -05:00
parent 834d612f1e
commit c5bf83f9a9
+9 -7
View File
@@ -14,9 +14,6 @@
*/ */
class Mustache { class Mustache {
public $_otag = '{{';
public $_ctag = '}}';
/** /**
* Should this Mustache throw exceptions when it finds unexpected tags? * Should this Mustache throw exceptions when it finds unexpected tags?
* *
@@ -85,6 +82,15 @@ class Mustache {
*/ */
const PRAGMA_UNESCAPED = 'UNESCAPED'; const PRAGMA_UNESCAPED = 'UNESCAPED';
/**
* Constants used for section and tag RegEx
*/
const SECTION_TYPES = '\^#\/';
const TAG_TYPES = '#\^\/=!<>\\{&';
public $_otag = '{{';
public $_ctag = '}}';
protected $_tagRegEx; protected $_tagRegEx;
protected $_template = ''; protected $_template = '';
@@ -258,8 +264,6 @@ class Mustache {
return $template; return $template;
} }
const SECTION_TYPES = '\^#\/';
protected function _prepareSectionRegEx($otag, $ctag) { protected function _prepareSectionRegEx($otag, $ctag) {
return sprintf( return sprintf(
'/(?:(?<=\\n)[ \\t]*)?%s(?<type>[%s])(?<tag_name>.+?)%s\\n?/s', '/(?:(?<=\\n)[ \\t]*)?%s(?<type>[%s])(?<tag_name>.+?)%s\\n?/s',
@@ -437,8 +441,6 @@ class Mustache {
return (isset($this->_throwsExceptions[$exception]) && $this->_throwsExceptions[$exception]); return (isset($this->_throwsExceptions[$exception]) && $this->_throwsExceptions[$exception]);
} }
const TAG_TYPES = '#\^\/=!<>\\{&';
protected function _prepareTagRegex($otag, $ctag) { protected function _prepareTagRegex($otag, $ctag) {
return sprintf( return sprintf(
'/(?<whitespace>(?<=\\n)[ \\t]*)?%s(?<type>[%s]?)(?<tag_name>.+?)(?:\\2|})?%s(?:\\s*(?=\\n))?/s', '/(?<whitespace>(?<=\\n)[ \\t]*)?%s(?<type>[%s]?)(?<tag_name>.+?)(?:\\2|})?%s(?:\\s*(?=\\n))?/s',