Explorar el Código

Merge remote-tracking branch 'upstream/master'

Laurent Laffont hace 13 años
padre
commit
aa754125e7
Se han modificado 8 ficheros con 183 adiciones y 23 borrados
  1. 0 0
      js/Compiler.js
  2. 57 1
      js/Kernel.deploy.js
  3. 75 3
      js/Kernel.js
  4. 5 3
      js/Parser.deploy.js
  5. 8 6
      js/Parser.js
  6. 0 0
      st/Compiler.st
  7. 31 1
      st/Kernel.st
  8. 7 9
      st/Parser.st

+ 0 - 0
js/Compiler.js


+ 57 - 1
js/Kernel.deploy.js

@@ -858,7 +858,7 @@ smalltalk.method({
 selector: 'commentStamp:prior:',
 fn: function (aStamp, prior){
 var self=this;
-
+return smalltalk.send(self, "_commentStamp", []);
 return self;}
 }),
 smalltalk.Behavior);
@@ -1796,6 +1796,40 @@ return self;}
 }),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+'_&',
+smalltalk.method({
+selector: '&',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	;
+return self;}
+}),
+smalltalk.Boolean);
+
+smalltalk.addMethod(
+'_|',
+smalltalk.method({
+selector: '|',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	;
+return self;}
+}),
+smalltalk.Boolean);
+
 
 
 smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
@@ -3415,6 +3449,17 @@ return self;}
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+'_asciiValue',
+smalltalk.method({
+selector: 'asciiValue',
+fn: function (){
+var self=this;
+return self.charCodeAt(0);;
+return self;}
+}),
+smalltalk.String);
+
 
 smalltalk.addMethod(
 '_streamClass',
@@ -3507,6 +3552,17 @@ return self;}
 }),
 smalltalk.String.klass);
 
+smalltalk.addMethod(
+'_value_',
+smalltalk.method({
+selector: 'value:',
+fn: function (aUTFCharCode){
+var self=this;
+return String.fromCharCode(aUTFCharCode);;
+return self;}
+}),
+smalltalk.String.klass);
+
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel');
 smalltalk.addMethod(

+ 75 - 3
js/Kernel.js

@@ -1151,10 +1151,10 @@ selector: 'commentStamp:prior:',
 category: 'accessing',
 fn: function (aStamp, prior){
 var self=this;
-
+return smalltalk.send(self, "_commentStamp", []);
 return self;},
-source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%20%22Ignored%20right%20now.%22'),
-messageSends: [],
+source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%20%22Stamp%20and%20prior%20ignored%20right%20now.%22%0A%09%5Eself%20commentStamp'),
+messageSends: ["commentStamp"],
 referencedClasses: []
 }),
 smalltalk.Behavior);
@@ -2416,6 +2416,48 @@ referencedClasses: []
 }),
 smalltalk.Boolean);
 
