Scanner.st
author Claus Gittinger <cg@exept.de>
Wed, 13 May 1998 19:58:56 +0200
changeset 709 b4351947a598
parent 708 11837544357d
child 714 09f35b01bbcf
permissions -rw-r--r--
moved error methods up
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     1
"
4
f6fd83437415 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
     3
	      All Rights Reserved
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     4
7ad01559b262 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
7ad01559b262 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
7ad01559b262 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7ad01559b262 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7ad01559b262 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
7ad01559b262 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    11
"
7ad01559b262 Initial revision
claus
parents:
diff changeset
    12
7ad01559b262 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#Scanner
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    14
	instanceVariableNames:'typeArray actionArray source lineNr token tokenType tokenPosition
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
    15
		tokenValue tokenName tokenLineNr hereChar peekChar peekChar2
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
    16
		requestor exitBlock errorFlag ignoreErrors ignoreWarnings
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
    17
		saveComments currentComments collectedSource
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    18
		allowUnderscoreInIdentifier allowDollarInIdentifier
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    19
		warnSTXSpecialComment warnUnderscoreInIdentifier
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    20
		warnOldStyleAssignment warnCommonMistakes outStream outCol
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    21
		warnSTXNameSpaceUse warnPossibleIncompatibilities
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
    22
		warnDollarInIdentifier'
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    23
	classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
    24
		WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
    25
		WarnCommonMistakes WarnPossibleIncompatibilities
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
    26
		WarnDollarInIdentifier AllowDollarInIdentifier'
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    27
	poolDictionaries:''
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
    28
	category:'System-Compiler'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    29
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    30
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    31
Object subclass:#Comment
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    32
	instanceVariableNames:'commentType commentString'
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    33
	classVariableNames:''
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    34
	poolDictionaries:''
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    35
	privateIn:Scanner
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    36
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    37
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    38
!Scanner class methodsFor:'documentation'!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    39
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    40
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    41
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    42
 COPYRIGHT (c) 1989 by Claus Gittinger
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
    43
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    44
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    45
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    46
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    47
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    48
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    49
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    50
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    51
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    52
!
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    53
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    54
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    55
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    56
    Scanner reads from a stream and returns individual smalltalk tokens
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    57
    Its main method is #nextToken, which reads and returns the next token
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    58
    Possibly placing additional information (such as tokenValue) into 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    59
    instance variables as a side effect.
75
d8b9d6b39497 *** empty log message ***
claus
parents: 74
diff changeset
    60
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    61
    TODO: 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    62
        some testers noticed, that ST-80's scanner methods are called
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    63
        xLetter, xDigit etc. For code using these (internals), the nextNumber,
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    64
        nextIdentifier etc. methods should be renamed.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    65
        (to me, these seem to be internal private methods; 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    66
         their public use is not a good idea ..)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    67
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    68
        Scanner is typically subclassed for parsing and #nextToken
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    69
        invoked via #self-sends.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    70
        This should be changed and scanner ought to be an instance variable
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    71
        of Parser - this allows more flexible use of the scanner/parser
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    72
        framework (i.e. changing the scanner without affecting the parser).
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    73
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    74
    [author:]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    75
        Claus Gittinger
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    76
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    77
    [see also:]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    78
        Parser
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    79
"
41
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
    80
! !
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
    81
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    82
!Scanner class methodsFor:'initialization'!
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
    83
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    84
binarySelectorCharacters
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    85
    "return a collection of characters which are allowed in
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    86
     binary selectors"
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    87
650
a8bcb32d1665 added #% as binop in typeTable.
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
    88
    ^ #( $& $- $+ $= $* $/ $\ $< $> $~ $@ $, $? $!! $| $%)
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    89
650
a8bcb32d1665 added #% as binop in typeTable.
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
    90
    "Created: / 4.1.1997 / 14:13:24 / cg"
a8bcb32d1665 added #% as binop in typeTable.
Claus Gittinger <cg@exept.de>
parents: 648
diff changeset
    91
    "Modified: / 27.2.1998 / 02:01:28 / cg"
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    92
!
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
    93
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
    94
initialize
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    95
    "initialize the classes defaults. Typically, these are changed
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    96
     later in the 'private.rc' file."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
    97
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
    98
    Warnings := true.
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
    99
    WarnSTXSpecials := true.
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
   100
    WarnUnderscoreInIdentifier := true.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   101
    WarnDollarInIdentifier := true.
87
claus
parents: 83
diff changeset
   102
    WarnOldStyleAssignment := true.
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   103
    WarnCommonMistakes := true.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   104
    WarnPossibleIncompatibilities := false.
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
   105
    AllowUnderscoreInIdentifier := false.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   106
    AllowDollarInIdentifier := false.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   107
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   108
    "
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   109
     self initialize
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   110
    "
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   111
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   112
    "Modified: 7.9.1997 / 01:37:57 / cg"
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
   113
!
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
   114
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   115
setupActions
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   116
    "initialize the scanners actionTables - these are used to dispatch
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   117
     into scanner methods as characters are read"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   118
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   119
    |block|
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   120
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   121
    ActionArray := Array new:256.
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   122
    TypeArray := Array new:256.
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   123
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   124
    block := [:s :char | s nextNumber].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   125
    ($0 asciiValue) to:($9 asciiValue) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   126
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   127
    ].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   128
87
claus
parents: 83
diff changeset
   129
    block := [:s :char | s nextSpecial].
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   130
    self binarySelectorCharacters do:[:binop |
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   131
        TypeArray at:(binop asciiValue) put:#special.
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   132
        ActionArray at:(binop asciiValue) put:block
87
claus
parents: 83
diff changeset
   133
    ].
claus
parents: 83
diff changeset
   134
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   135
    "/ that one is a special case (both binarySelector AND syntax).
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   136
    TypeArray at:($| asciiValue) put:nil.
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   137
87
claus
parents: 83
diff changeset
   138
    block := [:s :char | s nextToken:char].
89
claus
parents: 87
diff changeset
   139
    #( $; $. $( $) $[ $] "$!!" $^ $| $_ ) do:[:ch |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   140
        ActionArray at:(ch asciiValue) put:block
87
claus
parents: 83
diff changeset
   141
    ].
claus
parents: 83
diff changeset
   142
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   143
    block := [:s :char | s nextIdentifier].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   144
    ($a asciiValue) to:($z asciiValue) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   145
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   146
    ].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   147
    ($A asciiValue) to:($Z asciiValue) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   148
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   149
    ].
71
2aac7fbb5be0 *** empty log message ***
claus
parents: 69
diff changeset
   150
    AllowUnderscoreInIdentifier ifTrue:[
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   151
        ActionArray at:$_ asciiValue put:block
71
2aac7fbb5be0 *** empty log message ***
claus
parents: 69
diff changeset
   152
    ].
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   153
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   154
    "kludge: action is characterToken, but type is special"
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   155
    TypeArray at:($| asciiValue) put:#special.
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   156
80
101b42803846 *** empty log message ***
claus
parents: 76
diff changeset
   157
    "kludge: action is nextColonOrAssign, but type is special"
101b42803846 *** empty log message ***
claus
parents: 76
diff changeset
   158
    TypeArray at:($: asciiValue) put:#special.
