author | Jan Vrany <jan.vrany@labware.com> |
Thu, 27 Oct 2022 14:53:59 +0100 | |
branch | jv |
changeset 4735 | 3b11fb3ede98 |
parent 4723 | 524785227024 |
permissions | -rw-r--r-- |
3363 | 1 |
" |
2 |
COPYRIGHT (c) 2014 by eXept Software AG |
|
3394 | 3 |
All Rights Reserved |
3363 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libcomp' }" |
|
13 |
||
3613
cf01a916c775
class: EvalScriptingErrorHandler
Stefan Vogel <sv@exept.de>
parents:
3394
diff
changeset
|
14 |
"{ NameSpace: Smalltalk }" |
cf01a916c775
class: EvalScriptingErrorHandler
Stefan Vogel <sv@exept.de>
parents:
3394
diff
changeset
|
15 |
|
3363 | 16 |
CompilationErrorHandler subclass:#EvalScriptingErrorHandler |
17 |
instanceVariableNames:'' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'System-Compiler' |
|
21 |
! |
|
22 |
||
23 |
!EvalScriptingErrorHandler class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2014 by eXept Software AG |
|
3394 | 28 |
All Rights Reserved |
3363 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
I am the ErrorHandler used when executing eval-scripts |
|
42 |
" |
|
43 |
! ! |
|
44 |
||
45 |
!EvalScriptingErrorHandler methodsFor:'error handling'! |
|
46 |
||
47 |
error:aMessage position:position to:endPos from:aCompiler |
|
48 |
"error notification. |
|
49 |
This is sent by the compiler/evaluator if it detects errors." |
|
50 |
||
3394 | 51 |
self showErrorOrWarning:aMessage as:'Error' position:position to:endPos from:aCompiler. |
52 |
^ #Error |
|
53 |
! |
|
54 |
||
55 |
showErrorOrWarning:aMessage as:errorOrWarning position:position to:endPos from:aCompiler |
|
56 |
"error notification. |
|
57 |
This is sent by the compiler/evaluator if it detects errors." |
|
58 |
||
3378
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
59 |
|lineNr pos| |
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
60 |
|
3394 | 61 |
lineNr := myStream isNil ifTrue:[1] ifFalse:[myStream lineNumber ? '?']. |
3378
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
62 |
pos := position ? '?'. |
3633
1486488d996c
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3613
diff
changeset
|
63 |
|
3613
cf01a916c775
class: EvalScriptingErrorHandler
Stefan Vogel <sv@exept.de>
parents:
3394
diff
changeset
|
64 |
Stderr nextPutLine:('[%1 %2/%3] %4' bindWith:errorOrWarning with:lineNr with:pos with:aMessage). |
3394 | 65 |
currentSource notNil ifTrue:[ |
4308 | 66 |
Error handle:[:ex | |
67 |
] do:[ |
|
68 |
Stderr |
|
69 |
nextPutLine:currentSource; |
|
70 |
spaces:position?0; |
|
71 |
nextPutLine:'^'. |
|
72 |
]. |
|
3394 | 73 |
]. |
3363 | 74 |
^ #Error |
4308 | 75 |
|
76 |
"Modified: / 24-09-2018 / 14:18:02 / Claus Gittinger" |
|
3378
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
77 |
! |
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
78 |
|
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
79 |
warning:aMessage position:position to:endPos from:aCompiler |
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
80 |
"warning notification. |
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
81 |
This is sent by the compiler/evaluator if it detects something strange." |
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
82 |
|
3394 | 83 |
self showErrorOrWarning:aMessage as:'Warning' position:position to:endPos from:aCompiler. |
3378
4f6e4135ab25
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3376
diff
changeset
|
84 |
^ false |
3363 | 85 |
! ! |
86 |
||
3374
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
87 |
!EvalScriptingErrorHandler methodsFor:'queries'! |
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
88 |
|
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
89 |
autoDefineVariables |
3376
c9176bc16ede
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3374
diff
changeset
|
90 |
"when evaluating with --eval, auto define any variables as workspace vars" |
3374
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
91 |
|
3376
c9176bc16ede
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3374
diff
changeset
|
92 |
^ #workspace. "/ true |
3374
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
93 |
! ! |
0b430a313a88
class: EvalScriptingErrorHandler
Claus Gittinger <cg@exept.de>
parents:
3363
diff
changeset
|
94 |
|
3363 | 95 |
!EvalScriptingErrorHandler class methodsFor:'documentation'! |
96 |
||
97 |
version |
|
4308 | 98 |
^ '$Header$' |
3363 | 99 |
! |
100 |
||
101 |
version_CVS |
|
4308 | 102 |
^ '$Header$' |
3363 | 103 |
! ! |
3613
cf01a916c775
class: EvalScriptingErrorHandler
Stefan Vogel <sv@exept.de>
parents:
3394
diff
changeset
|
104 |