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