+smalltalk.addMethod(
+'_&',
+smalltalk.method({
+selector: '&',
+category: 'controlling',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	;
+return self;},
+source: unescape('%26%20aBoolean%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBoolean%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20false%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Boolean);
+
+smalltalk.addMethod(
+'_|',
+smalltalk.method({
+selector: '|',
+category: 'controlling',
+fn: function (aBoolean){
+var self=this;
+
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	;
+return self;},
+source: unescape('%7C%20aBoolean%0A%09%3C%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20true%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20aBoolean%3B%0A%09%20%20%20%20%7D%0A%09%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Boolean);
+
 
 
 smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
@@ -4600,6 +4642,21 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+'_asciiValue',
+smalltalk.method({
+selector: 'asciiValue',
+category: 'accessing',
+fn: function (){
+var self=this;
+return self.charCodeAt(0);;
+return self;},
+source: unescape('asciiValue%0A%09%3Creturn%20self.charCodeAt%280%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String);
+
 
 smalltalk.addMethod(
 '_streamClass',
@@ -4724,6 +4781,21 @@ referencedClasses: [smalltalk.String]
 }),
 smalltalk.String.klass);
 
+smalltalk.addMethod(
+'_value_',
+smalltalk.method({
+selector: 'value:',
+category: 'instance creation',
+fn: function (aUTFCharCode){
+var self=this;
+return String.fromCharCode(aUTFCharCode);;
+return self;},
+source: unescape('value%3A%20aUTFCharCode%0A%0A%09%3Creturn%20String.fromCharCode%28aUTFCharCode%29%3B%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String.klass);
+
 
 smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel');
 smalltalk.addMethod(

+ 5 - 3
js/Parser.deploy.js

@@ -1036,9 +1036,11 @@ smalltalk.method({
 selector: 'import:',
 fn: function (aStream){
 var self=this;
-smalltalk.send(smalltalk.send(aStream, "_atEnd", []), "_ifFalse_", [(function(){var nextChunk=nil;
-nextChunk=smalltalk.send(smalltalk.send(self, "_chunkParser", []), "_parse_", [aStream]);return smalltalk.send(nextChunk, "_ifNotNil_", [(function(){smalltalk.send(smalltalk.send(nextChunk, "_isInstructionChunk", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]), "_scanFrom_", [aStream]);}), (function(){return smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]);})]);return smalltalk.send(self, "_import_", [aStream]);})]);})]);
-return self;}
+try{var nextChunk=nil;
+var result=nil;
+(function(){while(!(function(){return smalltalk.send(aStream, "_atEnd", []);})()) {(function(){nextChunk=smalltalk.send(smalltalk.send(self, "_chunkParser", []), "_parse_", [aStream]);(($receiver = nextChunk) == nil || $receiver == undefined) ? (function(){return (function(){throw({name: 'stReturn', selector: '_import_', fn: function(){return self}})})();})() : $receiver;result=smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]);return (($receiver = smalltalk.send(nextChunk, "_isInstructionChunk", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(result, "_scanFrom_", [aStream]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(result, "_scanFrom_", [aStream]);})]);})()}})();
+return self;
+} catch(e) {if(e.name === 'stReturn' && e.selector === '_import_'){return e.fn()} throw(e)}}
 }),
 smalltalk.Importer);
 

+ 8 - 6
js/Parser.js

@@ -1337,12 +1337,14 @@ selector: 'import:',
 category: 'fileIn',
 fn: function (aStream){
 var self=this;
-smalltalk.send(smalltalk.send(aStream, "_atEnd", []), "_ifFalse_", [(function(){var nextChunk=nil;
-nextChunk=smalltalk.send(smalltalk.send(self, "_chunkParser", []), "_parse_", [aStream]);return smalltalk.send(nextChunk, "_ifNotNil_", [(function(){smalltalk.send(smalltalk.send(nextChunk, "_isInstructionChunk", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]), "_scanFrom_", [aStream]);}), (function(){return smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]);})]);return smalltalk.send(self, "_import_", [aStream]);})]);})]);
-return self;},
-source: unescape('import%3A%20aStream%0A%09aStream%20atEnd%20ifFalse%3A%20%5B%0A%09%20%20%20%20%7C%20nextChunk%20%7C%0A%09%20%20%20%20nextChunk%20%3A%3D%20self%20chunkParser%20parse%3A%20aStream.%0A%09%20%20%20%20nextChunk%20ifNotNil%3A%20%5B%0A%09%09nextChunk%20isInstructionChunk%20%0A%09%09%20%20%20%20ifTrue%3A%20%5B%28Compiler%20new%20loadExpression%3A%20nextChunk%20contents%29%0A%09%09%09%09%09%20scanFrom%3A%20aStream%5D%0A%09%09%20%20%20%20ifFalse%3A%20%5BCompiler%20new%20loadExpression%3A%20nextChunk%20contents%5D.%0A%09%09self%20import%3A%20aStream%5D%5D'),
-messageSends: ["ifFalse:", "atEnd", "parse:", "chunkParser", "ifNotNil:", "ifTrue:ifFalse:", "isInstructionChunk", "scanFrom:", "loadExpression:", "new", "contents", "import:"],
-referencedClasses: [smalltalk.nil]
+try{var nextChunk=nil;
+var result=nil;
+(function(){while(!(function(){return smalltalk.send(aStream, "_atEnd", []);})()) {(function(){nextChunk=smalltalk.send(smalltalk.send(self, "_chunkParser", []), "_parse_", [aStream]);(($receiver = nextChunk) == nil || $receiver == undefined) ? (function(){return (function(){throw({name: 'stReturn', selector: '_import_', fn: function(){return self}})})();})() : $receiver;result=smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]);return (($receiver = smalltalk.send(nextChunk, "_isInstructionChunk", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(result, "_scanFrom_", [aStream]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(result, "_scanFrom_", [aStream]);})]);})()}})();
+return self;
+} catch(e) {if(e.name === 'stReturn' && e.selector === '_import_'){return e.fn()} throw(e)}},
+source: unescape('import%3A%20aStream%0A%20%20%20%20%7C%20nextChunk%20result%20%7C%0A%20%20%20%20%5BaStream%20atEnd%5D%20whileFalse%3A%20%5B%0A%20%20%20%20%20%20%20%20nextChunk%20%3A%3D%20self%20chunkParser%20parse%3A%20aStream.%0A%20%20%20%20%20%20%20%20nextChunk%20ifNil%3A%20%5B%5Eself%5D.%0A%20%20%20%20%20%20%20%20result%20%3A%3D%20Compiler%20new%20loadExpression%3A%20nextChunk%20contents.%0A%20%20%20%20%20%20%20%20nextChunk%20isInstructionChunk%20%0A%20%20%20%20%20%20%20%20%20%20%20%20ifTrue%3A%20%5Bresult%20scanFrom%3A%20aStream%5D%5D'),
+messageSends: ["whileFalse:", "atEnd", "parse:", "chunkParser", "ifNil:", "loadExpression:", "new", "contents", "ifTrue:", "isInstructionChunk", "scanFrom:"],
+referencedClasses: [smalltalk.Compiler]
 }),
 smalltalk.Importer);
 

