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