SourceFileLoader.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Nov 2004 15:30:33 +0100
changeset 1561 175735dcd732
parent 1416 3da6a2670bd8
child 1573 b97142106d38
permissions -rw-r--r--
do not check for endOfInput if parsing from a Stream
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     1
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     3
	      All Rights Reserved
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     4
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
317a3bd63c65 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    11
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    12
1147
ab92bdd80de5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    13
"{ Package: 'stx:libcomp' }"
ab92bdd80de5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    14
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#SourceFileLoader
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    16
	instanceVariableNames:'myStream currentSource package wantChangeLog currentNameSpace
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    17
		usedNameSpaces'
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    18
	classVariableNames:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    19
	poolDictionaries:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    20
	category:'System-Compiler'
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    21
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    22
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    23
!SourceFileLoader class methodsFor:'documentation'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    24
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    25
copyright
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    26
"
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    27
 COPYRIGHT (c) 1995 by Claus Gittinger
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    28
	      All Rights Reserved
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    29
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    30
 This software is furnished under a license and may be used
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    35
 hereby transferred.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    36
"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    37
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    38
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    39
documentation
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    40
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    41
    Instances of this class are created temporary during fileIn.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    42
    They get notified about any errors. Currently, all we
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    43
    do here is to output the error on the Transcript;
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    44
    eventually, we will open a box showing the position of the error.
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    45
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    46
    Also, information found in scanned compiler directives is remembered
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    47
    here, for later queries (this is required, since the fileIn mechanism
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    48
    creates new parsers for every chunk - someone has to remember this
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    49
    information across chunks ...).
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    50
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    51
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 162
diff changeset
    52
        Claus Gittinger
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    53
"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    54
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    55
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    56
!SourceFileLoader class methodsFor:'instance creation'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    57
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    58
on:aStream
84
claus
parents: 83
diff changeset
    59
    ^ self new reader:aStream wantChangeLog:false
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    60
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
    61
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    62
!SourceFileLoader methodsFor:'accessing'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    63
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    64
source:aString
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    65
    "this is optionally sent by the chunk reader,
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    66
     to pass a single chunks source before its evaluated.
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    67
     This allows me to show the erronous code in a TextView
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    68
     (but this is not yet implemented)"
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    69
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    70
    currentSource := aString
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    71
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
    72
    "Modified: 5.1.1997 / 03:06:32 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    73
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    74
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    75
!SourceFileLoader methodsFor:'compiler queries'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    76
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    77
currentNameSpace
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    78
    "sent by the compiler to ask for the current nameSpace.
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    79
     This is still to be finished ..."
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    80
419
5a5140d5523e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    81
    currentNameSpace isNil ifTrue:[
832
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
    82
        currentNameSpace := Class nameSpaceQuerySignal query.
491
b05dc84e74c0 oops - did not always return the namespace correctly
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
    83
        "/ currentNameSpace := Smalltalk defaultNameSpace
419
5a5140d5523e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    84
    ].
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    85
    ^ currentNameSpace
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    86
832
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
    87
    "Created: / 5.11.1996 / 22:05:19 / cg"
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
    88
    "Modified: / 20.12.1996 / 00:01:32 / cg"
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
    89
    "Modified: / 18.3.1999 / 18:28:24 / stefan"
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    90
!
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
    91
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    92
packageToInstall
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    93
    "sent by the compiler to ask in which package new methods/classes
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    94
     are to be installed.
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    95
     This is still to be finished ..."
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
    96
419
5a5140d5523e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
    97
    package isNil ifTrue:[
832
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
    98
        package := Class packageQuerySignal query.
491
b05dc84e74c0 oops - did not always return the namespace correctly
Claus Gittinger <cg@exept.de>
parents: 464
diff changeset
    99
        "/ package := Project currentPackageName
419
5a5140d5523e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
   100
    ].
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   101
    ^ package
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   102
832
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
   103
    "Created: / 5.11.1996 / 19:56:03 / cg"
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
   104
    "Modified: / 20.12.1996 / 00:01:41 / cg"
