A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler-ct.404.mcz ==================== Summary ==================== Name: Compiler-ct.404 Author: ct Time: 17 June 2019, 10:51:02.869037 pm UUID: 19e019f5-3ff6-0143-926d-e29c155cc4be Ancestors: Compiler-eem.403 Fix a defect in Parser>>#parseCue:noPattern:ifFail: Full failure case description: Run the following statement: Compiler evaluate: '''''''' In the appearing error window, enter any valid smalltalk expression and save it. Before loading this commit, it will give you a NonBooleanError as doItFlag was set too late (and so was not passed to SyntaxErrorNotification). =============== Diff against Compiler-eem.403 =============== 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. 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)]. - doitFlag := noPattern. failBlock:= aBlock. [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 ! |
+1 Le lun. 17 juin 2019 à 22:51, <[hidden email]> a écrit : A new version of Compiler was added to project The Inbox: |
In reply to this post by commits-2
I am not experienced with the usual processes. (Where) would have been an
appropriate place to add a regression test for this issue? In general, would this kind of tests comply with the usual practices here? Please let me know what I can do better! Best, Christoph -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
Carpe Squeak!
|
It would be interesting to test such behavior like this: [Compiler evaluate: ''''''''] on: SyntaxErrorNotification do: [:ex | ex resume: '''''''''']. However, SyntaxErrorNotification has a very special interface to re-try the parsing/compiling: #reparse:notifying:#ifFail:. ... or maybe override Exception >> #retryUsing:? Best, Marcel
|
Hi Marcel,
I recently wrote a similar extension method for own purposes: resumeWithSource: aString self reparse: aString notifying: nil ifFail: nil; resumeUnchecked: self defaultResumeValue But it does have a different semantic than #retryUsing, which usually takes a block? This will work for [Compiler evaluate: '6 times 7'] on: SyntaxErrorNotification do: [:ex | ex resumeWithSource: '6*7']. but not for [Compiler evaluate: ''''''''] on: SyntaxErrorNotification do: [:ex | ex resumeWithSource: '''''''''']. Changing #parseCue:noPattern:ifFail: so that the initializing calls are also handled when raising ReparseSourceAfterEditing would solve the problem: ... doitFlag := noPattern. [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] on: ReparseAfterSourceEditing do: [ :ex | ... However, would this be a good approach? Best, Christoph -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
Carpe Squeak!
|
PS: I also wondered why SyntaxErrorNotification does not override #isResumable ...
From: Squeak-dev <[hidden email]> on behalf of Christoph Thiede <[hidden email]>
Sent: Tuesday, June 18, 2019 9:02:58 AM To: [hidden email] Subject: Re: [squeak-dev] The Inbox: Compiler-ct.404.mcz Hi Marcel,
I recently wrote a similar extension method for own purposes: resumeWithSource: aString self reparse: aString notifying: nil ifFail: nil; resumeUnchecked: self defaultResumeValue But it does have a different semantic than #retryUsing, which usually takes a block? This will work for [Compiler evaluate: '6 times 7'] on: SyntaxErrorNotification do: [:ex | ex resumeWithSource: '6*7']. but not for [Compiler evaluate: ''''''''] on: SyntaxErrorNotification do: [:ex | ex resumeWithSource: '''''''''']. Changing #parseCue:noPattern:ifFail: so that the initializing calls are also handled when raising ReparseSourceAfterEditing would solve the problem: ... doitFlag := noPattern. [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] on: ReparseAfterSourceEditing do: [ :ex | ... However, would this be a good approach? Best, Christoph -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
Carpe Squeak!
|
Free forum by Nabble | Edit this page |