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."
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<http://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<http://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<http://www.tudorgirba.com> www.feenk.com<http://www.feenk.com> "Every now and then stop and ask yourself if the war you're fighting is the right one."
Hi, Thanks! I tried before with catching Error, but of course SyntaxErrorNotification is a Notification :). This means I am tired and I should go to sleep. Thanks again for unlocking me. Cheers, Doru
On May 21, 2016, at 11:30 PM, Henrik Nergaard <henrik.nergaard@uia.no> wrote:
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."
-- www.tudorgirba.com www.feenk.com "Don't give to get. Just give."
participants (2)
-
Henrik Nergaard -
Tudor Girba