Catching the Notification stops it from popping up the syntaxErrorDebugger.

 

'AAA.st' asFileReference readStreamDo: [ :s |

               importer := CodeImporter fileStream: s.

              

               [ importer evaluateDeclarations ] on: SyntaxErrorNotification do: [ :e | ���]

              

].

 

From: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] On Behalf Of Tudor Girba
Sent: Saturday, May 21, 2016 11:25 PM
To: Pharo Development List <pharo-dev@lists.pharo.org>
Subject: [Pharo-dev] how to swallow a syntax error?

 

Hi,

 

I am having trouble making the compiler not be interactive when it encounters a syntax error.

 

To reproduce the problem I attach here an .st file that has a funny character in the method name. If I file this in, like:

            ���AAA.st��� asFileReference fileIn.

 

 I get a Syntax Error dialog. I would like to avoid that.

 

After diving in, I noticed that I can tell the requestor of the CodeImporter to not be interactive, but that does not seem to have an effect:

'AAA.st' asFileReference readStreamDo: [ :s |

            importer := CodeImporter fileStream: s.
            importer requestor interactive: false.
            importer evaluateDeclarations ]

 

I also tried to play on the end of the SyntaxErrorDebugger, and replace it with something that logs the exception, but I was not successful because that one is expected to return a string that can be compiled.

 

Can anyone point me in the right direction?

 

Cheers,

Doru

 

--
www.tudorgirba.com
www.feenk.com

"Every now and then stop and ask yourself if the war you're fighting is the right one."