101b42803846 *** empty log message ***
claus
parents: 76
diff changeset
   159
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   160
    ActionArray at:($' asciiValue) put:[:s :char | s nextString].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   161
    ActionArray at:($$ asciiValue) put:[:s :char | s nextCharacter].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   162
    ActionArray at:($# asciiValue) put:[:s :char | s nextHash].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   163
    ActionArray at:($% asciiValue) put:[:s :char | s nextPrimitive].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   164
    ActionArray at:($: asciiValue) put:[:s :char | s nextColonOrAssign]
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   165
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   166
    "
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   167
     Scanner setupActions
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   168
    "
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   169
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   170
    "Modified: 23.5.1997 / 12:07:55 / cg"
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   171
! !
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   172
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   173
!Scanner class methodsFor:'instance creation'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   174
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   175
for:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   176
    "create & return a new scanner reading from aStringOrStream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   177
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   178
    ^ (super new) initializeFor:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   179
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   180
    "Modified: 23.5.1997 / 12:08:42 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   181
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   182
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   183
!Scanner class methodsFor:'defaults'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   184
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   185
allowDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   186
    "return true, if $-characters are allowed in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   187
     Notice, that dollars are NEVER allowed as the first character in an identifier."
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   188
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   189
    ^ AllowDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   190
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   191
    "Created: 7.9.1997 / 01:32:18 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   192
    "Modified: 7.9.1997 / 01:39:44 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   193
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   194
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   195
allowDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   196
    "this allows turning on/off $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   197
     Notice, that dollars are NEVER allowed as the first character in an identifier.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   198
     If turned off (the default), dollars are not allowed in identifiers,
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   199
     but instead are scanned as character-constant prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   200
     If turned on, dollars are in identifiers are allowed, while extra
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   201
     dollars are still scanned as constant character prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   202
     If you have to fileIn old VW-Vsn2.x classes, turn this off
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   203
     before filing them in; i.e.:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   204
        Compiler allowDollarInIdentifiers:false"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   205
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   206
    AllowDollarInIdentifier := aBoolean.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   207
    self setupActions
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   208
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   209
    "Created: 7.9.1997 / 01:34:49 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   210
    "Modified: 7.9.1997 / 01:39:30 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   211
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   212
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   213
allowUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   214
    "return true, if underscores are allowed in identifiers"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   215
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   216
    ^ AllowUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   217
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   218
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   219
allowUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   220
    "this allows turning on/off underscores in identifiers.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   221
     If turned off (the default), underscores are not allowed in identifiers,
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   222
     but instead scanned as assignment character (old ST/80 syntax).
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   223
     If turned on, underscores are in identifiers are allowed, while extra
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   224
     underscores are still scanned as assignment.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   225
     If you have to fileIn old VW-Vsn2.x classes, 
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   226
     turn them off with:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   227
        Compiler allowUnderscoreInIdentifiers:false"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   228
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   229
    AllowUnderscoreInIdentifier := aBoolean.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   230
    self setupActions
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   231
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   232
    "Modified: 7.9.1997 / 01:35:19 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   233
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   234
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   235
warnCommonMistakes
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   236
    "return true, if common beginners mistakes are to be warned about"
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   237
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   238
    ^ WarnCommonMistakes
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   239
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   240
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   241
warnCommonMistakes:aBoolean
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   242
    "this allows turning on/off warnings about common beginners mistakes.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   243
     Those are not really errors in the strict sense, but often lead to
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   244
     run time errors later.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   245
     Examples are: expr or:expr2, where expr2 is not a block.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   246
     If you get bored by those warnings, turn them off by adding
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   247
     a line as:
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   248
	Compiler warnCommonMistakes:false
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   249
     in your 'private.rc' file"
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   250
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   251
    WarnCommonMistakes := aBoolean
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   252
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   253
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   254
warnDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   255
    "return true, if $-characters in identifiers are to be warned about"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   256
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   257
    ^ WarnDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   258
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   259
    "Created: 7.9.1997 / 01:36:17 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   260
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   261
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   262
warnDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   263
    "this allows turning on/off warnings about $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   264
     You may find those warnings useful, to make certain that your code
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   265
     is portable to other smalltalk versions, which do not allow this
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   266
     (i.e. VW releases 2.x and maybe others).
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   267
     Notice, that dollars are NEVER allowed as the first character in an identifier.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   268
     If you get bored by those warnings, turn them off by adding
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   269
     a line as:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   270
        Compiler warnDollarInIdentifier:false
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   271
     in your 'private.rc' file"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   272
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   273
    WarnDollarInIdentifier := aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   274
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   275
    "Created: 7.9.1997 / 01:37:42 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   276
    "Modified: 7.9.1997 / 01:40:02 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   277
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   278
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   279
warnOldStyleAssignment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   280
    "return true, if underscore-assignment (pre ST-80v4 syntax) are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   281
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   282
    ^ WarnOldStyleAssignment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   283
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   284
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   285
warnOldStyleAssignment:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   286
    "this allows turning on/off warnings about underscore-assignment (pre ST-80v4 syntax).
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   287
     If you get bored by those warnings, turn them off by adding
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   288
     a line as:
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   289
	Compiler warnOldStyleAssignment:false
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   290
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   291
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   292
    WarnOldStyleAssignment := aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   293
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   294
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   295
warnPossibleIncompatibilities
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   296
    "return true, if possible incompatibilities (with other ST systems)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   297
     are to be warned about"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   298
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   299
    ^ WarnPossibleIncompatibilities
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   300
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   301
    "Modified: 23.5.1997 / 12:02:02 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   302
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   303
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   304
warnPossibleIncompatibilities:aBoolean
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   305
    "this turns warnings about possible incompatibilities (with other ST systems)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   306
     on or off.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   307
     If you get bored by those warnings, turn them off by adding
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   308
     a line as:
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   309
        Compiler warnPossibleIncompatibilities:false
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   310
     in your 'private.rc' file."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   311
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   312
    WarnPossibleIncompatibilities := aBoolean
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   313
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   314
    "Created: 23.5.1997 / 12:02:45 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   315
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   316
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   317
warnSTXSpecials
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   318
    "return true, if ST/X specials are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   319
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   320
    ^ WarnSTXSpecials
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   321
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   322
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   323
warnSTXSpecials:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   324
    "this allows turning on/off warnings about stx specials.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   325
     If you get bored by those warnings, turn them off by adding
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   326
     a line as:
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   327
	Compiler warnSTXSpecials:false
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   328
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   329
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   330
    WarnSTXSpecials := aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   331
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   332
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   333
warnUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   334
    "return true, if underscores in identifiers are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   335
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   336
    ^ WarnUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   337
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   338
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   339
warnUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   340
    "this allows turning on/off warnings about underscores in identifiers.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   341
     You may find those warnings useful, to make certain that your code
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   342
     is portable to other smalltalk versions, which do not allow this
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   343
     (i.e. VW releases 2.x).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   344
     If you get bored by those warnings, turn them off by adding
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   345
     a line as:
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   346
        Compiler warnUnderscoreInIdentifier:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   347
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   348
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   349
    WarnUnderscoreInIdentifier := aBoolean
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   350
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   351
    "Modified: 7.9.1997 / 01:37:13 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   352
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   353
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   354
warnings
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   355
    "return true, if any warnings are to be shown"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   356
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   357
    ^ Warnings
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   358
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   359
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   360
warnings:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   361
    "this allows turning on/off all warnings; the default is on.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   362
     You can turn off warnings in your 'private.rc' file with
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   363
         Compiler warnings:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   364
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   365
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   366
    Warnings := aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   367
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   368
    "Modified: 23.5.1997 / 12:03:05 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   369
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   370
98
claus
parents: 97
diff changeset
   371
!Scanner methodsFor:'ST-80 compatibility'!
claus
parents: 97
diff changeset
   372
claus
parents: 97
diff changeset
   373
endOfLastToken
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   374
    "return the position of the token which was just read.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   375
     This method was required by some PD program.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   376
     It is not maintained and may be removed without notice."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   377
98
claus
parents: 97
diff changeset
   378
    ^ source position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   379
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   380
    "Modified: 23.5.1997 / 12:14:27 / cg"
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   381
!
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   382
630
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   383
scan:aStringOrStream 
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   384
    "initialize the scanner: set the source-stream and
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   385
     preread the first token"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   386
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   387
    self initializeFor:aStringOrStream.
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   388
    self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   389
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   390
    "Created: / 30.10.1997 / 16:59:39 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   391
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   392
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   393
scanToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   394
    "read the next token from my input stream"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   395
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   396
    ^ self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   397
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   398
    "Created: / 30.10.1997 / 17:00:16 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   399
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   400
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   401
scanTokens:aStringOrStream
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   402
    "return a collection of symbolic tokens from the passed input"
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   403
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   404
    |tokens|
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   405
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   406
    self initializeFor:aStringOrStream.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   407
    tokens := OrderedCollection new.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   408
    self nextToken.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   409
    [token notNil] whileTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   410
        tokens add:token.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   411
        self nextToken
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   412
    ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   413
    ^ tokens
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   414
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   415
    "
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   416
     Scanner new
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   417
        scanTokens:'Boolean subclass:#True
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   418
                                instanceVariableNames:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   419
                                classVariableNames:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   420
                                poolDictionaries:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   421
                                category:''Kernel-Objects''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   422
        '
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   423
    "
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   424
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   425
    "Modified: 20.6.1997 / 18:22:58 / cg"
98
claus
parents: 97
diff changeset
   426
! !
claus
parents: 97
diff changeset
   427
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   428
!Scanner methodsFor:'accessing'!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   429
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   430
comments
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   431
    "not yet implemented"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   432
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   433
    ^ currentComments
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   434
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   435
    "Created: 20.4.1996 / 20:07:01 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   436
    "Modified: 23.5.1997 / 12:14:45 / cg"
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   437
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   438
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   439
saveComments:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   440
    "not yet implemented"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   441
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   442
    saveComments := aBoolean
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   443
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   444
    "Created: 20.4.1996 / 20:03:56 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   445
    "Modified: 23.5.1997 / 12:14:49 / cg"
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   446
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   447
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   448
sourceStream
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   449
    ^ source
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   450
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   451
    "Created: 20.4.1996 / 19:59:58 / cg"
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   452
! !
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   453
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   454
!Scanner methodsFor:'directives'!
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   455
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   456
parseDirective
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   457
    "parse a directive - this is an ST/X special"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   458
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   459
    |directive packageName namespace list|
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   460
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   461
    source next.
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   462
    source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   463
    hereChar := source peekOrNil.
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   464
    hereChar isLetter ifTrue:[
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   465
        directive := source nextWord.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   466
        source peekOrNil == $: ifTrue:[
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   467
            source next.
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   468
            source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   469
            hereChar := source peekOrNil.
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   470
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   471
            "
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   472
             Package: 'name-of-package'
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   473
             Package: packageId
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   474
            "
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   475
            directive = 'Package' ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   476
                packageName := self parseDirectiveStringArg.
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   477
                packageName notNil ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   478
                    (requestor respondsTo:#setPackage:) ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   479
                        requestor setPackage:packageName
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   480
                    ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   481
                ] ifFalse:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   482
                    Transcript showCR:'unrecognized ''Package'' directive'.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   483
                    ^ false
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   484
                ]
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   485
            ].
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   486
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   487
            "
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   488
             Namespace: 'nameSpaceIdentifier'
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   489
             Namespace: nameSpaceIdentifier
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   490
            "
417
69263abda671 namespace support
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   491
            (directive = 'Namespace' 
69263abda671 namespace support
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   492
            or:[directive = 'NameSpace']) ifTrue:[
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   493
                namespace := self parseDirectiveStringArg.
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   494
                namespace notNil ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   495
                    (requestor respondsTo:#setNameSpace:) ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   496
                        requestor setNameSpace:namespace 
426
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
   497
                    ] ifFalse:[
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
   498
                        self setNameSpace:namespace
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   499
                    ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   500
                ] ifFalse:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   501
                    Transcript showCR:'unrecognized ''NameSpace'' directive'.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   502
                    ^ false
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   503
                ].
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   504
            ].
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   505
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   506
            "
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   507
             Uses: 'nameSpace1', ... , 'nameSpaceN'
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   508
             Uses: nameSpaceId1, ... , nameSpaceIdN
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   509
            "
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   510
            directive = 'Uses' ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   511
                list := self parseDirectiveStringListArg.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   512
                list notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   513
                    (requestor respondsTo:#addNameSpaces:) ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   514
                        requestor addNameSpaces:list 
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   515
                    ]
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   516
                ] ifFalse:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   517
                    Transcript showCR:'unrecognized ''Uses'' directive'.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   518
                    ^ false
