Lines Matching defs:source
33 protected $source;
40 * @param string $source The JavaScript code to compress
44 function compress($source)
46 $source = ltrim($source); // strip all initial whitespace
47 $source .= "\n";
51 $this->source = $source;
56 $slen = strlen($source); // size of input string
65 while ($idx < $slen && (strpos(self::CHARS, $source[$idx]) === false)) {
66 $result .= $source[$idx];
70 $ch = $source[$idx];
72 if ($ch == '/' && $source[$idx + 1] == '*' && $source[$idx + 2] != '@') {
73 $endC = strpos($source, '*/', $idx + 2);
77 if (substr($source, $idx, $endC + 2 - $idx) == '/* BEGIN NOCOMPRESS */') {
82 $beginNC = strpos($source, '/* BEGIN NOCOMPRESS */', $nextNC + 2);
83 $endNC = strpos($source, '/* END NOCOMPRESS */', $nextNC + 2);
96 $result .= "\n" . trim(substr($source, $idx + 22, $endNC - ($idx + 22))) . "\n"; // BEGIN comment = 22 chars
105 if ($ch == '/' && $source[$idx + 1] == '/') {
106 $endC = strpos($source, "\n", $idx + 2);
116 while (in_array($source[$idx - $j], self::WHITESPACE_CHARS)) {
121 function ($e) use ($source, $idx, $j) {
124 return substr($source, $idx, $len) === $e;
132 while ($ccd || $source[$idx + $j] != '/') {
133 if ($source[$idx + $j] == '\\') $j = $j + 2;
137 if ($source[$idx + $j - 1] == '[') $ccd = true;
138 else if ($source[$idx + $j - 1] == ']') $ccd = false;
141 $result .= substr($source, $idx, $j + 1);
150 while (($idx + $j < $slen) && $source[$idx + $j] != '"') {
151 if ($source[$idx + $j] == '\\' && ($source[$idx + $j + 1] == '"' || $source[$idx + $j + 1] == '\\')) {
157 $string = substr($source, $idx, $j + 1);
168 while (($idx + $j < $slen) && $source[$idx + $j] != "'") {
169 if ($source[$idx + $j] == '\\' && ($source[$idx + $j + 1] == "'" || $source[$idx + $j + 1] == '\\')) {
175 $string = substr($source, $idx, $j + 1);
186 while (($idx + $j < $slen) && $source[$idx + $j] != "`") {
187 if ($source[$idx + $j] == '\\' && ($source[$idx + $j + 1] == "`" || $source[$idx + $j + 1] == '\\')) {
193 $string = substr($source, $idx, $j + 1);
208 if ($idx + 1 < $slen && ((!$lch || $source[$idx + 1] == ' ')
209 || $lch != $source[$idx + 1]
210 || strpos(self::OPS, $source[$idx + 1]) === false)) {
212 if ($idx + 1 < $slen && (strpos(self::CHARS, $source[$idx + 1]) !== false)) {
248 $before = substr($this->source, max(0, $this->idx - 15), $this->idx);
249 $after = substr($this->source, $this->idx, 15);