[squeak-dev] PG3ShoutParser(SHParserST80)>>scanIdentifier

Levente Uzonyi leves at caesar.elte.hu
Wed Feb 28 01:51:00 UTC 2018


On Tue, 27 Feb 2018, gettimothy wrote:

> 
> Good morning.
> Asking advice on approach to fixing this the right way. End result is at minimum a functioning class and a test to catch this stuff going forward.
> 
> 
> On Squeak 5.1 16551
> 
> First, to recreate the issue..
> 
> 
>
>       PG3SchemaMirror subclass: #MyDBSchemaMirror  
> 
> 
> (and get it talking to the db via instructions here: http://forum.world.st/Status-of-PostgresV3-td4780110.html)
> Then, via those same instructions, get a Postgres Function downloaded to Squeak or attempt to enter one by hand.
> 
> 
> Second, the symptoms 
> 
> The SHParserST80) attempts to parse the code and a "Proceed for Truth" errors start popping up.
> 
> 
> Debugging it, the culprit is in
>       PG3ShoutParser(SHParserST80)>>scanIdentifier

Somehow it was not initialized properly.

> 
> 
> 
> (c := self nextChar) isAlphaNumeric
> or: [ allowUnderscoreSelectors and: [ c == $_ ] ] ] whileTrue.
>  
> 
> 
> Where allowUnderscoreSelectors is undefined.
> 
> As a quick fix attempt, changing to
>       Scanner allowUnderscoreAsAssignment 
> 
> makes that error go away. However, new ones start popping up, so I decided to dig into things a bit more.

allowUnderscoreSelectors should be initialized by SHParserST80 >> #parse: 
to the value of the expression: Scanner prefAllowUnderscoreSelectors.
What does that expression evaluate to in your image?

> 
> 
> Scanner is the wrong approach, because it and SHParserST80 are not related via inheritence (although they do share a common instance variable named "allowUnderscoreSelectors"
> 
> I wondering if SHParserST80 is superceded by Scanner and if so, I am wondering the best way to approach this bug.

No, the two are somewhat unrelated.
Scanner is the scanner used by the Compiler.
SHParserST80 is the parser used for syntax highlighting only.
The former is there to compile your code within a few hundred 
milliseconds (on slower machines).
The latter is there to highlight your code within a few milliseconds 
(on slower machines). It does that every time you press a key.

> 
> Should I fix it within the SHParserST80 paradigm or is migration to Scanner in order?

No, and no. Something is fishy in your image. Answering my question above
should get you closer to the solution.

Levente

> 
> Thx for your time.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>


More information about the Squeak-dev mailing list