426
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
   519
                ]
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   520
            ].
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   521
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   522
            "
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   523
             Prerequisites: 'name-of-package', ... , 'name-of-package'
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   524
            "
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   525
            directive = 'Prerequisites' ifTrue:[
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   526
                list := self parseDirectiveStringListArg.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   527
                list notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   528
                    (requestor respondsTo:#requirePackages:) ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   529
                        requestor requirePackages:list 
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   530
                    ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   531
                ] ifFalse:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   532
                    Transcript showCR:'unrecognized ''Prerequisites'' directive'.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   533
                    ^ false
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   534
                ]
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   535
            ].
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   536
        ]
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   537
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   538
    hereChar := source peekOrNil.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   539
    ^ true.
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   540
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   541
    "Modified: / 5.3.1998 / 02:55:32 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   542
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   543
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   544
parseDirectiveStringArg
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   545
    "helper for parsing a directive"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   546
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   547
    hereChar == $' ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   548
        self nextString.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   549
        tokenType == #String ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   550
            ^ tokenValue
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   551
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   552
    ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   553
    (hereChar isLetter or:[hereChar == $_]) ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   554
        self nextIdentifier.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   555
        tokenType == #Identifier ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   556
            ^ tokenName
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   557
        ]
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   558
    ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   559
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   560
    ^ nil
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   561
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   562
    "Modified: 23.5.1997 / 12:15:46 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   563
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   564
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   565
parseDirectiveStringListArg
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   566
    "helper for parsing a directive"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   567
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   568
    |list|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   569
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   570
    list := OrderedCollection new.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   571
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   572
    [hereChar == $'] whileTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   573
        list addLast:self parseDirectiveStringArg.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   574
        source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   575
        hereChar := source peekOrNil.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   576
        (hereChar == $,) ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   577
            source next.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   578
            source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   579
            hereChar := source peekOrNil.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   580
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   581
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   582
    ^ list
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   583
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   584
    "Modified: / 5.3.1998 / 02:55:40 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   585
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   586
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   587
!Scanner methodsFor:'dummy - syntax highlighting'!
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   588
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   589
markCommentFrom:pos1 to:pos2
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   590
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   591
    "Created: / 31.3.1998 / 13:34:45 / cg"
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
   592
!
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
   593
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   594
markConstantFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   595
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   596
    "Created: / 1.4.1998 / 13:02:56 / cg"
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   597
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   598
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
   599
markStringFrom:pos1 to:pos2
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
   600
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
   601
    "Created: / 31.3.1998 / 16:37:18 / cg"
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   602
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   603
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   604
markSymbolFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   605
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
   606
    "Created: / 1.4.1998 / 12:58:42 / cg"
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   607
! !
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   608
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   609
!Scanner methodsFor:'error handling'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   610
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   611
correctableError:message position:pos1 to:pos2
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   612
    "report an error which can be corrected by compiler -
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   613
     return true if correction is wanted"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   614
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   615
    |correctIt|
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   616
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   617
    requestor isNil ifTrue:[
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   618
	self showErrorMessage:message position:pos1.
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   619
	correctIt := false
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   620
    ] ifFalse:[
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   621
	correctIt := requestor correctableError:message position:pos1 to:pos2 from:self
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   622
    ].
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   623
    correctIt ifFalse:[
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   624
	exitBlock notNil ifTrue:[exitBlock value]
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   625
    ].
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   626
    ^ correctIt
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   627
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   628
    "Created: / 13.5.1998 / 16:45:56 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   629
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   630
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   631
lastTokenLineNumber
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   632
    "return the line number of the token which was just read."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   633
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   634
    ^ tokenLineNr
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   635
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   636
    "Created: 8.11.1996 / 18:46:36 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   637
    "Modified: 23.5.1997 / 12:16:12 / cg"
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   638
!
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
   639
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   640
notifyError:aMessage position:position to:endPos
7ad01559b262 Initial revision
claus
parents:
diff changeset
   641
    "notify requestor of an error - if there is no requestor
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   642
     put it on the transcript. Requestor is typically the CodeView
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   643
     in which the accept/doIt was triggered, or the PositionableStream
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   644
     which does the fileIn. The requestor may decide how to highlight the
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   645
     error (and/or to abort the compile).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   646
     Return the result passed back by the requestor."
7ad01559b262 Initial revision
claus
parents:
diff changeset
   647
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   648
    ignoreErrors ifFalse:[
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   649
	requestor isNil ifTrue:[
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   650
	    self showErrorMessage:aMessage position:position.
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   651
	    ^ false
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   652
	].
83
claus
parents: 81
diff changeset
   653
	^ requestor error:aMessage position:position to:endPos from:self 
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   654
    ].
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   655
    ^ false
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   656
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   657
7ad01559b262 Initial revision
claus
parents:
diff changeset
   658
notifyWarning:aMessage position:position to:endPos
7ad01559b262 Initial revision
claus
parents:
diff changeset
   659
    "notify requestor of an warning - if there is no requestor
7ad01559b262 Initial revision
claus
parents:
diff changeset
   660
     put it on the transcript.
7ad01559b262 Initial revision
claus
parents:
diff changeset
   661
     Return the result passed back by the requestor."
7ad01559b262 Initial revision
claus
parents:
diff changeset
   662
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   663
    ignoreWarnings ifFalse:[
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   664
	requestor isNil ifTrue:[
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   665
	    self showErrorMessage:aMessage position:position.
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   666
	    ^ false
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   667
	].
83
claus
parents: 81
diff changeset
   668
	^ requestor warning:aMessage position:position to:endPos from:self
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   669
    ].
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
   670
    ^ false
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   671
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   672
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   673
parseError:aMessage
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   674
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   675
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   676
    ^ self parseError:aMessage position:tokenPosition to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   677
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   678
    "Created: / 13.5.1998 / 16:45:13 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   679
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   680
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   681
parseError:aMessage position:position
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   682
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   683
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   684
    ^ self parseError:aMessage position:position to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   685
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   686
    "Created: / 13.5.1998 / 16:45:05 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   687
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   688
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   689
parseError:aMessage position:position to:endPos
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   690
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   691
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   692
    |m|
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   693
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   694
    errorFlag := true.
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   695
    m := 'Error: ' , aMessage.
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   696
    self notifyError:m position:position to:endPos.
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   697
    exitBlock notNil ifTrue:[exitBlock value].
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   698
    ^ false
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   699
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   700
    "Created: / 13.5.1998 / 16:44:55 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   701
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
   702
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   703
showErrorMessage:aMessage position:pos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   704
    "show an errormessage on the Transcript"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   705
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   706
    ignoreErrors ifFalse:[
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   707
	Smalltalk silentLoading == true ifFalse:[
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   708
	    Transcript showCR:(pos printString , ' [line: ' , tokenLineNr printString , '] ' , aMessage)
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   709
	]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   710
    ]
274
8e120bd82c69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   711
8e120bd82c69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
   712
    "Modified: 18.5.1996 / 15:44:35 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   713
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   714
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   715
syntaxError:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   716
    "a syntax error happened - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   717
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   718
    ^ self syntaxError:aMessage position:tokenPosition
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   719
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   720
7ad01559b262 Initial revision
claus
parents:
diff changeset
   721
syntaxError:aMessage position:position
7ad01559b262 Initial revision
claus
parents:
diff changeset
   722
    "a syntax error happened - only start position is known"
7ad01559b262 Initial revision
claus
parents:
diff changeset
   723
7ad01559b262 Initial revision
claus
parents:
diff changeset
   724
    ^ self syntaxError:aMessage position:position to:nil
7ad01559b262 Initial revision
claus
parents:
diff changeset
   725
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
   726
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   727
syntaxError:aMessage position:position to:endPos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   728
    "a syntax error happened"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   729
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   730
    self notifyError:('Error:' , aMessage) position:position to:endPos.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   731
    exitBlock notNil ifTrue:[exitBlock value].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   732
    ^ false
87
claus
parents: 83
diff changeset
   733
!
claus
parents: 83
diff changeset
   734
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   735
warnCommonMistake:msg at:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   736
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   737
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   738
    self warnCommonMistake:msg position:position to:position
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   739
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   740
    "Modified: 23.5.1997 / 12:16:34 / cg"
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   741
!
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   742
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   743
warnCommonMistake:msg position:pos1 to:pos2
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   744
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   745
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   746
    ignoreWarnings ifFalse:[
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   747
        warnCommonMistakes ifTrue:[
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   748
            self 
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   749
                warning:msg
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   750
                position:pos1 to:pos2.
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   751
        ]
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   752
    ]
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   753
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   754
    "Created: 18.7.1996 / 10:28:38 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   755
    "Modified: 23.5.1997 / 12:16:39 / cg"
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   756
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   757
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   758
warnDollarAt:position
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   759
    "warn about $-character in an identifier"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   760
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   761
    ignoreWarnings ifFalse:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   762
        warnDollarInIdentifier ifTrue:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   763
            self 
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   764
                warning:'$-characters in identifiers/symbols are nonportable' 
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   765
                position:position to:position.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   766
            "
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   767
             only warn once (per method)
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   768
            "
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   769
            warnDollarInIdentifier := false
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   770
        ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   771
    ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   772
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   773
    "Created: 7.9.1997 / 01:50:24 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   774
    "Modified: 7.9.1997 / 01:51:13 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   775
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   776
87
claus
parents: 83
diff changeset
   777
warnOldStyleAssignmentAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   778
    "warn about an oldStyle assignment"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   779
87
claus
parents: 83
diff changeset
   780
    ignoreWarnings ifFalse:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   781
        warnOldStyleAssignment ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   782
            self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   783
                warning:'old style assignment - please change to use '':='''
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   784
                position:position to:position.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   785
            "
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   786
             only warn once (per method)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   787
            "
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   788
            warnOldStyleAssignment := false
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   789
        ]
