'From Cuis 1.0 of 28 November 2009 [latest update: #337] on 8 December 2009 at 4:21:33 pm'!

!BlockContext methodsFor: 'printing' stamp: 'eem 5/16/2008 12:03'!
printOn: aStream
	| decompilation blockString truncatedBlockString |

	home == nil ifTrue: [^aStream nextPutAll: 'a BlockContext with home=nil'].
	aStream nextPutAll: '[] in '.
	super printOn: aStream.
	decompilation := [self decompile ifNil: ['--source missing--']]
						on: Error
						do: [:ex| ' (error in decompilation)'].
	blockString := ((decompilation isString
					ifTrue: [decompilation]
					ifFalse: [decompilation printString])
						replaceAll: Character cr with: Character space)
							replaceAll: Character tab with: Character space.
	truncatedBlockString := blockString truncateWithElipsisTo: 80.
	truncatedBlockString size < blockString size ifTrue:
		[truncatedBlockString := truncatedBlockString, ']}'].
	aStream space; nextPutAll: truncatedBlockString! !


!Browser methodsFor: 'class functions' stamp: 'eem 5/7/2008 12:04'!
classDefinitionText
	"return the text to display for the definition of the currently selected class"
	| theClass |
	^(theClass := self selectedClassOrMetaClass) ifNil: [''] ifNotNil: [theClass definition]! !


!ClassDescription methodsFor: '*Tweak-Hacks' stamp: 'eem 5/7/2008 12:03'!
browserDefinition: style
	"Answer a String that defines the receiver."
	^self definition! !


!Compiler methodsFor: 'public access' stamp: 'eem 5/6/2008 15:16'!
format: textOrStream in: aClass notifying: aRequestor contentsSymbol: aSymbol
	"Compile a parse tree from the argument, textOrStream. Answer a string containing the original code, formatted nicely.  If aBoolean is true, then decorate the resulting text with color and hypertext actions"

	| aNode |
	self from: textOrStream
		class: aClass
		context: nil
		notifying: aRequestor.
	aNode := self format: sourceStream noPattern: false ifFail: [^ nil].

	aSymbol == #colorPrint ifTrue:
		[^aNode asColorizedSmalltalk80Text].

	^aNode decompileString! !


!InstructionPrinter methodsFor: 'instruction decoding' stamp: 'eem 5/23/2008 13:58'!
pushConstant: obj
	"Print the Push Constant, obj, on Top Of Stack bytecode."

	self print: (String streamContents:
				[:s |
				s nextPutAll: 'pushConstant: '.
				(obj isKindOf: LookupKey)
					ifFalse: [obj printOn: s]
					ifTrue: [obj key
						ifNotNil: [s nextPutAll: '##'; nextPutAll: obj key]
						ifNil: [s nextPutAll: '###'; nextPutAll: obj value soleInstance name]]]).

	(obj isKindOf: CompiledMethod) ifTrue:
		[obj longPrintOn: stream indent: self indent + 2.
		^self].! !


!Metaclass methodsFor: '*Tweak-Hacks' stamp: 'eem 5/7/2008 12:03'!
browserDefinition: style
	"Answer a String that defines the receiver."
	^self definition! !


!Parser class methodsFor: 'class initialization' stamp: 'eem 9/10/2008 09:58'!
initialize
	Preferences
		addBooleanPreference: #allowUnderscoreAssignment 
		category: #compiler 
		default: false
		balloonHelp: 'If enabled, the compiler will accept _ (underscore) for assignment.\This provides backward compatibility with the pre-ANSI compiler.' withCRs.
	Preferences
		addBooleanPreference: #allowBlockArgumentAssignment 
		category: #compiler 
		default: false
		balloonHelp: 'If enabled, the compiler will allow assignment into block arguments.\This provides backward compatibility with the pre-closure compiler.' withCRs.! !


!ProcessBrowser methodsFor: 'accessing' stamp: 'eem 6/12/2008 12:41'!
stackListIndex: index 
	stackListIndex := index.
	selectedContext := (stackList notNil
						and: [index > 0]) ifTrue:
							[stackList at: index ifAbsent: []].
	selectedClass := nil.
	selectedSelector := nil.
	methodText := nil.
	self changed: #stackListIndex.
	self changed: #selectedMethod! !

!ProcessBrowser methodsFor: 'stack list' stamp: 'eem 6/12/2008 12:44'!
pcRange
	"Answer the indices in the source code for the method corresponding to  
	the selected context's program counter value."
	(selectedContext isNil or: [methodText isEmptyOrNil])
		ifTrue: [^ 1 to: 0].
	^selectedContext debuggerMap
		rangeForPC: (selectedContext pc ifNotNil: [:pc| pc] ifNil: [selectedContext method endPC])
		contextIsActiveContext: stackListIndex = 1! !

Parser initialize!
"Postscript:
Leave the line above, and replace the rest of this comment by a useful one.
Executable statements should follow this comment, and should
be separated by periods, with no exclamation points (!!).
Be sure to put any further comments in double-quotes, like this one."
Parser initialize.
"Postscript:
Can't recompile CompiledMethod so have to remove the class var explicitly."
(CompiledMethod classPool includesKey: #TempNameCache) ifTrue:
	[CompiledMethod removeClassVarName: #TempNameCache]!

