Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/compress.bat
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/compress.bat	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/compress.bat	(revision 2366)
@@ -0,0 +1,8 @@
+:: Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+:: For licensing, see LICENSE.html or http://ckeditor.com/license
+
+@ECHO OFF
+CLS
+ECHO.
+
+java -jar ../js.jar -opt -1 ../ckpackager.js -compress script.js
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/dump.bat
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/dump.bat	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/dump.bat	(revision 2366)
@@ -0,0 +1,8 @@
+:: Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+:: For licensing, see LICENSE.html or http://ckeditor.com/license
+
+@ECHO OFF
+CLS
+ECHO.
+
+java -jar ../js.jar -opt -1 ../ckpackager.js -dump script.js
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/script.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/script.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_dev/script.js	(revision 2366)
@@ -0,0 +1,200 @@
+/*
+ * CKEditor - The text editor for Internet - http://ckeditor.com
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ *
+ * == BEGIN LICENSE ==
+ *
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ *
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ *
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ *
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ *
+ * == END LICENSE ==
+ */
+
+/**
+ * @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
+ *		asynchronously.
+ */
+
+/**
+ * Load scripts asynchronously.
+ * @namespace
+ * @example
+ */
+CKEDITOR.scriptLoader = (function()
+{
+	var uniqueScripts = {};
+	var waitingList = {};
+
+	return /** @lends CKEDITOR.scriptLoader */ {
+		/**
+		 * Loads an external script checking if it hasn't been already loaded
+		 * previously by this function.
+		 * @param {String} scriptUrl The URL pointing to the external script to
+		 *		be loaded.
+		 * @param {Function} [callback] A function to be called when the script
+		 *		is loaded and executed
+		 * @param {Object} [scope] The scope ("this" reference) to be used for
+		 *		the callback call. Default to {@link CKEDITOR}.
+		 * @param {Boolean} [noCheck] Indicates that the script must be loaded
+		 *		anyway, not checking if it has already loaded.
+		 * @returns {Boolean} A boolean indicating that the script has been
+		 *		loaded. Returns false if it has already been loaded previously.
+		 * @example
+		 * CKEDITOR.scriptLoader.load( '/myscript.js' );
+		 * @example
+		 * CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
+		 *     {
+		 *         // Alerts "true" if the script has been properly loaded.
+		 *         // HTTP error 404 should return "false".
+		 *         alert( success );
+		 *     });
+		 */
+		load : function( scriptUrl, callback, scope, noCheck )
+		{
+			var isString = ( typeof scriptUrl == 'string' );
+
+			if ( isString )
+				scriptUrl = [ scriptUrl ];
+
+			if ( !scope )
+				scope = CKEDITOR;
+
+			var scriptCount = scriptUrl.length,
+				loadedCount = 0,
+				completed = [],
+				failed = [];
+
+			var doCallback = function( success )
+			{
+				if ( callback )
+				{
+					if ( isString )
+						callback.call( scope, success );
+					else
+						callback.call( scope, completed, failed );
+				}
+			};
+
+			if ( scriptCount == 0 )
+			{
+				doCallback( true );
+				return;
+			}
+
+			var checkLoaded = function( url, success )
+			{
+				( success ? completed : failed).push( url );
+
+				if ( --loadedCount <= 0 )
+					doCallback( success );
+			};
+
+			var onLoad = function( url, success )
+			{
+				// Mark this script as loaded.
+				uniqueScripts[ url ] = 1;
+
+				// Get the list of callback checks waiting for this file.
+				var waitingInfo = waitingList[ url ];
+				delete waitingList[ url ];
+
+				// Check all callbacks waiting for this file.
+				for ( var i = 0 ; i < waitingInfo.length ; i++ )
+					waitingInfo[ i ]( url, success );
+			};
+
+			var loadScript = function( url )
+			{
+				if ( noCheck !== true && uniqueScripts[ url ] )
+				{
+					checkLoaded( url, true );
+					return;
+				}
+
+				var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
+				waitingInfo.push( checkLoaded );
+
+				// Load it only for the first request.
+				if ( waitingInfo.length > 1 )
+					return;
+
+				// Create the <script> element.
+				var script = new CKEDITOR.dom.element( 'script' );
+				script.setAttributes( {
+					type : 'text/javascript',
+					src : url } );
+
+				if ( callback )
+				{
+					if ( CKEDITOR.env.ie )
+					{
+						// FIXME: For IE, we are not able to return false on error (like 404).
+
+						/** @ignore */
+						script.$.onreadystatechange = function ()
+						{
+							if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
+							{
+								script.$.onreadystatechange = null;
+								onLoad( url, true );
+							}
+						};
+					}
+					else
+					{
+						/** @ignore */
+						script.$.onload = function()
+						{
+							onLoad( url, true );
+						};
+
+						// FIXME: Opera and Safari will not fire onerror.
+
+						/** @ignore */
+						script.$.onerror = function()
+						{
+							onLoad( url, false );
+						};
+					}
+				}
+
+				// Append it to <head>.
+				script.appendTo( CKEDITOR.document.getHead() );
+
+				CKEDITOR.fire( 'download', url );		// @Packager.RemoveLine
+			};
+
+			for ( var i = 0 ; i < scriptCount ; i++ )
+			{
+				loadScript( scriptUrl[ i ] );
+			}
+		},
+
+		/**
+		 * Executes a JavaScript code into the current document.
+		 * @param {String} code The code to be executed.
+		 * @example
+		 * CKEDITOR.scriptLoader.loadCode( 'var x = 10;' );
+		 * alert( x );  // "10"
+		 */
+		loadCode : function( code )
+		{
+			// Create the <script> element.
+			var script = new CKEDITOR.dom.element( 'script' );
+			script.setAttribute( 'type', 'text/javascript' );
+			script.appendText( code );
+
+			// Append it to <head>.
+			script.appendTo( CKEDITOR.document.getHead() );
+		}
+	};
+})();
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic.pack
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic.pack	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic.pack	(revision 2366)
@@ -0,0 +1,31 @@
+﻿/*
+ * CKPackager - Sample Package file
+ */
+
+header :
+	'/*'												+ '\n' +
+	' * This file has been compressed with CKPackager'	+ '\n' +
+	' */'												+ '\n' +
+	'\n',
+
+constants :
+	{
+		'BASIC_COLOR_RED'	: 1,
+		'BASIC_COLOR_BLUE'	: 2,
+		'BASIC_COLOR_WHITE'	: 3,
+		'MyObject.CONST'	: 1
+	},
+
+packages :
+	[
+		{
+			output : 'basic_sample_compressed.js',
+
+			renameGlobals : false,
+			compactJavascript : true,
+			files :
+				[
+					'basic_sample.js'
+				]
+		}
+	]
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample.js	(revision 2366)
@@ -0,0 +1,88 @@
+/*
+ * #########
+ *  This is a sample script file, were we can check all features of FCKpackager.
+ *  The code has not much sense and it's here for demonstration purposes only.
+ *
+ * Please note that all statements are correctly terminated with a semi-colon
+ * (except brackets enclosed blocks, where it is optional). This is a
+ * requirement, otherwise your packed code may be broken.
+ * #########
+ */
+
+/*
+ * These constants must not be deployed. They are used in the development
+ * environment only, for readability and code comprehension.
+ */
+var BASIC_COLOR_RED = 1 ;
+var BASIC_COLOR_BLUE = 2 ;
+var BASIC_COLOR_WHITE = 3 ;
+
+// Create the global "MyObject".
+var MyObject = new Object() ;
+MyObject.CONST = 1 ;
+
+var _Html =
+'<div>\
+	<i>\
+		Some text\
+	</i>\
+</div>' ;
+
+// Get the color name.
+MyObject.GetColorName = function( colorId, upperCase )
+{
+	var name ;
+
+	if ( !colorId )
+		colorId = MyObject.CONST ;
+
+	switch ( colorId )
+	{
+		case BASIC_COLOR_RED :
+			name = 'Red' ;
+
+		case BASIC_COLOR_BLUE :
+			name = 'Blue' ;
+
+		case BASIC_COLOR_WHITE :
+			name = 'White' ;
+
+		default :
+			// The following must strings must be combined.
+			name =
+				'Unknown ' +
+				'color ' +
+				'id' +
+				" (double quotes " + "too)" ;
+	}
+
+	return upperCase ? name.toUpperCase() : name ;
+}
+
+// The following function has not much sense... it is just an example.
+MyObject.GetArray = function( value1, value2, value3, theLastWellDescriptiveArgument )
+{
+	var myArray = new Array() ;
+
+	var A = 'Let\'s see if the name "A" will cause conflict' ;
+
+	// Let's just push the arguments in the array.
+	myArray.push( value1 ) ;
+	myArray.push( value2 ) ;
+	myArray.push( value3 ) ;
+	myArray.push( theLastWellDescriptiveArgument ) ;
+
+	// The following line must not be deployed.
+	MyDebugFunction( myArray ) ;		// @Packager.RemoveLine
+
+	return myArray ;
+}
+
+// @Packager.Remove.Start
+// This function is used during the development. We don't want to deploy it,
+// so we use the @Packager.Remove.(Start/End) instructions.
+function DebugIt( message )
+{
+	alert( message ) ;
+}
+// @Packager.Remove.End
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample_compressed.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample_compressed.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/basic_sample_compressed.js	(revision 2366)
@@ -0,0 +1,5 @@
+/*
+ * This file has been compressed with CKPackager
+ */
+
+var BASIC_COLOR_RED=1,BASIC_COLOR_BLUE=2,BASIC_COLOR_WHITE=3,MyObject={};MyObject.CONST=1;var _Html='<div>\t<i>\t\tSome text\t</i></div>';MyObject.GetColorName=function(f,g){var h;if(!f)f=1;switch(f){case 1:h='Red';case 2:h='Blue';case 3:h='White';default:h='Unknown color id (double quotes too)';}return g?h.toUpperCase():h;};MyObject.GetArray=function(f,g,h,i){var j=[],k='Let\'s see if the name "A" will cause conflict';j.push(f);j.push(g);j.push(h);j.push(i);return j;};
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/run.bat
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/run.bat	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/_samples/basic/run.bat	(revision 2366)
@@ -0,0 +1,13 @@
+:: Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+:: For licensing, see LICENSE.html or http://ckeditor.com/license
+
+@ECHO OFF
+
+CLS
+ECHO.
+
+:: Show call stack on errors.
+java -jar ../../js.jar -opt -1 ../../ckpackager.js basic.pack
+
+:: Best performance.
+:: java -jar ../../js.jar -opt 1 ../../ckpackager.js basic.pack
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/ckpackager.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/ckpackager.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/ckpackager.js	(revision 2366)
@@ -0,0 +1,123 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+importPackage( org.mozilla.javascript );
+
+importClass( java.lang.System );
+importClass( java.io.File );
+importClass( java.io.BufferedWriter );
+importClass( java.io.FileWriter );
+
+var CKPACKAGER =
+{
+	dir : (function()
+		{
+			var packagerDir = new File( System.getProperty( 'java.class.path' ) );
+			return packagerDir.getParent();
+		})(),
+
+	getPackPath : function( relativePath )
+	{
+		var file = new File( CKPACKAGER.packDir, relativePath );
+		return file.getAbsolutePath();
+	},
+
+	getPackagerPath : function( relativePath )
+	{
+		var file = new File( CKPACKAGER.dir, relativePath );
+		return file.getAbsolutePath();
+	},
+
+	_loadedCode : {},
+
+	loadCode : function( path )
+	{
+		if ( this._loadedCode[ path ] )
+			return;
+
+		load( CKPACKAGER.getPackagerPath( path ) );
+	},
+
+	tools :
+	{
+		readFile : function( file )
+		{
+			var data = readFile( file );
+
+			// Remove the UTF-8 BOM.
+			return data.replace( /^\xEF\xBB\xBF/, '' );
+		},
+
+		getFileName : function( file )
+		{
+			var file = new File( file );
+			return file.getName();
+		}
+	}
+};
+
+function error( msg )
+{
+	print( msg );
+	print( '' );
+	quit();
+}
+
+if ( arguments[0] == '-dump' )
+{
+	CKPACKAGER.loadCode( 'includes/parser.js' );
+	CKPACKAGER.parser.dumpThree( CKPACKAGER.tools.readFile( arguments[1] ) );
+	quit();
+}
+else if ( arguments[0] == '-compress' )
+{
+	CKPACKAGER.loadCode( 'includes/scriptcompressor.js' );
+
+	var compressed = CKPACKAGER.scriptCompressor.compress( CKPACKAGER.tools.readFile( arguments[1] ) );
+
+	if ( arguments[2] )
+	{
+		var out = new BufferedWriter( new FileWriter( arguments[2] ) );
+		out.write( compressed );
+		out.close();
+	}
+
+	print( compressed );
+	quit();
+}
+else if ( arguments[0] == '-test' )
+{
+	CKPACKAGER.loadCode( 'test/test.js' );
+	quit();
+}
+
+CKPACKAGER.packFile = arguments[0];
+
+if ( !CKPACKAGER.packFile )
+	error( 'Usage:java -jar js.jar ckpackager.js sample.pack' );
+
+CKPACKAGER.packDir = (function()
+{
+	var packFile = new File( CKPACKAGER.packFile );
+
+	if ( !packFile.isFile() )
+		error( 'The file name "' + CKPACKAGER.packFile + '" was not found.' );
+
+	return packFile.getParent() || './';
+})();
+
+CKPACKAGER.loadCode( 'includes/packager.js' );
+
+//for ( var o in CKPACKAGER )
+//	print( o + ': ' + CKPACKAGER[o] );
+
+// print( String( System.getProperties() ).replace( /,/g, '\n') );
+
+(function()
+{
+	var packager = new CKPACKAGER.packager();
+	packager.loadDefinitionFile( CKPACKAGER.packFile );
+	packager.run();
+})();
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packagefile.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packagefile.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packagefile.js	(revision 2366)
@@ -0,0 +1,71 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+importClass( java.io.BufferedWriter );
+importClass( java.io.FileWriter );
+
+CKPACKAGER.loadCode( 'includes/scriptcompressor.js' );
+
+CKPACKAGER.packageFile = function( outputFile )
+{
+	this.output = outputFile;
+
+	this.header = null;
+	this.noCheck = false;
+	this.constants = null;
+	this.renameGlobals = false;
+	this.compactJavascript = true;
+	this.files = [];
+};
+
+CKPACKAGER.packageFile.prototype =
+{
+	createFile : function()
+	{
+		var source = [];
+
+		print( 'Packaging file ' + CKPACKAGER.tools.getFileName( this.output ) + '\n' );
+
+		for ( var i = 0 ; i < this.files.length ; i++ )
+		{
+			var file = this.files[ i ];
+
+			print( '    Adding ' + CKPACKAGER.tools.getFileName( file ) );
+
+			source.push( CKPACKAGER.tools.readFile( file ), '\n' );
+		}
+
+		source = source.join( '' );
+
+		var compressed = this.compactJavascript ?
+			CKPACKAGER.scriptCompressor.compress( source, this.renameGlobals, this.constants, this.noCheck ) :
+			source;
+
+		if ( this.header )
+			compressed = this.header + compressed;
+
+		compressed += '\n';
+
+		try
+		{
+			var file = new File( this.output );
+			file['delete']();
+
+			var out = new BufferedWriter( new FileWriter( this.output ) );
+			out.write( compressed );
+			out.close();
+	    }
+	    catch ( e )
+	    {
+			throw e;
+	    }
+
+		print( '' );
+		print( '    Number of files processed: ' + this.files.length );
+		print( '    Original size............: ' + source.length + ' bytes' );
+		print( '    Output file size.........: ' + compressed.length + ' bytes (' + Math.round( compressed.length / source.length * 100 ) + '% of original)' );
+		print( '' );
+	}
+};
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packager.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packager.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/packager.js	(revision 2366)
@@ -0,0 +1,100 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+CKPACKAGER.loadCode( 'includes/packagefile.js' );
+
+CKPACKAGER.packager = function()
+{
+	this.packageFiles = [];
+};
+
+CKPACKAGER.packager.prototype =
+{
+	loadDefinitionFile : function( filePath )
+	{
+		var file = new File( filePath );
+
+		// Evaluate the package definition, moving its contents to CKPACKAGER.packDefinition.
+		var packCode = 'var pack = { ' + CKPACKAGER.tools.readFile( filePath ) + '\n};';
+
+		var cx = Context.enter(),
+			scope = cx.initStandardObjects();
+
+		cx.evaluateString( scope, packCode, file.getName(), 1, null );
+
+		this.loadDefinition( scope.pack );
+	},
+
+	loadDefinition : function( definitionObject )
+	{
+		var packages = definitionObject.packages;
+
+		if ( packages )
+		{
+			for ( var i = 0 ; i < packages.length ; i++ )
+			{
+				var packDefinition = packages[ i ];
+
+				if ( !packDefinition.output )
+					error( 'The "output" value must be set for all packages in the packager defintion file(' + CKPACKAGER.packFile + ').' );
+
+				var packFile = new CKPACKAGER.packageFile( CKPACKAGER.getPackPath( packDefinition.output ) );
+
+				if ( definitionObject.header )
+					packFile.header = definitionObject.header;
+
+				if ( typeof definitionObject.noCheck != 'undefined' )
+					packFile.noCheck = definitionObject.noCheck;
+
+				if ( definitionObject.constants )
+					packFile.constants = definitionObject.constants;
+
+				if ( typeof packDefinition.renameGlobals != 'undefined' )
+					packFile.renameGlobals = packDefinition.renameGlobals;
+
+				if ( typeof packDefinition.compactJavascript != 'undefined' )
+					packFile.compactJavascript = packDefinition.compactJavascript;
+
+				var files = packDefinition.files;
+
+				if ( files )
+				{
+					for ( var f = 0 ; f < files.length ; f++ )
+						packFile.files.push( CKPACKAGER.getPackPath( files[ f ] ) );
+				}
+
+				this.packageFiles.push( packFile );
+			}
+		}
+	},
+
+	run : function()
+	{
+		var time = new Date();
+
+		for ( var i = 0 ; i < this.packageFiles.length ; i++ )
+		{
+			this.packageFiles[ i ].createFile();
+		}
+
+		time = ( new Date() ) - time;
+		time = time / 1000;
+
+		switch ( this.packageFiles.length )
+		{
+			case 0 :
+				print( 'No files defined' );
+				break;
+			case 1 :
+				print( 'The generation of the package file has been completed in ' + time + ' seconds.' );
+				break;
+			default :
+				print( 'The generation of ' + this.packageFiles.length + ' files has been completed in ' + time + ' seconds.' );
+				break;
+		}
+
+		print( '' );
+	}
+};
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/parser.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/parser.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/parser.js	(revision 2366)
@@ -0,0 +1,121 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+load( '../includes/token.js' );
+
+importPackage( org.mozilla.javascript );
+
+importClass( java.io.File );
+importClass( java.io.FileReader );
+
+(function()
+{
+	var indentation,
+		tree;
+
+	var printNode = function( node )
+	{
+		var str,
+			type = node.getType(),
+			currentTree = tree;
+
+		str =
+			node instanceof Node.StringNode ?
+				node.getString()
+			: type == Token.NUMBER ?
+				str = node.getDouble()
+			:
+				'';
+
+		switch ( type )
+		{
+			case Token.FUNCTION :
+
+				var fnIndex = node.getExistingIntProp( Node.FUNCTION_PROP ),
+					fn		= tree.getFunctionNode(fnIndex),
+					args	= [];
+
+				if ( fn.symbolTable != null )
+				{
+					var iter = fn.symbolTable.keySet().iterator();
+					while ( args.length < fn.getParamCount() )
+						args.push( iter.next() );
+				}
+
+				str += '(' + args + ')';
+
+				node = tree = fn;
+				break;
+
+			case Token.REGEXP :
+				str = '/' + tree.getRegexpString( node.getExistingIntProp( Node.REGEXP_PROP ) ) + '/';
+				str += tree.getRegexpFlags( node.getExistingIntProp( Node.REGEXP_PROP ) );
+				break;
+
+			case Token.CASE :
+			case Token.GOTO :
+				str = node.target.getNext();
+				break;
+
+			case Token.LOOP :
+				str = node.target;
+				break;
+
+			case Token.TARGET :
+				str = node.labelId();
+				break;
+		}
+
+		try { str = node.getString(); } catch (e) {}
+
+		print( indentation + node + ': ' + GetTokenName( type ) +
+			' (' + node.getLineno() + ')' +
+			( node instanceof Node.Scope ? ' (scope)' : '' ) +
+			( str !== '' ? ' = ' + str : '' ) );
+
+		indentation += '.';
+
+		node = node.getFirstChild()
+
+		while ( node )
+		{
+			printNode( node );
+			node = node.getNext();
+		}
+
+		if ( type == Token.FUNCTION )
+		{
+			tree = currentTree;
+		}
+
+		// Uncomment to stop on a specific token type.
+		/*
+		if ( type == Token.USE_STACK )
+			quit();
+		*/
+
+		indentation = indentation.substr( 1 );
+	}
+
+	CKPACKAGER.parser =
+	{
+		dumpThree : function( script )
+		{
+			// Setup the compiler environment, error reporter...
+			var compilerEnv = new CompilerEnvirons();
+			var errorReporter = compilerEnv.getErrorReporter();
+
+			// Create an instance of the parser...
+			var parser = new Parser(compilerEnv, errorReporter);
+
+			var scriptOrFnNode = parser.parse(script, null, 1);
+			tree = scriptOrFnNode;
+
+			indentation = '';
+
+			printNode( scriptOrFnNode );
+		}
+	};
+})();
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scope.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scope.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scope.js	(revision 2366)
@@ -0,0 +1,146 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+(function()
+{
+	var preProcess = function ( scope, node, names )
+	{
+		var child = node.getFirstChild();
+		while( child )
+		{
+			switch ( child.getType() )
+			{
+				case Token.THIS :
+					scope.thisCount++;
+					break;
+
+				case Token.FUNCTION :
+
+					// Functions are considered declared since the very start
+					// of the scope execution. So, we must look for them here.
+					// Unfortunately Symbol.declType is not public in the Rhino
+					// code.
+
+					scope.functionCount++;
+
+					var name = String( child.getString() );
+					if ( name.length > 0 )
+						scope.declaredNames[ name ] = 1;
+					break;
+
+				default:
+					preProcess( scope, child, names );
+			}
+
+			child = child.getNext();
+		}
+
+		return names;
+	};
+
+	CKPACKAGER.scope = function( rhinoNode, parentScope )
+	{
+		this.node = rhinoNode;
+		this.parent = parentScope;
+		this.args = [];
+		this.names = {};
+		this.declaredNames =
+		{
+			'this' : 1
+		};
+		this.thisCount = 0;
+		this.functionCount = 0;
+		this.noRename = false;
+
+		this.newNames = {};
+		this.nameCounter = parentScope ? parentScope.nameCounter : 0;
+
+		if ( rhinoNode.symbolTable != null )
+		{
+			var iter = rhinoNode.symbolTable.keySet().iterator(),
+				paramCount = rhinoNode.getParamCount();
+
+			while ( iter.hasNext() )
+			{
+				var symbol = String( iter.next() );
+
+				if ( this.args.length < paramCount )
+				{
+					this.args.push( symbol );
+					this.declaredNames[ symbol ] = 1;
+				}
+
+				this.names[ symbol ] = getNextName( this );
+			}
+		}
+
+		preProcess( this, rhinoNode );
+	}
+
+	var nameChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split( '' ),
+		nameCharsLength = nameChars.length;
+
+	// Mangles the list, having a different order for each run.
+	/*
+	nameChars.sort( function( a, b )
+		{
+			return Math.random() < 0.5 ? -1 : 1;
+		});
+	*/
+
+	var getNextName = function( scope )
+	{
+		var name;
+
+		do
+		{
+			var number = ++scope.nameCounter;
+
+			name = '';
+
+			while ( true )
+			{
+				var mod = number % nameCharsLength;
+				number = Math.floor( number / nameCharsLength );
+
+				if ( mod == 0 )
+				{
+					name = nameChars[ nameCharsLength - 1 ] + name;
+					number--;
+				}
+				else
+				{
+					name = nameChars[ mod - 1 ] + name;
+				}
+
+				if ( number <= 0 )
+					break;
+			}
+		}
+		while ( !isNaN( name.substr( 0, 1 ) ) )
+
+		return name;
+	};
+
+	CKPACKAGER.scope.prototype.getNewName = function( name, includeNotDeclared, includeNotListed )
+	{
+		if ( !this.noRename )
+		{
+			if ( ( includeNotDeclared || this.declaredNames[ name ] ) && this.names[ name ] )
+				return this.names[ name ];
+			else if ( includeNotListed || name == 'this' )
+				return ( this.declaredNames[ name ] = this.names[ name ] = getNextName( this ) );
+			else if ( this.parent )
+				return this.parent.getNewName( name, true );
+		}
+
+		return name;
+	};
+
+	CKPACKAGER.scope.prototype.declareName = function( name )
+	{
+		this.declaredNames[ name ] = 1;
+	};
+})();
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scriptcompressor.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scriptcompressor.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/scriptcompressor.js	(revision 2366)
@@ -0,0 +1,1115 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+importPackage( org.mozilla.javascript );
+importPackage( java.util.regex );
+
+importClass( java.io.File );
+importClass( java.io.FileReader );
+
+CKPACKAGER.loadCode( 'includes/scope.js' );
+CKPACKAGER.loadCode( 'includes/token.js' );
+
+(function()
+{
+	var scope,
+		tree,
+		noGlobals,
+		constantList,
+		lastWasVar,
+		ignoreSiblings,
+		isLoop,
+		output,
+		outputSize = 0,
+		maxSize = 2000;
+
+	var lang = {};
+
+	lang[ Token.NOT ] = '!';
+	lang[ Token.BITNOT ] = '~';
+	lang[ Token.POS ] = '+';
+	lang[ Token.NEG ] = '-';
+	lang[ Token.TYPEOF ] = 'typeof ';
+	lang[ Token.MUL ] = '*';
+	lang[ Token.DIV ] = '/';
+	lang[ Token.MOD ] = '%';
+	lang[ Token.ADD ] = '+';
+	lang[ Token.SUB ] = '-';
+	lang[ Token.RSH ] = '>>';
+	lang[ Token.LSH ] = '<<';
+	lang[ Token.URSH ] = '>>>';
+	lang[ Token.LT ] = '<';
+	lang[ Token.LE ] = '<=';
+	lang[ Token.GT ] = '>';
+	lang[ Token.GE ] = '>=';
+	lang[ Token.EQ ] = '==';
+	lang[ Token.NE ] = '!=';
+	lang[ Token.SHEQ ] = '===';
+	lang[ Token.SHNE ] = '!==';
+	lang[ Token.BITAND ] = '&';
+	lang[ Token.BITXOR ] = '^';
+	lang[ Token.BITOR ] = '|';
+	lang[ Token.AND ] = '&&';
+	lang[ Token.OR ] = '||';
+	lang[ Token.COMMA ] = ',';
+
+	// From http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operators:Operator_Precedence
+	var precedence = {};
+	precedence[ Token.DOT ] = 1;
+	precedence[ Token.INC ] = precedence[ Token.DEC ] = 3;
+	precedence[ Token.NOT ] = precedence[ Token.BITNOT ] = precedence[ Token.POS ] = precedence[ Token.NEG ] = precedence[ Token.TYPEOF ] = 4;
+	precedence[ Token.MUL ] = precedence[ Token.DIV ] = precedence[ Token.MOD ] = 5;
+	precedence[ Token.ADD ] = precedence[ Token.SUB ] = 6;
+	precedence[ Token.RSH ] = precedence[ Token.LSH ] = precedence[ Token.URSH ] = 7;
+	precedence[ Token.LT ] = precedence[ Token.LE ] = precedence[ Token.GT ] = precedence[ Token.GE ] = precedence[ Token.INSTANCEOF ] = 8;
+	precedence[ Token.EQ ] = precedence[ Token.NE ] = precedence[ Token.SHEQ ] = precedence[ Token.SHNE ] = 9;
+	precedence[ Token.BITAND ] = 10;
+	precedence[ Token.BITXOR ] = 11;
+	precedence[ Token.BITOR ] = 12;
+	precedence[ Token.AND ] = 13;
+	precedence[ Token.OR ] = 14;
+	precedence[ Token.HOOK ] = 15;
+	precedence[ Token.SETNAME ] = precedence[ Token.SETPROP ] = precedence[ Token.SETELEM ] = 16;
+	precedence[ Token.COMMA ] = 17;
+
+	var noSpaceChars = {' ':1,';':1,',':1,'.':1,'(':1,')':1,'[':1,']':1,'{':1,'}':1,'?':1,':':1,'!':1,'=':1,'>':1,'<':1,'*':1,'/':1,'%':1,'+':1,'-':1,'&':1,'|':1,'^':1};
+	var out = function()
+	{
+		if ( out.checkSpace )
+		{
+			var first = String( arguments[ 0 ] );
+
+			if (
+				( first == '++' && out.last == '+' ) ||
+				( first == '--' && out.last == '-' ) ||
+				( out.last == '++' && first == '+' ) ||
+				( out.last == '--' && first == '-' ) ||
+				( out.mayNeedSpace && !noSpaceChars[ first.substr( 0, 1 ) ] ) )
+			{
+				output.push( ' ' );
+				outputSize++;
+			}
+		}
+
+		var last = out.last = String( arguments[ arguments.length - 1 ] );
+		out.mayNeedSpace = ( last == '++' || last == '--' || !noSpaceChars[ last.substr( last.length - 1 ) ] );
+
+		for ( var i = 0 ; i < arguments.length ; i++ )
+		{
+			var str = String( arguments[i] );
+			outputSize += str.length;
+			output.push( str );
+		}
+
+		if ( outputSize > maxSize && last == ';' )
+		{
+			output.push( '\n' );
+			outputSize = 0;
+		}
+	};
+
+	out.mayNeedSpace = false;
+	out.checkSpace = true;
+	out.size = 0;
+
+	var isReserved = function( word )
+	{
+		return !!isReserved.words[ word ];
+	};
+	isReserved.words = { 'break':1,'else':1,'new':1,'var':1,'case':1,'finally':1,'return':1,'void':1,'catch':1,'for':1,'switch':1,'while':1,'continue':1,'function':1,'this':1,'with':1,'default':1,'if':1,'throw':1,'delete':1,'in':1,'try':1,'do':1,'instanceof':1,'typeof':1 };
+
+	var writeNode = function( node, opt )
+	{
+		if ( !node )
+			return;
+
+		var type = node.getType();
+
+		if ( type != Token.VAR )
+			lastWasVar = false;
+
+		switch ( type )
+		{
+			case Token.SCRIPT :
+				scope = new CKPACKAGER.scope( node, scope );
+				scope.noRename = noGlobals;
+
+				tree = node;
+				writeChildren( node );
+				break;
+
+			case Token.NAME :
+			case Token.BINDNAME :
+				var name = node.getString();
+				if ( constantList[ name ] )
+					out( constantList[ name ] );
+				else
+					out( scope.getNewName( name ) );
+				break;
+
+			case Token.VAR :
+				if ( lastWasVar )
+					out( ',' );
+				else
+					out( 'var ' );
+
+				var child = node.getFirstChild();
+				while ( child )
+				{
+					var name = child.getString();
+
+					out( scope.getNewName( name, true ) );
+
+					if ( child.getFirstChild() )
+					{
+						out( '=' );
+						writeChildren( child );
+					}
+
+					scope.declareName( name );
+
+					child = child.getNext();
+
+					if ( child )
+						out( ',' );
+				}
+
+				lastWasVar = ( node.getNext() && node.getNext().getType() == Token.VAR );
+
+				if ( !lastWasVar && ( !opt || !opt.noSemiColon ) )
+					out( ';' );
+
+				break;
+
+			case Token.SETNAME :
+				var name = node.getFirstChild().getString();
+
+				writeNode( node.getFirstChild() );
+
+				var value = node.getLastChild();
+
+				switch ( value.getType() )
+				{
+					case Token.MUL :
+					case Token.DIV :
+					case Token.MOD :
+					case Token.ADD :
+					case Token.SUB :
+					case Token.BITAND :
+					case Token.BITXOR :
+					case Token.BITOR :
+					case Token.LSH :
+					case Token.RSH :
+					case Token.URSH :
+
+						if ( ( value.getFirstChild().getType() == Token.NAME && value.getFirstChild().getString() == name ) )
+						{
+							out( lang[ value.getType() ], '=' );
+							writeNode( value.getLastChild() );
+							break;
+						}
+
+					default :
+						out( '=' );
+						writeNode( value );
+						break;
+				}
+
+				break;
+
+			case Token.NEW :
+				var child = node.getFirstChild(),
+					isArray,
+					isObject;
+
+				if ( child.getType() == Token.NAME )
+				{
+					if ( child.getString() == 'Array' && ( !child.getNext() || child.getNext().getType() != Token.NUMBER || child.getNext().getNext() ) )
+					{
+						out( '[' );
+						isArray = true;
+					}
+					else if ( child.getString() == 'Object' && !child.getNext() )
+					{
+						out( '{' );
+						isObject = true;
+					}
+				}
+
+				if ( !isArray && !isObject )
+				{
+					out( 'new ' );
+					writeNode( child );
+					out( '(' );
+				}
+
+				child = child.getNext();
+
+				while ( child )
+				{
+					if ( !writeNode( child ) )
+						break;
+
+					child = child.getNext();
+
+					if ( child )
+						out( ',' );
+				}
+
+				if ( isArray )
+					out( ']' );
+				else if ( isObject )
+					out( '}' );
+				else
+					out( ')' );
+				break;
+
+			case Token.FUNCTION :
+				var name = node.getString();
+
+				out( 'function' );
+
+				if ( name.length() )
+					out( ' ', scope.getNewName( name, true ) );
+
+				var currentTree = tree,
+					fnIndex = node.getExistingIntProp( Node.FUNCTION_PROP ),
+					fn = tree.getFunctionNode(fnIndex);
+
+				scope = new CKPACKAGER.scope( fn, scope );
+
+				out( '(' );
+
+				for ( var i = 0, len = scope.args.length ; i < len ; i++ )
+				{
+					if ( i > 0 )
+						out( ',' );
+					out( scope.getNewName( scope.args[ i ] ) );
+				}
+
+				out( '){' );
+
+				// Initialize the "this" replacement. Changes here must be
+				// reflected in the Token.THIS case.
+				if ( !scope.functionCount && scope.thisCount > 3 )
+					out( 'var ', scope.getNewName( 'this' ), '=this;' );
+
+				tree = fn;
+				writeNode( fn.getFirstChild(), { isFunction : true } );
+
+				scope = scope.parent;
+				tree = currentTree;
+
+				out( '}' );
+
+				if ( name.length() )
+					out( ';' );
+				break;
+
+			case Token.CALL :
+				var child = node.getFirstChild(),
+					childType = child.getType(),
+					isFunctionCall = ( childType == Token.FUNCTION || childType == Token.SETPROP || childType == Token.SETELEM );
+
+				if ( isFunctionCall )
+					out( '(' );
+
+				writeNode( child );
+
+				if ( isFunctionCall )
+					out( ')' );
+
+				out( '(' );
+
+				var param = child.getNext();
+				while( param )
+				{
+					if ( !writeNode( param ) )
+						break;
+
+					param = param.getNext();
+
+					if ( param )
+						out( ',' );
+				}
+
+				out( ')' );
+				break;
+
+			case Token.LOCAL_BLOCK :
+				writeChildren( node );
+				break;
+
+			case Token.BLOCK :
+				var child = node.getFirstChild(),
+					isLoop = opt && opt.isLoop,
+					isFunction = opt && opt.isFunction,
+					ignoreChildren = false;
+
+				if ( !child )
+					break;
+
+				if ( child.getType() == Token.IFNE )
+				{
+					writeNode( child );
+					break;
+				}
+				else if ( child.getType() == Token.SWITCH )
+				{
+					out( 'switch(' );
+					writeNode( child.getFirstChild() );
+					out( '){' );
+
+					var caseChild = child.getFirstChild().getNext();
+					while( caseChild )
+					{
+						writeNode( caseChild );
+						caseChild = caseChild.getNext();
+					}
+
+					caseChild = child.getNext().target.getNext();
+					if ( caseChild )
+					{
+						out( 'default:' );
+						writeChildren( caseChild );
+					}
+
+					out( '}' );
+
+					break;
+				}
+				else if ( child.getType() == Token.ENTERWITH )
+				{
+					out( 'with{' );
+					writeNode( child.getFirstChild() );
+					out( '){' );
+					writeChildren( child.getNext() );
+					out( '}' );
+					break;
+				}
+
+				while( child )
+				{
+					if ( child.getType() == Token.CONTINUE )
+					{
+						if ( !isLoop )
+							writeNode( child );
+						ignoreChildren = true;
+					}
+					else if ( child.getType() == Token.RETURN )
+					{
+						if ( !isFunction || child.getFirstChild() )
+							writeNode( child );
+						ignoreChildren = true;
+					}
+
+					// All children are ignored, except functions.
+					if ( !ignoreChildren || child.getType() == Token.FUNCTION )
+					{
+						if ( !writeNode( child ) )
+							break;
+					}
+
+					child = child.getNext();
+				}
+
+				break;
+
+			case Token.CASE :
+				out( 'case' );
+				writeNode( node.getFirstChild() );
+				out( ':' );
+				writeChildren( node.target.getNext() );
+				break;
+
+			case Token.BREAK :
+				out( 'break;' )
+				break;
+
+			case Token.LOOP :
+				var child = node.getFirstChild(),
+					block,
+					isDo = false;
+
+				if ( child.getType() == Token.GOTO )	// while (x) && for (;[x];[x])
+				{
+					// The block is located two nodes after it.
+					block = child.getNext().getNext();
+
+					// The increment expression is two steps from the block, if available.
+					var incrementExpression = block.getNext().getNext();
+
+					var expression = child.target.getNext();
+
+					if ( incrementExpression.getType() == Token.EXPR_VOID )	// for
+					{
+						out( 'for(;' );
+
+						if ( expression.getFirstChild().getType() != Token.TRUE )
+							writeNode( expression );
+
+						out( ';' );
+
+						writeNode( incrementExpression );
+
+						// Removes the ";" sent by EXPR_VOID.
+						output.pop();
+						outputSize--;
+
+						out( ')' );
+					}
+					else
+					{
+						if ( expression.getFirstChild().getType() == Token.TRUE )
+							out( 'for(;;)' );
+						else
+						{
+							out( 'while(' );
+							writeNode( expression );
+							out( ')' );
+						}
+					}
+				}
+				else if ( child.getType() == Token.TARGET )		// do { ... } while()
+				{
+					isDo = true;
+
+					out( 'do' );
+					block = child.getNext();
+				}
+				else	// for (x;[x];[x]) / for ( x in o )
+				{
+					out( 'for(' );
+
+					var hasName = false;
+
+					if ( child.getType() != Token.ENUM_INIT_KEYS )
+					{
+						writeNode( child, { noSemiColon : true } );
+
+						child = child.getNext();
+						hasName = true;
+					}
+
+					if ( child.getType() == Token.ENUM_INIT_KEYS )
+					{
+						block = child.getNext().getNext().getNext();
+
+						// Gets the BINDNAME token.
+						if ( !hasName )
+							writeNode( block.getFirstChild().getFirstChild().getFirstChild() );
+
+						writeNode( child );
+
+						block = block.getFirstChild().getNext();
+					}
+
+					if ( child.getType() == Token.GOTO )
+					{
+						out( ';' );
+						writeNode( child.target.getNext() );
+						out( ';' );
+
+						block = child.getNext().getNext();
+
+						// The increment expression is two steps from the block, if available.
+						var incrementExpression = block.getNext().getNext();
+
+						if ( incrementExpression.getType() == Token.EXPR_VOID )
+						{
+							writeNode( incrementExpression );
+
+							// Removes the ";" sent by EXPR_VOID.
+							output.pop();
+							outputSize--;
+						}
+					}
+
+					out( ')' );
+				}
+
+				var hasCurly = ( !block || !block.getFirstChild() || !!block.getFirstChild().getNext() );
+
+				if ( hasCurly )
+					out( '{' );
+
+				writeNode( block, { isLoop : true } );
+
+				if ( hasCurly )
+					out( '}' );
+
+				if ( isDo )
+				{
+					out( 'while(' );
+					writeNode( block.getNext().getNext() );
+					out( ')' );
+				}
+
+				break;
+
+			case Token.ENUM_INIT_KEYS :
+				out( ' in ' );
+				writeNode( node.getFirstChild() );
+				break;
+
+			case Token.EXPR_RESULT :
+			case Token.EXPR_VOID :
+				writeChildren( node );
+				out( ';' );
+				break;
+
+			case Token.GETPROP :
+				var child = node.getFirstChild(),
+					name = child.getNext().getString(),
+					finalName = name;
+
+				// Build the full name, like Obj.Prop1.Prop2
+				while ( child )
+				{
+					if ( child.getType() == Token.NAME )
+					{
+						name = child.getString() + '.' + name;
+						finalName = scope.getNewName( child.getString() ) + '.' + finalName;
+						break;
+					}
+
+					if ( child.getType() == Token.GETPROP )
+					{
+						child = child.getFirstChild();
+						name = child.getNext().getString() + '.' + name;
+
+						if ( child )
+							finalName = name;
+						else
+							finalName = scope.getNewName( child.getNext().getString() ) + '.' + finalName;
+
+						continue;
+					}
+
+					var parenthesis = !!precedence[ child.getType() ];
+
+					if ( parenthesis )
+						out( '(' );
+
+					writeNode( child );
+
+					if ( parenthesis )
+						out( ')' );
+
+					finalName = '.' + finalName;
+
+					child = null;
+					break;
+				}
+
+				// Check if the full name is a constant.
+				if ( child && constantList[ name ] )
+				{
+					out( constantList[ name ] );
+					break;
+				}
+				else
+					out( finalName );
+
+				break;
+
+			case Token.GETELEM :
+			case Token.DELPROP :
+			case Token.SETPROP :
+			case Token.SETELEM :
+			case Token.SETPROP_OP :
+			case Token.SETELEM_OP :
+				var owner = node.getFirstChild(),
+					prop = owner.getNext(),
+					ownerParenthesis = !!precedence[ owner.getType() ];
+
+				if ( type == Token.DELPROP )
+					out( 'delete ' );
+
+				if ( ownerParenthesis )
+					out( '(' );
+
+				writeNode( owner );
+
+				if ( ownerParenthesis )
+					out( ')' );
+
+				if ( prop.getType() == Token.STRING && !isReserved( prop.getString() ) && /^[a-zA-Z$_][\w$_]*$/.test( prop.getString() ) )
+				{
+					out( '.' );
+					out( prop.getString() );
+				}
+				else
+				{
+					out( '[' );
+					writeNode( prop );
+					out( ']' );
+				}
+
+				if ( type == Token.SETPROP || type == Token.SETELEM )
+				{
+					out( '=' );
+					writeNode( node.getLastChild() );
+				}
+
+				if ( type == Token.SETPROP_OP || type == Token.SETELEM_OP )
+				{
+					out( lang[ node.getLastChild().getType() ] );
+					out( '=' );
+					writeChildren( node.getLastChild() );
+				}
+				break;
+
+			case Token.IFNE :
+				out( 'if(' );
+				writeNode( node.getFirstChild() );
+				out( ')' );
+
+				var block = node.getNext(),
+					hasCurly = true;
+
+				hasCurly = ( !block || ( block.getType() == Token.BLOCK && block.getFirstChild() && block.getFirstChild().getNext() ) );
+
+				if ( hasCurly )
+					out( '{' );
+
+				writeNode( block );
+
+				if ( hasCurly )
+					out( '}' );
+
+				block = block.getNext();
+				if ( block.getType() == Token.GOTO )
+				{
+					out( 'else' );
+					block = block.getNext().getNext();
+
+					hasCurly = ( !block || ( block.getType() == Token.BLOCK && block.getFirstChild() && block.getFirstChild().getType() != Token.IFNE && block.getFirstChild().getNext() ) );
+
+					if ( hasCurly )
+						out( '{' );
+
+					writeNode( block );
+
+					if ( hasCurly )
+						out( '}' );
+				}
+
+				break;
+
+			case Token.IFEQ :
+				writeNode( node.getFirstChild() );
+				break;
+
+			case Token.STRING :
+				var value = String( node.getString() ),
+					singleParts = value.split( "'" ),
+					doubleParts = value.split( '"' );
+
+				value = value.replace( /[\n\r\t\\]/g, function( match )
+					{
+						var chars =
+						{
+							'\n' : '\\n',
+							'\r' : '\\r',
+							'\t' : '\\t',
+							'\\' : '\\\\'
+						};
+
+						return chars[ match ];
+					} );
+
+				if ( doubleParts.length > singleParts.length )
+					out( "'", value.replace( /'/g, "\\'" ), "'" );
+				else if ( singleParts.length > 1 )
+					out( '"', value.replace( /"/g, '\\"' ), '"' );
+				else
+					out( "'", value, "'" );
+				break;
+
+			case Token.NUMBER :
+				out( node.getDouble() );
+				break;
+
+			case Token.TRUE :
+				out( 'true' );
+				break;
+
+			case Token.FALSE :
+				out( 'false' );
+				break;
+
+			case Token.ARRAYLIT :
+				out( '[' );
+				var child = node.getFirstChild();
+				while( child )
+				{
+					if ( !writeNode( child ) )
+						break;
+
+					child = child.getNext();
+
+					if ( child )
+						out( ',' );
+				}
+				out( ']' );
+				break;
+
+			case Token.OBJECTLIT :
+				out( '{' );
+
+				var ids = node.getProp(Node.OBJECT_IDS_PROP),
+					counter = 0;
+
+				var child = node.getFirstChild();
+				while( child )
+				{
+					var id = ids[ counter++ ];
+
+					if ( isNaN( id ) && ( isReserved( id ) || !/^[a-zA-Z$_][\w$_]*$/.test( id ) ) )
+						out( "'", id, "'" );
+					else
+						out( id );
+
+					out( ':' );
+					if ( !writeNode( child ) )
+						break;
+
+					child = child.getNext();
+
+					if ( child )
+						out( ',' );
+				}
+
+				out( '}' );
+				break;
+
+			case Token.THIS :
+				// Replace "this" with a shorter name. Changes here must be
+				// reflected in the Token.FUNCTION case, which initialized the
+				// replacement variable.
+				if ( !scope.functionCount && scope.thisCount > 3 )
+					out( scope.getNewName( 'this' ) );
+				else
+					out( 'this' );
+				break;
+
+			case Token.NULL :
+				out( 'null' );
+				break;
+
+			case Token.CONTINUE :
+				out ( 'continue', ';' );
+				break;
+
+			case Token.RETURN :
+				var value = node.getFirstChild();
+
+				out( 'return' );
+
+				if ( value )
+					writeNode( value );
+
+				out( ';' );
+
+				break;
+
+			case Token.HOOK :
+				writeNode( node = node.getFirstChild() );
+				out( '?' );
+				writeNode( node = node.getNext() );
+				out( ':' );
+				writeNode( node.getNext() );
+				break;
+
+			case Token.REGEXP :
+				out( '/',
+					tree.getRegexpString( node.getExistingIntProp( Node.REGEXP_PROP ) ),
+					'/',
+					tree.getRegexpFlags( node.getExistingIntProp( Node.REGEXP_PROP ) ) );
+
+				break;
+
+			case Token.TRY :
+				// Get the "try" body.
+				var child = node.getFirstChild(),
+					finallyNode;
+
+				out( 'try{' );
+				writeNode( child );
+				out( '}' );
+
+				child = child.getNext();
+
+				// If a GOTO node is following it, then we have a "catch" block.
+				if ( child.getType() == Token.GOTO )
+				{
+					// The catch definition is 2 steps later (LOCAL_BLOCK node).
+					child = child.getNext().getNext();
+
+					var catchScopeVar = child.getFirstChild().getFirstChild().getString(),
+						overrideLocal = !!scope.names[ catchScopeVar ];
+
+					if ( !overrideLocal )
+						scope.names[ catchScopeVar ] = scope.declaredNames[ catchScopeVar ] = scope.getNewName( catchScopeVar, true, true );
+
+					out( 'catch(' );
+					// Send the catch scope (CATCH_SCOPE).
+					writeNode( child.getFirstChild().getFirstChild() );
+					out( '){' );
+
+					// Because of the scope, the catch block is in a much deeper node.
+					writeNode( child.getFirstChild().getNext().getFirstChild().getNext().getFirstChild() );
+
+					if ( !overrideLocal )
+						scope.names[ catchScopeVar ] = scope.declaredNames[ catchScopeVar ] = null;
+
+					out( '}' );
+				}
+
+				while ( child )
+				{
+					if ( child.getType() == Token.FINALLY )
+					{
+						out( 'finally{' );
+						writeNode( child.getFirstChild() );
+						out( '}' );
+						break;
+					}
+					child = child.getNext();
+				}
+
+				break;
+
+			case Token.THROW :
+				out( 'throw ' );
+				writeNode( node.getFirstChild() );
+				out( ';' );
+				break;
+
+			case Token.VOID :
+				out( 'void(' );
+				writeChildren( node );
+				out( ')' );
+				break;
+
+			case Token.INSTANCEOF :
+				writeNode( node.getFirstChild() );
+				out( ' instanceof ' );
+				writeNode( node.getLastChild() );
+				break;
+
+			case Token.TYPEOFNAME :
+				out( 'typeof ', scope.getNewName( node.getString() ) );
+				break;
+
+			case Token.TYPEOF :
+			case Token.NOT :
+			case Token.BITNOT :
+			case Token.POS :
+			case Token.NEG :
+				var child = node.getFirstChild();
+				var parenthesis = ( precedence[ type ] < ( precedence[ child.getType() ] || 0 ) );
+
+				out( lang[ type ] );
+
+				if ( parenthesis )
+					out( '(' );
+
+				writeNode( child );
+
+				if ( parenthesis )
+					out( ')' );
+
+				break;
+
+			case Token.MUL :
+			case Token.DIV :
+			case Token.MOD :
+			case Token.ADD :
+			case Token.SUB :
+			case Token.RSH :
+			case Token.LSH :
+			case Token.URSH :
+			case Token.LT :
+			case Token.LE :
+			case Token.GT :
+			case Token.GE :
+			case Token.EQ :
+			case Token.NE :
+			case Token.SHEQ :
+			case Token.SHNE :
+			case Token.BITAND :
+			case Token.BITXOR :
+			case Token.BITOR :
+			case Token.AND :
+			case Token.OR :
+			case Token.COMMA :
+				var left = node.getFirstChild(),
+					right = node.getLastChild(),
+					parenthesis;
+
+				// Check the operator precedence, to properly isolate things on
+				// parenthesis.
+				parenthesis = ( precedence[ type ] < ( precedence[ left.getType() ] || 0 ) );
+
+				if ( parenthesis )
+					out( '(' );
+
+				// The left side.
+				writeNode( left );
+
+				if ( parenthesis )
+					out( ')' );
+
+				// The operator.
+				out( lang[ type ] );
+
+				// The right side.
+				parenthesis = ( precedence[ type ] < ( precedence[ right.getType() ] || 0 ) );
+
+				if ( parenthesis )
+					out( '(' );
+
+				writeNode( right );
+
+				if ( parenthesis )
+					out( ')' );
+
+				break;
+
+			case Token.INC :
+			case Token.DEC :
+				var post = ( node.getExistingIntProp(Node.INCRDECR_PROP) & Node.POST_FLAG ) != 0,
+					str = type == Token.INC ? '++' : '--';
+
+				if ( !post )
+					out( str );
+
+				out.checkSpace = false;
+
+				writeNode( node.getFirstChild() );
+
+				if ( post )
+					out( str );
+
+				out.checkSpace = true;
+				break;
+
+			case Token.GOTO:
+			case Token.EMPTY:
+			case Token.LEAVEWITH:		// TRY
+			case Token.USE_STACK:		// SETPROP_OP
+				break;
+
+			default :
+				print( 'WARNING: Unknown token ' + GetTokenName( type ) );
+				break;
+		}
+
+		return true;
+	};
+
+	var writeChildren = function( node )
+	{
+		node = node.getFirstChild()
+
+		while ( node )
+		{
+			if ( !writeNode( node ) )
+				break;
+
+			node = node.getNext();
+		}
+	};
+
+	var regexLib =
+	{
+		packagerRemove : Pattern.compile( '(?m-s:^.*?@Packager\.Remove\.Start).*?(?m-s:@Packager\.Remove\.End.*?$\n?)', Pattern.DOTALL ),
+		packagerRemoveLine : Pattern.compile( '^.*@Packager\.RemoveLine.*$\n?', Pattern.MULTILINE )
+	};
+
+	var preProcess = function( script )
+	{
+		// Protect IE conditional comments. We are doing it in a way that works
+		// for CKEditor, but this is not a generic solution.
+		script = script.replace( /\/\*@([\s\S]+?)@\*\/(?:)/g, function( match, contents )
+			{
+				return 'CKPACKAGER_COND_COMMENT("' + encodeURIComponent( contents ) + '")||'
+			});
+
+		// The Java regex here is much faster.
+		script = String( regexLib.packagerRemove.matcher( script ).replaceAll( '' ) );
+//		script = script.replace( /[^\r\n]*@Packager\.Remove\.Start[\s\S]*?@Packager\.Remove\.End[^\r\n]*/g, '' );
+
+		// The Java regex makes no much difference here instead, but for
+		// consistense let's use it again.
+		script = String( regexLib.packagerRemoveLine.matcher( script ).replaceAll( '' ) );
+//		script = script.replace( /^.*@Packager\.RemoveLine.*/gm, '' );
+
+		return script;
+	};
+
+	var postProcess = function( script )
+	{
+		script = script.replace( /CKPACKAGER_COND_COMMENT\(["']([\s\S]+?)["']\)\|\|/g, function( match, contents )
+			{
+				return '/*@' + decodeURIComponent( contents ) + '@*/'
+			});
+
+		return script;
+	};
+
+	CKPACKAGER.scriptCompressor =
+	{
+		compress : function( script, renameGlobals, constants, noCheck )
+		{
+			script = preProcess( script );
+
+			// Reset.
+			scope = null;
+			tree = null;
+			lastWasVar = false;
+			ignoreSiblings = false;
+			isLoop = false;
+
+			var compilerEnv = new CompilerEnvirons(),
+				errorReporter = compilerEnv.getErrorReporter(),
+				parser = new Parser(compilerEnv, errorReporter),
+				scriptNode = parser.parse( script, null, 1 );
+
+			noGlobals = !renameGlobals;
+			constantList = constants || {};
+
+			// Reset the output.
+			output = [];
+			outputSize = 0;
+
+			// Start writting the "script" node.
+			writeNode( scriptNode );
+
+			var compressed = output.join( '' );
+
+			compressed = postProcess( compressed );
+
+			/*
+			print( '' );
+			print( compressed );
+			*/
+
+			// Try to parse the compressed results. If the resulting script is
+			// not valid, an error will be thrown here.
+
+			if ( !noCheck )
+			{
+				print( '' );
+				print( '    Checking compressed code...' );
+				parser.parse( compressed/*.replace( /;/g, ';\n' )*/, null, 1 );
+			}
+
+			return compressed;
+		}
+	}
+})();
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/token.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/token.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/includes/token.js	(revision 2366)
@@ -0,0 +1,264 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+function GetTokenName( token )
+{
+    switch ( token )
+    {
+      case Token.ERROR:           return "ERROR";
+      case Token.EOF:             return "EOF";
+      case Token.EOL:             return "EOL";
+      case Token.ENTERWITH:       return "ENTERWITH";
+      case Token.LEAVEWITH:       return "LEAVEWITH";
+      case Token.RETURN:          return "RETURN";
+      case Token.GOTO:            return "GOTO";
+      case Token.IFEQ:            return "IFEQ";
+      case Token.IFNE:            return "IFNE";
+      case Token.SETNAME:         return "SETNAME";
+      case Token.BITOR:           return "BITOR";
+      case Token.BITXOR:          return "BITXOR";
+      case Token.BITAND:          return "BITAND";
+      case Token.EQ:              return "EQ";
+      case Token.NE:              return "NE";
+      case Token.LT:              return "LT";
+      case Token.LE:              return "LE";
+      case Token.GT:              return "GT";
+      case Token.GE:              return "GE";
+      case Token.LSH:             return "LSH";
+      case Token.RSH:             return "RSH";
+      case Token.URSH:            return "URSH";
+      case Token.ADD:             return "ADD";
+      case Token.SUB:             return "SUB";
+      case Token.MUL:             return "MUL";
+      case Token.DIV:             return "DIV";
+      case Token.MOD:             return "MOD";
+      case Token.NOT:             return "NOT";
+      case Token.BITNOT:          return "BITNOT";
+      case Token.POS:             return "POS";
+      case Token.NEG:             return "NEG";
+      case Token.NEW:             return "NEW";
+      case Token.DELPROP:         return "DELPROP";
+      case Token.TYPEOF:          return "TYPEOF";
+      case Token.GETPROP:         return "GETPROP";
+      case Token.GETPROPNOWARN:   return "GETPROPNOWARN";
+      case Token.SETPROP:         return "SETPROP";
+      case Token.GETELEM:         return "GETELEM";
+      case Token.SETELEM:         return "SETELEM";
+      case Token.CALL:            return "CALL";
+      case Token.NAME:            return "NAME";
+      case Token.NUMBER:          return "NUMBER";
+      case Token.STRING:          return "STRING";
+      case Token.NULL:            return "NULL";
+      case Token.THIS:            return "THIS";
+      case Token.FALSE:           return "FALSE";
+      case Token.TRUE:            return "TRUE";
+      case Token.SHEQ:            return "SHEQ";
+      case Token.SHNE:            return "SHNE";
+      case Token.REGEXP:          return "REGEXP";
+      case Token.BINDNAME:        return "BINDNAME";
+      case Token.THROW:           return "THROW";
+      case Token.RETHROW:         return "RETHROW";
+      case Token.IN:              return "IN";
+      case Token.INSTANCEOF:      return "INSTANCEOF";
+      case Token.LOCAL_LOAD:      return "LOCAL_LOAD";
+      case Token.GETVAR:          return "GETVAR";
+      case Token.SETVAR:          return "SETVAR";
+      case Token.CATCH_SCOPE:     return "CATCH_SCOPE";
+      case Token.ENUM_INIT_KEYS:  return "ENUM_INIT_KEYS";
+      case Token.ENUM_INIT_VALUES:return "ENUM_INIT_VALUES";
+      case Token.ENUM_INIT_ARRAY: return "ENUM_INIT_ARRAY";
+      case Token.ENUM_NEXT:       return "ENUM_NEXT";
+      case Token.ENUM_ID:         return "ENUM_ID";
+      case Token.THISFN:          return "THISFN";
+      case Token.RETURN_RESULT:   return "RETURN_RESULT";
+      case Token.ARRAYLIT:        return "ARRAYLIT";
+      case Token.OBJECTLIT:       return "OBJECTLIT";
+      case Token.GET_REF:         return "GET_REF";
+      case Token.SET_REF:         return "SET_REF";
+      case Token.DEL_REF:         return "DEL_REF";
+      case Token.REF_CALL:        return "REF_CALL";
+      case Token.REF_SPECIAL:     return "REF_SPECIAL";
+      case Token.DEFAULTNAMESPACE:return "DEFAULTNAMESPACE";
+      case Token.ESCXMLTEXT:      return "ESCXMLTEXT";
+      case Token.ESCXMLATTR:      return "ESCXMLATTR";
+      case Token.REF_MEMBER:      return "REF_MEMBER";
+      case Token.REF_NS_MEMBER:   return "REF_NS_MEMBER";
+      case Token.REF_NAME:        return "REF_NAME";
+      case Token.REF_NS_NAME:     return "REF_NS_NAME";
+      case Token.TRY:             return "TRY";
+      case Token.SEMI:            return "SEMI";
+      case Token.LB:              return "LB";
+      case Token.RB:              return "RB";
+      case Token.LC:              return "LC";
+      case Token.RC:              return "RC";
+      case Token.LP:              return "LP";
+      case Token.RP:              return "RP";
+      case Token.COMMA:           return "COMMA";
+      case Token.ASSIGN:          return "ASSIGN";
+      case Token.ASSIGN_BITOR:    return "ASSIGN_BITOR";
+      case Token.ASSIGN_BITXOR:   return "ASSIGN_BITXOR";
+      case Token.ASSIGN_BITAND:   return "ASSIGN_BITAND";
+      case Token.ASSIGN_LSH:      return "ASSIGN_LSH";
+      case Token.ASSIGN_RSH:      return "ASSIGN_RSH";
+      case Token.ASSIGN_URSH:     return "ASSIGN_URSH";
+      case Token.ASSIGN_ADD:      return "ASSIGN_ADD";
+      case Token.ASSIGN_SUB:      return "ASSIGN_SUB";
+      case Token.ASSIGN_MUL:      return "ASSIGN_MUL";
+      case Token.ASSIGN_DIV:      return "ASSIGN_DIV";
+      case Token.ASSIGN_MOD:      return "ASSIGN_MOD";
+      case Token.HOOK:            return "HOOK";
+      case Token.COLON:           return "COLON";
+      case Token.OR:              return "OR";
+      case Token.AND:             return "AND";
+      case Token.INC:             return "INC";
+      case Token.DEC:             return "DEC";
+      case Token.DOT:             return "DOT";
+      case Token.FUNCTION:        return "FUNCTION";
+      case Token.EXPORT:          return "EXPORT";
+      case Token.IMPORT:          return "IMPORT";
+      case Token.IF:              return "IF";
+      case Token.ELSE:            return "ELSE";
+      case Token.SWITCH:          return "SWITCH";
+      case Token.CASE:            return "CASE";
+      case Token.DEFAULT:         return "DEFAULT";
+      case Token.WHILE:           return "WHILE";
+      case Token.DO:              return "DO";
+      case Token.FOR:             return "FOR";
+      case Token.BREAK:           return "BREAK";
+      case Token.CONTINUE:        return "CONTINUE";
+      case Token.VAR:             return "VAR";
+      case Token.WITH:            return "WITH";
+      case Token.CATCH:           return "CATCH";
+      case Token.FINALLY:         return "FINALLY";
+      case Token.VOID:            return "VOID";
+      case Token.RESERVED:        return "RESERVED";
+      case Token.EMPTY:           return "EMPTY";
+      case Token.BLOCK:           return "BLOCK";
+      case Token.LABEL:           return "LABEL";
+      case Token.TARGET:          return "TARGET";
+      case Token.LOOP:            return "LOOP";
+      case Token.EXPR_VOID:       return "EXPR_VOID";
+      case Token.EXPR_RESULT:     return "EXPR_RESULT";
+      case Token.JSR:             return "JSR";
+      case Token.SCRIPT:          return "SCRIPT";
+      case Token.TYPEOFNAME:      return "TYPEOFNAME";
+      case Token.USE_STACK:       return "USE_STACK";
+      case Token.SETPROP_OP:      return "SETPROP_OP";
+      case Token.SETELEM_OP:      return "SETELEM_OP";
+      case Token.LOCAL_BLOCK:     return "LOCAL_BLOCK";
+      case Token.SET_REF_OP:      return "SET_REF_OP";
+      case Token.DOTDOT:          return "DOTDOT";
+      case Token.COLONCOLON:      return "COLONCOLON";
+      case Token.XML:             return "XML";
+      case Token.DOTQUERY:        return "DOTQUERY";
+      case Token.XMLATTR:         return "XMLATTR";
+      case Token.XMLEND:          return "XMLEND";
+      case Token.TO_OBJECT:       return "TO_OBJECT";
+      case Token.TO_DOUBLE:       return "TO_DOUBLE";
+      case Token.GET:             return "GET";
+      case Token.SET:             return "SET";
+      case Token.LET:             return "LET";
+      case Token.YIELD:           return "YIELD";
+      case Token.CONST:           return "CONST";
+      case Token.SETCONST:        return "SETCONST";
+      case Token.ARRAYCOMP:       return "ARRAYCOMP";
+      case Token.WITHEXPR:        return "WITHEXPR";
+      case Token.LETEXPR:         return "LETEXPR";
+      case Token.DEBUGGER:        return "DEBUGGER";
+    }
+
+    return '??? ' + token;
+}
+
+/*
+	The following tokens are not managed by the compressor.
+
+          case ERROR:           return "ERROR";
+          case EOF:             return "EOF";
+          case EOL:             return "EOL";
+          case GETPROPNOWARN:   return "GETPROPNOWARN";
+          case RETHROW:         return "RETHROW";
+          case IN:              return "IN";
+          case INSTANCEOF:      return "INSTANCEOF";
+          case LOCAL_LOAD:      return "LOCAL_LOAD";
+          case GETVAR:          return "GETVAR";
+          case SETVAR:          return "SETVAR";
+          case ENUM_INIT_KEYS:  return "ENUM_INIT_KEYS";
+          case ENUM_INIT_VALUES:return "ENUM_INIT_VALUES";
+          case ENUM_INIT_ARRAY: return "ENUM_INIT_ARRAY";
+          case ENUM_NEXT:       return "ENUM_NEXT";
+          case ENUM_ID:         return "ENUM_ID";
+          case THISFN:          return "THISFN";
+          case RETURN_RESULT:   return "RETURN_RESULT";
+          case GET_REF:         return "GET_REF";
+          case SET_REF:         return "SET_REF";
+          case DEL_REF:         return "DEL_REF";
+          case REF_CALL:        return "REF_CALL";
+          case REF_SPECIAL:     return "REF_SPECIAL";
+          case DEFAULTNAMESPACE:return "DEFAULTNAMESPACE";
+          case ESCXMLTEXT:      return "ESCXMLTEXT";
+          case ESCXMLATTR:      return "ESCXMLATTR";
+          case REF_MEMBER:      return "REF_MEMBER";
+          case REF_NS_MEMBER:   return "REF_NS_MEMBER";
+          case REF_NAME:        return "REF_NAME";
+          case REF_NS_NAME:     return "REF_NS_NAME";
+          case SEMI:            return "SEMI";
+          case LB:              return "LB";
+          case RB:              return "RB";
+          case LC:              return "LC";
+          case RC:              return "RC";
+          case LP:              return "LP";
+          case RP:              return "RP";
+          case ASSIGN:          return "ASSIGN";
+          case ASSIGN_BITOR:    return "ASSIGN_BITOR";
+          case ASSIGN_BITXOR:   return "ASSIGN_BITXOR";
+          case ASSIGN_BITAND:   return "ASSIGN_BITAND";
+          case ASSIGN_LSH:      return "ASSIGN_LSH";
+          case ASSIGN_RSH:      return "ASSIGN_RSH";
+          case ASSIGN_URSH:     return "ASSIGN_URSH";
+          case ASSIGN_ADD:      return "ASSIGN_ADD";
+          case ASSIGN_SUB:      return "ASSIGN_SUB";
+          case ASSIGN_MUL:      return "ASSIGN_MUL";
+          case ASSIGN_DIV:      return "ASSIGN_DIV";
+          case ASSIGN_MOD:      return "ASSIGN_MOD";
+          case COLON:           return "COLON";
+          case DOT:             return "DOT";
+          case EXPORT:          return "EXPORT";
+          case IMPORT:          return "IMPORT";
+          case IF:              return "IF";
+          case ELSE:            return "ELSE";
+          case DEFAULT:         return "DEFAULT";
+          case WHILE:           return "WHILE";
+          case DO:              return "DO";
+          case FOR:             return "FOR";
+          case WITH:            return "WITH";
+          case RESERVED:        return "RESERVED";
+          case EMPTY:           return "EMPTY";
+          case LABEL:           return "LABEL";
+          case JSR:             return "JSR";
+          case USE_STACK:       return "USE_STACK";
+          case SETPROP_OP:      return "SETPROP_OP";
+          case SETELEM_OP:      return "SETELEM_OP";
+          case LOCAL_BLOCK:     return "LOCAL_BLOCK";
+          case SET_REF_OP:      return "SET_REF_OP";
+          case DOTDOT:          return "DOTDOT";
+          case COLONCOLON:      return "COLONCOLON";
+          case XML:             return "XML";
+          case DOTQUERY:        return "DOTQUERY";
+          case XMLATTR:         return "XMLATTR";
+          case XMLEND:          return "XMLEND";
+          case TO_OBJECT:       return "TO_OBJECT";
+          case TO_DOUBLE:       return "TO_DOUBLE";
+          case GET:             return "GET";
+          case SET:             return "SET";
+          case LET:             return "LET";
+          case YIELD:           return "YIELD";
+          case CONST:           return "CONST";
+          case SETCONST:        return "SETCONST";
+          case ARRAYCOMP:       return "ARRAYCOMP";
+          case WITHEXPR:        return "WITHEXPR";
+          case LETEXPR:         return "LETEXPR";
+          case DEBUGGER:        return "DEBUGGER";
+*/
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.bat
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.bat	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.bat	(revision 2366)
@@ -0,0 +1,8 @@
+:: Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+:: For licensing, see LICENSE.html or http://ckeditor.com/license
+
+@ECHO OFF
+CLS
+ECHO.
+
+java -jar ../js.jar -opt -1 ../ckpackager.js -test
Index: /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.js
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.js	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/ckpackager/test/test.js	(revision 2366)
@@ -0,0 +1,303 @@
+/*
+Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+CKPACKAGER.loadCode( 'includes/scriptcompressor.js' );
+
+(function()
+{
+	var autoTests =
+	[
+		[	"var a=1;" ],
+
+		[	"var a=1;var b=2;",
+			"var a=1,b=2;" ],
+
+		[	"var var1 = var1, var2 = var1;",
+			"var a=var1,b=a;" ],
+
+		[	"function Test( param ) { var myVar = 1; return myVar + param; }; Test( 'Sample' );",
+			"function a(b){var c=1;return c+b;};a('Sample');" ],
+
+		[	"var result = 6 * 10 / 3 + 4;",
+			"var a=24;" ],
+
+		[	"var sum = 1 + 2 + Math['P' + String('I')] - Math.E;",
+			"var a=3+Math['P'+String('I')]-Math.E;" ],
+
+		[	"var sum = ( a + b ) - ( c * ( d - e ) );",
+			"var a=a+b-c*(d-e);" ],
+
+		[	"var str = '\"Tiger\", \"Lion\" ' + \"& 'Cat'\";",
+			"var a='\"Tiger\", \"Lion\" & \\'Cat\\'';" ],
+
+		[	"var str = \"'Tiger', 'Lion' \" + '& \"Cat\"';",
+			"var a=\"'Tiger', 'Lion' & \\\"Cat\\\"\";" ],
+
+		[	"var funs = fun() + fun1( a ) + fun2( a + b, c );",
+			"var a=fun()+fun1(a)+fun2(a+b,c);" ],
+
+		[	"var a,b,c;if(a)go();" ],
+
+		[	"if(a){go1();go2();}" ],
+
+		[	"if(a){go();}",
+			"if(a)go();" ],
+
+		[	"if((a=1))go();",
+			"if(a=1)go();" ],
+
+		[	"if(a){if(b)go();}",
+			"if(a)if(b)go();" ],
+
+		[	"while(a=1){go();break;}" ],
+
+		[	"while(a=1)go();" ],
+
+		[	"while(a=1){go();}",
+			"while(a=1)go();" ],
+
+		[	"while(a=1){go1();continue;go2();}",
+			"while(a=1){go1();}" ],
+
+		[	"while(a=1){go1();continue;go2();function go1(){go();};}",
+			"while(a=1){a();function a(){go();};}" ],
+
+		[	"do{go1();go2();}while(e)" ],
+
+		[	"do{go();}while(e)",
+			"do go();while(e)" ],
+
+		[	"for(var i=0,len=ar.length;i<len;i++){go1();go2();}",
+			"for(var a=0,b=ar.length;a<b;a++){go1();go2();}" ],
+
+		[	"for(var i=0,len=ar.length;i<len;i++){go();}",
+			"for(var a=0,b=ar.length;a<b;a++)go();" ],
+
+		[	"for(var o in obj.prop){go1();go2();}",
+			"for(var a in obj.prop){go1();go2();}" ],
+
+		[	"for(var o in obj.prop){go()}",
+			"for(var a in obj.prop)go();" ],
+
+		[	"for(o in obj.prop)go();" ],
+
+		[	"for(;;i++){}" ],
+
+		[	"for(;;){}" ],
+
+		[	"while(true){go();}",
+			"for(;;)go();" ],
+
+		[	"for(;a;){}",
+			"while(a){}" ],
+
+		[	"for(;q;++q){}" ],
+
+		[	"for(var a=b.length-1;a>=0;a--){}" ],
+
+		[	"if(true){go();}",
+			"go();" ],
+
+		[	"if(c==false)go();" ],
+
+		[	"if(c===true)go();" ],
+
+		[	"if(e)go1();else go2();" ],
+
+		[	"a&b;a&&b;" ],
+
+		[	"a+=10;a&=10;" ],
+
+		[	"a=b-14;a=b+1;" ],
+
+		[	"a>>b;a<<b;a>>>b;" ],
+
+		[	"a=a+2;b=b+2;c=c/3;d=d*4;",
+			"a+=2;b+=2;c/=3;d*=4;" ],
+
+		[	"typeof v=='string';" ],
+
+		[	"delete a.b.c;" ],
+
+		[	"new OBJ.clazz('Test',15);" ],
+
+		[	"new clazz();" ],
+
+		[	"var a=new Array();",
+			"var a=[];" ],
+
+		[	"var a=new Array(2);" ],
+
+		[	"var a=new Array(2,'fred');",
+			"var a=[2,'fred'];" ],
+
+		[	"var a=new Array(b);",
+			"var a=[b];" ],
+
+		[	"var a=new Object();",
+			"var a={};" ],
+
+		[	"var a=new Object(2);" ],
+
+		[	"if(a)b();else if(c)d();else e();" ],
+
+		[	"A.B.C=3;" ],
+
+		[	"A.B['C']=3;",
+			"A.B.C=3;" ],
+
+		[	"A.B['C'+a]=3;" ],
+
+		[	"var o={a:{b:function(){o;}}};",
+			"var a={a:{b:function(){a;}}};" ],
+
+		[	"var a=[1,2,'Fred'];" ],
+
+		[	"function(A,B,C){var D=A+B,E=C+1;return D+E;}",
+			"function(a,b,c){var d=a+b,e=c+1;return d+e;}" ],
+
+		[	"function(){return;go();}",
+			"function(){}" ],
+
+		[	"function(){go();return;}",
+			"function(){go();}" ],
+
+		[	"function(){function A(B,C){var D=B+C;return D;};}",
+			"function(){function a(b,c){var d=b+c;return d;};}" ],
+
+		[	"function(){}" ],
+
+		[	"switch(A){case 'A':go1();break;case 'B':go2();default:go3();}" ],
+
+		[	"var a,x,y,r=10;with(Math){a=PI*r*r;x=r*cos(PI);y=r*sin(E/2);}",
+			"var a,b,c,d=10;with{Math){a=PI*d*d;b=d*cos(PI);c=d*sin(E/2);}" ],
+
+		[	"(function(A){go(A);})('Test');",
+			"(function(a){go(a);})('Test');" ],
+
+		[	"x=a?b:c;" ],
+
+		[	"a=++c+d-- - --d;" ],
+
+		[	"a=/AA\s*/gi;" ],
+
+		[	"is=/AA\s*/gi.test('Test');" ],
+
+		[	"s='Test1 ' +\n'& \\\nTest2';",
+			"s='Test1 & Test2';" ],
+
+		[	"x=null;" ],
+
+		[	"try{go();}catch(e){throw 'Test';}",
+			"try{go();}catch(a){throw 'Test';}" ],
+
+		[	"try{go();}finally{go2();}" ],
+
+		[	"try{go();}catch(e){throw e;}finally{go2();}",
+			"try{go();}catch(a){throw a;}finally{go2();}" ],
+
+		[	"a=-c;" ],
+
+		[	"b=+c;" ],
+
+		[	"a=!(b+c);" ],
+
+		[	"typeof a+b;" ],
+
+		[	"x+=y;x-=y;x*=y;x/=y;x%=y;x<<=y;x>>=y;x>>>=y;x&=y;x^=y;x|=y;" ],
+
+		[	"x=void(0);" ],
+
+		[	"x=\"\\nFred\\t\\tKami's \\\\Edu \\r\\n\";" ],
+
+		[	"function(){this.a();this.b();this.c();}" ],
+
+		[	"function(){this.a();this.b();this.c();this.d();}",
+			"function(){var a=this;a.a();a.b();a.c();a.d();}" ],
+
+		[	"ie=/*@cc_on!@*/false;" ],
+
+		[	"(this.a||(this.a={})).b={};" ],
+
+		[	"while(a){if(b)continue;go();}" ],
+
+		[	"function(a){if(b)return;go();}" ],
+
+		[	"a||(a=b);"],
+
+		[	"obj instanceof claz;" ],
+
+		[	"o={prop1:1,1:'Fred','var':'Reserved','#':'XYZ','do-it':1};" ],
+
+		[	"o['#']['var']=1;" ],
+
+		[	"a.b+=1;" ],
+
+		[	"(a?b:c).go();" ]
+	];
+
+	var tests =
+	{
+	};
+
+	////////////////////////////////////////////////
+
+	function assertEquals( expected, actual )
+	{
+		if ( expected != actual )
+		{
+			var error =
+			{
+				expected : expected,
+				actual : actual
+			}
+
+			throw error;
+		}
+	}
+
+	// Create the auto tests.
+	function createAutoTest( counter, source, expected )
+	{
+		tests[ 'autoTest' + ( counter + 1000 ).toString().substr( 1 ) ] = function()
+		{
+			assertEquals( expected || source, CKPACKAGER.scriptCompressor.compress( source, true, null, true ) );
+		};
+	}
+
+	for ( var i = 0 ; i < autoTests.length ; i++ )
+	{
+		var autoTest = autoTests[ i ];
+		createAutoTest( i+1, autoTest[ 0 ], autoTest[ 1 ] );
+	}
+
+	// Run tests.
+	var passCount = 0,
+		failCount = 0;
+	for ( var test in tests )
+	{
+		try
+		{
+			tests[ test ]();
+			print( 'PASSED: ' + test );
+			passCount++;
+		}
+		catch ( error )
+		{
+			print( 'FAILED: ' + test );
+
+			if ( !error.expected )
+				throw error;
+
+			print( '  Expected: ' + error.expected );
+			print( '  Actual  : ' + error.actual );
+
+			failCount++;
+		}
+	}
+
+	print( '' );
+	print( 'Finished: ' + passCount + ' passed / ' + failCount + ' failed' );
+})();
Index: /CKEditor/branches/prototype/_dev/packager/package_2.bat
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/package_2.bat	(revision 2366)
+++ /CKEditor/branches/prototype/_dev/packager/package_2.bat	(revision 2366)
@@ -0,0 +1,7 @@
+:: Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.
+:: For licensing, see LICENSE.html or http://ckeditor.com/license
+
+@ECHO OFF
+CLS
+
+java -jar ckpackager/js.jar -opt -1 ckpackager/ckpackager.js ../../ckeditor.pack
Index: /CKEditor/branches/prototype/_dev/packager/packagefilegen.html
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/packagefilegen.html	(revision 2365)
+++ /CKEditor/branches/prototype/_dev/packager/packagefilegen.html	(revision 2366)
@@ -26,4 +26,10 @@
 	//<![CDATA[
 
+// Firebug has been presented some bugs with console. It must be "initialized"
+// before the page load to work.
+// FIXME: Remove the following in the future, if Firebug gets fixed.
+if ( typeof console != 'undefined' )
+	console.log();
+
 function generate()
 {
@@ -36,5 +42,13 @@
 	output.value = document.getElementById( 'header' ).value + '\r\n\r\n';
 
+	var output2 = document.getElementById( 'output_ckpackager' );
+	output2.value = document.getElementById( 'header_ckpackager' ).value + '\r\n\r\n';
+
 	output.value += '\t<Constants removeDeclaration="false">\r\n';
+	output2.value +=
+		''		+	'constants :'	+ '\r\n' +
+		'\t'	+		'{'			+ '\r\n';
+
+	var hasConst = false;
 
 	for ( var prop in CKEDITOR )
@@ -42,7 +56,19 @@
 		var typeOfProp = typeof CKEDITOR[ prop ];
 		if ( /^[A-Z\d$_]+$/.test( prop ) && typeOfProp != 'object' && typeOfProp != 'function' && typeOfProp != 'undefined' )
+		{
+			if ( hasConst )
+				output2.value += ',\r\n';
+			else
+				hasConst = true;
 			output.value += '\t\t<Constant name="CKEDITOR.' + prop + '" value="' + CKEDITOR[ prop ] + '" />\r\n';
+			output2.value += '\t\t\'CKEDITOR.' + prop + '\' : ' + CKEDITOR[ prop ];
+		}
 	}
+
+	output2.value += '\r\n';
+
 	output.value += '\t</Constants>\r\n\r\n';
+	output2.value +=
+		'\t'	+		'},'		+ '\r\n\r\n';
 
 	output.value += document.getElementById( 'basic' ).contentDocument.getElementById( 'output' ).value + '\r\n';
@@ -51,5 +77,16 @@
 	output.value += '</Package>\r\n';
 
+	output2.value +=
+		''		+	'packages :'	+ '\r\n' +
+		'\t'	+		'['			+ '\r\n';
+
+	output2.value += document.getElementById( 'basic' ).contentDocument.getElementById( 'output_ckpackager' ).value + '\r\n';
+	output2.value += document.getElementById( 'full' ).contentDocument.getElementById( 'output_ckpackager' ).value + '\r\n';
+
+	output2.value +=
+		'\t'	+		']'			+ '\r\n';
+
 	output.style.display = '';
+	output2.style.display = '';
 }
 
@@ -63,5 +100,8 @@
 		</p>
 		<p>
-			<textarea id="output" cols="80" rows="30" style="width: 100%; display: none"></textarea>
+			<textarea id="output" cols="80" rows="15" style="width: 100%; display: none"></textarea>
+		</p>
+		<p>
+			<textarea id="output_ckpackager" cols="80" rows="15" style="width: 100%; display: none"></textarea>
 		</p>
 		<iframe id="basic" src="packagefilegen_basic.html" style="position: absolute; left: -1000px">
@@ -113,4 +153,16 @@
  */
 ]]&gt;&lt;/Header&gt;</textarea>
