Browse Source

Forgot to commit changes made to Kernel.st

Nicolas Petton 13 years ago
parent
commit
bfb86eb564
2 changed files with 64 additions and 1 deletions
  1. 49 1
      js/Kernel.js
  2. 15 0
      st/Kernel.st

+ 49 - 1
js/Kernel.js

@@ -354,7 +354,7 @@ fn: function (aBlock, anotherBlock){
 var self=this;
 try{aBlock()} catch(e) {anotherBlock(e)};
 return self;},
-source: unescape('try%3A%20aBlock%20catch%3A%20anotherBlock%0A%09%3Ctry%7BaBlock%28%29%7D%20catch%28e%29%20%7BanotherBlock%28e%29%7D%3E'),
+source: unescape('try%3A%20aBlock%20catch%3A%20anotherBlock%0A%09%3Ctry%7BaBlock%28%29%7D%20catch%28e%29%20%7BanotherBlock%28e%29%7D%3E%20'),
 messageSends: [],
 referencedClasses: []
 }),
@@ -774,6 +774,54 @@ referencedClasses: []
 }),
 smalltalk.Smalltalk);
 
+smalltalk.addMethod(
+'_basicParse_',
+smalltalk.method({
+selector: 'basicParse:',
+category: 'accessing',
+fn: function (aString){
+var self=this;
+return smalltalk.parser.parse(aString);
+return self;},
+source: unescape('basicParse%3A%20aString%0A%09%3Creturn%20smalltalk.parser.parse%28aString%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Smalltalk);
+
+smalltalk.addMethod(
+'_parse_',
+smalltalk.method({
+selector: 'parse:',
+category: 'accessing',
+fn: function (aString){
+var self=this;
+var result=nil;
+smalltalk.send(self, "_try_catch_", [(function(){return result=smalltalk.send(self, "_basicParse_", [aString]);}), (function(ex){return smalltalk.send(smalltalk.send(self, "_parseError_", [ex]), "_signal", []);})]);
+return result;
+return self;},
+source: unescape('parse%3A%20aString%0A%09%7C%20result%20%7C%0A%09self%20try%3A%20%5Bresult%20%3A%3D%20self%20basicParse%3A%20aString%5D%20catch%3A%20%5B%3Aex%20%7C%20%28self%20parseError%3A%20ex%29%20signal%5D.%0A%09%5Eresult'),
+messageSends: ["try:catch:", "basicParse:", "signal", "parseError:"],
+referencedClasses: []
+}),
+smalltalk.Smalltalk);
+
+smalltalk.addMethod(
+'_parseError_',
+smalltalk.method({
+selector: 'parseError:',
+category: 'accessing',
+fn: function (anException){
+var self=this;
+return smalltalk.Error._new()
+		._messageText_('Parse error on line ' + anException.line + ' column ' + anException.column + ' : ' + anException.message);
+return self;},
+source: unescape('parseError%3A%20anException%0A%09%3Creturn%20smalltalk.Error._new%28%29%0A%09%09._messageText_%28%27Parse%20error%20on%20line%20%27%20+%20anException.line%20+%20%27%20column%20%27%20+%20anException.column%20+%20%27%20%3A%20%27%20+%20anException.message%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Smalltalk);
+
 
 smalltalk.Smalltalk.klass.iVarNames = ['current'];
 smalltalk.addMethod(

+ 15 - 0
st/Kernel.st

@@ -258,6 +258,21 @@ removeClass: aClass
 	aClass class methodDictionary values do: [:each |
 		aClass class removeCompiledMethod: each].
 	self basicDelete: aClass name
+!
+
+basicParse: aString
+	<return smalltalk.parser.parse(aString)>
+!
+
+parse: aString
+	| result |
+	self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex) signal].
+	^result
+!
+
+parseError: anException
+	<return smalltalk.Error._new()
+		._messageText_('Parse error on line ' + anException.line + ' column ' + anException.column + ' : ' + anException.message)>
 ! !
 
 Smalltalk class instanceVariableNames: 'current'!