A new version of Compiler was added to project The Inbox:
http://source.squeak.org/inbox/Compiler-ct.457.mcz ==================== Summary ==================== Name: Compiler-ct.457 Author: ct Time: 13 April 2021, 7:44:59.516492 pm UUID: 22e7ee9f-1b8a-054c-a950-a742690bc284 Ancestors: Compiler-nice.456 Fixes a long-known bug when parsing a message with multiple repetitions of a colon. See Tests-ct.451 and http://forum.world.st/BUG-Parser-does-not-detect-syntax-error-with-double-colon-tp5112572.html. Depends on Collections-ct.936. =============== Diff against Compiler-nice.456 =============== Item was changed: ----- Method: Parser>>expected: (in category 'error handling') ----- expected: aString "Notify a problem at token 'here'." + ^ self expected: aString at: hereMark + requestorOffset! - ^ self notify: aString , ' expected' at: hereMark + requestorOffset! Item was added: + ----- Method: Parser>>expected:at: (in category 'error handling') ----- + expected: aString at: location + + ^ self + notify: ('{1} expected' translated format: {aString}) + at: location! Item was changed: ----- Method: Parser>>messagePart:repeat: (in category 'expression types') ----- messagePart: level repeat: repeat | start receiver selector args precedence words keywordStart | [receiver := parseNode. (hereType == #keyword and: [level >= 3]) ifTrue: [start := self startOfNextToken. selector := WriteStream on: (String new: 32). args := OrderedCollection new. words := OrderedCollection new. [hereType == #keyword] whileTrue: [keywordStart := self startOfNextToken + requestorOffset. selector nextPutAll: self advance. words addLast: (keywordStart to: self endOfLastToken + requestorOffset). self primaryExpression ifFalse: [^self expected: 'Argument']. self messagePart: 2 repeat: true. args addLast: parseNode]. + + selector := selector readStream. + words do: [:word | + (selector next: word size - 1) + indexOf: $: ifPresent: [:index | + ^self expected: 'Argument' at: word start + index]. + selector skip: 1]. + selector := (Symbol lookup: selector contents) ifNil: [ self correctSelector: selector contents wordIntervals: words exprInterval: (start to: self endOfLastToken) ifAbort: [ ^ self fail ] ]. precedence := 3] ifFalse: [ (level >= 2 and: [hereType == #verticalBar]) ifTrue: [self transformAVerticalBarIntoABinarySelector]. (hereType == #binary and: [level >= 2]) ifTrue: [start := self startOfNextToken. selector := self advance asOctetString asSymbol. self primaryExpression ifFalse: [^self expected: 'Argument']. self messagePart: 1 repeat: true. args := Array with: parseNode. precedence := 2] ifFalse: [hereType == #word ifTrue: [start := self startOfNextToken. selector := self advance. args := #(). words := OrderedCollection with: (start + requestorOffset to: self endOfLastToken + requestorOffset). selector := (Symbol lookup: selector) ifNil: [ self correctSelector: selector wordIntervals: words exprInterval: (start to: self endOfLastToken) ifAbort: [ ^ self fail ] ]. precedence := 1] ifFalse: [^args notNil]]]. parseNode := MessageNode new receiver: receiver selector: selector arguments: args precedence: precedence from: encoder sourceRange: (start to: self endOfLastToken). repeat] whileTrue: []. ^true! |
Hi Christoph. > Depends on Collections-ct.936. Please try to avoid connecting bug fixes to (unrelated) proposals. Instead, try to fix the bugs with the available means. This way, your fixes can get merged faster. For your proposals, try to find examples that can improve code readability in general to promote an objective discussion. Best, Marcel
|
Free forum by Nabble | Edit this page |