|  | @@ -913,6 +913,14 @@ prompt
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  !Repl methodsFor: 'actions'!
 |  |  !Repl methodsFor: 'actions'!
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +clearScreen
 | 
											
												
													
														|  | 
 |  | +	| esc cls |
 | 
											
												
													
														|  | 
 |  | +	esc := String fromCharCode: 27.
 | 
											
												
													
														|  | 
 |  | +	cls := esc, '[2J', esc, '[0;0f'.
 | 
											
												
													
														|  | 
 |  | +	process stdout write: cls.
 | 
											
												
													
														|  | 
 |  | +	interface prompt
 | 
											
												
													
														|  | 
 |  | +!
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  close
 |  |  close
 | 
											
												
													
														|  |  	process stdin destroy
 |  |  	process stdin destroy
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
										
											
												
													
														|  | @@ -936,11 +944,16 @@ eval: buffer on: anObject
 | 
											
												
													
														|  |  			result := Compiler new evaluateExpression: buffer on: anObject]
 |  |  			result := Compiler new evaluateExpression: buffer on: anObject]
 | 
											
												
													
														|  |  		catch: [:e |
 |  |  		catch: [:e |
 | 
											
												
													
														|  |  			e isSmalltalkError
 |  |  			e isSmalltalkError
 | 
											
												
													
														|  | -			    ifTrue: [ErrorHandler new handleError: e]
 |  | 
 | 
											
												
													
														|  | -			    ifFalse: [process stdout write: e jsStack]]].
 |  | 
 | 
											
												
													
														|  | 
 |  | +			    ifTrue: [ e resignal ]
 | 
											
												
													
														|  | 
 |  | +			    ifFalse: [ process stdout write: e jsStack ]]].
 | 
											
												
													
														|  |  	^ result
 |  |  	^ result
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +printWelcome
 | 
											
												
													
														|  | 
 |  | +	Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.
 | 
											
												
													
														|  | 
 |  | +	Transcript show: 'Type :q to exit.'; cr.
 | 
											
												
													
														|  | 
 |  | +!
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  setPrompt
 |  |  setPrompt
 | 
											
												
													
														|  |  	interface setPrompt: self prompt
 |  |  	interface setPrompt: self prompt
 | 
											
												
													
														|  |  ! !
 |  |  ! !
 | 
											
										
											
												
													
														|  | @@ -983,18 +996,12 @@ assignNewVariable: buffer do: aBlock
 | 
											
												
													
														|  |  	^ self parseAssignment: buffer do: [ :name :expr || varName value |
 |  |  	^ self parseAssignment: buffer do: [ :name :expr || varName value |
 | 
											
												
													
														|  |  		varName := name ifNil: [self nextResultName].
 |  |  		varName := name ifNil: [self nextResultName].
 | 
											
												
													
														|  |  		session := self addVariableNamed: varName to: session.
 |  |  		session := self addVariableNamed: varName to: session.
 | 
											
												
													
														|  | -		value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session.
 |  | 
 | 
											
												
													
														|  | 
 |  | +		[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]
 | 
											
												
													
														|  | 
 |  | +			on: Error
 | 
											
												
													
														|  | 
 |  | +			do: [ :e | ErrorHandler new logError: e. value := nil].
 | 
											
												
													
														|  |  		aBlock value: varName value: value]
 |  |  		aBlock value: varName value: value]
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -clearScreen
 |  | 
 | 
											
												
													
														|  | -	| esc cls |
 |  | 
 | 
											
												
													
														|  | -	esc := String fromCharCode: 27.
 |  | 
 | 
											
												
													
														|  | -	cls := esc, '[2J', esc, '[0;0f'.
 |  | 
 | 
											
												
													
														|  | -	process stdout write: cls.
 |  | 
 | 
											
												
													
														|  | -	interface prompt
 |  | 
 | 
											
												
													
														|  | -!
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  encapsulateVariable: aString withValue: anObject in: aClass
 |  |  encapsulateVariable: aString withValue: anObject in: aClass
 | 
											
												
													
														|  |  	"Add getter and setter for given variable to session."
 |  |  	"Add getter and setter for given variable to session."
 | 
											
												
													
														|  |  	| compiler |
 |  |  	| compiler |
 | 
											
										
											
												
													
														|  | @@ -1022,7 +1029,7 @@ instanceVariableNamesFor: aClass
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  isIdentifier: aString
 |  |  isIdentifier: aString
 | 
											
												
													
														|  | -	^ aString match: '^[a-z_]\w+$' asRegexp
 |  | 
 | 
											
												
													
														|  | 
 |  | +	^ aString match: '^[a-z_]\w*$' asRegexp
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  isVariableDefined: aString
 |  |  isVariableDefined: aString
 | 
											
										
											
												
													
														|  | @@ -1047,8 +1054,8 @@ parseAssignment: aString do: aBlock
 | 
											
												
													
														|  |  	| assignment |
 |  |  	| assignment |
 | 
											
												
													
														|  |  	assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].
 |  |  	assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].
 | 
											
												
													
														|  |  	^ (assignment size = 2 and: [self isIdentifier: assignment first])
 |  |  	^ (assignment size = 2 and: [self isIdentifier: assignment first])
 | 
											
												
													
														|  | -		ifTrue: [aBlock value: assignment first value: assignment last]
 |  | 
 | 
											
												
													
														|  | -		ifFalse: [aBlock value: nil value: nil]
 |  | 
 | 
											
												
													
														|  | 
 |  | +		ifTrue: [ aBlock value: assignment first value: assignment last ]
 | 
											
												
													
														|  | 
 |  | +		ifFalse: [ aBlock value: nil value: nil ]
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  presentResultNamed: varName withValue: value
 |  |  presentResultNamed: varName withValue: value
 | 
											
										
											
												
													
														|  | @@ -1056,11 +1063,6 @@ presentResultNamed: varName withValue: value
 | 
											
												
													
														|  |  	interface prompt
 |  |  	interface prompt
 | 
											
												
													
														|  |  !
 |  |  !
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -printWelcome
 |  | 
 | 
											
												
													
														|  | -	Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.
 |  | 
 | 
											
												
													
														|  | -	Transcript show: 'Type :q to exit.'; cr.
 |  | 
 | 
											
												
													
														|  | -!
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  processLine: buffer
 |  |  processLine: buffer
 | 
											
												
													
														|  |  	"Processes lines entered through the readline interface."
 |  |  	"Processes lines entered through the readline interface."
 | 
											
												
													
														|  |  	| show |
 |  |  	| show |
 |