[squeak-dev] The Trunk: Compiler-mt.413.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Nov 21 15:23:16 UTC 2019


Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.413.mcz

==================== Summary ====================

Name: Compiler-mt.413
Author: mt
Time: 21 November 2019, 4:23:15.551156 pm
UUID: db181638-e223-5648-8bea-f5084f9c44ad
Ancestors: Compiler-mt.412, Compiler-ct.407

Merges Compiler-ct.407. We can now programmatically handle syntax errors:

[Compiler evaluate: '3+?']
	on: SyntaxErrorNotification
	do: [:ex | ex resume: '3+4'].

=============== Diff against Compiler-mt.412 ===============

Item was changed:
  ----- Method: Parser>>parseCue:noPattern:ifFail: (in category 'public access') -----
  parseCue: aCue noPattern: noPattern ifFail: aBlock 
  	"Answer a MethodNode for the argument, sourceStream, that is the root of
  	 a parse tree. Parsing is done with respect to the CompilationCue to 
  	 resolve variables. Errors in parsing are reported to the cue's requestor; 
  	 otherwise aBlock is evaluated. The argument noPattern is a Boolean that is
  	 true if the the sourceStream does not contain a method header (i.e., for DoIts)."
  
  	| methNode repeatNeeded myStream s p subSelection |
  	myStream := aCue sourceStream.
  	[repeatNeeded := false.
  	 p := myStream position.
  	 s := myStream upToEnd.
  	 myStream position: p.
- 
- 	 doitFlag := noPattern.
- 	 failBlock:= aBlock.
  	
+ 	 doitFlag := noPattern.
+ 	 [self encoder init: aCue notifying: self.
- 	 self encoder init: aCue notifying: self.
  	 self init: myStream cue: aCue failBlock: [^ aBlock value].
  	
  	 subSelection := self interactive and: [cue requestor selectionInterval = (p + 1 to: p + s size)].
  
+ 	 failBlock:= aBlock.
+ 	 methNode := self method: noPattern context: cue context] 
- 	 [methNode := self method: noPattern context: cue context] 
  		on: ReparseAfterSourceEditing 
  		do:	[ :ex |
  			repeatNeeded := true.
  			properties := nil. "Avoid accumulating pragmas and primitives Number"
  			myStream := ex newSource 
  				ifNil: [subSelection
  							ifTrue:
  								[ReadStream
  									on: cue requestor text string
  									from: cue requestor selectionInterval first
  									to: cue requestor selectionInterval last]
  							ifFalse:
  								[ReadStream on: cue requestor text string]]
  				ifNotNil: [:src | myStream := src readStream]].
  	 repeatNeeded] whileTrue:
  		[encoder := self encoder class new].
  	methNode sourceText: s.
  	^methNode
  !

Item was added:
+ ----- Method: SyntaxErrorNotification>>isResumable (in category 'accessing') -----
+ isResumable
+ 
+ 	^ true!

Item was changed:
  ----- Method: SyntaxErrorNotification>>messageText (in category 'accessing') -----
  messageText
  	^ super messageText
+ 		ifEmpty: [messageText := code]!
- 		ifNil: [messageText := code]!

Item was added:
+ ----- Method: SyntaxErrorNotification>>resume: (in category 'accessing') -----
+ resume: source
+ 
+ 	self reparse: source notifying: nil ifFail: nil.
+ 	^ super resume: self defaultResumeValue!



More information about the Squeak-dev mailing list