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