+ 0 - 0
st/Compiler.st


+ 31 - 1
st/Kernel.st

@@ -387,7 +387,8 @@ methodsFor: aString stamp: aStamp
 !
 
 commentStamp: aStamp prior: prior
-         "Ignored right now."
+         "Stamp and prior ignored right now."
+	^self commentStamp
 ! !
 
 !Behavior methodsFor: 'instance creation'!
@@ -852,6 +853,26 @@ or: aBlock
 
 not
 	^self = false
+!
+
+& aBoolean
+	<
+	    if(self == true) {
+		return aBoolean;
+	    } else {
+		return false;
+	    }
+	>
+!
+
+| aBoolean
+	<
+	    if(self == true) {
+		return true;
+	    } else {
+		return aBoolean;
+	    }
+	>
 ! !
 
 !Boolean methodsFor: 'copying'!
@@ -1422,6 +1443,10 @@ escaped
 
 unescaped
 	<return unescape(self)>
+!
+
+asciiValue
+	<return self.charCodeAt(0);>
 ! !
 
 !String methodsFor: 'adding'!
@@ -1652,6 +1677,11 @@ streamContents: blockWithArg
 	stream := (self streamClass on: String new).
 	blockWithArg value: stream.
 	^ stream contents
+!
+
+value: aUTFCharCode
+
+	<return String.fromCharCode(aUTFCharCode);>
 ! !
 
 SequenceableCollection subclass: #Array

+ 7 - 9
st/Parser.st

@@ -750,15 +750,13 @@ chunkParser
 !Importer methodsFor: 'fileIn'!
 
 import: aStream
-	aStream atEnd ifFalse: [
-	    | nextChunk |
-	    nextChunk := self chunkParser parse: aStream.
-	    nextChunk ifNotNil: [
-		nextChunk isInstructionChunk 
-		    ifTrue: [(Compiler new loadExpression: nextChunk contents)
-					 scanFrom: aStream]
-		    ifFalse: [Compiler new loadExpression: nextChunk contents].
-		self import: aStream]]
+    | nextChunk result |
+    [aStream atEnd] whileFalse: [
+        nextChunk := self chunkParser parse: aStream.
+        nextChunk ifNil: [^self].
+        result := Compiler new loadExpression: nextChunk contents.
+        nextChunk isInstructionChunk 
+            ifTrue: [result scanFrom: aStream]]
 ! !
 
 Object subclass: #Exporter