87
claus
parents: 83
diff changeset
   790
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   791
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   792
    "Modified: 23.5.1997 / 12:16:48 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   793
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   794
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   795
warnPossibleIncompatibility:msg position:pos1 to:pos2
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   796
    "warn about a possible incompatibility with other ST systems"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   797
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   798
    ignoreWarnings ifFalse:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   799
        warnPossibleIncompatibilities ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   800
            self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   801
                warning:('Possible incompatibility.\\' , msg) withCRs
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   802
                position:pos1 to:pos2.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   803
        ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   804
    ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   805
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   806
    "Created: 23.5.1997 / 12:17:54 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   807
    "Modified: 23.5.1997 / 12:22:37 / cg"
87
claus
parents: 83
diff changeset
   808
!
claus
parents: 83
diff changeset
   809
claus
parents: 83
diff changeset
   810
warnUnderscoreAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   811
    "warn about an underscore in an identifier"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   812
87
claus
parents: 83
diff changeset
   813
    ignoreWarnings ifFalse:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   814
        warnUnderscoreInIdentifier ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   815
            self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   816
                warning:'underscores in identifiers/symbols are nonportable' 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   817
                position:position to:position.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   818
            "
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   819
             only warn once (per method)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   820
            "
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   821
            warnUnderscoreInIdentifier := false
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   822
        ]
87
claus
parents: 83
diff changeset
   823
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   824
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   825
    "Modified: 23.5.1997 / 12:17:06 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   826
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   827
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   828
warning:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   829
    "a warning - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   830
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   831
    ^ self warning:aMessage position:tokenPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   832
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   833
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   834
warning:aMessage position:position
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   835
    "a warning - only start position is known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   836
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   837
    ^ self warning:aMessage position:position to:nil
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   838
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   839
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   840
warning:aMessage position:position to:endPos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   841
    "a warning"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   842
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   843
    ^ self notifyWarning:('Warning: ' , aMessage) position:position to:endPos
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
   844
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
   845
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   846
!Scanner methodsFor:'general scanning'!
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   847
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   848
scanPositionsFor:aTokenString inString:aSourceString
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   849
    "scan aSourceString for occurrances of aTokenString.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   850
     Return a collection of start positions.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   851
     Added for VW compatibility (to support syntax-highlight)."
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   852
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   853
    |searchType searchName searchValue positions t|
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   854
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   855
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   856
     first, look what kind of token we have to search for
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   857
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   858
    self initializeFor:(ReadStream on:aTokenString).
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   859
    self nextToken.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   860
    searchType := tokenType.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   861
    searchName := tokenName.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   862
    searchValue := tokenValue.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   863
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   864
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   865
     start the real work ...
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   866
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   867
    self initializeFor:(ReadStream on:aSourceString).
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   868
    positions := OrderedCollection new.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   869
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   870
    [(t := self nextToken) ~~ #EOF] whileTrue:[
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   871
	searchType == t ifTrue:[
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   872
	    (searchName isNil or:[tokenName = searchName]) ifTrue:[
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   873
		(searchValue isNil or:[tokenValue = searchValue]) ifTrue:[
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   874
		    positions add:tokenPosition.
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   875
		]
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   876
	    ]
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   877
	]
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   878
    ].
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   879
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   880
    ^ positions
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   881
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   882
    "