553c25252a78 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 827
diff changeset
   105
    "Modified: / 18.3.1999 / 18:28:30 / stefan"
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   106
!
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   107
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   108
usedNameSpaces
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   109
    "sent by the compiler to ask for a list of used nameSpaces.
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   110
     This is still to be finished ..."
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   111
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   112
    ^ usedNameSpaces
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   113
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   114
    "Created: 5.11.1996 / 22:05:37 / cg"
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   115
!
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   116
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   117
wantChangeLog
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   118
    "sent by the compiler to ask if a changeLog entry should
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   119
     be written. Return false here, since SourceFileLaoders are
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   120
     used to read existing source files"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   121
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   122
    ^ wantChangeLog
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   123
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   124
1153
6d89ce46bf3a Fix typo
Stefan Vogel <sv@exept.de>
parents: 1147
diff changeset
   125
!SourceFileLoader methodsFor:'directive processing'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   126
452
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   127
addUsedSpace:aNameSpace
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   128
    "sent by the compiler, whenever it encounters a 'Uses:'
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   129
     directive; collect used namespaces here, for later namespace
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   130
     queries"
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   131
452
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   132
    usedNameSpaces isNil ifTrue:[
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   133
        usedNameSpaces := OrderedCollection new.
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   134
    ].
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   135
    usedNameSpaces add:aNameSpace
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   136
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   137
    "Created: 19.12.1996 / 22:26:12 / cg"
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   138
    "Modified: 5.1.1997 / 03:07:17 / cg"
452
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   139
!
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   140
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   141
addUsedSpaces:aNameSpaceList
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   142
    "sent by the compiler, whenever it encounters a 'Uses:'
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   143
     directive; collect used namespaces here, for later namespace
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   144
     queries"
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   145
452
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   146
    usedNameSpaces isNil ifTrue:[
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   147
        usedNameSpaces := OrderedCollection new.
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   148
    ].
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   149
    aNameSpaceList do:[:aNameSpace |
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   150
        usedNameSpaces add:aNameSpace
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   151
    ].
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   152
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   153
    "Created: 19.12.1996 / 22:26:23 / cg"
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   154
    "Modified: 5.1.1997 / 03:07:24 / cg"
452
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   155
!
466112d0d3fd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
   156
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   157
requirePackage:packageName
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   158
    "sent by the compiler, whenever it encounters a 'Prerequisites:'
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   159
     directive. For now, this is ignored."
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   160
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   161
    'require package: ' print.
279
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   162
    packageName printCR
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   163
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   164
    "Modified: 5.1.1997 / 03:08:06 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   165
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   166
428
1d24f4dfed64 moved namespace creation completely to Namespace class.
Claus Gittinger <cg@exept.de>
parents: 419
diff changeset
   167
setNameSpace:aNameSpaceName
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   168
    "sent by the compiler, whenever it encounters a 'NameSpace:'
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   169
     directive. Remember the namespace for further variable resolving
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   170
     and nameSpace queries."
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   171
1041
98fa50f8353f renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   172
    currentNameSpace := NameSpace fullName:aNameSpaceName
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   173
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   174
    "Modified: 5.1.1997 / 03:08:43 / cg"
1041
98fa50f8353f renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   175
98fa50f8353f renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   176
98fa50f8353f renamed Namespace to NameSpace
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   177
416
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   178
!
123973b721e6 namespace support
Claus Gittinger <cg@exept.de>
parents: 414
diff changeset
   179
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   180
setPackage:packageName
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   181
    "sent by the compiler, whenever it encounters a 'Package:'
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   182
     directive. Remember the package for further queries."
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   183
414
9fbab8aec86a fixes for package query
Claus Gittinger <cg@exept.de>
parents: 279
diff changeset
   184
    package := packageName asSymbol
279
bda67d871f7d printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   185
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   186
    "Modified: 5.1.1997 / 03:09:00 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   187
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   188
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   189
!SourceFileLoader methodsFor:'error handling'!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   190
83
claus
parents: 73
diff changeset
   191
correctableError:aMessage position:position to:endPos from:aCompiler
827
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   192
    "correctable error notification during fileIn.
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   193
     This is sent by the compiler/evaluator if it detects undefined variables-errors."
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   194
827
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   195
    "/ Transcript show:'**  '; showCR:aMessage.
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   196
    "/ self showWherePosition:position to:endPos from:aCompiler.
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   197
97
claus
parents: 84
diff changeset
   198
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   199
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   200
    "Modified: 8.11.1996 / 18:53:17 / cg"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   201
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   202
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   203
correctableSelectorWarning:aMessage position:position to:endPos from:aCompiler
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   204
    "correctable error notification during fileIn."
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   205
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   206
    ^ false
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   207
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   208
    "Modified: / 19.1.2000 / 16:25:58 / cg"
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   209
    "Created: / 19.1.2000 / 16:27:25 / cg"
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   210
!
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 832
diff changeset
   211
