MediaWiki  REL1_22
jsminplus.php File Reference

JSMinPlus version 1.4. More...

Go to the source code of this file.

Classes

class  JSCompilerContext
class  JSMinPlus
class  JSNode
class  JSParser
class  JSToken
class  JSTokenizer

Enumerations

enum  DECLARED_FORM
enum  EXPRESSED_FORM
enum  JS_ARRAY_INIT
enum  JS_BLOCK
enum  JS_CALL
enum  JS_FOR_IN
enum  JS_GETTER
enum  JS_GROUP
enum  JS_INDEX
enum  JS_LABEL
enum  JS_LIST
enum  JS_MINIFIED
enum  JS_NEW_WITH_ARGS
enum  JS_OBJECT_INIT
enum  JS_PROPERTY_INIT
enum  JS_SCRIPT
enum  JS_SETTER
enum  KEYWORD_BREAK
enum  KEYWORD_CASE
enum  KEYWORD_CATCH
enum  KEYWORD_CONST
enum  KEYWORD_CONTINUE
enum  KEYWORD_DEBUGGER
enum  KEYWORD_DEFAULT
enum  KEYWORD_DELETE
enum  KEYWORD_DO
enum  KEYWORD_ELSE
enum  KEYWORD_ENUM
enum  KEYWORD_FALSE
enum  KEYWORD_FINALLY
enum  KEYWORD_FOR
enum  KEYWORD_FUNCTION
enum  KEYWORD_IF
enum  KEYWORD_IN
enum  KEYWORD_INSTANCEOF
enum  KEYWORD_NEW
enum  KEYWORD_NULL
enum  KEYWORD_RETURN
enum  KEYWORD_SWITCH
enum  KEYWORD_THIS
enum  KEYWORD_THROW
enum  KEYWORD_TRUE
enum  KEYWORD_TRY
enum  KEYWORD_TYPEOF
enum  KEYWORD_VAR
enum  KEYWORD_VOID
enum  KEYWORD_WHILE
enum  KEYWORD_WITH
enum  OP_AND
enum  OP_ASSIGN
enum  OP_BITWISE_AND
enum  OP_BITWISE_NOT
enum  OP_BITWISE_OR
enum  OP_BITWISE_XOR
enum  OP_COLON
enum  OP_COMMA
enum  OP_CONDCOMMENT_END
enum  OP_DECREMENT
enum  OP_DIV
enum  OP_DOT
enum  OP_EQ
enum  OP_GE
enum  OP_GT
enum  OP_HOOK
enum  OP_INCREMENT
enum  OP_LE
enum  OP_LEFT_BRACKET
enum  OP_LEFT_CURLY
enum  OP_LEFT_PAREN
enum  OP_LSH
enum  OP_LT
enum  OP_MINUS
enum  OP_MOD
enum  OP_MUL
enum  OP_NE
enum  OP_NOT
enum  OP_OR
enum  OP_PLUS
enum  OP_RIGHT_BRACKET
enum  OP_RIGHT_CURLY
enum  OP_RIGHT_PAREN
enum  OP_RSH
enum  OP_SEMICOLON
enum  OP_STRICT_EQ
enum  OP_STRICT_NE
enum  OP_UNARY_MINUS
enum  OP_UNARY_PLUS
enum  OP_URSH
enum  STATEMENT_FORM
enum  TOKEN_CONDCOMMENT_END
enum  TOKEN_CONDCOMMENT_START
enum  TOKEN_END
enum  TOKEN_IDENTIFIER
enum  TOKEN_NEWLINE
enum  TOKEN_NUMBER
enum  TOKEN_REGEXP
enum  TOKEN_STRING

Detailed Description

JSMinPlus version 1.4.

Minifies a javascript file using a javascript parser

This implements a PHP port of Brendan Eich's Narcissus open source javascript engine (in javascript) References: http://en.wikipedia.org/wiki/Narcissus_(JavaScript_engine) Narcissus sourcecode: http://mxr.mozilla.org/mozilla/source/js/narcissus/ JSMinPlus weblog: http://crisp.tweakblogs.net/blog/cat/716

Tino Zijdel <[email protected]>

Usage: $minified = JSMinPlus::minify($script [, $filename])

Versionlog (see also changelog.txt): 23-07-2011 - remove dynamic creation of OP_* and KEYWORD_* defines and declare them on top reduce memory footprint by minifying by block-scope some small byte-saving and performance improvements 12-05-2009 - fixed hook:colon precedence, fixed empty body in loop and if-constructs 18-04-2009 - fixed crashbug in PHP 5.2.9 and several other bugfixes 12-04-2009 - some small bugfixes and performance improvements 09-04-2009 - initial open sourced version 1.0

Latest version of this script: http://files.tweakers.net/jsminplus/jsminplus.zip

Definition in file jsminplus.php.


Enumeration Type Documentation

Definition at line 93 of file jsminplus.php.

Definition at line 94 of file jsminplus.php.

Definition at line 83 of file jsminplus.php.

enum JS_BLOCK

Definition at line 77 of file jsminplus.php.

enum JS_CALL

Definition at line 80 of file jsminplus.php.

enum JS_FOR_IN