30
26e2f849916a keep tokenRadix; accept E in floats
claus
parents: 20
diff changeset
   883
     Scanner new scanPositionsFor:'hello' inString:'foo bar hello baz hello' 
26e2f849916a keep tokenRadix; accept E in floats
claus
parents: 20
diff changeset
   884
     Scanner new scanPositionsFor:'3.14' inString:'foo 3.145 bar hello 3.14 baz hello 3.14' 
26e2f849916a keep tokenRadix; accept E in floats
claus
parents: 20
diff changeset
   885
     Scanner new scanPositionsFor:'16' inString:'foo 16 bar hello 16r10 baz hello 2r10000' 
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   886
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   887
! !
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
   888
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   889
!Scanner methodsFor:'initialization'!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   890
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   891
initialize
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   892
    "initialize the scanner"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   893
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   894
    errorFlag := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   895
    tokenPosition := 1.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   896
    tokenLineNr := lineNr := 1.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   897
    currentComments := nil.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   898
    saveComments := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   899
    ignoreErrors := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   900
    ignoreWarnings := Warnings not.
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   901
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   902
    warnSTXSpecialComment := WarnSTXSpecials.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   903
    warnSTXNameSpaceUse := WarnSTXSpecials.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   904
    warnUnderscoreInIdentifier := WarnUnderscoreInIdentifier.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   905
    warnDollarInIdentifier := WarnDollarInIdentifier.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   906
    warnOldStyleAssignment := WarnOldStyleAssignment.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   907
    warnCommonMistakes := WarnCommonMistakes.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   908
    warnPossibleIncompatibilities := WarnPossibleIncompatibilities.
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   909
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   910
    allowUnderscoreInIdentifier := AllowUnderscoreInIdentifier.
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   911
    allowDollarInIdentifier := AllowDollarInIdentifier.
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   912
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   913
    ActionArray isNil ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   914
        self class setupActions
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   915
    ].
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   916
    actionArray := ActionArray.
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
   917
    typeArray := TypeArray.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   918
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   919
    "Modified: 7.9.1997 / 01:51:01 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   920
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   921
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   922
initializeFor:aStringOrStream
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   923
    "initialize the new scanner & prepare for reading from aStringOrStream"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   924
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   925
    self initialize.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   926
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   927
    aStringOrStream isStream ifFalse:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   928
        source := ReadStream on:aStringOrStream
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   929
    ] ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   930
        source := aStringOrStream.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   931
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   932
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   933
    "Modified: 23.5.1997 / 12:00:39 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   934