+		<textarea id="header_ckpackager" cols="80" rows="10" style="display: none">/*
+ * CKPackager - Sample Package file
+ */
+
+header :
+	'/*'																		+ '\n' +
+	'Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.'	+ '\n' +
+	'For licensing, see LICENSE.html or http://ckeditor.com/license'			+ '\n' +
+	'*/'																		+ '\n' +
+	'\n',
+
+noCheck : false,</textarea>
 	</form>
 </body>
Index: /CKEditor/branches/prototype/_dev/packager/packagefilegen_basic.html
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/packagefilegen_basic.html	(revision 2365)
+++ /CKEditor/branches/prototype/_dev/packager/packagefilegen_basic.html	(revision 2366)
@@ -27,4 +27,10 @@
 	//<![CDATA[
 
+// Firebug has been presented some bugs with console. It must be "initialized"
+// before the page load to work.
+// FIXME: Remove the following in the future, if Firebug gets fixed.
+if ( typeof console != 'undefined' )
+	console.log();
+
 var downloaded = [];
 
@@ -37,7 +43,15 @@
 {
 	var output = document.getElementById( 'output' );
+	var output2 = document.getElementById( 'output_ckpackager' );
+
 	output.value = '\t<PackageFile path="ckeditor_basic.js">\r\n';
+	output2.value =
+		'\t\t'		+	'{'										+ '\r\n' +
+		'\t\t\t'	+		'output : \'ckeditor_basic.js\','	+ '\r\n' +
+		'\t\t\t'	+		'files :'							+ '\r\n' +
+		'\t\t\t\t'	+			'['								+ '\r\n';
 
-	var appendedFiles = {};
+	var appendedFiles = {},
+		hasFile = false;
 	var appendFile = function( filePath )
 	{
@@ -47,5 +61,11 @@
 		appendedFiles[ filePath ] = true;
 
+		if ( hasFile )
+			output2.value += ',\r\n';
+		else
+			hasFile = true;
+
 		output.value += '\t\t<File path="' + filePath + '" />\r\n';
+		output2.value += '\t\t\t\t\t\'' + filePath + '\'';
 	};
 
@@ -68,7 +88,13 @@
 	}
 
