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