Browse Source

- Fixed 2 bugs introduced with Symbols != String
- New documentation

Nicolas Petton 12 years ago
parent
commit
94a342f291

+ 68 - 0
css/documentation.css

@@ -0,0 +1,68 @@
+#wrapper {
+    margin-left: 350px;
+    text-align: left;
+}
+
+#header {
+    text-align: left;
+    margin: 20px;
+}
+
+.documentation {
+    border-top: 1px solid #999;
+}
+
+.documentation a {
+    color: #C71212;
+    cursor: pointer;
+}
+
+.documentation a:hover {
+    color: white;
+    background: #D15E5E;
+    text-decoration: none;
+}
+
+.documentation pre {
+    border-radius: 3px;
+    border: 1px solid #ccc;
+    background: #eee;
+    padding: 5px;
+}
+
+.documentation .menu {
+    position: fixed;
+    left: 0;
+    bottom: 0;
+    top: 0;
+    width: 300px;
+    background: #ddd;
+    overflow-y: scroll;
+}
+
+.documentation .doc_chapter {
+    position: absolute;
+    background: #fafafa;
+    left: 300px;
+    right: 0;
+    padding: 0 20px;
+}
+
+.documentation .doc_chapter a {
+    background: #eae3c6;
+}
+
+.documentation .doc_chapter a:hover {
+    background: #D15E5E;
+    color: white;
+}
+
+.documentation .doc_chapter .links {
+    border-top: 1px solid #999;
+    margin-top: 10px;
+    padding-top: 10px;
+}
+
+.documentation .doc_chapter h2 {
+    border-bottom: 1px solid #999;
+}

+ 35 - 0
documentation.html

@@ -0,0 +1,35 @@
+<!DOCTYPE html> 
+<html> 
+  <head> 
+    <title>Amber Smalltalk - Documentation</title> 
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
+    <meta name="author" content="Nicolas Petton" /> 
+    <link rel="stylesheet" type="text/css" href='css/style.css' /> 
+    <link rel="stylesheet" type="text/css" href='css/documentation.css' /> 
+    <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/> 
+    <link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'> 
+    <script type='text/javascript' src='js/amber.js'></script> 
+    <script type='text/javascript' src='js/lib/showdown.js'></script> 
+  </head> 
+  <body> 
+    
+    <div id="wrapper"> 
+      
+      <div id="header"> 
+	<h1>Documentation</h1>
+	<h2>Version 0.9.1</h2>
+	<img src="images/amber.png"/> 
+      <ul id="tabs"> 
+	<li><a target="_blank" href="http://amber-lang.net/index.html">Overview</a></li> · 
+	<li><a target="_blank" href="http://amber-lang.net/index.html#download">Download</a></li> · 
+	<li><a target="_blank" href="http://amber-lang.net/learn.html">Learn</a></li> ·
+	<li><a target="_blank" href="http://amber-lang.net/documentation.html">Documentation</a></li> ·
+	<li><a target="_blank" target="_blank" href="https://github.com/NicolasPetton/amber">Source</a></li> 
+      </ul> 
+      
+      <div class="clear"></div> 
+    </div>
+    <script type='text/javascript'> loadAmber({files: ['Documentation.js']}) </script> 
+    
+  </body> 
+</html> 

+ 1 - 1
index.html

@@ -109,7 +109,7 @@
       </div> 
     </div> 
     
-    <script type='text/javascript'> loadAmber() </script> 
+    <script type='text/javascript'> loadAmber({files: ['Documentation.js']}) </script> 
     
   </body> 
 </html> 

+ 1 - 0
js/.#boot.js

@@ -0,0 +1 @@
+nico@kiwi.home.6848:1324419122

+ 11 - 0
js/Compiler.deploy.js

@@ -1837,6 +1837,17 @@ smalltalk.Compiler.klass);
 
 
 smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler');
+smalltalk.addMethod(
+'_doIt',
+smalltalk.method({
+selector: 'doIt',
+fn: function (){
+var self=this;
+return smalltalk.send((function(){return smalltalk.send((smalltalk.Compiler || Compiler), "_methodsFor_", ["initialization"]);}), "_value", []);
+return self;}
+}),
+smalltalk.DoIt);
+
 
 
 smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler');

+ 17 - 1
js/Compiler.js

@@ -1713,7 +1713,7 @@ smalltalk.send((smalltalk.DoIt || DoIt), "_removeCompiledMethod_", [smalltalk.se
 return result;
 return self;},
 args: ["aString"],
-source: unescape('loadExpression%3A%20aString%0A%09%7C%20result%20%7C%0A%09DoIt%20addCompiledMethod%3A%20%28self%20eval%3A%20%28self%20compileExpression%3A%20aString%29%29.%0A%09result%20%3A%3D%20DoIt%20new%20doIt.%0A%09DoIt%20removeCompiledMethod%3A%20%28DoIt%20methodDictionary%20at%3A%20%23doIt%29.%0A%09%5Eresult'),
+source: unescape('loadExpression%3A%20aString%0A%09%7C%20result%20%7C%0A%09DoIt%20addCompiledMethod%3A%20%28self%20eval%3A%20%28self%20compileExpression%3A%20aString%29%29.%0A%09result%20%3A%3D%20DoIt%20new%20doIt.%0A%09DoIt%20removeCompiledMethod%3A%20%28DoIt%20methodDictionary%20at%3A%20%27doIt%27%29.%0A%09%5Eresult'),
 messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
 referencedClasses: ["DoIt"]
 }),
