Sha256: 5653787398a5468200e046fb9d3525e61c4e609ba031358fa1da6bbc52f4bd90
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
Object subclass: #Repl instanceVariableNames: 'readline interface util' category: 'REPL'! !Repl methodsFor: 'accessing'! prompt ^'amber >> ' ! ! !Repl methodsFor: 'actions'! createInterface "No completion for now" interface := readline createInterface: process stdin stdout: process stdout. interface on: 'line' do: [:buffer | self eval: buffer]. interface on: 'close' do: [self close]. self setPrompt. interface prompt ! setPrompt interface setPrompt: self prompt ! close process stdin destroy ! eval: buffer | result | buffer isEmpty ifFalse: [ self try: [ result := Compiler new loadExpression: buffer. Transcript show: result] catch: [:e | e isSmalltalkError ifTrue: [ErrorHandler new handleError: e] ifFalse: [process stdout write: e jsStack]]]. interface prompt ! ! !Repl methodsFor: 'initialization'! initialize super initialize. readline := require value: 'readline'. util := require value: 'util' ! ! !Repl class methodsFor: 'not yet classified'! main self new createInterface ! !
Version data entries
6 entries across 6 versions & 2 rubygems