[squeak-dev] The Trunk: ShoutCore-mt.81.mcz
Levente Uzonyi
leves at caesar.elte.hu
Mon Jun 15 16:20:08 UTC 2020
Hi Marcel,
On Mon, 15 Jun 2020, commits at source.squeak.org wrote:
> Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:
> http://source.squeak.org/trunk/ShoutCore-mt.81.mcz
>
> ==================== Summary ====================
>
> Name: ShoutCore-mt.81
> Author: mt
> Time: 15 June 2020, 4:41:07.031209 pm
> UUID: b5dfda57-678c-bd4b-91ba-3eae94326352
> Ancestors: ShoutCore-mt.80
>
> Avoid breaking new hook for <pragmaParser> when subclassing SHParserST80. That is, re-use all existing pragma parsers automatically in subclasses. Note that #methodDict was chosen over #lookupSelector: for performance reasons.
I think it would be worth adding a few test cases custom pragma parsers.
>
> =============== Diff against ShoutCore-mt.80 ===============
>
> Item was changed:
> ----- Method: SHParserST80>>parsePragmaStatement (in category 'parse pragma') -----
> parsePragmaStatement
>
> | parserSelector |
> (currentToken last == $:
> and: [(parserSelector := Symbol lookup: currentToken allButLast) notNil])
> ifFalse: ["Quick exit to not break one-word pragmas such as <primitive> and <foobar>; also avoid interning new symbols for made-up pragmas such as for <my: 1 new: 2 pragma: 3> not interning #my."
> ^ self parsePragmaStatementKeywords].
I think it would be easier to read the above lines in the following form:
currentToken last == $: ifTrue: [
(Symbol lookup: currentToken allButLast) ifNotNil: [ :parserSelector |
"Quick exit to not break one-word pragmas such as <primitive> and <foobar>; also avoid interning new symbols for made-up pragmas such as for <my: 1 new: 2 pragma: 3> not interning #my."
^self parsePragmaStatementKeywords ] ].
>
> + SHParserST80 methodDict
> - self class methodDict
> at: parserSelector
> ifPresent: [:parserMethod |
> (parserMethod pragmas
> anySatisfy: [:pragma | pragma keyword == #pragmaParser])
> ifTrue: [^ self executeMethod: parserMethod]].
How about using #hasPragma: here?
(parserMethod hasPragma: #pragmaParser) ifTrue: [
^self executeMethod: parserMethod ]
Levente
>
> ^ self parsePragmaStatementKeywords!
More information about the Squeak-dev
mailing list
|