@@ -2572,6 +2572,22 @@ smalltalk.Compiler.klass);
 
 
 smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler');
+smalltalk.addMethod(
+unescape('_doIt'),
+smalltalk.method({
+selector: unescape('doIt'),
+category: '',
+fn: function (){
+var self=this;
+return smalltalk.send((function(){return smalltalk.send((smalltalk.Compiler || Compiler), "_methodsFor_", ["initialization"]);}), "_value", []);
+return self;},
+args: [],
+source: unescape('doIt%20%5E%5BCompiler%20methodsFor%3A%20%27initialization%27%5D%20value'),
+messageSends: ["value", "methodsFor:"],
+referencedClasses: ["Compiler"]
+}),
+smalltalk.DoIt);
+
 
 
 smalltalk.addClass('DynamicArrayNode', smalltalk.Node, [], 'Compiler');

File diff suppressed because it is too large
+ 96 - 0
js/Documentation.deploy.js


File diff suppressed because it is too large
+ 137 - 0
js/Documentation.js


+ 1 - 2
js/Kernel-Collections.deploy.js

@@ -2218,8 +2218,7 @@ smalltalk.method({
 selector: 'next',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
-return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);
+return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return nil;})() : (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return nil;}), (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})]));
 return self;}
 }),
 smalltalk.Stream);

+ 3 - 4
js/Kernel-Collections.js

@@ -3159,12 +3159,11 @@ selector: unescape('next'),
 category: 'reading',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
-return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);
+return ((($receiver = smalltalk.send(self, "_atEnd", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return nil;})() : (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return nil;}), (function(){smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);})]));
 return self;},
 args: [],
-source: unescape('next%0A%09self%20position%3A%20self%20position%20+%201.%20%0A%09%5Ecollection%20at%3A%20self%20position'),
-messageSends: ["position:", unescape("+"), "position", "at:"],
+source: unescape('next%0A%09%5Eself%20atEnd%20%0A%09%09ifTrue%3A%20%5Bnil%5D%0A%09%09ifFalse%3A%20%5B%0A%09%09%09self%20position%3A%20self%20position%20+%201.%20%0A%09%09%09collection%20at%3A%20self%20position%5D'),
+messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", unescape("+"), "position", "at:"],
 referencedClasses: []
 }),
 smalltalk.Stream);

+ 2 - 0
js/amber.js