+	output2.value += '\r\n';
+
 	output.value += '\t</PackageFile>\r\n';
+	output2.value +=
+		'\t\t\t\t'	+			']'								+ '\r\n' +
+		'\t\t'		+	'},'									+ '\r\n';
 
 	output.style.display = '';
+	output2.style.display = '';
 }
 
@@ -83,4 +109,7 @@
 		<textarea id="output" rows="10" cols="80" style="width: 100%; display: none"></textarea>
 	</p>
+	<p>
+		<textarea id="output_ckpackager" rows="10" cols="80" style="width: 100%; display: none"></textarea>
+	</p>
 </body>
 </html>
Index: /CKEditor/branches/prototype/_dev/packager/packagefilegen_full.html
===================================================================
--- /CKEditor/branches/prototype/_dev/packager/packagefilegen_full.html	(revision 2365)
+++ /CKEditor/branches/prototype/_dev/packager/packagefilegen_full.html	(revision 2366)
@@ -27,4 +27,10 @@
 	//<![CDATA[
 
+// Firebug has been presented some bugs with console. It must be "initialized"
+// before the page load to work.
+// FIXME: Remove the following in the future, if Firebug gets fixed.
+if ( typeof console != 'undefined' )
+	console.log();
+
 var downloaded = [];
 