Definition at line 79 of file jsminplus.php.

enum JS_GETTER

Definition at line 86 of file jsminplus.php.

enum JS_GROUP

Definition at line 88 of file jsminplus.php.

enum JS_INDEX

Definition at line 82 of file jsminplus.php.

enum JS_LABEL

Definition at line 78 of file jsminplus.php.

enum JS_LIST

Definition at line 89 of file jsminplus.php.

Definition at line 91 of file jsminplus.php.

Definition at line 81 of file jsminplus.php.

Definition at line 84 of file jsminplus.php.

Definition at line 85 of file jsminplus.php.

enum JS_SCRIPT

Definition at line 76 of file jsminplus.php.

enum JS_SETTER

Definition at line 87 of file jsminplus.php.

Definition at line 141 of file jsminplus.php.

Definition at line 142 of file jsminplus.php.

Definition at line 143 of file jsminplus.php.

Definition at line 144 of file jsminplus.php.

Definition at line 145 of file jsminplus.php.

Definition at line 146 of file jsminplus.php.

Definition at line 147 of file jsminplus.php.

Definition at line 148 of file jsminplus.php.

enum KEYWORD_DO

Definition at line 149 of file jsminplus.php.

Definition at line 150 of file jsminplus.php.

Definition at line 151 of file jsminplus.php.

Definition at line 152 of file jsminplus.php.

Definition at line 153 of file jsminplus.php.

Definition at line 154 of file jsminplus.php.

Definition at line 155 of file jsminplus.php.

enum KEYWORD_IF

Definition at line 156 of file jsminplus.php.

enum KEYWORD_IN

Definition at line 157 of file jsminplus.php.

Definition at line 158 of file jsminplus.php.

Definition at line 159 of file jsminplus.php.

Definition at line 160 of file jsminplus.php.

Definition at line 161 of file jsminplus.php.

Definition at line 162 of file jsminplus.php.

Definition at line 163 of file jsminplus.php.

Definition at line 164 of file jsminplus.php.

Definition at line 165 of file jsminplus.php.

Definition at line 166 of file jsminplus.php.

Definition at line 167 of file jsminplus.php.

Definition at line 168 of file jsminplus.php.

Definition at line 169 of file jsminplus.php.

Definition at line 170 of file jsminplus.php.

Definition at line 171 of file jsminplus.php.

enum OP_AND

Definition at line 103 of file jsminplus.php.

enum OP_ASSIGN

Definition at line 109 of file jsminplus.php.

Definition at line 106 of file jsminplus.php.

Definition at line 127 of file jsminplus.php.

Definition at line 104 of file jsminplus.php.

Definition at line 105 of file jsminplus.php.

enum OP_COLON

Definition at line 101 of file jsminplus.php.

enum OP_COMMA

Definition at line 99 of file jsminplus.php.

Definition at line 135 of file jsminplus.php.

Definition at line 120 of file jsminplus.php.

enum OP_DIV

Definition at line 124 of file jsminplus.php.

enum OP_DOT

Definition at line 128 of file jsminplus.php.

enum OP_EQ

Definition at line 108 of file jsminplus.php.

enum OP_GE

Definition at line 117 of file jsminplus.php.

enum OP_GT

Definition at line 118 of file jsminplus.php.

enum OP_HOOK

Definition at line 100 of file jsminplus.php.

Definition at line 119 of file jsminplus.php.

enum OP_LE

Definition at line 113 of file jsminplus.php.

Definition at line 129 of file jsminplus.php.

Definition at line 131 of file jsminplus.php.

Definition at line 133 of file jsminplus.php.

enum OP_LSH

Definition at line 112 of file jsminplus.php.

enum OP_LT

Definition at line 114 of file jsminplus.php.

enum OP_MINUS

Definition at line 122 of file jsminplus.php.

enum OP_MOD

Definition at line 125 of file jsminplus.php.

enum OP_MUL

Definition at line 123 of file jsminplus.php.

enum OP_NE

Definition at line 111 of file jsminplus.php.

enum OP_NOT

Definition at line 126 of file jsminplus.php.

enum OP_OR

Definition at line 102 of file jsminplus.php.

enum OP_PLUS

Definition at line 121 of file jsminplus.php.

Definition at line 130 of file jsminplus.php.

Definition at line 132 of file jsminplus.php.

Definition at line 134 of file jsminplus.php.

enum OP_RSH

Definition at line 116 of file jsminplus.php.

Definition at line 98 of file jsminplus.php.

Definition at line 107 of file jsminplus.php.

Definition at line 110 of file jsminplus.php.

Definition at line 138 of file jsminplus.php.

Definition at line 137 of file jsminplus.php.

enum OP_URSH

Definition at line 115 of file jsminplus.php.

Definition at line 95 of file jsminplus.php.

Definition at line 74 of file jsminplus.php.

Definition at line 73 of file jsminplus.php.

enum TOKEN_END

Definition at line 67 of file jsminplus.php.

Definition at line 69 of file jsminplus.php.

Definition at line 72 of file jsminplus.php.

Definition at line 68 of file jsminplus.php.

Definition at line 71 of file jsminplus.php.

Definition at line 70 of file jsminplus.php.