! !
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   935
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   936
!Scanner methodsFor:'private'!
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
   937
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   938
backupPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   939
    "if reading from a stream, at the end we might have read
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   940
     one token too many"
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   941
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   942
    (tokenType == #EOF) ifFalse:[
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   943
	source position:tokenPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   944
    ]
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   945
!
15
992c3d87edbf *** empty log message ***
claus
parents: 10
diff changeset
   946
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   947
beginComment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   948
    ^ self
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   949
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   950
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   951
checkForKeyword:string
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   952
    "check if string is a keyword (as opposed to an identifier).
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   953
     That is, its one of 'self', 'super', 'nil', 'true', 'false',
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   954
     or 'thisContext'.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   955
     'here' is handled elsewhere (since it must be treated as an
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   956
     identifier, if declared locally."
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   957
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   958
    |firstChar|
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   959
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   960
    firstChar := string at:1.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   961
    (firstChar == $s) ifTrue:[
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   962
        (string = 'self')  ifTrue:[tokenType := #Self. ^true].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   963
        (string = 'super') ifTrue:[tokenType := #Super. ^true]
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   964
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   965
    (firstChar == $n) ifTrue:[
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   966
        (string = 'nil') ifTrue:[tokenType := #Nil. ^true]
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   967
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   968
    (firstChar == $t) ifTrue:[
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   969
        (string = 'true') ifTrue:[tokenType := #True. ^true].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   970
        (string = 'thisContext') ifTrue:[tokenType := #ThisContext. ^true]
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   971
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   972
    (firstChar == $f) ifTrue:[
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   973
        (string = 'false') ifTrue:[tokenType := #False. ^true]
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   974
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   975
    ^ false
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   976
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   977
    "Modified: / 13.5.1998 / 14:59:55 / cg"
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   978
!
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
   979
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   980
collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   981
    ^ collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   982
!
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   983
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   984
endComment:comment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   985
    saveComments ifTrue:[
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   986
	currentComments isNil ifTrue:[
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   987
	    currentComments := OrderedCollection with:comment
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   988
	] ifFalse:[
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   989
	    currentComments add:comment
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
   990
	]
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
   991
    ].
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
   992
!
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
   993
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   994
endComment:commentString type:commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   995
    |comment|
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   996
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   997
    saveComments ifTrue:[
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   998
        comment := Comment new.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   999
        comment commentString:commentString; commentType:commentType.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1000
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1001
        currentComments isNil ifTrue:[
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1002
            currentComments := OrderedCollection with:comment
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1003
        ] ifFalse:[
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1004
            currentComments add:comment
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1005
        ]
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1006
    ].
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1007
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1008
    "Created: / 17.2.1998 / 14:48:49 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1009
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1010
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1011
ignoreErrors
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1012
    "turn off notification of errors"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1013
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1014
    ignoreErrors := true
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1015
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1016
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1017
ignoreWarnings
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1018
    "turn off notification of warnings"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1019
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1020
    ignoreWarnings := true
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1021
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1022
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1023
notifying:anObject
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1024
    "set the requestor to be notified"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1025
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1026
    requestor := anObject
426
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1027
!
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1028
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1029
setNameSpace:aNameSpace
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1030
    "/ ignored here
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1031
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1032
    "Created: 8.11.1996 / 13:33:10 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1033
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1034
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1035
!Scanner methodsFor:'reading next token'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1036
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1037
nextCharacter
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1038
    "a $ has been read - return a character token"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1039
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1040
    |nextChar|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1041
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1042
    source next.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1043
    nextChar := source next.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1044
    nextChar notNil ifTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1045
        tokenValue := token := nextChar.
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1046
        tokenType := #Character.
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1047
"/        self markConstantFrom:tokenPosition to:(tokenPosition + 1).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1048
    ] ifFalse:[
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1049
        tokenValue := token := nil.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1050
        tokenType := #EOF
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1051
    ].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1052
    ^ tokenType
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1053
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1054
    "Modified: / 13.5.1998 / 15:09:50 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1055
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1056
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1057
nextColonOrAssign
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1058
    "colon has been read - look for = to make it an assign"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1059
120
claus
parents: 103
diff changeset
  1060
    "/ special kludge for identifier:= (without spaces inbetween)
claus
parents: 103
diff changeset
  1061
    "/ here we needed two characters lookahead after the identifier ...
claus
parents: 103
diff changeset
  1062
claus
parents: 103
diff changeset
  1063
    peekChar == $= ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1064
        source next.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1065
        peekChar := nil.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1066
        tokenType := token := #':='.
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1067
        ^ tokenType
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1068
    ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1069
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1070
    "/ special kludge for nameSpace:: (without spaces inbetween)
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1071
    "/ here we needed two characters lookahead after the identifier ...
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1072
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1073
    peekChar == $: ifTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1074
        source next.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1075
        peekChar := nil.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1076
        tokenType := token :=#'::'.
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1077
        ^ tokenType
120
claus
parents: 103
diff changeset
  1078
    ].
claus
parents: 103
diff changeset
  1079
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1080
    (source nextPeek == $=) ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1081
        source next.
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1082
        tokenType := token := $_
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1083
    ] ifFalse:[
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1084
        tokenType := token := $:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1085
    ].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1086
    ^ tokenType
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1087
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1088
    "Modified: / 13.5.1998 / 15:10:04 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1089
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1090
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1091
nextHash
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1092
    |nextChar string part|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1093
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1094
    nextChar := source nextPeek.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1095
    nextChar notNil ifTrue:[
620
15bd9a44f63f handle #_
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
  1096
        (nextChar isLetterOrDigit
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1097
        or:[(allowUnderscoreInIdentifier == true) and:[nextChar == $_]]) ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1098
            string := ''.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1099
            [nextChar notNil 
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1100
             and:[nextChar isLetterOrDigit 
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1101
                  or:[allowUnderscoreInIdentifier == true
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1102
                      and:[nextChar == $_]]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1103
                 ]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1104
            ] whileTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1105
                part := source nextAlphaNumericWord.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1106
                part notNil ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1107
                    string := string , part.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1108
                ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1109
                nextChar := source peek.
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1110
                allowUnderscoreInIdentifier == true ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1111
                    nextChar == $_ ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1112
                        self warnUnderscoreAt:source position.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1113
                    ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1114
                    [nextChar == $_] whileTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1115
                        string := string copyWith:nextChar.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1116
                        nextChar := source nextPeek.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1117
                        (nextChar isAlphaNumeric) ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1118
                            string := string , source nextAlphaNumericWord.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1119
                            nextChar := source peek.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1120
                        ]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1121
                    ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1122
                ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1123
                (nextChar == $:) ifFalse:[
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1124
                    self markSymbolFrom:tokenPosition to:(source position-1).
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1125
                    tokenValue := token := string asSymbol.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1126
                    tokenType := #Symbol.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1127
                    ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1128
                ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1129
                string := string copyWith:nextChar.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1130
                nextChar := source nextPeek
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1131
            ].
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1132
            tokenValue := token := string asSymbol.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1133
            tokenType := #Symbol.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1134
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1135
        ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1136
        (nextChar == $( ) ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1137
            source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1138
            token := '#('.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1139
            tokenType := #HashLeftParen.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1140
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1141
        ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1142
        (nextChar == $[ ) ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1143
            "it seems that ST-80 supports Constant ByteArrays as #[...]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1144
             (seen in a PD program)"
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1145
            source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1146
            token := '#['.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1147
            tokenType := #HashLeftBrack.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1148
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1149
        ].
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1150
        (nextChar == $' ) ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1151
            "it seems that ST-80 supports arbitrary symbols as #'...'
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1152
             (seen in a PD program)"
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1153
            self nextString.
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1154
            self markSymbolFrom:tokenPosition to:(source position-1).
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1155
            tokenValue := token := tokenValue asSymbol.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1156
            tokenType := #Symbol.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1157
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1158
        ].
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1159
        ((typeArray at:(nextChar asciiValue)) == #special) ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1160
            string := source next asString.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1161
            nextChar := source peek.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1162
            nextChar notNil ifTrue:[
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1163
                ((typeArray at:(nextChar asciiValue)) == #special) ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1164
                    source next.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1165
                    string := string copyWith:nextChar
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1166
                ]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1167
            ].
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1168
            self markSymbolFrom:tokenPosition to:(source position-1).
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1169
            tokenValue := token := string asSymbol.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1170
            tokenType := #Symbol.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1171
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1172
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1173
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1174
    "this allows hash to be used as binop -
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1175
     I dont know, if this is correct ..."
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1176
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1177
    tokenName := token := '#'.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1178
    tokenType := #BinaryOperator.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1179
    ^ tokenType
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1180
"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1181
    self syntaxError:'unexpected end-of-input in Symbol'
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1182
            position:tokenPosition to:(tokenPosition + 1).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1183
    ^ #Error
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1184
"
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1185
.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  1186
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1187
    "Modified: / 1.4.1998 / 13:02:45 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1188
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1189
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1190
nextId
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1191
    |nextChar string oldString 
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1192
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1193
     max   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1194
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1195
    nextChar := source peekOrNil.
96
claus
parents: 91
diff changeset
  1196
    string := String basicNew:20.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1197
    index := 0.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1198
    max := 10.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1199
    [true] whileTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1200
        (nextChar notNil and:[nextChar isLetterOrDigit]) ifFalse:[
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1201
            ^ string copyTo:index
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1202
        ].
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1203
        (index == max) ifTrue:[
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1204
            oldString := string.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1205
            string := String basicNew:(max * 2).
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1206
            string replaceFrom:1 to:max with:oldString.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1207
            max := max * 2
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1208
        ].
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1209
        index := index + 1.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1210
        string at:index put:nextChar.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1211
        nextChar := source nextPeek
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1212
    ]
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1213
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1214
    "Modified: / 5.3.1998 / 02:53:57 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1215
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1216
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1217
nextIdentifier
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1218
    |nextChar string ok pos|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1219
87
claus
parents: 83
diff changeset
  1220
    hereChar == $_ ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1221
        "/
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1222
        "/ no need to check for allowUnderscoreInIdentifier here;
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1223
        "/ could not arrive here if it was off
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1224
        "/
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1225
        nextChar := source nextPeek.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1226
        (nextChar isAlphaNumeric or:[nextChar == $_]) ifFalse:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1227
            "oops: a single underscore is an old-style assignement"
467
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1228
            nextChar ~~ $: ifTrue:[
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1229
                self warnOldStyleAssignmentAt:tokenPosition.
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1230
                source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1231
                tokenType := token := $_.
467
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1232
                ^ tokenType
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1233
            ]
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1234
        ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1235
        string := '_'.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1236
        self warnUnderscoreAt:tokenPosition.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1237
        [nextChar == $_] whileTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1238
            string := string copyWith:$_.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1239
            nextChar := source nextPeek.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1240
        ].
467
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1241
        nextChar isAlphaNumeric ifTrue:[
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1242
            string := string , source nextAlphaNumericWord.
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  1243
        ]
87
claus
parents: 83
diff changeset
  1244
    ] ifFalse:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1245
        string := source nextAlphaNumericWord "self nextId".
87
claus
parents: 83
diff changeset
  1246
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1247
    nextChar := source peekOrNil.
87
claus
parents: 83
diff changeset
  1248
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1249
    (nextChar == $_ 
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1250
    or:[nextChar == $$]) ifTrue:[
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1251
        ok := (nextChar == $_) ifTrue:[allowUnderscoreInIdentifier] ifFalse:[allowDollarInIdentifier].
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1252
        ok ifTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1253
            pos := source position.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1254
            nextChar == $_ ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1255
                self warnUnderscoreAt:pos.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1256
            ] ifFalse:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1257
                self warnDollarAt:pos.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1258
            ].
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1259
            [ok] whileTrue:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1260
                string := string copyWith:nextChar.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1261
                nextChar := source nextPeek.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1262
                (nextChar isAlphaNumeric) ifTrue:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1263
                    string := string , source nextAlphaNumericWord.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1264
                    nextChar := source peekOrNil.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1265
                ].
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1266
                (nextChar == $_) ifTrue:[
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1267
                    ok := allowUnderscoreInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1268
                ] ifFalse:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1269
                    (nextChar == $$) ifTrue:[
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1270
                        ok := allowDollarInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1271
                    ] ifFalse:[
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1272
                        ok := false
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1273
                    ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1274
                ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1275
            ].
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1276
        ].
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  1277
    ].
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  1278
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1279
    (nextChar == $:) ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1280
        source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1281
        (source peekOrNil == $=) ifFalse:[
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1282
            (source peekOrNil == $:) ifFalse:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1283
                tokenName := token := string copyWith:nextChar.
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1284
                tokenType := #Keyword.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1285
                ^ self
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1286
            ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1287
            peekChar := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1288
            peekChar2 := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1289
        ] ifTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1290
            peekChar := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1291
            peekChar2 := $=.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1292
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1293
    ].
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1294
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1295
    nextChar == $- ifTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1296
        pos := source position.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1297
        self
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1298
            warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other systems'
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1299
            position:pos to:pos.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1300
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1301
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1302
    tokenName := token := string.
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1303
    (self checkForKeyword:string) ifTrue:[^ tokenType].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1304
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1305
    tokenType := #Identifier.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1306
    ^ tokenType
120
claus
parents: 103
diff changeset
  1307
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1308
    "Created: / 13.9.1995 / 12:56:42 / claus"
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1309
    "Modified: / 13.5.1998 / 14:58:39 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1310
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1311
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1312
nextMantissa:radix
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1313
    |nextChar value factor|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1314
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1315
    value := 0.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1316
    factor := 1.0 / radix.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1317
    nextChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1318
    [(nextChar notNil and:[nextChar isDigitRadix:radix])] whileTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1319
        value := value + (nextChar digitValue * factor).
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1320
        factor := factor / radix.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1321
        nextChar := source nextPeek
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1322
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1323
    ^ value
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1324
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1325
    "Modified: / 5.3.1998 / 02:54:11 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1326
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1327
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1328
nextNumber
441
fa5637faa969 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 431
diff changeset
  1329
    |nextChar value s tokenRadix|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1330
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1331
    tokenRadix := 10.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1332
    value := Integer readFrom:source radix:tokenRadix.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1333
    nextChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1334
    (nextChar == $r) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1335
        tokenRadix := value.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1336
        source next.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1337
        s := 1.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1338
        source peekOrNil == $- ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1339
            source next.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1340
            s := -1
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1341
        ].
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1342
        value := Integer readFrom:source radix:tokenRadix.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1343
        value := value * s.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1344
        nextChar := source peekOrNil
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1345
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1346
    (nextChar == $.) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1347
        nextChar := source nextPeek.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1348
        (nextChar notNil and:[nextChar isDigitRadix:tokenRadix]) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1349
            value := value asFloat + (self nextMantissa:tokenRadix).
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1350
            nextChar := source peekOrNil
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1351
        ] ifFalse:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1352