@@ -37,8 +43,16 @@
 {
 	var output = document.getElementById( 'output' );
+	var output2 = document.getElementById( 'output_ckpackager' );
+
 	output.value = '\t<PackageFile path="ckeditor.js">\r\n';
+	output2.value =
+		'\t\t'		+	'{'										+ '\r\n' +
+		'\t\t\t'	+		'output : \'ckeditor.js\','			+ '\r\n' +
+		'\t\t\t'	+		'files :'							+ '\r\n' +
+		'\t\t\t\t'	+			'['								+ '\r\n';
 
-	var appendedFiles = {};
-	var appendFile = function( filePath )
+	var appendedFiles = {},
+		hasFile = false;
+	var appendFile = function( filePath, commented )
 	{
 		if ( appendedFiles[ filePath ] )
@@ -47,5 +61,14 @@
 		appendedFiles[ filePath ] = true;
 
+		if ( hasFile )
+			output2.value += ',\r\n';
+		else
+			hasFile = true;
+
+		if ( commented )
+			output2.value += '//';
+
 		output.value += '\t\t<File path="' + filePath + '" />\r\n';
+		output2.value += '\t\t\t\t\t\'' + filePath + '\'';
 	};
 
@@ -65,10 +88,16 @@
 			continue;
 
-		appendFile( path );
+		appendFile( path, /\/lang\/(?:)/.test( path ) );
 	}
 