83
claus
parents: 73
diff changeset
   212
error:aMessage position:position to:endPos from:aCompiler
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   213
    "error notification during fileIn.
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   214
     This is sent by the compiler/evaluator if it detects errors."
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   215
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   216
    "
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   217
     will eventually open a TextBox here, showing the error ....
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   218
    "
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   219
    Transcript show:'===>  '; showCR:aMessage.
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   220
    self showWherePosition:position to:endPos from:aCompiler.
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   221
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   222
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   223
    "Modified: 8.11.1996 / 18:49:41 / cg"
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   224
!
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   225
98
claus
parents: 97
diff changeset
   226
insertAndSelect:aString at:aCharacterPosition
claus
parents: 97
diff changeset
   227
    "ST-80 compatible error notification during fileIn."
claus
parents: 97
diff changeset
   228
claus
parents: 97
diff changeset
   229
    "
claus
parents: 97
diff changeset
   230
     will eventually open a TextBox here, showing the error ....
claus
parents: 97
diff changeset
   231
    "
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   232
    Transcript show:'===>  '; showCR:aString.
98
claus
parents: 97
diff changeset
   233
    ^ false
275
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   234
da3efc596541 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
   235
    "Modified: 18.5.1996 / 15:44:54 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   236
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   237
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   238
showWherePosition:position to:endPos from:aCompiler
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   239
    "show more details about the errors/warnings position."
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   240
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   241
    |cls sel where|
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   242
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   243
    "
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   244
     will eventually open a TextBox here, showing the error ....
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   245
    "
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   246
    (cls := aCompiler targetClass) notNil ifTrue:[
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   247
        (sel := aCompiler selector) notNil ifTrue:[
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   248
            Transcript show:'      when compiling '; show:cls name.
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   249
            Transcript show:'>>'; show:sel.
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   250
        ] ifFalse:[
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   251
            Transcript show:'      when compiling/evaluating for '; show:cls name.
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   252
        ].
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   253
        Transcript cr.
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   254
    ].
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   255
    myStream isFileStream ifTrue:[
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   256
        Transcript show:'      while reading '; showCR:myStream pathName.
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   257
    ].
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   258
    (where := aCompiler lastTokenLineNumber) notNil ifTrue:[
827
ed73e2d19dae suppress correctable-warnings.
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
   259
        Transcript show:'      at or near line '; show:where; showCR:' [relative to chunk start]'.
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   260
    ].
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   261
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   262
    "Created: 8.11.1996 / 18:49:08 / cg"
464
f409008c2106 commentary
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   263
    "Modified: 5.1.1997 / 03:04:05 / cg"
430
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   264
!
fbf6a7c19b86 show more info in case of errors while reading from a file
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   265
1166
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   266
unusedVariableWarning:aString position:relPos to:relEndPos from:aCompiler
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   267
    "compiler notifies us of a (or some) unused variables;
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   268
     hilight the error (relPos to relEndPos) and show a Box asking for continue/correct/abort;
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   269
     this method should return true to the compiler if user wants the error
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   270
     to be corrected; false otherwise"
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   271
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   272
    ^ false
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   273
!
3b4083f0b1b4 unusedVariableWarning
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
   274
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   275
warning:aMessage position:position to:endPos from:aCompiler
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   276
    "warning notification during fileIn - ignore it.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   277
     This is sent by the compiler/evaluator if it detects errors."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   278
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   279
    ^ self
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   280
! !
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   281
1416
3da6a2670bd8 method category rename
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   282
!SourceFileLoader methodsFor:'private-accessing'!
73
317a3bd63c65 Initial revision
claus
parents:
diff changeset
   283
84
claus
parents: 83
diff changeset
   284
reader:aStream wantChangeLog:aBoolean
claus
parents: 83
diff changeset
   285
    myStream := aStream.
claus
parents: 83
diff changeset
   286
    wantChangeLog := aBoolean
claus
parents: 83
diff changeset
   287
! !
claus
parents: 83
diff changeset
   288
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   289
!SourceFileLoader class methodsFor:'documentation'!
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   290
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   291
version
1416
3da6a2670bd8 method category rename
Claus Gittinger <cg@exept.de>
parents: 1166
diff changeset
   292
    ^ '$Header: /cvs/stx/stx/libcomp/SourceFileLoader.st,v 1.30 2003-05-07 14:13:07 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   293
! !