diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/libs/JavaScriptMinifier.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/libs/JavaScriptMinifier.php')
-rw-r--r-- | includes/libs/JavaScriptMinifier.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/includes/libs/JavaScriptMinifier.php b/includes/libs/JavaScriptMinifier.php index 0b4be9ae..998805ae 100644 --- a/includes/libs/JavaScriptMinifier.php +++ b/includes/libs/JavaScriptMinifier.php @@ -59,7 +59,7 @@ class JavaScriptMinifier { const TYPE_DO = 15; // keywords: case, var, finally, else, do, try const TYPE_FUNC = 16; // keywords: function const TYPE_LITERAL = 17; // all literals, identifiers and unrecognised tokens - + // Sanity limit to avoid excessive memory usage const STACK_LIMIT = 1000; @@ -72,9 +72,9 @@ class JavaScriptMinifier { * literals (e.g. quoted strings) longer than $maxLineLength are encountered * or when required to guard against semicolon insertion. * - * @param $s String JavaScript code to minify - * @param $statementsOnOwnLine Bool Whether to put each statement on its own line - * @param $maxLineLength Int Maximum length of a single line, or -1 for no maximum. + * @param string $s JavaScript code to minify + * @param bool $statementsOnOwnLine Whether to put each statement on its own line + * @param int $maxLineLength Maximum length of a single line, or -1 for no maximum. * @return String Minified code */ public static function minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 ) { @@ -385,7 +385,7 @@ class JavaScriptMinifier { self::TYPE_LITERAL => true ) ); - + // Rules for when newlines should be inserted if // $statementsOnOwnLine is enabled. // $newlineBefore is checked before switching state, @@ -514,7 +514,7 @@ class JavaScriptMinifier { return self::parseError($s, $end, 'Number with several E' ); } $end++; - + // + sign is optional; - sign is required. $end += strspn( $s, '-+', $end ); $len = strspn( $s, '0123456789', $end ); @@ -564,13 +564,13 @@ class JavaScriptMinifier { $out .= ' '; $lineLength++; } - + $out .= $token; $lineLength += $end - $pos; // += strlen( $token ) $last = $s[$end - 1]; $pos = $end; $newlineFound = false; - + // Output a newline after the token if required // This is checked before AND after switching state $newlineAdded = false; @@ -589,7 +589,7 @@ class JavaScriptMinifier { } elseif( isset( $goto[$state][$type] ) ) { $state = $goto[$state][$type]; } - + // Check for newline insertion again if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) { $out .= "\n"; @@ -598,7 +598,7 @@ class JavaScriptMinifier { } return $out; } - + static function parseError($fullJavascript, $position, $errorMsg) { // TODO: Handle the error: trigger_error, throw exception, return false... return false; |