@@ -69,6 +69,7 @@ amber = (function() {
 				'Kernel-Collections.deploy',
 				'Kernel-Exceptions.deploy',
 				'Kernel-Transcript.deploy',
+				'Kernel-Announcements.deploy',
 				'Canvas.deploy'
 			]);
 		} else {
@@ -82,6 +83,7 @@ amber = (function() {
 				'Kernel-Collections',
 				'Kernel-Exceptions',
 				'Kernel-Transcript',
+				'Kernel-Announcements',
 				'Canvas',
 				'Compiler',
 				'parser',

+ 419 - 0
js/lib/showdown.js

@@ -0,0 +1,419 @@
+/*
+   A A L        Source code at:
+   T C A   <http://www.attacklab.net/>
+   T K B
+*/
+
+var Showdown={};
+Showdown.converter=function(){
+var _1;
+var _2;
+var _3;
+var _4=0;
+this.makeHtml=function(_5){
+_1=new Array();
+_2=new Array();
+_3=new Array();
+_5=_5.replace(/~/g,"~T");
+_5=_5.replace(/\$/g,"~D");
+_5=_5.replace(/\r\n/g,"\n");
+_5=_5.replace(/\r/g,"\n");
+_5="\n\n"+_5+"\n\n";
+_5=_6(_5);
+_5=_5.replace(/^[ \t]+$/mg,"");
+_5=_7(_5);
+_5=_8(_5);
+_5=_9(_5);
+_5=_a(_5);
+_5=_5.replace(/~D/g,"$$");
+_5=_5.replace(/~T/g,"~");
+return _5;
+};
+var _8=function(_b){
+var _b=_b.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(_c,m1,m2,m3,m4){
+m1=m1.toLowerCase();
+_1[m1]=_11(m2);
+if(m3){
+return m3+m4;
+}else{
+if(m4){
+_2[m1]=m4.replace(/"/g,"&quot;");
+}
+}
+return "";
+});
+return _b;
+};
+var _7=function(_12){
+_12=_12.replace(/\n/g,"\n\n");
+var _13="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";
+var _14="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";
+_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,_15);
+_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,_15);
+_12=_12.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,_15);
+_12=_12.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,_15);
+_12=_12.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,_15);
+_12=_12.replace(/\n\n/g,"\n");
+return _12;
+};
+var _15=function(_16,m1){
+var _18=m1;
+_18=_18.replace(/\n\n/g,"\n");
+_18=_18.replace(/^\n/,"");
+_18=_18.replace(/\n+$/g,"");
+_18="\n\n~K"+(_3.push(_18)-1)+"K\n\n";
+return _18;
+};
+var _9=function(_19){
+_19=_1a(_19);
+var key=_1c("<hr />");
+_19=_19.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);
+_19=_19.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key);
+_19=_19.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key);
+_19=_1d(_19);
+_19=_1e(_19);
+_19=_1f(_19);
+_19=_7(_19);
+_19=_20(_19);
+return _19;
+};
+var _21=function(_22){
+_22=_23(_22);
+_22=_24(_22);
+_22=_25(_22);
+_22=_26(_22);
+_22=_27(_22);
+_22=_28(_22);
+_22=_11(_22);
+_22=_29(_22);
+_22=_22.replace(/  +\n/g," <br />\n");
+return _22;
+};
+var _24=function(_2a){
+var _2b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;
+_2a=_2a.replace(_2b,function(_2c){
+var tag=_2c.replace(/(.)<\/?code>(?=.)/g,"$1`");
+tag=_2e(tag,"\\`*_");
+return tag;
+});
+return _2a;
+};
+var _27=function(_2f){
+_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_30);
+_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_30);
+_2f=_2f.replace(/(\[([^\[\]]+)\])()()()()()/g,_30);
+return _2f;
+};
+var _30=function(_31,m1,m2,m3,m4,m5,m6,m7){
+if(m7==undefined){
+m7="";
+}
+var _39=m1;
+var _3a=m2;
+var _3b=m3.toLowerCase();
+var url=m4;
+var _3d=m7;
+if(url==""){
+if(_3b==""){
+_3b=_3a.toLowerCase().replace(/ ?\n/g," ");
+}
+url="#"+_3b;
+if(_1[_3b]!=undefined){
+url=_1[_3b];
+if(_2[_3b]!=undefined){
+_3d=_2[_3b];
+}
+}else{
+if(_39.search(/\(\s*\)$/m)>-1){
+url="";
+}else{
+return _39;
+}
+}
+}
+url=_2e(url,"*_");
+var _3e="<a href=\""+url+"\"";
+if(_3d!=""){
+_3d=_3d.replace(/"/g,"&quot;");
+_3d=_2e(_3d,"*_");
+_3e+=" title=\""+_3d+"\"";
+}
+_3e+=">"+_3a+"</a>";
+return _3e;
+};
+var _26=function(_3f){
+_3f=_3f.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_40);
+_3f=_3f.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_40);
+return _3f;
+};
+var _40=function(_41,m1,m2,m3,m4,m5,m6,m7){
+var _49=m1;
+var _4a=m2;
+var _4b=m3.toLowerCase();
+var url=m4;
+var _4d=m7;
+if(!_4d){
+_4d="";
+}
+if(url==""){
+if(_4b==""){
+_4b=_4a.toLowerCase().replace(/ ?\n/g," ");
+}
+url="#"+_4b;
+if(_1[_4b]!=undefined){
+url=_1[_4b];
+if(_2[_4b]!=undefined){
+_4d=_2[_4b];
+}
+}else{
+return _49;
+}
+}
+_4a=_4a.replace(/"/g,"&quot;");
+url=_2e(url,"*_");
+var _4e="<img src=\""+url+"\" alt=\""+_4a+"\"";
+_4d=_4d.replace(/"/g,"&quot;");
+_4d=_2e(_4d,"*_");
+_4e+=" title=\""+_4d+"\"";
+_4e+=" />";
+return _4e;
+};
+var _1a=function(_4f){
+_4f=_4f.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(_50,m1){
+return _1c("<h1>"+_21(m1)+"</h1>");
+});
+_4f=_4f.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(_52,m1){
+return _1c("<h2>"+_21(m1)+"</h2>");
+});
+_4f=_4f.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(_54,m1,m2){
+var _57=m1.length;
+return _1c("<h"+_57+">"+_21(m2)+"</h"+_57+">");
+});
+return _4f;
+};
+var _58;
+var _1d=function(_59){
+_59+="~0";
+var _5a=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
+if(_4){
+_59=_59.replace(_5a,function(_5b,m1,m2){
+var _5e=m1;
+var _5f=(m2.search(/[*+-]/g)>-1)?"ul":"ol";
+_5e=_5e.replace(/\n{2,}/g,"\n\n\n");
+var _60=_58(_5e);
+_60=_60.replace(/\s+$/,"");
+_60="<"+_5f+">"+_60+"</"+_5f+">\n";
+return _60;
+});
+}else{
+_5a=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
+_59=_59.replace(_5a,function(_61,m1,m2,m3){
+var _65=m1;
+var _66=m2;
+var _67=(m3.search(/[*+-]/g)>-1)?"ul":"ol";
+var _66=_66.replace(/\n{2,}/g,"\n\n\n");
+var _68=_58(_66);
+_68=_65+"<"+_67+">\n"+_68+"</"+_67+">\n";
+return _68;
+});
+}
+_59=_59.replace(/~0/,"");
+return _59;
+};
+_58=function(_69){
+_4++;
+_69=_69.replace(/\n{2,}$/,"\n");
+_69+="~0";
+_69=_69.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(_6a,m1,m2,m3,m4){
+var _6f=m4;
+var _70=m1;
+var _71=m2;
+if(_70||(_6f.search(/\n{2,}/)>-1)){
+_6f=_9(_72(_6f));
+}else{
+_6f=_1d(_72(_6f));
+_6f=_6f.replace(/\n$/,"");
+_6f=_21(_6f);
+}
+return "<li>"+_6f+"</li>\n";
+});
+_69=_69.replace(/~0/g,"");
+_4--;
+return _69;
+};
+var _1e=function(_73){
+_73+="~0";
+_73=_73.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(_74,m1,m2){
+var _77=m1;
+var _78=m2;
+_77=_79(_72(_77));
+_77=_6(_77);
+_77=_77.replace(/^\n+/g,"");
+_77=_77.replace(/\n+$/g,"");
+_77="<pre><code>"+_77+"\n</code></pre>";
+return _1c(_77)+_78;
+});
+_73=_73.replace(/~0/,"");
+return _73;
+};
+var _1c=function(_7a){
+_7a=_7a.replace(/(^\n+|\n+$)/g,"");
+return "\n\n~K"+(_3.push(_7a)-1)+"K\n\n";
+};
+var _23=function(_7b){
+_7b=_7b.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(_7c,m1,m2,m3,m4){
+var c=m3;
+c=c.replace(/^([ \t]*)/g,"");
+c=c.replace(/[ \t]*$/g,"");
+c=_79(c);
+return m1+"<code>"+c+"</code>";
+});
+return _7b;
+};
+var _79=function(_82){
+_82=_82.replace(/&/g,"&amp;");
+_82=_82.replace(/</g,"&lt;");
+_82=_82.replace(/>/g,"&gt;");
+_82=_2e(_82,"*_{}[]\\",false);
+return _82;
+};
+var _29=function(_83){
+_83=_83.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");
+_83=_83.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");
+return _83;
+};
+var _1f=function(_84){
+_84=_84.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(_85,m1){
+var bq=m1;
+bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0");
+bq=bq.replace(/~0/g,"");
+bq=bq.replace(/^[ \t]+$/gm,"");
+bq=_9(bq);
+bq=bq.replace(/(^|\n)/g,"$1  ");
+bq=bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(_88,m1){
+var pre=m1;
+pre=pre.replace(/^  /mg,"~0");
+pre=pre.replace(/~0/g,"");
+return pre;
+});
+return _1c("<blockquote>\n"+bq+"\n</blockquote>");
+});
+return _84;
+};
+var _20=function(_8b){
+_8b=_8b.replace(/^\n+/g,"");
+_8b=_8b.replace(/\n+$/g,"");
+var _8c=_8b.split(/\n{2,}/g);
+var _8d=new Array();
+var end=_8c.length;
+for(var i=0;i<end;i++){
+var str=_8c[i];
+if(str.search(/~K(\d+)K/g)>=0){
+_8d.push(str);
+}else{
+if(str.search(/\S/)>=0){
+str=_21(str);
+str=str.replace(/^([ \t]*)/g,"<p>");
+str+="</p>";
+_8d.push(str);
+}
+}
+}
+end=_8d.length;
+for(var i=0;i<end;i++){
+while(_8d[i].search(/~K(\d+)K/)>=0){
+var _91=_3[RegExp.$1];
+_91=_91.replace(/\$/g,"$$$$");
+_8d[i]=_8d[i].replace(/~K\d+K/,_91);
+}
+}
+return _8d.join("\n\n");
+};
+var _11=function(_92){
+_92=_92.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");
+_92=_92.replace(/<(?![a-z\/?\$!])/gi,"&lt;");
+return _92;
+};
+var _25=function(_93){
+_93=_93.replace(/\\(\\)/g,_94);
+_93=_93.replace(/\\([`*_{}\[\]()>#+-.!])/g,_94);
+return _93;
+};
+var _28=function(_95){
+_95=_95.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"<a href=\"$1\">$1</a>");
+_95=_95.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(_96,m1){
+return _98(_a(m1));
+});
+return _95;
+};
+var _98=function(_99){
+function char2hex(ch){
+var _9b="0123456789ABCDEF";
+var dec=ch.charCodeAt(0);
+return (_9b.charAt(dec>>4)+_9b.charAt(dec&15));
+}
+var _9d=[function(ch){
+return "&#"+ch.charCodeAt(0)+";";
+},function(ch){
+return "&#x"+char2hex(ch)+";";
+},function(ch){
+return ch;
+}];
+_99="mailto:"+_99;
+_99=_99.replace(/./g,function(ch){
+if(ch=="@"){
+ch=_9d[Math.floor(Math.random()*2)](ch);
+}else{
+if(ch!=":"){
+var r=Math.random();
+ch=(r>0.9?_9d[2](ch):r>0.45?_9d[1](ch):_9d[0](ch));
+}
+}
+return ch;
+});
+_99="<a href=\""+_99+"\">"+_99+"</a>";
+_99=_99.replace(/">.+:/g,"\">");
+return _99;
+};
+var _a=function(_a3){
+_a3=_a3.replace(/~E(\d+)E/g,function(_a4,m1){
+var _a6=parseInt(m1);
+return String.fromCharCode(_a6);
+});
+return _a3;
+};
+var _72=function(_a7){
+_a7=_a7.replace(/^(\t|[ ]{1,4})/gm,"~0");
+_a7=_a7.replace(/~0/g,"");
+return _a7;
+};
+var _6=function(_a8){
+_a8=_a8.replace(/\t(?=\t)/g,"    ");
+_a8=_a8.replace(/\t/g,"~A~B");
+_a8=_a8.replace(/~B(.+?)~A/g,function(_a9,m1,m2){
+var _ac=m1;
+var _ad=4-_ac.length%4;
+for(var i=0;i<_ad;i++){
+_ac+=" ";
+}
+return _ac;
+});
+_a8=_a8.replace(/~A/g,"    ");
+_a8=_a8.replace(/~B/g,"");
+return _a8;
+};
+var _2e=function(_af,_b0,_b1){
+var _b2="(["+_b0.replace(/([\[\]\\])/g,"\\$1")+"])";
+if(_b1){
+_b2="\\\\"+_b2;
+}
+var _b3=new RegExp(_b2,"g");
+_af=_af.replace(_b3,_94);
+return _af;
+};
+var _94=function(_b4,m1){
+var _b6=m1.charCodeAt(0);
+return "~E"+_b6+"E";
+};
+};
+if(typeof exports!='undefined')exports.Showdown=Showdown;

+ 0 - 13
st/Additional-Examples.st

@@ -1,13 +0,0 @@
-Smalltalk current createPackage: 'Additional-Examples' properties: #{}!
-Object subclass: #ClassInitializationExample
-	instanceVariableNames: ''
-	category: 'Additional-Examples'!
-!ClassInitializationExample commentStamp!
-This class will pop up an alert when it is loaded into Amber.!
-
-!ClassInitializationExample class methodsFor: 'initialization'!
-
-initialize
-	window alert: 'Hello from inside the ', self printString , ' initialize method.'
-! !
-

+ 6 - 1
st/Compiler.st

@@ -812,7 +812,7 @@ loadExpression: aString
 	| result |
 	DoIt addCompiledMethod: (self eval: (self compileExpression: aString)).
 	result := DoIt new doIt.
-	DoIt removeCompiledMethod: (DoIt methodDictionary at: #doIt).
+	DoIt removeCompiledMethod: (DoIt methodDictionary at: 'doIt').
 	^result
 !
 
@@ -1401,6 +1401,11 @@ Object subclass: #DoIt
 	instanceVariableNames: ''
 	category: 'Compiler'!
 
+!DoIt methodsFor: ''!
+
+doIt ^[Compiler methodsFor: 'initialization'] value
+! !
+
 Node subclass: #DynamicArrayNode
 	instanceVariableNames: ''
 	category: 'Compiler'!

+ 586 - 0
st/Documentation.st

@@ -0,0 +1,586 @@
+Smalltalk current createPackage: 'Documentation' properties: #{}!
+Object subclass: #DocumentationBuilder
+	instanceVariableNames: 'chapters announcer widget'
+	category: 'Documentation'!
+
+!DocumentationBuilder methodsFor: 'accessing'!
+
+chapters
+	^chapters ifNil: [chapters := self buildChapters]
+!
+
+announcer
+	^announcer ifNil: [announcer := Announcer new]
+!
+
+widget
+	^widget ifNil: [widget := DocumentationWidget on: self]
+! !
+
+!DocumentationBuilder methodsFor: 'building'!
+
+buildChapters
+	^((self class methodDictionary values sorted: [:a :b | a selector < b selector])
+		select: [:each | each category = 'chapters'])
+		collect: [:each | self perform: each selector]
+!
+
+buildOn: aCanvas
+	aCanvas with: self widget
+!
+
+buildOnJQuery: aJQuery
+	self buildOn: (HTMLCanvas onJQuery: aJQuery)
+! !
+
+!DocumentationBuilder methodsFor: 'chapters'!
+
+ch1introduction
+	^DocChapter new
+		title: 'Introduction';
+		contents: '
+
+##Amber Smalltalk in a nutshell.
+
+Amber is an implementation of the Smalltalk-80 language. 
+It allows developers to write client-side heavy web applications in Smalltalk. Amber includes an integrated development environment with a class browser, workspace and transcript.
+
+Amber includes the following features:
+
+- It is semantically and syntactically equivalent to Pharo Smalltalk (the implementation considered as the reference)
+- It is written in itself and compiles into efficient JavaScript
+- A canvas API similar to Seaside to generate HTML
+- A jQuery binding.
+
+## Disclaimer
+
+This documentation doesn''t aim to teach Smalltalk. 
+Knowledge of Smalltalk is needed to understand the topics covered in this documentation. 
+If you want to learn the Smalltalk language, you can read the excellent [Pharo By Example](http://www.pharobyexample.org) book.
+'
+!
+
+ch2differencesWithOtherSmalltalks
+	^DocChapter new
+		title: 'Differences with other Smalltalks';
+		contents: '
+Amber has some differences with other Smalltalk implementations. 
+Because it maps Smalltalk constructs one-to-one with the JavaScript equivalent, including Smalltalk classes to JavaScript constructors, the core class library is simplified compared to Pharo Smalltalk. 
+The following list explains the main differences:
+
+- The collection class hierarchy is simpler compared to most Smalltalk implementations. As of today, there is no SortedCollection. The size of arrays is dynamic, and they behave like an ordered collection. 
+  They can also be sorted with the #sort* methods.
+- The Date class behaves like the Date and TimeStamp classes in Pharo Smalltalk. Therefore both Date today and Date now are valid in Amber.
+'
+!
+
+ch3GettingStarted
+	^DocChapter new
+		title: 'Getting started';
+		contents: '
+To get started hacking in Amber you can basically take three routes, independent of your platform:
+
+1. Just try it out at http://www.amber-lang.net (click the "Class browser" button) - but you will **not be able to save any code you write**!! 
+    Still, it works fine for looking at the IDE and playing around. Just don''t press F5/reload - it will bring you back to zero. 
+    (Well, if you still want to develop and save code online someone has set up this site seems for free use: https://www.screwtopdb.com/amberstore/topics?name=amberstore/amber.html )
+2. Download an Amber zip-ball, install Nodejs, fire up the Amber server and then open Amber from localhost - then you **can save code**. Detailed instructions are below!!
+3. Same as above but install git first and get a proper clone from http://github.com/NicolasPetton/amber instead of a zip/tar-ball. 
+    If you want to **contribute to Amber itself** this is really what you want to do. It requires installing git first, but it is quite simple - although we leave this bit as an "exercise to the reader" :)
+
+**PLEASE NOTE:** Amber core developers use Linux. 
+We do not want to introduce dependencies that aren''t cross platform - but currently amberc (the command line compiler) is a bash script and we also use Makefiles 
+(for building Amber itself and server side examples) written on Linux/Unix. So using Windows is currently a bit limited - you can''t run "make" in the .st directory to rebuild whole of Amber for example.
+ BUT... if you only want to use Amber to build web client apps and not really get involved in hacking Amber itself - then you should be fine!!
+
+## Downloading Amber
+Currently you can download in zip or tar-ball format, either cutting edge or a release. [Downloads are available here](https://github.com/NicolasPetton/amber/archives/amber). 
+At the moment of writing you have release [0.9 as zip](https://github.com/NicolasPetton/amber/zipball/0.9) or [tar](https://github.com/NicolasPetton/amber/tarball/0.9), 
+or [cutting edge as zip](https://github.com/NicolasPetton/amber/zipball/amber) or [tar](https://github.com/NicolasPetton/amber/tarball/amber).
+
+At the moment this is just a **1.5Mb download**, so its very small. Unpack wherever you like, but I would rename the directory that is unpacked to something slightly shorter - like say "amber-0.9" or just "amber". 
+And yes, at this point you can double click the index.html file in the amber directory to get the IDE up, but again, **you will not be able to save code**. So please continue below :)
+
+## Installing Node.js
+[Node](http://www.nodejs.org) (for short) is simply the V8 Javascript VM from Google (used in Chrome) hooked together with some hard core C-libraries for doing "evented I/O".
+ Basically it''s Javascript for the server - on asynch steroids. Amber runs fine in Node and we use it for several Amber tools, like amberc (the command line Amber compiler) or the Amber server (see below). 
+There are also several Amber-Node example to look at if you want to play with running Amber programs server side. **In short - you really want to install Nodejs. :)**
+
+- Installing Node on Linux can be done using your package tool of choice ("apt-get install nodejs" for example) or any other way described at [the download page](http://nodejs.org/#download).
+- Installing Node on MacOS seems to be easiest by getting it from [here](https://sites.google.com/site/nodejsmacosx/).
+- Installing Node on Windows is probably done best by using the [download from Nodejs.org](http://nodejs.org/#download). This is not an installer, it is instead simply the node executable - **node.exe**.
+    - Put node.exe somewhere in your path. In Windows7 I can run a command prompt "As administrator" (right click the command prompt in Start menu) and then just "copy node.exe c:\windows\" or such.
+
+## Starting Amber server
+Nicolas has written a minimal webDAV server that is the easiest way to get up and running Amber with the ability to save code. This little server is written in... Amber!! 
+And it runs on top of Node. So to start it up serving your brand new directory tree of sweet Amber you do:
+
+    cd amber      (or whatever you called the directory you unpackaged)
+    ./bin/server  (in windows you type "node server\server.js" instead)
+
+It should say it is listening on port 4000. If it does, hooray!! That means both Node and Amber are good. In Windows you might get a question about opening that port in the local firewall - yep, do it!!
+
+## Firing up Amber
+The Amber IDE is written in... Amber. It uses JQuery and runs right in your browser as a ... well, a web page. 
+We could open it up just using a file url - but the reason we performed the previous steps is so that we can load the IDE web page from a server that can handle PUTs (webDAV) of source code. 
+According to web security Amber can only do PUT back to the same server it was loaded from. Thus we instead want to open it through our little server now listening on port 4000:
+
+    http://localhost:4000/index.html
+
+Clicking the above link should get your Amber running.
+
+To verify that you can indeed commit - just select a Package in the browser, like say "Examples" and press "Commit package" button. **If all goes well nothing happens :)**. 
+So in order to really know if it worked we can check the modified date on the files **amber/st/Examples.st**, **amber/js/Examples.js** and **amber/js/Examples.deploy.js** - they should be brand new.
+
+NOTE: We can use any webDAV server and Apache2 has been used earlier and works fine. But the Amber server is smaller and simpler to start.
+
+'
+!
+
+ch4FirstApp
+	^DocChapter new
+		title: 'A first application';
+		contents: '
+
+Let''s make Hello World in Amber.
+
+First, you need a place for your new project. I made a new directory under amber:
+
+    amber/projects/hello
+
+This will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.
+
+Your index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:
+
+
+    <!!DOCTYPE html>
+    <html>
+      <head>
+        <title>My First Amber Project</title>
+        <script src="../../js/amber.js" type="text/javascript"></script>
+        <script type="text/javascript">
+          loadAmber({
+            files: [],
+            prefix: ''projects/hello/js'',
+            ready: function() {
+              
+            }}); 
+        </script>
+      </head>
+      <body>
+        <article>
+          <h1>My First Amber Project</h1>
+          <button onclick="smalltalk.Browser._open()">class browser</button>
+          <button id="sayHello">say hello</button>
+        </article>
+      </body>
+    </html>
+
+Now start up amber with node.js and navigate to  http://localhost:4000/projects/hello/index.html
+
+It''s boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. 
+Then click save. This creates a new class and leaves the old one intact, it doesn''t overwrite it. Your class will look like this:
+
+    Object subclass: #Hello
+        instanceVariableNames: ''''
+        package: ''HelloApp''
+
+Now click save and navigate to your new class in its new package.
+ Then click ''commit package''. You just created a new class and saved your work. 
+On your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.
+
+Now, refresh your browser page and reopen the class browser. Oh no, your new class is gone!! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:
+
+
+    loadAmber({
+        files: [''HelloApp.js''],
+        prefix: ''projects/hello/js'',
+        ready: function() {      
+    }}); 
+
+Save and refresh again. Now your class is loaded and shows up in the class browser.
+
+Now, let''s make this class do something. Create a new message in the class browser by navigating to your class, then clicking ''not yet classified'' and fill in a simple message. Try this for example:
+
+    begin
+	"Makes me say hello to the user."
+
+	| msg button |
+	msg := ''Hello world!!''.
+	button := ''#sayHello'' asJQuery.
+	button click: [button after: ''<p>'' , msg , ''</p>''].
+
+Your message isn''t too helpful if it doesn''t get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:
+
+    loadAmber({
+        files: [''HelloApp.js''],
+        prefix: ''projects/hello/js'', // path for js files i think
+        ready: function() {
+          $(function() {
+            smalltalk.Hello._new()._begin();
+          });
+    }}); 
+
+From there, you can create new Smalltalk classes and messages to build up your app. Enjoy!!
+'
+!
+
+ch5Index
+	^ClassesIndexChapter new
+!
+
+ch6KernelObjects
+	^PackageDocChapter new
+		title: 'Kernel-Objects';
+		package: (Package named: 'Kernel-Objects');
+		contents: ''
+! !
+
+DocumentationBuilder class instanceVariableNames: 'current'!
+
+!DocumentationBuilder class methodsFor: 'accessing'!
+
+current
+	^current ifNil: [current := self new]
+! !
+
+!DocumentationBuilder class methodsFor: 'initialization'!
+
+initialize
+	self current buildOnJQuery: (window jQuery: 'body')
+! !
+
+Widget subclass: #DocChapter
+	instanceVariableNames: 'title contents parent'
+	category: 'Documentation'!
+
+!DocChapter methodsFor: 'accessing'!
+
+title
+	^title ifNil: ['']
+!
+
+title: aString
+	title := aString
+!
+
+contents
+	^contents
+!
+
+contents: aString
+	contents := aString
+!
+
+htmlContents
+	^(Showdown at: #converter) new makeHtml: self contents
+!
+
+chapters
+	"A doc chapter can contain sub chapters"
+	^#()
+!
+
+cssClass
+	^'doc_chapter'
+!
+
+level
+	^self parent ifNil: [1] ifNotNil: [self parent level +1]
+!
+
+level: anInteger
+	level := anInteger
+!
+
+parent
+	^parent
+!
+
+parent: aChapter
+	parent := aChapter
+! !
+
+!DocChapter methodsFor: 'actions'!
+
+selectClass: aClass
+	DocumentationBuilder current announcer announce: (ClassSelectionAnnouncement on: aClass)
+!
+
+selectChapter: aChapter
+	DocumentationBuilder current widget selectChapter: aChapter
+! !
+
+!DocChapter methodsFor: 'rendering'!
+
+renderOn: html
+	html div 
+		class: self cssClass;
+		with: [
+			self renderDocOn: html.
+			self renderLinksOn: html]
+!
+
+renderDocOn: html
+	| div |
+	html h1 with: self title.
+	self renderNavigationOn: html.
+	div := html div class: 'contents'.
+	div asJQuery html: self htmlContents
+!
+
+renderNavigationOn: html
+	self parent ifNotNil: [
+		html div 
+			class: 'navigation'; with: [
+				html a
+					with: '← back to ', self parent title;
+					onClick: [self selectChapter: self parent]]]
+!
+
+renderLinksOn: html
+	html ul 
+		class: 'links';
+		with: [
+			self chapters do: [:each |
+				html li with: [
+					html a
+						with: each title;
+						onClick: [self selectChapter: each]]]]
+! !
+
+DocChapter subclass: #PackageDocChapter
+	instanceVariableNames: 'package chapters'
+	category: 'Documentation'!
+
+!PackageDocChapter methodsFor: 'accessing'!
+
+package
+	^package
+!
+
+package: aPackage
+	package := aPackage.
+	chapters := (aPackage classes sorted: [:a :b | a name < b name]) collect: [:each |
+		(ClassDocChapter on: each)
+			parent: self;
+			yourself]
+!
+
+title
+	^'Package ', self package name
+!
+
+chapters
+	^chapters
+!
+
+contents
+	^'Classes in package ', self package name, ':'
+! !
+
+!PackageDocChapter class methodsFor: 'instance creation'!
+
+on: aPackage
+	^self new
+		package: aPackage;
+		yourself
+! !
+
+DocChapter subclass: #ClassDocChapter
+	instanceVariableNames: 'theClass'
+	category: 'Documentation'!
+
+!ClassDocChapter methodsFor: 'accessing'!
+
+theClass
+	^theClass
+!
+
+theClass: aClass
+	theClass := aClass.
+	self subscribe
+!
+
+contents
+	^self theClass comment isEmpty
+		ifTrue: [self theClass name, ' is not documented yet.']
+		ifFalse: [self theClass comment]
+!
+
+cssClass
+	^'doc_class ', super cssClass
+!
+
+title
+	^self theClass name
+!
+
+subscribe
+	DocumentationBuilder current announcer 
+		on: ClassSelectionAnnouncement do: [:ann |
+			ann theClass = self theClass ifTrue: [
+				DocumentationBuilder current widget selectChapter: self]]
+! !
+
+!ClassDocChapter methodsFor: 'rendering'!
+
+renderLinksOn: html
+	html ul 
+		class: 'links';
+		with: [
+			html li with: [html a
+				with: 'Browse this class';
+				onClick: [Browser openOn: self theClass]]]
+! !
+
+!ClassDocChapter class methodsFor: 'accessing'!
+
+on: aClass
+	^self new
+		theClass: aClass;
+		yourself
+! !
+
+Widget subclass: #DocumentationWidget
+	instanceVariableNames: 'builder selectedChapter chapterDiv'
+	category: 'Documentation'!
+
+!DocumentationWidget methodsFor: 'accessing'!
+
+builder
+	^builder
+!
+
+builder: aDocumentationBuilder
+	builder := aDocumentationBuilder
+!
+
+chapters
+	^self builder chapters
+!
+
+selectedChapter
+	^selectedChapter ifNil: [selectedChapter := self chapters first]
+!
+
+selectedChapter: aChapter
+	^selectedChapter := aChapter
+! !
+
+!DocumentationWidget methodsFor: 'actions'!
+
+selectChapter: aChapter
+	self selectedChapter: aChapter.
+	self updateChapterDiv
+! !
+
+!DocumentationWidget methodsFor: 'rendering'!
+
+renderOn: html
+	html div 
+		class: 'documentation';
+		with: [
+			self renderMenuOn: html.
+			chapterDiv := html div.
+			self updateChapterDiv]
+!
+
+renderMenuOn: html
+	html div 
+		class: 'menu';
+		with: [
+			html ol with: [
+				self chapters do: [:each |
+					html li with: [
+						self renderChapterMenu: each on: html]]]]
+!
+
+renderChapterMenu: aChapter on: html
+	html a
+		with: aChapter title;
+		onClick: [
+			self selectChapter: aChapter].
+	html ol with: [
+			aChapter chapters do: [:each |
+				html li with: [
+					self renderChapterMenu: each on: html]]]
+! !
+
+!DocumentationWidget methodsFor: 'updating'!
+
+updateChapterDiv
+	chapterDiv contents: [:html |
+		html with: self selectedChapter]
+! !
+
+!DocumentationWidget class methodsFor: 'instance creation'!
+
+on: aBuilder
+	^self new
+		builder: aBuilder;
+		yourself
+! !
+
+DocChapter subclass: #ClassesIndexChapter
+	instanceVariableNames: ''
+	category: 'Documentation'!
+
+!ClassesIndexChapter methodsFor: 'accessing'!
+
+cssClass
+	^'index_doc ', super cssClass
+!
+
+title
+	^'Smalltalk classes by index'
+!
+
+alphabet
+	^'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+! !
+
+!ClassesIndexChapter methodsFor: 'rendering'!
+
+renderDocOn: html
+	html h1 with: self title.
+	self alphabet do: [:letter || classes |
+		classes := Smalltalk current classes select: [:each | each name first = letter].
+		classes ifNotEmpty: [html h2 with: letter].
+		html ul with: [
+			(classes sorted: [:a :b | a name < b name]) 
+				do: [:each |
+					html li with: [html a 
+						with: each name;
+						onClick: [self selectClass: each]]]]]
+! !
+
+!ClassesIndexChapter class methodsFor: 'accessing'!
+
+on: aClass
+	^self new
+		theClass: aClass;
+		yourself
+! !
+
+Object subclass: #ClassSelectionAnnouncement
+	instanceVariableNames: 'theClass'
+	category: 'Documentation'!
+
+!ClassSelectionAnnouncement methodsFor: 'accessing'!
+
+theClass
+	^theClass
+!
+
+theClass: aClass
+	theClass := aClass
+! !
+
+!ClassSelectionAnnouncement class methodsFor: 'instance creation'!
+
+on: aClass
+	^self new
+		theClass: aClass;
+		yourself
+! !
+

+ 5 - 2
st/Kernel-Collections.st

@@ -1102,8 +1102,11 @@ skip: anInteger
 !Stream methodsFor: 'reading'!
 
 next
-	self position: self position + 1. 
-	^collection at: self position
+	^self atEnd 
+		ifTrue: [nil]
+		ifFalse: [
+			self position: self position + 1. 
+			collection at: self position]
 !
 
 next: anInteger

+ 3 - 0
st/Makefile

@@ -83,6 +83,9 @@ Examples.js: Examples.st SUnit.js IDE.js
 Kernel-Tests.js: Kernel-Tests.st SUnit.js
 	$(AMBERC) $(FLAGS) -l SUnit $<;
 
+# Documentation
+Documentation.js: Documentation.st Canvas.js
+	$(AMBERC) $(FLAGS) -l Canvas $<;
 
 # Installing is simply copying all js files to js directory.
 install: all

Some files were not shown because too many files changed in this diff