"/            nextChar == (Character cr) ifTrue:[
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1353
"/                lineNr := lineNr + 1.
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1354
"/            ].
499
e7052694178d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 498
diff changeset
  1355
            nextChar := peekChar := $..
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1356
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1357
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1358
    ((nextChar == $e) or:[nextChar == $E]) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1359
        nextChar := source nextPeek.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1360
        (nextChar notNil and:[(nextChar isDigitRadix:tokenRadix) or:['+-' includes:nextChar]]) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1361
            s := 1.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1362
            (nextChar == $+) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1363
                nextChar := source nextPeek
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1364
            ] ifFalse:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1365
                (nextChar == $-) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1366
                    nextChar := source nextPeek.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1367
                    s := s negated
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1368
                ]
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1369
            ].
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1370
            value := value asFloat
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1371
                     * (10.0 raisedToInteger:((Integer readFrom:source radix:tokenRadix) * s))
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1372
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1373
    ].
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1374
    nextChar == $- ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1375
        self
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1376
            warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other systems'
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1377
            position:(source position) to:source position.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1378
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1379
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1380
    tokenValue := token := value.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1381
    (value isMemberOf:Float) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1382
        (nextChar == $d) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1383
            source next
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1384
        ].
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1385
        tokenType := #Float
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1386
    ] ifFalse:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1387
        tokenType := #Integer
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1388
    ].
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1389
"/    self markConstantFrom:tokenPosition to:(source position - 1).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1390
    ^ tokenType
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  1391
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1392
    "Modified: / 1.4.1998 / 13:06:28 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1393
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1394
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1395
nextPrimitive
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1396
    |nextChar inPrimitive string 
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1397
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1398
     len   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1399
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1400
    nextChar := source nextPeek.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1401
    string := String new:500.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1402
    len := 500.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1403
    index := 1.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1404
    (nextChar == ${) ifTrue:[
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1405
        nextChar := source nextPeek.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1406
        inPrimitive := true.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1407
        [inPrimitive] whileTrue:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1408
            [nextChar == $%] whileFalse:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1409
                nextChar isNil ifTrue:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1410
                    self syntaxError:'unterminated primitive'
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1411
                            position:tokenPosition to:source position.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1412
                    ^ #Error
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1413
                ].
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1414
                string at:index put:nextChar.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1415
                (index == len) ifTrue:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1416
                    string := string , (String new:len).
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1417
                    len := len * 2
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1418
                ].
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1419
                index := index + 1.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1420
                nextChar := source next
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1421
            ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1422
            (source peekOrNil == $}) ifTrue:[
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1423
                inPrimitive := false
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1424
            ] ifFalse:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1425
                string at:index put:nextChar.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1426
                (index == len) ifTrue:[
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1427
                    string := string , (String new:len).
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1428
                    len := len * 2
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1429
                ].
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1430
                index := index + 1.
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1431
                nextChar := source next
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1432
            ]
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1433
        ].
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1434
        source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1435
        tokenValue := token := string copyTo:(index - 1).
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1436
        tokenType := #Primitive.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1437
        lineNr := lineNr + (tokenValue occurrencesOf:(Character cr)).
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1438
        ^ tokenType
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1439
    ].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1440
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1441
    "a % alone is a binary operator"
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1442
    tokenName := token := '%'.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1443
    tokenType := #BinaryOperator.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1444
    ^ tokenType.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1445