+	output2.value += '\r\n';
+
 	output.value += '\t</PackageFile>\r\n';
+	output2.value +=
+		'\t\t\t\t'	+			']'								+ '\r\n' +
+		'\t\t'		+	'}'									+ '\r\n';
 
 	output.style.display = '';
+	output2.style.display = '';
 }
 
@@ -96,4 +125,7 @@
 			<textarea id="output" rows="10" cols="80" style="width: 100%; display: none"></textarea>
 		</p>
+		<p>
+			<textarea id="output_ckpackager" rows="10" cols="80" style="width: 100%; display: none"></textarea>
+		</p>
 	</form>
 </body>
Index: /CKEditor/branches/prototype/ckeditor.pack
===================================================================
--- /CKEditor/branches/prototype/ckeditor.pack	(revision 2366)
+++ /CKEditor/branches/prototype/ckeditor.pack	(revision 2366)
@@ -0,0 +1,95 @@
+﻿/*
+ * CKPackager - Sample Package file
+ */
+
+header :
+	'/*'																		+ '\n' +
+	'Copyright (c) 2003-2008, Frederico Caldeira Knabben. All rights reserved.'	+ '\n' +
+	'For licensing, see LICENSE.html or http://ckeditor.com/license'			+ '\n' +
+	'*/'																		+ '\n' +
+	'\n',
+
+noCheck : false,
+
+constants :
+	{
+		'CKEDITOR.ELEMENT_MODE_NONE' : 0,
+		'CKEDITOR.ELEMENT_MODE_REPLACE' : 1,
+		'CKEDITOR.ELEMENT_MODE_APPENDTO' : 2,
+		'CKEDITOR.NODE_ELEMENT' : 1,
+		'CKEDITOR.NODE_TEXT' : 3,
+		'CKEDITOR.NODE_COMMENT' : 8,
+		'CKEDITOR.UI_BUTTON' : 1,
+		'CKEDITOR.SELECTION_NONE' : 1,
+		'CKEDITOR.SELECTION_TEXT' : 2,
+		'CKEDITOR.SELECTION_ELEMENT' : 3
+	},
+
+packages :
+	[
+		{
+			output : 'ckeditor_basic.js',
+			files :
+				[
+					'_source/core/ckeditor_base.js',
+					'_source/core/event.js',
+					'_source/core/editor_basic.js',
+					'_source/core/env.js',
+					'_source/core/ckeditor_basic.js'
+				]
+		},
+
+		{
+			output : 'ckeditor.js',
+			files :
+				[
+					'_source/core/ckeditor_base.js',
+					'_source/core/env.js',
+					'_source/core/xml.js',
+					'_source/core/ajax.js',
+					'_source/core/event.js',
+					'_source/core/editor_basic.js',
+					'_source/core/ckeditor_basic.js',
+					'_source/core/dom.js',
+					'_source/core/tools.js',
+					'_source/core/dtd.js',
+					'_source/core/dom/event.js',
+					'_source/core/dom/domobject.js',
+					'_source/core/dom/node.js',
+					'_source/core/dom/element.js',
+					'_source/core/dom/window.js',
+					'_source/core/dom/document.js',
+					'_source/core/config.js',
+					'_source/core/lang.js',
+					'_source/core/scriptLoader.js',
+					'_source/core/resourceManager.js',
+					'_source/core/plugins.js',
+					'_source/core/skins.js',
+					'_source/core/themes.js',
+					'_source/core/ui.js',
+					'_source/core/editor.js',
+					'_source/core/htmlparser.js',
+					'_source/core/htmlparser/comment.js',
+					'_source/core/htmlparser/text.js',
+					'_source/core/htmlparser/fragment.js',
+					'_source/core/htmlparser/element.js',
+					'_source/core/ckeditor.js',
+					'_source/core/dom/text.js',
+					'_source/core/_bootstrap.js',
+//					'_source/lang/en.js',
+					'_source/plugins/basicstyles/plugin.js',
+					'_source/plugins/button/plugin.js',
+					'_source/plugins/elementspath/plugin.js',
+					'_source/plugins/htmldataprocessor/plugin.js',
+					'_source/plugins/sourcearea/plugin.js',
+					'_source/plugins/toolbar/plugin.js',
+					'_source/plugins/wysiwygarea/plugin.js',
+					'_source/plugins/selection/plugin.js',
+					'_source/plugins/htmlwriter/plugin.js',
+					'_source/plugins/editingblock/plugin.js',
+//					'_source/plugins/sourcearea/lang/it.js',
+					'_source/themes/default/theme.js'
+				]
+		}
+
+	]
Index: /CKEditor/branches/prototype/fckpackager.xml
===================================================================
--- /CKEditor/branches/prototype/fckpackager.xml	(revision 2365)
+++ /CKEditor/branches/prototype/fckpackager.xml	(revision 2366)
@@ -83,9 +83,9 @@
 		<File path="_source/core/dom/document.js" />
 		<File path="_source/core/config.js" />
+		<File path="_source/core/lang.js" />
 		<File path="_source/core/scriptLoader.js" />
 		<File path="_source/core/resourceManager.js" />
 		<File path="_source/core/plugins.js" />
 		<File path="_source/core/skins.js" />
-		<File path="_source/lang/en.js" />
 		<File path="_source/core/themes.js" />
 		<File path="_source/core/ui.js" />
@@ -109,4 +109,5 @@
 		<File path="_source/plugins/htmlwriter/plugin.js" />
 		<File path="_source/plugins/editingblock/plugin.js" />
+		<File path="_source/plugins/sourcearea/lang/it.js" />
 		<File path="_source/themes/default/theme.js" />
 	</PackageFile>
