[squeak-dev] The Trunk: Compiler-eem.403.mcz
Eliot Miranda
eliot.miranda at gmail.com
Tue Mar 19 18:59:51 UTC 2019
On Tue, Mar 19, 2019 at 11:58 AM <commits at source.squeak.org> wrote:
> Eliot Miranda uploaded a new version of Compiler to project The Trunk:
> http://source.squeak.org/trunk/Compiler-eem.403.mcz
>
> ==================== Summary ====================
>
> Name: Compiler-eem.403
> Author: eem
> Time: 19 March 2019, 11:58:47.238202 am
> UUID: a0f07dce-0a58-422e-af37-32d5a3bd6546
> Ancestors: Compiler-eem.402
>
> Fixed yhree typos in a comment, and improved the class comments for
> ParseNodeEnumerator & subclass.
>
Oh really? Three steps forward, one step back. Boy this is a humiliating
business ;-)
>
> =============== Diff against Compiler-eem.402 ===============
>
> Item was changed:
> ParseNodeVisitor subclass: #ParseNodeEnumerator
> instanceVariableNames: 'theBlock theSelectBlock'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Compiler-Support'!
>
> + !ParseNodeEnumerator commentStamp: 'eem 3/19/2019 11:58' prior: 0!
> - !ParseNodeEnumerator commentStamp: 'eem 8/31/2010 11:41' prior: 0!
> ParseNodeEnumerator implements ParseNode>>nodesDo:. It can be used to
> enumerate an entire tree via
> aParseNode accept: (ParseNodeEnumerator ofBlock: aBlock)
> or selectively, excluding the node and subnodes for which selectBlock
> answers false, via
> aParseNode accept: (ParseNodeEnumerator
> ofBlock: aBlock
> select:
> selectBlock)
> + Instance Variables
> + theBlock: <BlockClosure>
> + theSelectBlock: <BlockClosure | nil>
>
> + theBlock
> + - the block that is evaluated with the parse nodes the receiver
> visits.
> +
> + theSelectBlock
> + - an optional block used to select blocks to visit and descend
> into.
> +
> Here's a doIt that generates and compiles the visiting methods:
>
> self superclass selectors do:
> [:s|
> self compile: (String streamContents:
> [:str| | arg |
> arg := 'a', (s allButFirst: 5) allButLast.
> str nextPutAll: s, ' ', arg; crtab;
> nextPutAll: '(theSelectBlock isNil or:
> [theSelectBlock value: '; nextPutAll: arg; nextPutAll: ']) ifFalse:'; crtab;
> tab: 2; nextPutAll: '[^nil].'; crtab;
> nextPutAll: 'theBlock value: '; nextPutAll: arg;
> nextPut: $.; crtab;
> nextPutAll: '^super '; nextPutAll: s, ' ', arg])]!
>
> Item was changed:
> ParseNodeEnumerator subclass: #ParseNodeWithPrecedingStatementEnumerator
> instanceVariableNames: 'precedingStatement'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Compiler-Support'!
> +
> + !ParseNodeWithPrecedingStatementEnumerator commentStamp: 'eem 3/19/2019
> 11:55' prior: 0!
> + A ParseNodeWithPrecedingStatementEnumerator is a ParseNodeEnumerator
> that accepts a binary block in ofBlock:, and hence enumerates statement
> nodes with their preceding statement, or nil if they are the first.
> +
> + Instance Variables
> + precedingStatement: <ParseNode | nil>
> +
> + precedingStatement
> + - the preceding statement node, if any
> + !
>
> Item was changed:
> ----- Method: ParseNodeWithPrecedingStatementEnumerator>>ofBlock: (in
> category 'initialize-release') -----
> ofBlock: aBlock
> "N.B. This enumerator visits a node before any of the node's
> children.
> + Hence, when enumerating statements in a block, we can ensure that
> + the second argument to the block, the preceding statement, is
> non-nil
> + only for top-level statements in the block by nilling out
> precedingStatement
> - Hence, when enumewrating statements in a block, we can ensure that
> - the second argument to the block, the preceeding statement, is
> non-nil
> - only for top-level statements in the block by nilling out
> preceedingStatement
> once the block is evaluated. Perhaps stronger would be to capture
> its value
> in a temporary and nil it before evaluating, but this is good
> enough."
> theBlock := [:node|
> aBlock value: node value:
> precedingStatement.
> precedingStatement := nil]!
>
>
>
--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190319/db3c8653/attachment.html>
More information about the Squeak-dev
mailing list
|