PG3ShoutParser(SHParserST80)>>scanIdentifier

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
tty
Reply | Threaded
Open this post in threaded view
|

PG3ShoutParser(SHParserST80)>>scanIdentifier

tty

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



(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.


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.

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

Thx for your time.












Reply | Threaded
Open this post in threaded view
|

Re: PG3ShoutParser(SHParserST80)>>scanIdentifier

Levente Uzonyi
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.
>
>
>
>
>
>
>
>
>
>
>
>

tty
Reply | Threaded
Open this post in threaded view
|

Re: PG3ShoutParser(SHParserST80)>>scanIdentifier

tty
Hi Levente

Thank you for the response.

>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 prefAllowUnderscoreSelectors ->  true



The
SHParserST80 >>parse: 

does initialize the instance variables via this message send


self initializeInstanceVariables.

Which just loads an array of the instance variable names into an Array


initializeInstanceVariables

instanceVariables := classOrMetaClass 
ifNil: [ #() ]
ifNotNil: [ classOrMetaClass allInstVarNames asArray ].
Looking at the SHParserST80>>initialize

it sends SHParserST90>initialize

Which loads Smalltalk globals into the environment instance variable.

Inspecting that, I see no reference to the preferences.


If you think it should be in there, let me know and I will initialize the preferences there.

Thanks for your time.



tty
Reply | Threaded
Open this post in threaded view
|

Re: PG3ShoutParser(SHParserST80)> > scanIdentifier

tty
In reply to this post by Levente Uzonyi
I will download a fresh image tomorrow and try to reproduce. Thx





---- On Tue, 27 Feb 2018 20:51:00 -0500 [hidden email] wrote ----

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.

>

>

>

>

>

>

>

>

>

>

>

>





tty
Reply | Threaded
Open this post in threaded view
|

Re: PG3ShoutParser(SHParserST80)>>scanIdentifier

tty
In reply to this post by Levente Uzonyi
Problem solved.

I had loaded PostgresV3 from smalltalkhub(?) insteak of squeaksource.

The other repo is out of date.

thanks!

---- On Tue, 27 Feb 2018 20:51:00 -0500 Levente Uzonyi <[hidden email]> wrote ----
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.
>
>
>
>
>
>
>
>
>
>
>
>