TextCollectingCompilationErrorHandler.st
author Claus Gittinger <cg@exept.de>
Thu, 16 Mar 2017 18:54:52 +0100
changeset 4139 1eaaab745ca8
parent 3863 f76515fab307
child 4317 55b15140c1bb
permissions -rw-r--r--
#UI_ENHANCEMENT by cg class: Parser changed: #selectorCheck:for:positions: don't complain recursive message decls
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
3863
f76515fab307 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
    14
"{ NameSpace: Smalltalk }"
f76515fab307 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
    15
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
CompilationErrorHandler subclass:#TextCollectingCompilationErrorHandler
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    17
	instanceVariableNames:'lines collectWarnings'
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'System-Compiler'
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!TextCollectingCompilationErrorHandler class methodsFor:'documentation'!
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
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 (c) 2010 by Claus Gittinger
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    collects messages - for check before checking in
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
! !
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    45
!TextCollectingCompilationErrorHandler methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    46
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    47
errorsOnly:aBoolean
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    48
    collectWarnings := aBoolean not
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    49
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    50
    "Created: / 02-11-2010 / 13:09:34 / cg"
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    51
! !
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    52
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
!TextCollectingCompilationErrorHandler methodsFor:'error handling'!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
error:aMessage position:position to:endPos from:aCompiler
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    56
    (lines includes:aMessage) ifTrue:[^ self ].
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    57
    lines add:aMessage.
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    58
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    59
    myStream nextPutLine:('Error: [' ,
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    60
                          aCompiler classToCompileFor name
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    61
                          , '>>',
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    62
                          (aCompiler selector ? '???')
3863
f76515fab307 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
    63
                          , '] ' , (aMessage allBold withColor:Color red darkened)).
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    "Created: / 02-11-2010 / 12:52:23 / cg"
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    66
    "Modified: / 03-11-2010 / 12:28:49 / cg"
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
warning:aMessage position:position to:endPos from:aCompiler
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    70
    collectWarnings ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    71
        (lines includes:aMessage) ifTrue:[^ self ].
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    72
        lines add:aMessage.
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    73
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    74
        myStream nextPutLine:('Warning: [' ,
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    75
                              aCompiler classToCompileFor name
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    76
                              , '>>',
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    77
                              (aCompiler selector ? '???')
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    78
                              , '] ' , aMessage).
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    79
    ].
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    "Created: / 02-11-2010 / 12:51:30 / cg"
2454
b8ed44a5c0c7 changed:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
    82
    "Modified: / 03-11-2010 / 12:28:45 / cg"
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
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    85
!TextCollectingCompilationErrorHandler methodsFor:'initialization'!
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    86
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    87
initialize
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    88
    lines := OrderedCollection new.
2446
Claus Gittinger <cg@exept.de>
parents: 2444
diff changeset
    89
    collectWarnings := true.
2444
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    90
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    91
    "Created: / 02-11-2010 / 13:00:55 / cg"
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    92
! !
e6b39d346228 changed:
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
    93
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!TextCollectingCompilationErrorHandler class methodsFor:'documentation'!
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
version_CVS
3863
f76515fab307 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
    97
    ^ '$Header$'
2434
d4382efb6b9b initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
! !
3863
f76515fab307 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 2454
diff changeset
    99