"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1446
    self syntaxError:('invalid character: ''' , nextChar asString , '''')
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1447
            position:tokenPosition to:(tokenPosition + 1).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1448
    ^ #Error
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1449
"
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1450
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1451
    "Modified: / 5.3.1998 / 02:54:43 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1452
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1453
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1454
nextSpecial
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1455
    "a special character has been read, look for another one.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1456
     also -number is handled here"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1457
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1458
    |firstChar secondChar thirdChar string p|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1459
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1460
    firstChar := source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1461
    secondChar := source peekOrNil.
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
  1462
    ((firstChar == $-) and:[secondChar notNil]) ifTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1463
        secondChar isDigit ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1464
            self nextNumber.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1465
            tokenValue := token := tokenValue negated.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1466
            ^ tokenType
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1467
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1468
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1469
    string := firstChar asString.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1470
    secondChar notNil ifTrue:[
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1471
        ((typeArray at:(secondChar asciiValue)) == #special) ifTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1472
            (secondChar == $-) ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1473
                "special- look if minus belongs to number following"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1474
                p := source position.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1475
                source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1476
                thirdChar := source peekOrNil.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1477
                source position:p.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1478
                thirdChar isDigit ifTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1479
                    tokenName := token := string.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1480
                    tokenType := #BinaryOperator.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1481
                    self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1482
                        warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other ST systems' 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1483
                        position:p-1 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1484
                        to:p.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1485
                    ^ tokenType
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1486
                ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1487
            ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1488
            source next.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1489
            string := string copyWith:secondChar
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1490
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1491
    ].
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1492
    tokenName := token := string.
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
  1493
    tokenType := #BinaryOperator.
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  1494
    ^ tokenType
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
  1495
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1496
    "Modified: / 5.3.1998 / 02:54:54 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1497
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1498
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1499
nextString
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1500
    |nextChar string pos
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1501
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1502
     len   "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1503
     inString|
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1504
96
claus
parents: 91
diff changeset
  1505
    string := String basicNew:20.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1506
    len := 20.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1507
    index := 1.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1508
    pos := source position.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1509
    source next.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1510
    nextChar := source next.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1511
    inString := true.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1512
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1513
    [inString] whileTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1514
        nextChar isNil ifTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1515
            self syntaxError:'unexpected end-of-input in String'
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1516
                    position:pos to:(source position - 1).
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1517
            self markStringFrom:pos to:source position-1.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1518
            token := nil.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1519
            tokenType := #EOF.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1520
            ^ tokenType
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1521
        ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1522
        (nextChar == Character cr) ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1523
            lineNr := lineNr + 1
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1524
        ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1525
        (nextChar == Character quote) ifTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1526
            (source peekOrNil == Character quote) ifTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1527
                source next
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1528
            ] ifFalse:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1529
                inString := false
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1530
            ]
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1531
        ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1532
        inString ifTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1533
            string at:index put:nextChar.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1534
            (index == len) ifTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1535
                string := string , (String new:len).
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1536
                len := len * 2
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1537
            ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1538
            index := index + 1.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1539
            nextChar := source next
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1540
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1541
    ].
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1542
    self markStringFrom:pos to:source position-1.
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1543
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1544
    tokenValue := token := string copyTo:(index - 1).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1545
    tokenType := #String.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1546
    ^ tokenType
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1547
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1548
    "Modified: / 31.3.1998 / 17:33:14 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1549
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1550
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1551
nextToken
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1552
    "return the next token from the source-stream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1553
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1554
    |skipping actionBlock v ch|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1555
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1556
    peekChar notNil ifTrue:[
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1557
        peekChar isSeparator ifTrue:[
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1558
            peekChar == (Character cr) ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1559
                lineNr := lineNr + 1.
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1560
            ].
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1561
            peekChar := peekChar2.
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1562
            peekChar2 := nil.
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1563
        ].
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1564
    ].
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1565
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1566
    peekChar notNil ifTrue:[
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1567
        ch := peekChar.
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1568
        peekChar := peekChar2.
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1569
        peekChar2 := nil.
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1570
        hereChar := nil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1571
    ] ifFalse:[
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1572
        skipping := true.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1573
        [skipping] whileTrue:[
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1574
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1575
            outStream notNil ifTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1576
                hereChar := source peekOrNil.
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1577
                [(hereChar == Character space)
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1578
                 or:[hereChar isSeparator]
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1579
                ] whileTrue:[
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1580
                    source next.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1581
                    outStream space. 
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1582
                    outCol := outCol + 1.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1583
                ]
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1584
            ] ifFalse:[
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1585
                hereChar := source skipSeparatorsExceptCR.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1586
            ].
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1587
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1588
            hereChar == (Character cr) ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1589
                lineNr := lineNr + 1.
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1590
                source next.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1591
                outStream notNil ifTrue:[
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1592
                    outStream cr.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1593
                    outCol := 1
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1594
                ]
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1595
            ] ifFalse:[
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1596
                hereChar == (Character return) ifTrue:[
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1597
                    outStream notNil ifTrue:[
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1598
                        outStream nextPut:hereChar.
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1599
                        outCol := 1
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1600
                    ].
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1601
                    source next.
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1602
                ] ifFalse:[
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1603
                    hereChar == (Character doubleQuote) ifTrue:[
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1604
                        "start of a comment"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1605
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1606
                        self skipComment.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1607
                        hereChar := source peekOrNil.
487
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1608
                    ] ifFalse:[
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1609
                        skipping := false
4bc6586a7d67 oops - did not treat return as whiteSpace
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  1610
                    ]
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1611
                ]
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1612
            ]
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1613
        ].
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1614
        hereChar isNil ifTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1615
            token := nil.
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1616
            tokenType := #EOF.
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1617
            ^ tokenType
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1618
        ].
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1619
        ch := hereChar
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1620
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1621
    tokenPosition := source position.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1622
    tokenLineNr := lineNr.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1623
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1624
    (v := ch asciiValue) == 0 ifTrue:[
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1625
        v := Character space asciiValue
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1626
    ].
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1627
    actionBlock := actionArray at:v.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1628
    actionBlock notNil ifTrue:[
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1629
        ^ actionBlock value:self value:ch
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1630
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1631
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1632
    self syntaxError:('invalid character: ''' , ch asString , ''' ',
449
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1633
                      '(' , v printString , ')')
6ad7a414ea5d just to make certain: handle 0-characters in input
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1634
            position:tokenPosition to:tokenPosition.
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1635
    source next.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1636
    tokenName := nil.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1637
    tokenType := token := #Error.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1638
    ^ #Error
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1639
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1640
    "Modified: / 13.9.1995 / 12:56:14 / claus"
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1641
    "Modified: / 13.5.1998 / 15:11:39 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1642
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1643
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1644
nextToken:aCharacter
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1645
    tokenType := token := aCharacter.
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1646
    hereChar notNil ifTrue:[source next].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1647
    ^ tokenType
603
021722b8a427 correctly scan trailing period after a number in a block (as in x := x + 1.]
Claus Gittinger <cg@exept.de>
parents: 546
diff changeset
  1648
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1649
    "Modified: / 13.5.1998 / 15:10:23 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1650
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1651
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1652
skipComment
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1653
    |commentStream commentType startPos|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1654
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1655
    saveComments ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1656
        commentStream := WriteStream on:''.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1657
        self beginComment.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1658
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1659
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1660
    outStream notNil ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1661
        outStream nextPut:Character doubleQuote.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1662
        outCol := outCol + 1
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1663
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1664
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1665
    startPos := source position.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1666
    source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1667
    hereChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1668
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1669
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1670
     special ST/X addition:
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1671
     a $/ right after the initial double quote makes it an up-to-end-of-line comment,
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1672
     which is very useful to comment out parts of filed-in source code.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1673
     Since this is non-standard, use it in very rare cases only. 
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1674
     (maybe the upcoming ansi-standard adds something similar - in this case, I will
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1675
      change it without notice)"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1676
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1677
    hereChar == $/ ifTrue:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1678
        commentType := #eolComment.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1679
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1680
        hereChar := source nextPeek.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1681
        [hereChar notNil and:[hereChar ~~ Character cr]] whileTrue:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1682
            commentStream notNil ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1683
                commentStream nextPut:hereChar
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1684
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1685
            outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1686
                outStream nextPut:hereChar.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1687
                outCol := outCol + 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1688
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1689
            hereChar := source nextPeek.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1690
        ].
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1691
        self markCommentFrom:startPos to:(source position).
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1692
        lineNr := lineNr + 1.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1693
        ignoreWarnings ifFalse:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1694
            warnSTXSpecialComment ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1695
                self warning:'end-of-line comments are a nonstandard feature of ST/X' 
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1696
                     position:startPos to:(source position).
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1697
                "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1698
                 only warn once
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1699
                "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1700
                warnSTXSpecialComment := false
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1701
            ]
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1702
        ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1703
        outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1704
            outStream cr.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1705
            outCol := 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1706
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1707
    ] ifFalse:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1708
        commentType := #regularComment.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1709
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1710
        hereChar == ${ ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1711
            "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1712
             special ST/X addition:
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1713
             a ${ right after the initial double quote starts a directive
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1714
            "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1715
            self parseDirective
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1716
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1717
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1718
        [hereChar notNil and:[hereChar ~~ (Character doubleQuote)]] whileTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1719
            hereChar == (Character cr) ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1720
                lineNr := lineNr + 1.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1721
            ].
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1722
            commentStream notNil ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1723
                commentStream nextPut:hereChar
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1724
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1725
            outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1726
                outStream nextPut:hereChar.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1727
                outCol := outCol + 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1728
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1729
            hereChar := source nextPeek
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1730
        ].
666
bf2af3d84787 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
  1731
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1732
        hereChar isNil ifTrue:[
666
bf2af3d84787 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
  1733
            self markCommentFrom:startPos to:(source size).
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1734
            self warning:'unclosed comment' position:startPos to:(source position)
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1735
        ] ifFalse:[
666
bf2af3d84787 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
  1736
            self markCommentFrom:startPos to:(source position).
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1737
            outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1738
                outStream nextPut:(Character doubleQuote).
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1739
                outCol := outCol + 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1740
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1741
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1742
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1743
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1744
    "skip final dQuote or cr"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1745
    source next.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1746
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1747
    saveComments ifTrue:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1748
        self endComment:(commentStream contents) type:commentType.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1749
    ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1750
666
bf2af3d84787 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
  1751
    "Modified: / 31.3.1998 / 23:45:26 / cg"
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1752
! !
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1753
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1754
!Scanner::Comment methodsFor:'accessing'!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1755
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1756
commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1757
    "return the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1758
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1759
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1760
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1761
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1762
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1763
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1764
commentString:something
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1765
    "set the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1766
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1767
    commentString := something.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1768
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1769
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1770
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1771
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1772
commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1773
    "return the value of the instance variable 'commentType' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1774
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1775
    ^ commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1776
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1777
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1778
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1779
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1780
commentType:something
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1781
    "set the value of the instance variable 'commentType' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1782
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1783
    commentType := something.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1784
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1785
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1786
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1787
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1788
string
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1789
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1790
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1791
    "Created: / 17.2.1998 / 14:49:52 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1792
! !
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1793
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1794
!Scanner class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  1795
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  1796
version
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1797
    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.82 1998-05-13 17:58:56 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  1798
! !
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1799
Scanner initialize!