TextCollectingCompilationErrorHandler.st
author Claus Gittinger <cg@exept.de>
Wed, 03 Nov 2010 12:31:30 +0100
changeset 2454 b8ed44a5c0c7
parent 2450 0c079be8226c
child 3863 f76515fab307
permissions -rw-r--r--
changed: #error:position:to:from: #warning:position:to:from:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2010 by Claus Gittinger
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libcomp' }"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
CompilationErrorHandler subclass:#TextCollectingCompilationErrorHandler
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    15
	instanceVariableNames:'lines collectWarnings'
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Compiler'
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!TextCollectingCompilationErrorHandler class methodsFor:'documentation'!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 2010 by Claus Gittinger
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    collects messages - for check before checking in
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
! !
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    43
!TextCollectingCompilationErrorHandler methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    44
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    45
errorsOnly:aBoolean
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    46
    collectWarnings := aBoolean not
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    47
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    48
    "Created: / 02-11-2010 / 13:09:34 / cg"
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    49
! !
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    50
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
!TextCollectingCompilationErrorHandler methodsFor:'error handling'!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
error:aMessage position:position to:endPos from:aCompiler
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    54
    (lines includes:aMessage) ifTrue:[^ self ].
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    55
    lines add:aMessage.
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    56
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    57
    myStream nextPutLine:('Error: [' ,
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    58
                          aCompiler classToCompileFor name
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    59
                          , '>>',
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    60
                          (aCompiler selector ? '???')
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    61
                          , '] ' , (aMessage allBold colorizeAllWith:Color red darkened)).
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "Created: / 02-11-2010 / 12:52:23 / cg"
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    64
    "Modified: / 03-11-2010 / 12:28:49 / cg"
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
warning:aMessage position:position to:endPos from:aCompiler
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    68
    collectWarnings ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    69
        (lines includes:aMessage) ifTrue:[^ self ].
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    70
        lines add:aMessage.
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    71
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    72
        myStream nextPutLine:('Warning: [' ,
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    73
                              aCompiler classToCompileFor name
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    74
                              , '>>',
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    75
                              (aCompiler selector ? '???')
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    76
                              , '] ' , aMessage).
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    77
    ].
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    "Created: / 02-11-2010 / 12:51:30 / cg"
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    80
    "Modified: / 03-11-2010 / 12:28:45 / cg"
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
! !
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    83
!TextCollectingCompilationErrorHandler methodsFor:'initialization'!
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    84
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    85
initialize
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    86
    lines := OrderedCollection new.
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    87
    collectWarnings := true.
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    88
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    89
    "Created: / 02-11-2010 / 13:00:55 / cg"
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    90
! !
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    91
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
!TextCollectingCompilationErrorHandler class methodsFor:'documentation'!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
version_CVS
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    95
    ^ '$Header: /cvs/stx/stx/libcomp/TextCollectingCompilationErrorHandler.st,v 1.6 2010-11-03 11:31:30 cg Exp $'
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
! !