diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ /support/jsast/jsast /support/jsxmin/jsxmin -# Diviner artifacts +# Diviner artifacts /docs/ /.divinercache/ diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -22,4 +22,3 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/example/php-tictactoe/ai.php b/example/php-tictactoe/ai.php --- a/example/php-tictactoe/ai.php +++ b/example/php-tictactoe/ai.php @@ -57,5 +57,3 @@ return false; } - - diff --git a/example/php-typeahead/animals.txt b/example/php-typeahead/animals.txt --- a/example/php-typeahead/animals.txt +++ b/example/php-typeahead/animals.txt @@ -179,4 +179,4 @@ woodchuck yak zebra -zebu \ No newline at end of file +zebu diff --git a/pkg/init.min.js b/pkg/init.min.js --- a/pkg/init.min.js +++ b/pkg/init.min.js @@ -1 +1 @@ -(function(){if(window.JX)return;window.JX={};var c={};function f(l){if(JX[l])return;c[l]=[];JX[l]=function(){c[l].push(arguments);};}JX.flushHoldingQueue=function(n,l){for(var m=0;m<\/sc'+'ript\>');}JX.onload=function(l){if(e){l();}else h.push(l);};})(); \ No newline at end of file +(function(){if(window.JX)return;window.JX={};var c={};function f(l){if(JX[l])return;c[l]=[];JX[l]=function(){c[l].push(arguments);};}JX.flushHoldingQueue=function(n,l){for(var m=0;m<\/sc'+'ript\>');}JX.onload=function(l){if(e){l();}else h.push(l);};})(); diff --git a/pkg/javelin.min.js b/pkg/javelin.min.js --- a/pkg/javelin.min.js +++ b/pkg/javelin.min.js @@ -1 +1 @@ -JX.$E=function(c){var b=new Error(c);var a=JX.$E.caller;if(a)b.caller_fn=a.caller;throw b;};JX.$A=function(b){var c=[];for(var a=0;a-1;},addSigil:function(a,b){var c=a.getAttribute('data-sigil')||'';if(!JX.Stratcom.hasSigil(a,b))c+=' '+b;a.setAttribute('data-sigil',c);},getData:function(e){var d=(e.getAttribute('data-meta')||'').split('_');if(d[0]&&d[1]){var a=this._data[d[0]];var c=d[1];if(a&&(c in a))return a[c];}var b={};if(!this._data[1])this._data[1]={};this._data[1][this._dataIndex]=b;e.setAttribute('data-meta','1_'+(this._dataIndex++));return b;},addData:function(b,a){return JX.copy(JX.Stratcom.getData(b),a);},allocateMetadataBlock:function(){return this._dataBlock++;}}});JX.behavior=function(b,a){JX.behavior._behaviors[b]=a;JX.behavior._statics[b]={};};JX.initBehaviors=function(c){var d=[];for(var e in c){if(!(e in JX.behavior._behaviors)){d.push(e);continue;}var a=c[e];if(!a.length){if(JX.behavior._initialized.hasOwnProperty(e))continue;a=[null];}for(var b=0;b=300)){this._fail();return;}b=this._extractResponse(c);if(!b)JX.$E('JX.Request("'+this.getURI()+'", ...): '+'server returned an invalid response.');}catch(a){this._fail();return;}try{this._handleResponse(b);this._cleanup();}catch(a){setTimeout(function(){throw a;},0);}},_extractResponse:function(e){var c=e.responseText;if(this.getExpectCSRFGuard())c=c.substring('for (;;);'.length);var d=this.getResponseType().toUpperCase();if(d=='TEXT'){return c;}else if(d=='JSON'||d=='JAVELIN'){return JX.JSON.parse(c);}else if(d=='XML'){var a;try{if(typeof DOMParser!='undefined'){var parser=new DOMParser();a=parser.parseFromString(c,"text/xml");}else{a=new ActiveXObject("Microsoft.XMLDOM");a.async=false;a.loadXML(e.responseText);}return a.documentElement;}catch(b){this._fail();return null;}}return null;},_fail:function(a){this._cleanup();this.invoke('error',a,this);this.invoke('finally');},_done:function(c){this._cleanup();if(c.onload)for(var a=0;a-1);if(a&&!c){d.className+=' '+b;}else if(c&&!a)d.className=d.className.replace(new RegExp('(^|\\s)'+b+'(?:\\s|$)','g'),' ');},htmlize:function(a){return (''+a).replace(/&/g,'&').replace(/"/g,'"').replace(//g,'>');},show:function(){for(var a=0;a')));var a=JX.Vector.getDim(d);document.body.removeChild(d);return a;},scry:function(d,f,e){var b=d.getElementsByTagName(f);if(!e)return JX.$A(b);var c=[];for(var a=0;a, "'+d+'", "'+c+'"): '+'matched no nodes.');return a[0];},focus:function(b){try{b.focus();}catch(a){}},scrollTo:function(a){window.scrollTo(0,JX.$V(a).y);},_getAutoID:function(a){if(!a.getAttribute('data-autoid'))a.setAttribute('data-autoid','autoid_'+(++JX.DOM._autoid));return a.getAttribute('data-autoid');}}});JX.install('JSON',{statics:{parse:function(data){if(typeof data!='string')return null;if(window.JSON&&JSON.parse){var obj;try{obj=JSON.parse(data);}catch(e){}return obj||null;}data=data.replace(/\u2028/g,'\\u2028').replace(/\u2029/g,'\\u2029');return eval('('+data+')');},stringify:function(e){if(window.JSON&&JSON.stringify)return JSON.stringify(e);var c=[];if(e===null||e===true||e===false||typeof e=='number')return ''+e;if(e.push&&e.pop){var d;for(var a=0;a-1;},addSigil:function(a,b){var c=a.getAttribute('data-sigil')||'';if(!JX.Stratcom.hasSigil(a,b))c+=' '+b;a.setAttribute('data-sigil',c);},getData:function(e){var d=(e.getAttribute('data-meta')||'').split('_');if(d[0]&&d[1]){var a=this._data[d[0]];var c=d[1];if(a&&(c in a))return a[c];}var b={};if(!this._data[1])this._data[1]={};this._data[1][this._dataIndex]=b;e.setAttribute('data-meta','1_'+(this._dataIndex++));return b;},addData:function(b,a){return JX.copy(JX.Stratcom.getData(b),a);},allocateMetadataBlock:function(){return this._dataBlock++;}}});JX.behavior=function(b,a){JX.behavior._behaviors[b]=a;JX.behavior._statics[b]={};};JX.initBehaviors=function(c){var d=[];for(var e in c){if(!(e in JX.behavior._behaviors)){d.push(e);continue;}var a=c[e];if(!a.length){if(JX.behavior._initialized.hasOwnProperty(e))continue;a=[null];}for(var b=0;b=300)){this._fail();return;}b=this._extractResponse(c);if(!b)JX.$E('JX.Request("'+this.getURI()+'", ...): '+'server returned an invalid response.');}catch(a){this._fail();return;}try{this._handleResponse(b);this._cleanup();}catch(a){setTimeout(function(){throw a;},0);}},_extractResponse:function(e){var c=e.responseText;if(this.getExpectCSRFGuard())c=c.substring('for (;;);'.length);var d=this.getResponseType().toUpperCase();if(d=='TEXT'){return c;}else if(d=='JSON'||d=='JAVELIN'){return JX.JSON.parse(c);}else if(d=='XML'){var a;try{if(typeof DOMParser!='undefined'){var parser=new DOMParser();a=parser.parseFromString(c,"text/xml");}else{a=new ActiveXObject("Microsoft.XMLDOM");a.async=false;a.loadXML(e.responseText);}return a.documentElement;}catch(b){this._fail();return null;}}return null;},_fail:function(a){this._cleanup();this.invoke('error',a,this);this.invoke('finally');},_done:function(c){this._cleanup();if(c.onload)for(var a=0;a-1);if(a&&!c){d.className+=' '+b;}else if(c&&!a)d.className=d.className.replace(new RegExp('(^|\\s)'+b+'(?:\\s|$)','g'),' ');},htmlize:function(a){return (''+a).replace(/&/g,'&').replace(/"/g,'"').replace(//g,'>');},show:function(){for(var a=0;a')));var a=JX.Vector.getDim(d);document.body.removeChild(d);return a;},scry:function(d,f,e){var b=d.getElementsByTagName(f);if(!e)return JX.$A(b);var c=[];for(var a=0;a, "'+d+'", "'+c+'"): '+'matched no nodes.');return a[0];},focus:function(b){try{b.focus();}catch(a){}},scrollTo:function(a){window.scrollTo(0,JX.$V(a).y);},_getAutoID:function(a){if(!a.getAttribute('data-autoid'))a.setAttribute('data-autoid','autoid_'+(++JX.DOM._autoid));return a.getAttribute('data-autoid');}}});JX.install('JSON',{statics:{parse:function(data){if(typeof data!='string')return null;if(window.JSON&&JSON.parse){var obj;try{obj=JSON.parse(data);}catch(e){}return obj||null;}data=data.replace(/\u2028/g,'\\u2028').replace(/\u2029/g,'\\u2029');return eval('('+data+')');},stringify:function(e){if(window.JSON&&JSON.stringify)return JSON.stringify(e);var c=[];if(e===null||e===true||e===false||typeof e=='number')return ''+e;if(e.push&&e.pop){var d;for(var a=0;a=0&&this._focus=0&&this._display[this._focus]){this._choose(this._display[this._focus]);return true;}else{result=this.invoke('query',this._control.value);if(result.getPrevented())return true;}return false;},setValue:function(a){this._control.value=a;},getValue:function(){return this._control.value;},_update:function(event){if(event.getType()=='focus'){this._focused=true;this.updatePlaceholder();}var a=event.getSpecialKey();if(a&&event.getType()=='keydown')switch(a){case 'up':if(this._display.length&&this._changeFocus(-1))event.prevent();break;case 'down':if(this._display.length&&this._changeFocus(1))event.prevent();break;case 'return':if(this.submit()){event.prevent();return;}break;case 'esc':if(this._display.length&&this.getAllowNullSelection()){this.hide();event.prevent();}break;case 'tab':return;}setTimeout(JX.bind(this,function(){if(this._value==this._control.value)return;this.refresh();}),0);},handleEvent:function(a){if(this._stop||a.getPrevented())return;var b=a.getType();if(b=='blur'){this._focused=false;this.updatePlaceholder();this.hide();}else this._update(a);},removeListener:function(){if(this._listener)this._listener.remove();},setPlaceholder:function(a){this._placeholder=a;this.updatePlaceholder();return this;},updatePlaceholder:function(){if(this._placeholderVisible){if(this._focused||!this._placeholder){this._placeholderVisible=false;this._control.value='';}}else if(!this._focused)if(this._placeholder&&!this._control.value)this._placeholderVisible=true;if(this._placeholderVisible)this._control.value=this._placeholder;JX.DOM.alterClass(this._control,'jx-typeahead-placeholder',this._placeholderVisible);}}});JX.install('TypeaheadNormalizer',{statics:{normalize:function(a){return (''+a).toLocaleLowerCase().replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,'').replace(/ +/g,' ').replace(/^\s*|\s*$/g,'');}}});JX.install('TypeaheadSource',{construct:function(){this._raw={};this._lookup={};this.setNormalizer(JX.TypeaheadNormalizer.normalize);this._excludeIDs={};},events:['waiting','resultsready','complete'],properties:{normalizer:null,queryExtractor:null,transformer:null,maximumResultCount:5,sortHandler:null},members:{_raw:null,_lookup:null,_excludeIDs:null,_changeListener:null,_startListener:null,bindToTypeahead:function(a){this._changeListener=a.listen('change',JX.bind(this,this.didChange));this._startListener=a.listen('start',JX.bind(this,this.didStart));},unbindFromTypeahead:function(){this._changeListener.remove();this._startListener.remove();},didChange:function(a){return;},didStart:function(){return;},clearCache:function(){this._raw={};this._lookup={};},addExcludeID:function(a){if(a)this._excludeIDs[a]=true;},removeExcludeID:function(a){if(a)delete this._excludeIDs[a];},addResult:function(b){b=(this.getTransformer()||this._defaultTransformer)(b);if(b.id in this._raw)return;this._raw[b.id]=b;var c=this.tokenize(b.tokenizable||b.name);for(var a=0;a=0&&this._focus=0&&this._display[this._focus]){this._choose(this._display[this._focus]);return true;}else{result=this.invoke('query',this._control.value);if(result.getPrevented())return true;}return false;},setValue:function(a){this._control.value=a;},getValue:function(){return this._control.value;},_update:function(event){if(event.getType()=='focus'){this._focused=true;this.updatePlaceholder();}var a=event.getSpecialKey();if(a&&event.getType()=='keydown')switch(a){case 'up':if(this._display.length&&this._changeFocus(-1))event.prevent();break;case 'down':if(this._display.length&&this._changeFocus(1))event.prevent();break;case 'return':if(this.submit()){event.prevent();return;}break;case 'esc':if(this._display.length&&this.getAllowNullSelection()){this.hide();event.prevent();}break;case 'tab':return;}setTimeout(JX.bind(this,function(){if(this._value==this._control.value)return;this.refresh();}),0);},handleEvent:function(a){if(this._stop||a.getPrevented())return;var b=a.getType();if(b=='blur'){this._focused=false;this.updatePlaceholder();this.hide();}else this._update(a);},removeListener:function(){if(this._listener)this._listener.remove();},setPlaceholder:function(a){this._placeholder=a;this.updatePlaceholder();return this;},updatePlaceholder:function(){if(this._placeholderVisible){if(this._focused||!this._placeholder){this._placeholderVisible=false;this._control.value='';}}else if(!this._focused)if(this._placeholder&&!this._control.value)this._placeholderVisible=true;if(this._placeholderVisible)this._control.value=this._placeholder;JX.DOM.alterClass(this._control,'jx-typeahead-placeholder',this._placeholderVisible);}}});JX.install('TypeaheadNormalizer',{statics:{normalize:function(a){return (''+a).toLocaleLowerCase().replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,'').replace(/ +/g,' ').replace(/^\s*|\s*$/g,'');}}});JX.install('TypeaheadSource',{construct:function(){this._raw={};this._lookup={};this.setNormalizer(JX.TypeaheadNormalizer.normalize);this._excludeIDs={};},events:['waiting','resultsready','complete'],properties:{normalizer:null,queryExtractor:null,transformer:null,maximumResultCount:5,sortHandler:null},members:{_raw:null,_lookup:null,_excludeIDs:null,_changeListener:null,_startListener:null,bindToTypeahead:function(a){this._changeListener=a.listen('change',JX.bind(this,this.didChange));this._startListener=a.listen('start',JX.bind(this,this.didStart));},unbindFromTypeahead:function(){this._changeListener.remove();this._startListener.remove();},didChange:function(a){return;},didStart:function(){return;},clearCache:function(){this._raw={};this._lookup={};},addExcludeID:function(a){if(a)this._excludeIDs[a]=true;},removeExcludeID:function(a){if(a)delete this._excludeIDs[a];},addResult:function(b){b=(this.getTransformer()||this._defaultTransformer)(b);if(b.id in this._raw)return;this._raw[b.id]=b;var c=this.tokenize(b.tokenizable||b.name);for(var a=0;agetNodeLine($ast).": ".$reason); + 'Parsing failed at line '.$this->getNodeLine($ast).': '.$reason); } protected function getObjectLiteralPropertyLine(array $ast, $property) { diff --git a/support/jsxmin/jsxmin_main.cpp b/support/jsxmin/jsxmin_main.cpp --- a/support/jsxmin/jsxmin_main.cpp +++ b/support/jsxmin/jsxmin_main.cpp @@ -26,9 +26,9 @@ int main(int argc, char* argv[]) { try { - + string replacements(argc > 1 ? argv[1] : ""); - + // Create a node. NodeProgram root(stdin); jsxminify(&root, replacements); diff --git a/support/jsxmin/jsxmin_reduction.cpp b/support/jsxmin/jsxmin_reduction.cpp --- a/support/jsxmin/jsxmin_reduction.cpp +++ b/support/jsxmin/jsxmin_reduction.cpp @@ -15,7 +15,7 @@ * * See accompanying file LICENSE.txt. * -* @author Marcel Laverdet +* @author Marcel Laverdet */ #include "libfbjs/node.hpp" diff --git a/support/jsxmin/reduce.hpp b/support/jsxmin/reduce.hpp --- a/support/jsxmin/reduce.hpp +++ b/support/jsxmin/reduce.hpp @@ -15,7 +15,7 @@ * * See accompanying file LICENSE.txt. * -* @author Marcel Laverdet +* @author Marcel Laverdet */ #pragma once diff --git a/support/jsxmin/reduce.cpp b/support/jsxmin/reduce.cpp --- a/support/jsxmin/reduce.cpp +++ b/support/jsxmin/reduce.cpp @@ -15,7 +15,7 @@ * * See accompanying file LICENSE.txt. * -* @author Marcel Laverdet +* @author Marcel Laverdet */ #include "reduce.hpp" @@ -197,8 +197,8 @@ ++it; Node* elseBlock = *it; if (elseBlock == NULL) { - // If we're the child of a statement list, we can safely delete the - // whole if/else node. But if we're a child of an if statement, we can + // If we're the child of a statement list, we can safely delete the + // whole if/else node. But if we're a child of an if statement, we can // not remove the node or we'll leave the parent with a surprising and // segfaulty number of child nodes, e.g. if (x) {} else if (0) {} if (dynamic_cast(parent()->node())) { diff --git a/support/php/JavelinHelper.php b/support/php/JavelinHelper.php --- a/support/php/JavelinHelper.php +++ b/support/php/JavelinHelper.php @@ -119,9 +119,9 @@ if ($javelin->onload) { throw new Exception( - "Javelin onload functions have been registered, but the response is ". - "being rendered as an Ajax response. This is invalid; use behaviors ". - "instead."); + 'Javelin onload functions have been registered, but the response is '. + 'being rendered as an Ajax response. This is invalid; use behaviors '. + 'instead.'); } $javelin->dirty = false; @@ -139,9 +139,9 @@ public function __destruct() { if ($this->dirty) { throw new Exception( - "Javelin has behaviors, metadata or onload functions to include in ". - "the response but you did not call renderHTMLFooter() or ". - "renderAjaxResponse() after registering them."); + 'Javelin has behaviors, metadata or onload functions to include in '. + 'the response but you did not call renderHTMLFooter() or '. + 'renderAjaxResponse() after registering them.'); } } @@ -152,4 +152,3 @@ return self::$instance; } } -