Scanner.st
author Claus Gittinger <cg@exept.de>
Tue, 29 Aug 2006 19:20:08 +0200
changeset 1900 66c65b0abf72
parent 1856 209089a85ed3
child 1930 ff11ddb6de58
permissions -rw-r--r--
error messages (line based)
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
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
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
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
    13
"{ Package: 'stx:libcomp' }"
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
    14
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#Scanner
1595
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    16
	instanceVariableNames:'typeArray actionArray source lineNr token tokenType tokenPosition
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    17
		tokenValue tokenName tokenLineNr hereChar peekChar peekChar2
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    18
		requestor exitBlock errorFlag ignoreErrors ignoreWarnings
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
    19
		saveComments currentComments collectedSource scanColonAsKeyword
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
    20
		outStream outCol inArrayLiteral lastDirective parserFlags
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
    21
		didWarnAboutSTXSpecialComment didWarnAboutUnderscoreInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
    22
		didWarnAboutOldStyleAssignment didWarnAboutDollarInIdentifier'
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
    23
	classVariableNames:'TypeArray ActionArray Warnings EmptySourceNotificationSignal'
1595
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    24
	poolDictionaries:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    25
	category:'System-Compiler'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    26
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    27
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    28
Object subclass:#Comment
1595
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    29
	instanceVariableNames:'commentType commentString'
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    30
	classVariableNames:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    31
	poolDictionaries:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    32
	privateIn:Scanner
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    33
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    34
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    35
Object subclass:#Directive
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    36
	instanceVariableNames:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    37
	classVariableNames:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    38
	poolDictionaries:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    39
	privateIn:Scanner
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    40
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    41
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    42
Scanner::Directive subclass:#ClassDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    43
	instanceVariableNames:'className'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    44
	classVariableNames:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    45
	poolDictionaries:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    46
	privateIn:Scanner::Directive
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    47
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    48
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    49
Scanner::Directive::ClassDirective subclass:#ClassHintDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    50
	instanceVariableNames:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    51
	classVariableNames:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    52
	poolDictionaries:''
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    53
	privateIn:Scanner::Directive
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    54
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    55
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
    56
Query subclass:#DoNotShowCompilerWarningAgainActionQuery
1595
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    57
	instanceVariableNames:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    58
	classVariableNames:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    59
	poolDictionaries:''
69f4593db7d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
    60
	privateIn:Scanner
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
    61
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
    62
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    63
!Scanner class methodsFor:'documentation'!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    64
901
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    65
bugs
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    66
"
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    67
   array constant containing keywords as in:
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    68
        #(
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    69
                foo:bar:
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    70
                fee:baz:
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    71
         )
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    72
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    73
   is scanned as 4-element array containing ( #foo: #bar: #fee: #baz: )
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    74
   this MUST be fixed.
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    75
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    76
   workaround:
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    77
        #(
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    78
                #'foo:bar:'
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    79
                #'fee:baz:'
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    80
         )
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    81
        
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    82
"
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    83
!
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    84
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    85
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    86
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    87
 COPYRIGHT (c) 1989 by Claus Gittinger
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
    88
              All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    89
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    90
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    91
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    92
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    93
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    94
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    95
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    96
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    97
!
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    98
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    99
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   100
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   101
    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
   102
    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
   103
    Possibly placing additional information (such as tokenValue) into 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   104
    instance variables as a side effect.
75
d8b9d6b39497 *** empty log message ***
claus
parents: 74
diff changeset
   105
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   106
    TODO: 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   107
        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
   108
        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
   109
        nextIdentifier etc. methods should be renamed.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   110
        (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
   111
         their public use is not a good idea ..)
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   112
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   113
        Scanner is typically subclassed for parsing and #nextToken
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   114
        invoked via #self-sends.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   115
        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
   116
        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
   117
        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
   118
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   119
    Extensions:
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   120
        this scanner allows for 3-character binary selectors.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   121
        also, # is a valid selector. (however, ## is currently scanned as a symbol literal).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   122
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   123
    [author:]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   124
        Claus Gittinger
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   125
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   126
    [see also:]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   127
        Parser
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   128
"
41
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
   129
! !
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
   130
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   131
!Scanner class methodsFor:'initialization'!
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   132
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   133
binarySelectorCharacters
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   134
    "return a collection of characters which are allowed in binary selectors"
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   135
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   136
    ^ #( $& $- $+ $= $* $/ $\ $< $> $~ $@ $, $? $!! $| $% $#).
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   137
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   138
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   139
extendedBinarySelectorCharacters
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   140
    "return a collection of characters which are optionally allowed in binary selectors"
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   141
1288
a3ba417e1efe extendedBinarySelectors
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
   142
    |characters|
a3ba417e1efe extendedBinarySelectors
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
   143
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   144
    characters := OrderedCollection new.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   145
    characters add:(Character value:16rB1).  "/ plus-minus
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   146
    characters add:(Character value:16rD7).  "/ times
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   147
    characters add:(Character value:16rB7).  "/ centered dot
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   148
    characters add:(Character value:16rF7).  "/ divide
1288
a3ba417e1efe extendedBinarySelectors
Claus Gittinger <cg@exept.de>
parents: 1283
diff changeset
   149
    ^ characters
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   150
!
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   151
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   152
setupActions
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   153
    "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
   154
     into scanner methods as characters are read"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   155
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   156
    |block|
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   157
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   158
    ActionArray := Array new:256.
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   159
    TypeArray := Array new:256.
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   160
1303
f726ae1bc0d2 comment
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
   161
    "/ TODO: later versions should be configurable w.r.t separators.
f726ae1bc0d2 comment
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
   162
    "/ #(9 10 12 13 26 32) do: [:i | TypeArray at:(i+1) put: #separator].
f726ae1bc0d2 comment
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
   163
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   164
    block := [:s :char | s nextNumber].
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   165
    ($0 codePoint) to:($9 codePoint) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   166
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   167
    ].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   168
87
claus
parents: 83
diff changeset
   169
    block := [:s :char | s nextSpecial].
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   170
    self binarySelectorCharacters do:[:binop |
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   171
        TypeArray at:(binop codePoint) put:#special.
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   172
        ActionArray at:(binop codePoint) put:block
87
claus
parents: 83
diff changeset
   173
    ].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   174
    block := [:s :char | s nextExtendedSpecial].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   175
    self extendedBinarySelectorCharacters do:[:binop |
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   176
        TypeArray at:(binop codePoint) put:#extendedSpecial.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   177
        ActionArray at:(binop codePoint) put:block
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   178
    ].
87
claus
parents: 83
diff changeset
   179
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   180
    "/ that one is a special case (both binarySelector AND syntax).
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   181
    TypeArray at:($| codePoint) put:nil.
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   182
87
claus
parents: 83
diff changeset
   183
    block := [:s :char | s nextToken:char].
1510
875c90576897 Fix duplicate assignment to ActionArray for sh
Stefan Vogel <sv@exept.de>
parents: 1509
diff changeset
   184
    ';.^|()[]{}' do:[:ch |
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   185
        ActionArray at:(ch codePoint) put:block
87
claus
parents: 83
diff changeset
   186
    ].
claus
parents: 83
diff changeset
   187
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   188
    block := [:s :char | s nextIdentifier].
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   189
    ($a codePoint) to:($z codePoint) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   190
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   191
    ].
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   192
    ($A codePoint) to:($Z codePoint) do:[:index |
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   193
        ActionArray at:index put:block
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   194
    ].
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   195
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   196
    "kludge: action is characterToken, but type is special"
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   197
    TypeArray at:($| codePoint) put:#special.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   198
80
101b42803846 *** empty log message ***
claus
parents: 76
diff changeset
   199
    "kludge: action is nextColonOrAssign, but type is special"
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   200
    TypeArray at:($: codePoint) put:#special.
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   201
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
   202
    ActionArray at:($' codePoint) put:[:s :char | s nextString:char].
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   203
    ActionArray at:($$ codePoint) put:[:s :char | s nextCharacter].
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   204
    ActionArray at:($# codePoint) put:[:s :char | s nextHash].
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   205
    ActionArray at:($!! codePoint) put:[:s :char | s nextExcla].
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
   206
    ActionArray at:($% codePoint) put:[:s :char | s nextPrimitive].
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   207
    ActionArray at:($: codePoint) put:[:s :char | s nextColonOrAssign].
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   208
    ActionArray at:($_ codePoint) put:[:s :char | s nextUnderline].
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   209
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   210
    "
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   211
     Scanner setupActions
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   212
    "
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   213
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
   214
    "Modified: / 01-08-2006 / 14:56:45 / cg"
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   215
! !
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   216
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   217
!Scanner class methodsFor:'instance creation'!
141
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
for:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   220
    "create & return a new scanner reading from aStringOrStream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   221
1235
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   222
    ^ self basicNew initializeFor:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   223
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   224
    "Modified: 23.5.1997 / 12:08:42 / cg"
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   225
!
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   226
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   227
new    
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   228
    "create & return a new scanner"
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   229
859
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   230
    ^ self basicNew initialize.
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   231
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   232
    "Modified: / 23.5.1997 / 12:08:42 / cg"
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   233
    "Created: / 26.5.1999 / 12:02:16 / stefan"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   234
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   235
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   236
!Scanner class methodsFor:'Signal constants'!
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   237
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   238
doNotShowCompilerWarningAgainActionQuery
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   239
    ^ DoNotShowCompilerWarningAgainActionQuery
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   240
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   241
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   242
emptySourceNotificationSignal
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   243
    ^ EmptySourceNotificationSignal
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   244
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   245
    "Created: / 16.5.1998 / 15:55:14 / cg"
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   246
! !
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   247
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   248
!Scanner class methodsFor:'class initialization'!
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   249
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   250
initialize
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   251
    "initialize the classes defaults. Typically, these are changed
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   252
     later in the 'private.rc' file."
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   253
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   254
    EmptySourceNotificationSignal isNil ifTrue:[
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   255
        EmptySourceNotificationSignal := QuerySignal new mayProceed:true.
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   256
        EmptySourceNotificationSignal notifierString:'empty source given to evaluate'.
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   257
        EmptySourceNotificationSignal nameClass:self message:#emptySourceNotificationSignal.
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   258
    ].
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   259
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   260
    "
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   261
     self initialize
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   262
    "
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   263
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   264
    "Modified: / 16.5.1998 / 15:55:41 / cg"
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   265
! !
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   266
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   267
!Scanner class methodsFor:'defaults'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   268
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   269
allowDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   270
    "return true, if $-characters are allowed in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   271
     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
   272
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   273
    ^ ParserFlags allowDollarInIdentifier
608
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:32:18 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   276
    "Modified: 7.9.1997 / 01:39:44 / 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
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   279
allowDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   280
    "this allows turning on/off $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   281
     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
   282
     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
   283
     but instead are scanned as character-constant prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   284
     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
   285
     dollars are still scanned as constant character prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   286
     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
   287
     before filing them in; i.e.:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   288
        Compiler allowDollarInIdentifiers:false"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   289
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   290
    ParserFlags allowDollarInIdentifier:aBoolean.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   291
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   292
    "Created: 7.9.1997 / 01:34:49 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   293
    "Modified: 7.9.1997 / 01:39:30 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   294
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   295
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   296
allowDolphinExtensions
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   297
    "return true, if ##(..) computed literal Arrays are allowed"
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   298
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   299
    ^ ParserFlags allowDolphinExtensions
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   300
!
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   301
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   302
allowDolphinExtensions:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   303
    "this allows turning on/off support for computed literal Arrays ##(..) as in dolphin.
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   304
     If you want to fileIn Dolphin classes, enable this with:
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   305
        Compiler allowDolphinComputedArrays:true"
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   306
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   307
    ParserFlags allowDolphinExtensions:aBoolean.
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   308
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   309
    "
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   310
     self allowDolphinExtensions:true
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   311
     self allowDolphinExtensions:false
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   312
    "
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   313
!
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   314
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   315
allowLiteralNameSpaceSymbols
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   316
    "return true, if literal nameSpace symbols are allowed (#foo::bar) are allowed"
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   317
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   318
    ^ AllowLiteralNameSpaceSymbols
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   319
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   320
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   321
allowOldStyleAssignment
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   322
    "return true, if underscore-assignment (pre ST-80v4 syntax) are to be allowed"
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   323
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   324
    ^ ParserFlags allowOldStyleAssignment
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   325
!
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   326
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   327
allowOldStyleAssignment:aBoolean
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   328
    "this allows turning on/off recognition of underscore-assignment (pre ST-80v4 syntax).
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   329
     You must turn this off, if code with variables named '_' is to be filedIn"
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   330
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   331
    ParserFlags allowOldStyleAssignment:aBoolean
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   332
!
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   333
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   334
allowQualifiedNames
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   335
    "return true, if #{..} qualified names are allowed"
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   336
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   337
    ^ ParserFlags allowQualifiedNames
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   338
!
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   339
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   340
allowQualifiedNames:aBoolean
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   341
    "this allows turning on/off support for qualifiedNames #{ .., } as in vw3.
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   342
     If you want to fileIn vw3 or later classes, enable this with:
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   343
        Compiler allowQualifiedNames:true
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   344
     Notice, that qualified names are not really supported semantically
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   345
     (they are parsed, but treated like regular globals)
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   346
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   347
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   348
    ParserFlags allowQualifiedNames:aBoolean.
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   349
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   350
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   351
     self allowQualifiedNames:true
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   352
     self allowQualifiedNames:false
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   353
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   354
!
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   355
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   356
allowSqueakExtensions
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   357
    "return true, if support for squeak extensions
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   358
        computed arrays { .., }
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   359
        c/java style arguments in message sends rec foo(arg1, ... argN)
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   360
     is enabled."
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   361
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   362
    ^ ParserFlags allowSqueakExtensions
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   363
!
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   364
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   365
allowSqueakExtensions:aBoolean
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   366
    "this allows turning on/off support for squeak extensions:
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   367
        computed arrays { .., }
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   368
        c/java style arguments in message sends rec foo(arg1, ... argN)
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   369
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   370
     If you want to fileIn Squeak classes, enable this with:
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   371
        Compiler allowSqueakComputedArrays:true"
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   372
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   373
    ParserFlags allowSqueakExtensions:aBoolean.
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   374
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   375
    "
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   376
     self allowSqueakExtensions:true
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   377
     self allowSqueakExtensions:false
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   378
    "
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   379
!
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   380
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   381
allowUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   382
    "return true, if underscores are allowed in identifiers"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   383
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   384
    ^ ParserFlags allowUnderscoreInIdentifier
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   385
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   386
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   387
allowUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   388
    "this allows turning on/off underscores in identifiers.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   389
     If turned off (the default), underscores are not allowed in identifiers,
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   390
     but instead scanned as assignment character (old ST/80 syntax).
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   391
     If turned on, underscores are in identifiers are allowed, while extra
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   392
     underscores are still scanned as assignment.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   393
     If you have to fileIn old VW-Vsn2.x classes, 
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   394
     turn them off with:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   395
        Compiler allowUnderscoreInIdentifiers:false"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   396
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   397
    ParserFlags allowUnderscoreInIdentifier:aBoolean.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   398
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   399
    "Modified: 7.9.1997 / 01:35:19 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   400
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   401
1644
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   402
maxBinarySelectorSize
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   403
    ^ 3
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   404
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   405
    "
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   406
     in ST/X, binops are allowed with up-to 3 characters;
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   407
     for example:
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   408
        <->
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   409
        <=>
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   410
        +++
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   411
        :=:
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   412
     etc. are valid binOps here
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   413
    "
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   414
!
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   415
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   416
warnCommonMistakes
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   417
    "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
   418
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   419
    ^ ParserFlags warnCommonMistakes
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   420
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   421
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   422
warnCommonMistakes:aBoolean
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   423
    "this allows turning on/off warnings about common beginners mistakes.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   424
     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
   425
     run time errors later.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   426
     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
   427
     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
   428
     a line as:
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
   429
        Compiler warnCommonMistakes:false
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   430
     in your 'private.rc' file"
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   431
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   432
    ParserFlags warnCommonMistakes:aBoolean
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   433
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   434
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   435
warnDollarInIdentifier
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   436
    "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
   437
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   438
    ^ ParserFlags warnDollarInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   439
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   440
    "Created: 7.9.1997 / 01:36:17 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   441
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   442
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   443
warnDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   444
    "this allows turning on/off warnings about $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   445
     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
   446
     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
   447
     (i.e. VW releases 2.x and maybe others).
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   448
     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
   449
     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
   450
     a line as:
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   451
        Compiler warnDollarInIdentifier:false
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   452
     in your 'private.rc' file"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   453
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   454
    ParserFlags warnDollarInIdentifier:aBoolean
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   455
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   456
    "Created: 7.9.1997 / 01:37:42 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   457
    "Modified: 7.9.1997 / 01:40:02 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   458
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   459
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   460
warnOldStyleAssignment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   461
    "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
   462
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   463
    ^ ParserFlags warnOldStyleAssignment
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   464
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   465
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   466
warnOldStyleAssignment:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   467
    "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
   468
     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
   469
     a line as:
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
   470
        Compiler warnOldStyleAssignment:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   471
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   472
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   473
    ParserFlags warnOldStyleAssignment:aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   474
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   475
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   476
warnPossibleIncompatibilities
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   477
    "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
   478
     are to be warned about"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   479
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   480
    ^ ParserFlags warnPossibleIncompatibilities
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   481
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   482
    "Modified: 23.5.1997 / 12:02:02 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   483
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   484
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   485
warnPossibleIncompatibilities:aBoolean
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   486
    "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
   487
     on or off.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   488
     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
   489
     a line as:
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   490
        Compiler warnPossibleIncompatibilities:false
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   491
     in your 'private.rc' file."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   492
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   493
    ParserFlags warnPossibleIncompatibilities:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   494
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   495
    "Created: 23.5.1997 / 12:02:45 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   496
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   497
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   498
warnSTXSpecials
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   499
    "return true, if ST/X specials are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   500
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   501
    ^ ParserFlags warnSTXSpecials
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   502
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   503
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   504
warnSTXSpecials:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   505
    "this allows turning on/off warnings about stx specials.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   506
     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
   507
     a line as:
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
   508
        Compiler warnSTXSpecials:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   509
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   510
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   511
    ParserFlags warnSTXSpecials:aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   512
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   513
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   514
warnUnderscoreInIdentifier
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   515
    "return true, if underscores in identifiers are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   516
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   517
    ^ ParserFlags warnUnderscoreInIdentifier
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   518
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   519
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   520
warnUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   521
    "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
   522
     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
   523
     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
   524
     (i.e. VW releases 2.x).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   525
     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
   526
     a line as:
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   527
        Compiler warnUnderscoreInIdentifier:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   528
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   529
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   530
    ParserFlags warnUnderscoreInIdentifier:aBoolean
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   531
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   532
    "Modified: 7.9.1997 / 01:37:13 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   533
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   534
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   535
warnings
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   536
    "return true, if any warnings are to be shown"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   537
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   538
    ^ ParserFlags warnings
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   539
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   540
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   541
warnings:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   542
    "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
   543
     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
   544
         Compiler warnings:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   545
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   546
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   547
    ParserFlags warnings:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   548
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   549
    "Modified: 23.5.1997 / 12:03:05 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   550
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   551
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   552
!Scanner class methodsFor:'utility scanning'!
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   553
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   554
scanNumberFrom:aStream
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   555
    "utility - helper for Number>>readSmalltalkSyntaxFrom:"
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   556
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   557
    ^ self basicNew scanNumberFrom:aStream
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   558
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   559
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   560
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   561
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   562
     s := '12345abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   563
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   564
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   565
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   566
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   567
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   568
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   569
     s := '16rffffxabcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   570
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   571
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   572
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   573
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   574
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   575
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   576
     s := '1.2345abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   577
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   578
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   579
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   580
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   581
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   582
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   583
     s := '1.abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   584
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   585
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   586
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   587
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   588
    "Modified: / 18.6.1998 / 23:10:39 / cg"
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   589
! !
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   590
1417
7e97dd2df5ca method category rename
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
   591
!Scanner methodsFor:'Compatibility-ST80'!
98
claus
parents: 97
diff changeset
   592
claus
parents: 97
diff changeset
   593
endOfLastToken
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   594
    "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
   595
     This method was required by some PD program.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   596
     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
   597
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   598
    ^ source position1Based
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   599
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   600
    "Modified: 23.5.1997 / 12:14:27 / cg"
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   601
!
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   602
630
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   603
scan:aStringOrStream 
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   604
    "initialize the scanner: set the source-stream and
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   605
     preread the first token"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   606
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   607
    self initializeFor:aStringOrStream.
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   608
    self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   609
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   610
    "Created: / 30.10.1997 / 16:59:39 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   611
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   612
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   613
scanToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   614
    "read the next token from my input stream"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   615
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   616
    ^ self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   617
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   618
    "Created: / 30.10.1997 / 17:00:16 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   619
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   620
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   621
scanTokens:aStringOrStream
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   622
    "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
   623
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   624
    |tokens|
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   625
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   626
    self initializeFor:aStringOrStream.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   627
    tokens := OrderedCollection new.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   628
    self nextToken.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   629
    [token notNil] whileTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   630
        tokens add:token.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   631
        self nextToken
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   632
    ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   633
    ^ tokens
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   634
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   635
    "
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   636
     Scanner new
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   637
        scanTokens:'Boolean subclass:#True
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   638
                                instanceVariableNames:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   639
                                classVariableNames:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   640
                                poolDictionaries:''''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   641
                                category:''Kernel-Objects''
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   642
        '
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   643
    "
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   644
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   645
    "Modified: 20.6.1997 / 18:22:58 / cg"
98
claus
parents: 97
diff changeset
   646
! !
claus
parents: 97
diff changeset
   647
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   648
!Scanner methodsFor:'accessing'!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   649
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   650
comments
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
   651
    ^ currentComments ? #()
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   652
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   653
1509
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   654
exitBlock:aBlock
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   655
    exitBlock := aBlock
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   656
!
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   657
1202
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   658
inArrayLiteral:aBoolean
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   659
    inArrayLiteral := aBoolean
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   660
!
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   661
859
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   662
lineNumber
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   663
    ^ lineNr
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   664
!
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   665
795
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   666
newSourceStream:aStream
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   667
    source := aStream.
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   668
    self nextToken.
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   669
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   670
    "Created: / 29.10.1998 / 21:59:33 / cg"
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   671
!
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   672
1497
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   673
outStream:aStream
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   674
    outStream := aStream.
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   675
    outCol := outCol ? 1.
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   676
!
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   677
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   678
saveComments:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   679
    "not yet implemented"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   680
1582
701f40070c8a comments returns a collection
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   681
    saveComments := aBoolean.
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   682
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   683
    "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
   684
    "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
   685
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   686
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   687
sourcePosition
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   688
    ^ source position1Based
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   689
!
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   690
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   691
sourceStream
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   692
    ^ source
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   693
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   694
    "Created: 20.4.1996 / 19:59:58 / cg"
1235
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   695
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   696
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   697
tokenLineNr
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   698
    ^ tokenLineNr
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   699
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   700
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   701
tokenName
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   702
    ^ tokenName
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   703
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   704
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   705
tokenPosition
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   706
    ^ tokenPosition
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   707
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   708
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   709
tokenType
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   710
    ^ tokenType
1238
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   711
!
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   712
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   713
tokenValue
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   714
    ^ tokenValue
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   715
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   716
    "Created: / 21.12.2001 / 22:38:08 / cg"
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   717
! !
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   718
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   719
!Scanner methodsFor:'accessing-flags'!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   720
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   721
allowDollarInIdentifier
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   722
    ^ parserFlags allowDollarInIdentifier
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   723
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   724
1511
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   725
allowDollarInIdentifier:something
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   726
    parserFlags allowDollarInIdentifier:something
1511
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   727
!
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   728
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   729
allowLiteralNameSpaceSymbols
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   730
    ^ parserFlags allowLiteralNameSpaceSymbols
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   731
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   732
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   733
allowLiteralNameSpaceSymbols:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   734
    parserFlags allowLiteralNameSpaceSymbols:aBoolean
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   735
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   736
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   737
allowOldStyleAssignment
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   738
    ^ parserFlags allowOldStyleAssignment
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   739
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   740
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   741
allowOldStyleAssignment:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   742
    parserFlags allowOldStyleAssignment:aBoolean
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   743
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   744
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   745
allowSqueakExtensions
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   746
    "return true, if support for squeak extensions
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   747
        computed arrays { .., }
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   748
        c/java style arguments in message sends rec foo(arg1, ... argN)
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   749
     is enabled."
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   750
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   751
    ^ parserFlags allowSqueakExtensions
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   752
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   753
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   754
allowSqueakExtensions:aBoolean
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   755
    "this allows turning on/off support for squeak extensions:
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   756
        computed arrays { .., }
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   757
        c/java style arguments in message sends rec foo(arg1, ... argN)
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   758
    "
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   759
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   760
    parserFlags allowSqueakExtensions:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   761
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   762
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   763
allowUnderscoreInIdentifier
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   764
    ^ parserFlags allowUnderscoreInIdentifier
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   765
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   766
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   767
allowUnderscoreInIdentifier:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   768
    parserFlags allowUnderscoreInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   769
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   770
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   771
parserFlags
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   772
    ^ parserFlags
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   773
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   774
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   775
parserFlags:aParserFlagsInstance
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   776
    parserFlags := aParserFlagsInstance
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   777
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   778
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   779
scanColonAsKeyword
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   780
    "/ not used here, but eases subclassing for other languages.
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   781
    ^ scanColonAsKeyword
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   782
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   783
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   784
warnCommonMistakes
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   785
    ^ parserFlags warnCommonMistakes
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   786
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   787
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   788
warnCommonMistakes:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   789
    parserFlags warnCommonMistakes:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   790
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   791
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   792
warnDollarInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   793
    ^ parserFlags warnDollarInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   794
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   795
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   796
warnDollarInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   797
    parserFlags warnDollarInIdentifier:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   798
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   799
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   800
warnOldStyleAssignment
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   801
    ^ parserFlags warnOldStyleAssignment
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   802
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   803
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   804
warnOldStyleAssignment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   805
    parserFlags warnOldStyleAssignment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   806
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   807
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   808
warnPossibleIncompatibilities
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   809
    ^ parserFlags warnPossibleIncompatibilities
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   810
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   811
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   812
warnPossibleIncompatibilities:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   813
    parserFlags warnPossibleIncompatibilities:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   814
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   815
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   816
warnSTXNameSpaceUse
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   817
    ^ parserFlags warnSTXNameSpaceUse
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   818
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   819
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   820
warnSTXNameSpaceUse:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   821
    parserFlags warnSTXNameSpaceUse:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   822
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   823
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   824
warnSTXSpecialComment
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   825
    ^ parserFlags warnSTXSpecialComment
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   826
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   827
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   828
warnSTXSpecialComment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   829
    parserFlags warnSTXSpecialComment:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   830
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   831
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   832
warnUnderscoreInIdentifier
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   833
    ^ parserFlags warnUnderscoreInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   834
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   835
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   836
warnUnderscoreInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   837
    parserFlags warnUnderscoreInIdentifier:aBoolean
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   838
! !
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   839
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   840
!Scanner methodsFor:'directives'!
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   841
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   842
parseClassDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   843
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   844
     Class: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   845
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   846
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   847
    |className|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   848
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   849
    className := self parseDirectiveClassNameArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   850
    className isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   851
        Transcript showCR:'unrecognized ''Class'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   852
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   853
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   854
    lastDirective := Directive newClassDirective className:className.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   855
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   856
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   857
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   858
parseClassHintDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   859
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   860
     ClassHint: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   861
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   862
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   863
    |className|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   864
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   865
    className := self parseDirectiveClassNameArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   866
    className isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   867
        Transcript showCR:'unrecognized ''ClassHint'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   868
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   869
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   870
    lastDirective := Directive newClassHintDirective className:className.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   871
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   872
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   873
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   874
parseDirective
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   875
    "parse a directive inside a comment (introduced with '{').
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   876
     This is an ST/X special"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   877
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   878
    |directive|
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   879
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   880
    source next.
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   881
    source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   882
    hereChar := source peekOrNil.
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   883
    hereChar isLetter ifTrue:[
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   884
        directive := source nextWord asLowercase.
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   885
        source peekOrNil == $: ifTrue:[
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   886
            source next.
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   887
            source skipSeparatorsExceptCR.
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   888
            hereChar := source peekOrNil.
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   889
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   890
            "
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   891
             Package: 'name-of-package'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   892
             Package: packageId
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   893
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   894
            directive = 'package' ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   895
                self parsePackageDirective.
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   896
            ].
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   897
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   898
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   899
             Namespace: 'nameSpaceIdentifier'
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   900
             Namespace: nameSpaceIdentifier
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   901
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   902
            (directive = 'namespace') ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   903
                self parseNamespaceDirective.
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   904
            ].
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
   905
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   906
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   907
             Uses: 'nameSpace1', ... , 'nameSpaceN'
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   908
             Uses: nameSpaceId1, ... , nameSpaceIdN
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   909
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   910
            directive = 'uses' ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   911
                self parseUsesDirective.
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   912
            ].
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   913
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   914
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   915
             Prerequisites: 'name-of-package', ... , 'name-of-package'
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   916
            "
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   917
            directive = 'prerequisites' ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   918
                self parsePrerequisitesDirective.
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   919
            ].
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   920
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   921
            "
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   922
             Syntax: 'name-of-dialect'
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   923
            "
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   924
            directive = 'syntax' ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   925
                self parseSyntaxDirective.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   926
            ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   927
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   928
            "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   929
             Class: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   930
            "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   931
            directive = 'class' ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   932
                self parseClassDirective.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   933
            ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   934
            "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   935
             ClassHint: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   936
            "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   937
            directive = 'classhint' ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   938
                self parseClassHintDirective.
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   939
            ].
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
   940
        ]
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
   941
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   942
    hereChar := source peekOrNil.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   943
    ^ true.
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
   944
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   945
    "Modified: / 5.3.1998 / 02:55:32 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   946
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   947
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   948
parseDirectiveClassNameArg
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   949
    "helper for parsing a directive"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   950
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   951
    ^ self parseDirectiveStringArg:[:ch | ch isLetter or:[ch == $_ or:[ch == $:]]].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   952
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   953
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   954
parseDirectiveStringArg
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   955
    "helper for parsing a directive"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   956
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   957
    ^ self parseDirectiveStringArg:[:ch | ch isLetter or:[ch == $_]]
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   958
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   959
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   960
parseDirectiveStringArg:characterCheckBlock
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   961
    "helper for parsing a directive"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   962
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   963
    |strBuffer|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   964
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   965
    strBuffer := WriteStream on:(String new).
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   966
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   967
    hereChar == $' ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   968
        hereChar := source nextPeek.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   969
        [hereChar ~~ $'] whileTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   970
            strBuffer nextPut:hereChar.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   971
            hereChar := source nextPeek.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   972
        ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   973
        hereChar := source nextPeek.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   974
        ^ strBuffer contents
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   975
    ].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   976
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   977
    (characterCheckBlock value:hereChar) ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   978
        [characterCheckBlock value:hereChar] whileTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   979
            strBuffer nextPut:hereChar.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   980
            hereChar := source nextPeek.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   981
        ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
   982
        ^ strBuffer contents
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   983
    ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   984
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   985
    ^ nil
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
   986
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   987
    "Modified: 23.5.1997 / 12:15:46 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   988
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   989
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   990
parseDirectiveStringListArg
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   991
    "helper for parsing a directive"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   992
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   993
    |list|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   994
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   995
    list := OrderedCollection new.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   996
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   997
    [hereChar == $'] whileTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   998
        list addLast:self parseDirectiveStringArg.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   999
        source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1000
        hereChar := source peekOrNil.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1001
        (hereChar == $,) ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1002
            source next.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1003
            source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1004
            hereChar := source peekOrNil.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1005
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1006
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1007
    ^ list
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1008
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1009
    "Modified: / 5.3.1998 / 02:55:40 / cg"
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1010
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1011
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1012
parseNamespaceDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1013
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1014
     Namespace: 'nameSpace'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1015
     Namespace: nameSpace
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1016
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1017
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1018
    |namespace target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1019
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1020
    namespace := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1021
    namespace isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1022
        Transcript showCR:'unrecognized ''Namespace'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1023
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1024
    ].
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1025
    target := (requestor notNil and:[ requestor respondsTo:#setNameSpace: ]) ifTrue:[requestor] ifFalse:[self].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1026
    target setNameSpace:namespace.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1027
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1028
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1029
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1030
parsePackageDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1031
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1032
     Package: 'name-of-package'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1033
     Package: packageId
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1034
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1035
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1036
    |packageName target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1037
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1038
    packageName := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1039
    packageName isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1040
        Transcript showCR:'unrecognized ''Package'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1041
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1042
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1043
    packageName := packageName asSymbol.
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1044
    target := (requestor notNil and:[ requestor respondsTo:#setPackage: ]) ifTrue:[requestor] ifFalse:[self].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1045
    target setPackage:packageName.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1046
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1047
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1048
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1049
parsePrerequisitesDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1050
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1051
     Prerequisites: 'name-of-package1', ... , 'name-of-packageN'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1052
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1053
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1054
    |list|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1055
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1056
    list := self parseDirectiveStringListArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1057
    list isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1058
        Transcript showCR:'unrecognized ''Prerequisites'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1059
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1060
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1061
    (requestor notNil and:[requestor respondsTo:#requirePackages:]) ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1062
        requestor requirePackages:list 
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1063
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1064
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1065
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1066
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1067
parseSyntaxDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1068
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1069
     Syntax: 'st-syntax-id'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1070
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1071
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1072
    |syntax target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1073
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1074
    syntax := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1075
    syntax isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1076
        Transcript showCR:'unrecognized ''Syntax'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1077
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1078
    ].
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1079
    target := (requestor notNil and:[ requestor respondsTo:#setSyntax: ]) ifTrue:[requestor] ifFalse:[self].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1080
    target setSyntax:syntax.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1081
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1082
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1083
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1084
parseUsesDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1085
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1086
     Uses: 'nameSpace1', ... , 'nameSpaceN'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1087
     Uses: nameSpaceId1, ... , nameSpaceIdN
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1088
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1089
    
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1090
    |list|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1091
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1092
    list := self parseDirectiveStringListArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1093
    list isNil ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1094
        Transcript showCR:'unrecognized ''Uses'' directive'.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1095
        ^ false
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1096
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1097
    (requestor notNil and:[requestor respondsTo:#addNameSpaces:]) ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1098
        requestor addNameSpaces:list 
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1099
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1100
    ^ true
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1101
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1102
1418
4aae7d34124a method category rename
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1103
!Scanner methodsFor:'dummy-syntax highlighting'!
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1104
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1105
markCommentFrom:pos1 to:pos2
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1106
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1107
    "Created: / 31.3.1998 / 13:34:45 / cg"
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1108
!
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1109
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1110
markConstantFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1111
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1112
    "Created: / 1.4.1998 / 13:02:56 / cg"
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1113
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1114
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1115
markStringFrom:pos1 to:pos2
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1116
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1117
    "Created: / 31.3.1998 / 16:37:18 / cg"
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1118
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1119
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1120
markSymbolFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1121
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1122
    "Created: / 1.4.1998 / 12:58:42 / cg"
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1123
! !
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1124
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1125
!Scanner methodsFor:'error handling'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1126
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1127
correctableError:message position:pos1 to:pos2
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1128
    "report an error which can be corrected by compiler -
874
7872cc72b96e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1129
     return non-false, if correction is wanted (there is more than
7872cc72b96e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 873
diff changeset
  1130
     true/false returned here)"
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1131
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1132
    |correctIt|
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1133
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1134
    requestor isNil ifTrue:[
828
436585929a76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 821
diff changeset
  1135
"/        self showErrorMessage:message position:pos1.
436585929a76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 821
diff changeset
  1136
        correctIt := false
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1137
    ] ifFalse:[
828
436585929a76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 821
diff changeset
  1138
        correctIt := requestor correctableError:message position:pos1 to:pos2 from:self
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1139
    ].
1492
943f98b9334d handle #Error from correctableError
penk
parents: 1489
diff changeset
  1140
943f98b9334d handle #Error from correctableError
penk
parents: 1489
diff changeset
  1141
    (correctIt == false or:[correctIt == #Error]) ifTrue:[
1622
5a79277049ee code cleanup
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
  1142
        exitBlock value
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1143
    ].
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1144
    ^ correctIt
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1145
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1146
    "Created: / 13.5.1998 / 16:45:56 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1147
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1148
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1149
correctableSelectorWarning:message position:pos1 to:pos2
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1150
    "report a warning which can be corrected by compiler -
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1151
     return non-false, if correction is wanted (there is more than
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1152
     true/false returned here)"
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1153
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1154
    |correctIt|
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1155
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1156
    requestor isNil ifTrue:[
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1157
        correctIt := false
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1158
    ] ifFalse:[
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1159
        correctIt := requestor correctableSelectorWarning:message position:pos1 to:pos2 from:self
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1160
    ].
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1161
    correctIt == false ifTrue:[
1622
5a79277049ee code cleanup
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
  1162
        exitBlock value
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1163
    ].
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1164
    ^ correctIt
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1165
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1166
    "Created: / 19.1.2000 / 16:28:03 / cg"
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1167
!
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1168
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1169
errorMessagePrefix
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1170
    ^ 'Error:'
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1171
!
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1172
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1173
ignorableParseError:message
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1174
    self parseError:message.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1175
    "/ if proceeded, install method anyway (used with non-st/x primitives)
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1176
    errorFlag := false.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1177
!
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1178
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1179
invalidCharacter:ch
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1180
    |errMsg v|
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1181
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1182
    v := ch codePoint.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1183
    ch isPrintable ifTrue:[
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1184
        errMsg := 'Invalid character: ''' , ch asString , ''' ', '(' , (v radixPrintStringRadix:16) , ').'.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1185
    ] ifFalse:[
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1186
        errMsg := 'Invalid character: ' , (v radixPrintStringRadix:16) , '.'.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1187
    ].
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1188
    v > 16r7F ifTrue:[
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1189
        errMsg := errMsg , '\\Notice: only 7-bit ascii allowed (for compatibility).' withCRs.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1190
    ].
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1191
    self syntaxError:errMsg position:tokenPosition to:tokenPosition.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1192
    source next.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1193
    tokenName := token := nil.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1194
    tokenType := #Error.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1195
    ^ #Error
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1196
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1197
    "Modified: / 22-08-2006 / 14:26:21 / cg"
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1198
!
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1199
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1200
lastTokenLineNumber
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1201
    "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
  1202
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1203
    ^ tokenLineNr
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1204
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1205
    "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
  1206
    "Modified: 23.5.1997 / 12:16:12 / cg"
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1207
!
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1208
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1209
notifyError:aMessage position:position to:endPos
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1210
    "notify requestor of an error - if there is no requestor
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
  1211
     put it on the transcript. Requestor is typically the CodeView
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
  1212
     in which the accept/doIt was triggered, or the PositionableStream
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
  1213
     which does the fileIn. The requestor may decide how to highlight the
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
  1214
     error (and/or to abort the compile).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1215
     Return the result passed back by the requestor."
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1216
1339
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  1217
    |err|
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  1218
53
c5dd7abf8431 *** empty log message ***
claus
parents: 49
diff changeset
  1219
    ignoreErrors ifFalse:[
1648
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1220
        requestor notNil ifTrue:[
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1221
            requestor error:aMessage position:position to:endPos from:self.
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1222
            ^ self
1339
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  1223
        ].
1648
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1224
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1225
        Parser::ParseError isHandled ifTrue:[
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1226
            err := Parser::ParseError new.
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1227
            err errorMessage:aMessage startPosition:position endPosition:endPos.
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1228
            err parameter:self.
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1229
            err lineNumber:tokenLineNr "lineNr".
1648
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1230
            err raiseRequest.
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1231
            ^ self
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1232
        ].
0c1261bae0e6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1233
        self showErrorMessage:aMessage position:position.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1234
    ].
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1235
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1236
    "Modified: / 22-08-2006 / 14:10:16 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1237
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1238
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1239
notifyWarning:aMessage doNotShowAgainAction:doNotShowAgainAction position:position to:endPos
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1240
    "notify requestor of an warning - if there is no requestor, just ignore it.
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1241
     Return the result passed back from the requestor (or false, if there is none)."
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1242
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1243
    |answer|
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1244
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1245
    ignoreWarnings ifTrue:[ ^ false ].
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1246
    requestor isNil ifTrue:[
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1247
"/        self showErrorMessage:aMessage position:position.
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1248
        ^ false
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1249
    ].
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1250
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1251
    doNotShowAgainAction notNil ifTrue:[
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1252
        DoNotShowCompilerWarningAgainActionQuery 
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1253
            answer:doNotShowAgainAction
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1254
            do:[
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1255
                answer := requestor warning:aMessage position:position to:endPos from:self
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1256
            ]
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1257
    ] ifFalse:[
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1258
        answer := requestor warning:aMessage position:position to:endPos from:self
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1259
    ].
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1260
    ^ answer
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1261
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1262
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1263
notifyWarning:aMessage position:position to:endPos
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1264
    "notify requestor of an warning - if there is no requestor
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1265
     put it on the transcript.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1266
     Return the result passed back by the requestor."
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1267
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1268
    ^ self notifyWarning:aMessage doNotShowAgainAction:nil position:position to:endPos.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1269
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1270
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1271
parseError:aMessage
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1272
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1273
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1274
    ^ self parseError:aMessage position:tokenPosition to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1275
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1276
    "Created: / 13.5.1998 / 16:45:13 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1277
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1278
1900
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1279
parseError:aMessage line:lNr
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1280
    "report an error"
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1281
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1282
    |position|
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1283
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1284
    tokenLineNr := lNr.
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1285
    (requestor notNil and:[requestor isTextView]) ifTrue:[
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1286
        position := requestor characterPositionOfLine:lNr col:1.
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1287
        ^ self parseError:aMessage position:position to:nil
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1288
    ].
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1289
    ^ self parseError:aMessage position:nil to:nil
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1290
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1291
    "Created: / 13.5.1998 / 16:45:05 / cg"
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1292
!
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1293
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1294
parseError:aMessage position:position
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1295
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1296
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1297
    ^ self parseError:aMessage position:position to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1298
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1299
    "Created: / 13.5.1998 / 16:45:05 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1300
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1301
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1302
parseError:aMessage position:position to:endPos
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1303
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1304
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1305
    |m fullMessage|
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1306
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1307
    "/ fullMessage := (self errorMessagePrefix) , ' ' , (aMessage ? '???').
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1308
    fullMessage := (aMessage ? 'Unspecified error').
1563
207841f4402e errorFlag setting cleanup
Claus Gittinger <cg@exept.de>
parents: 1530
diff changeset
  1309
    self errorFlag:true.
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1310
    self notifyError:fullMessage position:position to:endPos.
1622
5a79277049ee code cleanup
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
  1311
    exitBlock value.
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1312
    ^ false
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1313
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1314
    "Created: / 13-05-1998 / 16:44:55 / cg"
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1315
    "Modified: / 22-08-2006 / 14:13:11 / cg"
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1316
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1317
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1318
showErrorMessage:aMessage position:pos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1319
    "show an errormessage on the Transcript"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1320
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1321
    ignoreErrors ifFalse:[
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1322
        Smalltalk silentLoading == true ifFalse:[
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1323
            Transcript showCR:(pos printString , ' [line: ' , tokenLineNr printString , '] ' , aMessage)
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1324
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1325
    ]
274
8e120bd82c69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
  1326
8e120bd82c69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
  1327
    "Modified: 18.5.1996 / 15:44:35 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1328
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1329
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1330
syntaxError:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1331
    "a syntax error happened - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1332
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1333
    ^ self syntaxError:aMessage position:tokenPosition
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1334
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1335
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1336
syntaxError:aMessage position:position
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1337
    "a syntax error happened - only start position is known"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1338
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1339
    ^ self syntaxError:aMessage position:position to:nil
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1340
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1341
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1342
syntaxError:aMessage position:position to:endPos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1343
    "a syntax error happened"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1344
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1345
    |fullMessage|
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1346
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1347
    "/ fullMessage := self errorMessagePrefix , ' ' , aMessage.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1348
    fullMessage := aMessage.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1349
    self notifyError:fullMessage position:position to:endPos.
1622
5a79277049ee code cleanup
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
  1350
    exitBlock value.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1351
    ^ false
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1352
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1353
    "Modified: / 22-08-2006 / 14:05:45 / cg"
87
claus
parents: 83
diff changeset
  1354
!
claus
parents: 83
diff changeset
  1355
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1356
warnCommonMistake:msg at:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1357
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1358
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1359
    self warnCommonMistake:msg position:position to:position
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1360
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1361
    "Modified: 23.5.1997 / 12:16:34 / cg"
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1362
!
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1363
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1364
warnCommonMistake:msg position:pos1 to:pos2
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1365
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1366
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1367
    ignoreWarnings ifFalse:[
1755
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1368
        parserFlags warnings ifTrue:[
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1369
            parserFlags warnCommonMistakes ifTrue:[
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1370
                self 
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1371
                    warning:msg
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1372
                    position:pos1 to:pos2.
1858c80ffdf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1722
diff changeset
  1373
            ]
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1374
        ]
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1375
    ]
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1376
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1377
    "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
  1378
    "Modified: 23.5.1997 / 12:16:39 / cg"
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1379
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1380
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1381
warnDollarAt:position
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1382
    "warn about $-character in an identifier"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1383
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1384
    ignoreWarnings ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1385
        didWarnAboutDollarInIdentifier ifFalse:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1386
            parserFlags warnDollarInIdentifier ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1387
                self 
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1388
                    warning:'$-characters in identifiers/symbols are nonportable' 
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1389
                    doNotShowAgainAction:[ ParserFlags warnDollarInIdentifier:false ]
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1390
                    position:position to:position.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1391
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1392
                 only warn once (per method)
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1393
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1394
                didWarnAboutDollarInIdentifier := true
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1395
            ]
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1396
        ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1397
    ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1398
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1399
    "Created: 7.9.1997 / 01:50:24 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1400
    "Modified: 7.9.1997 / 01:51:13 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1401
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1402
87
claus
parents: 83
diff changeset
  1403
warnOldStyleAssignmentAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1404
    "warn about an oldStyle assignment"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1405
87
claus
parents: 83
diff changeset
  1406
    ignoreWarnings ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1407
        didWarnAboutOldStyleAssignment ifFalse:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1408
            parserFlags warnOldStyleAssignment ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1409
                self 
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1410
                    warning:'Old style assignment - please change to use '':='''
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1411
                    doNotShowAgainAction:[ ParserFlags warnOldStyleAssignment:false ]
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1412
                    position:position to:position.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1413
                    
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1414
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1415
                 only warn once (per method)
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1416
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1417
                didWarnAboutOldStyleAssignment := true
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1418
            ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1419
        ]
87
claus
parents: 83
diff changeset
  1420
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1421
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1422
    "Modified: 23.5.1997 / 12:16:48 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1423
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1424
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1425
warnPossibleIncompatibility:msg position:pos1 to:pos2
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1426
    "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
  1427
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1428
    ignoreWarnings ifFalse:[
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1429
        parserFlags warnPossibleIncompatibilities ifTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1430
            self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1431
                warning:('Possible incompatibility.\\' , msg) withCRs
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1432
                doNotShowAgainAction:[ ParserFlags warnPossibleIncompatibilities:false ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1433
                position:pos1 to:pos2.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1434
        ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1435
    ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1436
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1437
    "Created: 23.5.1997 / 12:17:54 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1438
    "Modified: 23.5.1997 / 12:22:37 / cg"
87
claus
parents: 83
diff changeset
  1439
!
claus
parents: 83
diff changeset
  1440
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1441
warnSTXSpecialCommentAt:position to:endPosition
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1442
    ignoreWarnings ifFalse:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1443
        didWarnAboutSTXSpecialComment ifFalse:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1444
            parserFlags warnSTXSpecialComment ifTrue:[
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1445
                self warning:'End-of-line comments are a nonstandard feature of ST/X' 
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1446
                     doNotShowAgainAction:[ ParserFlags warnSTXSpecials:false ]
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1447
                     position:position to:endPosition.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1448
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1449
                 only warn once
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1450
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1451
                didWarnAboutSTXSpecialComment := true
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1452
            ]
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1453
        ]
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1454
    ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1455
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1456
87
claus
parents: 83
diff changeset
  1457
warnUnderscoreAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1458
    "warn about an underscore in an identifier"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1459
87
claus
parents: 83
diff changeset
  1460
    ignoreWarnings ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1461
        didWarnAboutUnderscoreInIdentifier ifFalse:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1462
            parserFlags warnUnderscoreInIdentifier ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1463
                self 
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1464
                    warning:'Underscores in identifiers/symbols are nonportable' 
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1465
                    doNotShowAgainAction:[ ParserFlags warnUnderscoreInIdentifier:false ]
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1466
                    position:position to:position.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1467
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1468
                 only warn once (per method)
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1469
                "
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1470
                didWarnAboutUnderscoreInIdentifier := true
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1471
            ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1472
        ]
87
claus
parents: 83
diff changeset
  1473
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1474
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1475
    "Modified: 23.5.1997 / 12:17:06 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1476
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1477
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1478
warning:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1479
    "a warning - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1480
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1481
    ^ self warning:aMessage position:tokenPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1482
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1483
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1484
warning:aMessage doNotShowAgainAction:doNotShowAgainAction position:position to:endPos
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1485
    "a warning"
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1486
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1487
    ^ self 
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1488
        notifyWarning:((self warningMessagePrefix) , ' ' , aMessage)
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1489
        doNotShowAgainAction:doNotShowAgainAction
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1490
        position:position to:endPos
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1491
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1492
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1493
warning:aMessage position:position
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1494
    "a warning - only start position is known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1495
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1496
    ^ self warning:aMessage position:position to:nil
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1497
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1498
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1499
warning:aMessage position:position to:endPos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1500
    "a warning"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1501
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1502
    ^ self 
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1503
        notifyWarning:((self warningMessagePrefix) , ' ' , aMessage) 
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1504
        doNotShowAgainAction:nil
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1505
        position:position to:endPos
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1506
!
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1507
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1508
warningMessagePrefix
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1509
    ^ 'Warning:'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1510
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1511
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1512
!Scanner methodsFor:'general scanning'!
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1513
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1514
scanDoing:aBlock
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1515
    "scan, evaluating aBlock for every scanned token."
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1516
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1517
    |t|
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1518
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1519
    [(t := self nextToken) ~~ #EOF] whileTrue:[
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1520
        aBlock value:t.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1521
    ].
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1522
!
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1523
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1524
scanNumberFrom:aStringOrStream
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1525
    "scan aSourceString for the next number in smalltalk syntax
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1526
     Return the number or nil."
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1527
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1528
    |oldPos|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1529
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1530
    self initializeFor:aStringOrStream.
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  1531
    oldPos := source position.
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1532
    self nextToken.
1349
ec1b7cc48572 allow any number in #scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 1347
diff changeset
  1533
    tokenValue isNumber ifTrue:[
996
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1534
        "/ must keep stream positioned correctly
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1535
        "/ (undo lookahead)
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1536
        peekChar notNil ifTrue:[
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1537
            peekChar2 notNil ifTrue:[
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1538
                source skip:-1
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1539
            ].
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1540
            source skip:-1
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1541
        ].
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1542
        ^ tokenValue
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1543
    ].
996
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1544
    "/ backup in case of error; return nil
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  1545
    source position:oldPos.
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1546
    ^ nil.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1547
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1548
    "Created: / 18.6.1998 / 23:05:22 / cg"
996
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  1549
    "Modified: / 19.11.1999 / 18:25:52 / cg"
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1550
!
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  1551
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1552
scanPositionsFor:aTokenString inString:aSourceString
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1553
    "scan aSourceString for occurrances of aTokenString.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1554
     Return a collection of start positions.
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1555
     Added for VW compatibility (to support simple syntax-highlight)."
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1556
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1557
    |searchType searchName searchValue positions t|
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1558
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1559
    aTokenString notNil ifTrue:[
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1560
        "
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1561
         first, look what kind of token we have to search for
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1562
        "
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1563
        self initializeFor:(ReadStream on:aTokenString).
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1564
        self nextToken.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1565
        searchType := tokenType.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1566
        searchName := tokenName.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1567
        searchValue := tokenValue.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1568
    ].
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1569
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1570
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1571
     start the real work ...
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1572
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1573
    self initializeFor:(ReadStream on:aSourceString).
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1574
    positions := OrderedCollection new.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1575
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1576
    [(t := self nextToken) ~~ #EOF] whileTrue:[
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1577
        searchType == t ifTrue:[
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1578
            (searchName isNil or:[tokenName = searchName]) ifTrue:[
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1579
                (searchValue isNil or:[tokenValue = searchValue]) ifTrue:[
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1580
                    positions add:tokenPosition.
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1581
                ]
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1582
            ]
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  1583
        ]
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1584
    ].
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1585
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1586
    ^ positions
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1587
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1588
    "
30
26e2f849916a keep tokenRadix; accept E in floats
claus
parents: 20
diff changeset
  1589
     Scanner new scanPositionsFor:'hello' inString:'foo bar hello baz hello' 
26e2f849916a keep tokenRadix; accept E in floats
claus
parents: 20
diff changeset
  1590
     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
  1591
     Scanner new scanPositionsFor:'16' inString:'foo 16 bar hello 16r10 baz hello 2r10000' 
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1592
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1593
! !
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  1594
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1595
!Scanner methodsFor:'initialization'!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1596
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1597
initialize
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1598
    "initialize the scanner"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1599
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1600
    errorFlag := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1601
    tokenPosition := 1.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  1602
    tokenLineNr := lineNr := 1.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1603
    currentComments := nil.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1604
    saveComments := false.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1605
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1606
    parserFlags := ParserFlags new.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1607
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1608
    ignoreErrors := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1609
    ignoreWarnings := Warnings not.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1610
    didWarnAboutSTXSpecialComment := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1611
    didWarnAboutUnderscoreInIdentifier := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1612
    didWarnAboutDollarInIdentifier := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1613
    didWarnAboutOldStyleAssignment := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1614
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1615
"/    warnSTXSpecialComment := WarnSTXSpecials.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1616
"/    warnSTXNameSpaceUse := WarnSTXSpecials.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1617
"/    warnUnderscoreInIdentifier := WarnUnderscoreInIdentifier.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1618
"/    warnDollarInIdentifier := WarnDollarInIdentifier.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1619
"/    warnOldStyleAssignment := WarnOldStyleAssignment.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1620
"/    warnCommonMistakes := WarnCommonMistakes.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1621
"/    warnPossibleIncompatibilities := WarnPossibleIncompatibilities.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1622
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1623
"/    allowUnderscoreInIdentifier := AllowUnderscoreInIdentifier.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1624
"/    allowDollarInIdentifier := AllowDollarInIdentifier.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1625
"/    allowOldStyleAssignment := AllowOldStyleAssignment.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1626
"/    allowSqueakExtensions := AllowSqueakExtensions.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1627
"/    allowLiteralNameSpaceSymbols := AllowLiteralNameSpaceSymbols.
900
2914b42fa972 comment
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
  1628
2914b42fa972 comment
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
  1629
    "/ not used here, but eases subclassing for other languages.
2914b42fa972 comment
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
  1630
    scanColonAsKeyword := true. 
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1631
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1632
    ActionArray isNil ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1633
        self class setupActions
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1634
    ].
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1635
    actionArray := ActionArray.
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1636
    typeArray := TypeArray.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1637
785
14d0ec37a754 added hook for subclasses which do not want to scan
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
  1638
    "Modified: / 17.10.1998 / 15:48:06 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1639
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1640
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1641
initializeFlagsFrom:aScanner
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1642
    "initialize flags from another scanner"
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1643
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1644
    ignoreErrors := aScanner ignoreErrors.
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1645
    ignoreWarnings := aScanner ignoreWarnings.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1646
    parserFlags := aScanner parserFlags copy.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1647
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1648
    "/ not used here, but eases subclassing for other languages.
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1649
    scanColonAsKeyword := aScanner scanColonAsKeyword. 
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1650
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1651
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1652
initializeFor:aStringOrStream
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1653
    "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
  1654
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1655
    self initialize.
847
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  1656
    self source:aStringOrStream.
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  1657
!
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  1658
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  1659
setSource:newSource
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  1660
    source := newSource
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  1661
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  1662
!
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  1663
847
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  1664
source:aStringOrStream
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  1665
    "prepare for reading from aStringOrStream"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1666
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1667
    errorFlag := false.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1668
    tokenPosition := 1.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1669
    tokenLineNr := lineNr := 1.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1670
    currentComments := nil.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1671
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1672
    aStringOrStream isStream ifFalse:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1673
        source := ReadStream on:aStringOrStream
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1674
    ] ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1675
        source := aStringOrStream.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1676
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1677
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  1678
    "Modified: / 26.5.1999 / 12:02:16 / stefan"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1679
! !
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1680
1237
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1681
!Scanner methodsFor:'parser interface'!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1682
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1683
errorFlag:flagArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1684
    errorFlag := flagArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1685
!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1686
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1687
token
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1688
    ^ token
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1689
!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1690
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1691
tokenLineNr:lineNumberArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1692
    tokenLineNr := lineNumberArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1693
!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1694
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1695
tokenPosition:positionArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1696
    tokenPosition := positionArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1697
! !
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  1698
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1699
!Scanner methodsFor:'private'!
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  1700
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1701
backupPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1702
    "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
  1703
     one token too many"
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
  1704
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1705
    (tokenType == #EOF) ifFalse:[
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1706
        source position1Based:tokenPosition
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1707
    ]
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1708
!
15
992c3d87edbf *** empty log message ***
claus
parents: 10
diff changeset
  1709
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1710
beginComment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1711
    ^ self
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1712
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1713
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1714
checkForKeyword:string
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1715
    "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
  1716
     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
  1717
     or 'thisContext'.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1718
     '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
  1719
     identifier, if declared locally."
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1720
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1721
    |firstChar|
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1722
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1723
    firstChar := string at:1.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1724
    (firstChar == $s) ifTrue:[
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1725
        (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
  1726
        (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
  1727
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1728
    (firstChar == $n) ifTrue:[
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1729
        (string = 'nil') ifTrue:[tokenType := #Nil. tokenValue := nil. ^true]
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1730
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1731
    (firstChar == $t) ifTrue:[
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1732
        (string = 'true') ifTrue:[tokenType := #True. tokenValue := true. ^true].
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1733
        (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
  1734
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1735
    (firstChar == $f) ifTrue:[
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1736
        (string = 'false') ifTrue:[tokenType := #False. tokenValue := false. ^true]
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1737
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1738
    ^ false
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1739
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1740
    "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
  1741
!
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1742
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1743
collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1744
    ^ collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1745
!
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1746
1236
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1747
eatPeekChar
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1748
    peekChar isNil ifTrue:[
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1749
        source next.
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1750
    ] ifFalse:[
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1751
        peekChar := nil.
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1752
    ].
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1753
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1754
    "Created: / 24.10.1998 / 17:25:39 / cg"
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1755
!
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  1756
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1757
endComment:comment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1758
    saveComments ifTrue:[
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1759
        currentComments isNil ifTrue:[
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1760
            currentComments := OrderedCollection with:comment
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1761
        ] ifFalse:[
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1762
            currentComments add:comment
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
  1763
        ]
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  1764
    ].
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  1765
!
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  1766
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1767
endComment:commentString type:commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1768
    |comment|
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1769
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1770
    saveComments ifTrue:[
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1771
        comment := Comment new commentString:commentString commentType:commentType.
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1772
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1773
        currentComments isNil ifTrue:[
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1774
            currentComments := OrderedCollection with:comment
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1775
        ] ifFalse:[
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1776
            currentComments add:comment
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1777
        ]
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
    "Created: / 17.2.1998 / 14:48:49 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1781
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  1782
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1783
escapeCharacterFor:aCharacter
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1784
    "only if AllowExtendedSTXSyntax is true 
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1785
     For now: do not use, since stc does not support it.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1786
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1787
     much like character escapes in C-literals;
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1788
     expands:
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1789
        \n      newLine
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1790
        \r      return
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1791
        \t      tab
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1792
        \b      backspace
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1793
        \f      formfeed
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1794
        \g      bell
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1795
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1796
        \\      backSlash
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1797
        \ ...\  (backslash-separator) ignored up to next backslash
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1798
        \xNN    hexCharacter
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1799
        \uNNNN  hex UnicodeCharacter
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1800
    "
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1801
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1802
    |ascii nextChar fetchNext|
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1803
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1804
    aCharacter == $n ifTrue:[^ Character nl].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1805
    aCharacter == $r ifTrue:[^ Character return].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1806
    aCharacter == $t ifTrue:[^ Character tab].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1807
    aCharacter == $b ifTrue:[^ Character backspace].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1808
    aCharacter == $f ifTrue:[^ Character ff].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1809
    aCharacter == $g ifTrue:[^ Character bell].
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1810
    aCharacter == $\ ifTrue:[^ aCharacter].
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1811
    aCharacter isSeparator ifTrue:[
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1812
        nextChar := source next.
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1813
        [nextChar notNil and:[nextChar ~~ $\]] whileTrue:[
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1814
            (nextChar == Character cr) ifTrue:[
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1815
                lineNr := lineNr + 1
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1816
            ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1817
            nextChar := source next.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1818
        ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1819
        ^ nil
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1820
    ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1821
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1822
    (aCharacter == $x or:[ aCharacter == $u ]) ifTrue:[
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1823
        fetchNext := 
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1824
            [
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1825
                nextChar := source next.
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1826
                (nextChar notNil and:[nextChar isDigitRadix:16]) ifFalse:[
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1827
                    self syntaxError:'hex digit expected in string literal'
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1828
                         position:(source position1Based-1) to:(source position1Based-1).
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1829
                ].
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1830
                nextChar digitValue
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1831
            ].
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1832
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1833
        ascii := fetchNext value.
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1834
        ascii := (ascii bitShift:4) bitOr:(fetchNext value).
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1835
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1836
        (aCharacter == $u ) ifTrue:[
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1837
            ascii := (ascii bitShift:4) bitOr:(fetchNext value).
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1838
            ascii := (ascii bitShift:4) bitOr:(fetchNext value).
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1839
        ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1840
        ^ Character value:ascii.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1841
    ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1842
    ^ aCharacter
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1843
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1844
    "
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1845
     ParserFlags allowExtendedSTXSyntax:true
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1846
    "
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1847
    "
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1848
     'hello\nworld' 
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1849
     'hello\x0Dworld'  
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1850
     'hello\x08world'   
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1851
     'hello\
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1852
    \world'   
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1853
    "                      
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1854
    "
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1855
     ParserFlags allowExtendedSTXSyntax:false
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1856
    "
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1857
!
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1858
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1859
ignoreErrors
1365
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1860
    "return the flag which controls notification of errors"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1861
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1862
    ^ ignoreErrors
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1863
!
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1864
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1865
ignoreErrors:aBoolean
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1866
    "enable/disable notification of errors"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1867
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1868
    ignoreErrors := aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1869
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1870
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1871
ignoreWarnings
1365
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1872
    "return the flag which controls notification of warnings"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1873
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1874
    ^ ignoreWarnings
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1875
!
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1876
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1877
ignoreWarnings:aBoolean
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1878
    "enable/disable notification of warnings"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1879
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  1880
    ignoreWarnings := aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1881
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1882
714
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1883
isCommentCharacter:ch
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1884
    "return true, if ch is the comment-start character.
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1885
     Brought into a separate method to allow for easier subclassing"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1886
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1887
    ^ ch == $"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1888
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1889
    "Created: / 14.5.1998 / 20:51:42 / cg"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1890
    "Modified: / 14.5.1998 / 20:53:01 / cg"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1891
!
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  1892
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1893
isSpecialOrExtendedSpecialCharacter:ch
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1894
    |charType|
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1895
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1896
    charType := typeArray at:(ch codePoint).
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1897
    ^ (charType == #special) 
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1898
       or:[ (charType == #extendedSpecial) and:[parserFlags allowExtendedBinarySelectors] ] 
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1899
!
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1900
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1901
notifying:anObject
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1902
    "set the requestor to be notified"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1903
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1904
    requestor := anObject
426
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1905
!
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1906
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1907
setNameSpace:aNameSpace
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1908
    "/ ignored here
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1909
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  1910
    "Created: 8.11.1996 / 13:33:10 / cg"
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1911
!
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1912
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1913
setPackage:aNameSpace
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1914
    "/ ignored here
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1915
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  1916
    "Created: 8.11.1996 / 13:33:10 / cg"
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  1917
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  1918
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  1919
setSyntax:aSyntax
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1920
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1921
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1922
!Scanner methodsFor:'reading next token'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1923
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1924
nextCharacter
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1925
    "a $ has been read - return a character token"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1926
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1927
    |nextChar t|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1928
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1929
    source next.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1930
    nextChar := source next.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1931
    nextChar notNil ifTrue:[
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1932
        t := nextChar.
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1933
        tokenType := #Character.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1934
    ] ifFalse:[
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1935
        t := nil.
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1936
        tokenType := #EOF
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1937
    ].
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  1938
    tokenValue := token := t.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1939
    ^ tokenType
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1940
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1941
    "Modified: / 13.5.1998 / 15:09:50 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1942
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1943
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1944
nextColonOrAssign
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1945
    "colon has been read - look for = to make it an assign"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1946
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1947
    |charType thirdChar|
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1948
120
claus
parents: 103
diff changeset
  1949
    "/ special kludge for identifier:= (without spaces inbetween)
claus
parents: 103
diff changeset
  1950
    "/ here we needed two characters lookahead after the identifier ...
claus
parents: 103
diff changeset
  1951
claus
parents: 103
diff changeset
  1952
    peekChar == $= ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1953
        source next.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1954
        peekChar := nil.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  1955
        tokenType := token := #':='.
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1956
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1957
        thirdChar := source peek.
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1958
        thirdChar notNil ifTrue:[
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1959
            (self isSpecialOrExtendedSpecialCharacter:thirdChar) ifTrue:[
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1960
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1961
            ]
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1962
        ].
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  1963
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1964
        ^ tokenType
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1965
    ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1966
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1967
    "/ special kludge for nameSpace:: (without spaces inbetween)
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1968
    "/ here we needed two characters lookahead after the identifier ...
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1969
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1970
    peekChar == $: ifTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1971
        source next.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1972
        peekChar := nil.
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  1973
        tokenType := token := #'::'.
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1974
        ^ tokenType
120
claus
parents: 103
diff changeset
  1975
    ].
claus
parents: 103
diff changeset
  1976
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1977
    (source nextPeek == $=) ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1978
        source next.
1004
708e1ca35c3b dont unify := and _ tokens (otherwise, highlighter would not know
Claus Gittinger <cg@exept.de>
parents: 1002
diff changeset
  1979
        tokenType := token := #':='
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1980
    ] ifFalse:[
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1981
        tokenType := token := $:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1982
    ].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1983
    ^ tokenType
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1984
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  1985
    "Modified: / 13.5.1998 / 15:10:04 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1986
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1987
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1988
nextExcla
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1989
    "a !! has been read - return either
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1990
        the !! binarySelector, 
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1991
        ExclaLeftParen     (for '!!('),
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1992
        ExclaLeftBrack     (for '!!['), 
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1993
        ExclaLeftBrace     (for '!!{')
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1994
    "
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1995
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1996
    |nextChar|
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1997
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  1998
    nextChar := source nextPeek.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1999
    parserFlags allowExtendedSTXSyntax == true ifTrue:[
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2000
        (nextChar == $( ) ifTrue:[
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2001
            source next.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2002
            token := '!!('.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2003
            tokenType := #ExclaLeftParen.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2004
            ^ tokenType
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2005
        ].
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2006
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2007
        (nextChar == $[ ) ifTrue:[
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2008
            source next.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2009
            token := '!!['.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2010
            tokenType := #ExclaLeftBrack.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2011
            ^ tokenType
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2012
        ].
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2013
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2014
        (nextChar == ${ ) ifTrue:[
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2015
            source next.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2016
            token := '!!{'.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2017
            tokenType := #ExclaLeftBrace.
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2018
            ^ tokenType
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2019
        ].
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2020
    ].
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2021
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2022
    "this allows excla to be used as binop -
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2023
     I dont know, if this is correct ..."
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2024
1307
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2025
"/    tokenName := token := '!!'.
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2026
"/    tokenType := #BinaryOperator.
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2027
"/    ^ tokenType
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2028
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2029
    ^ self nextSpecialWith:$!!.
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2030
!
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2031
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2032
nextExtendedSpecial:ch
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2033
    parserFlags allowExtendedBinarySelectors ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2034
        ^ self nextSpecial
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2035
    ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2036
    ^ self invalidCharacter:source peek.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2037
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2038
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2039
nextHash
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2040
    "a # has been read - return either
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2041
        a symbol, 
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2042
        HashLeftParen     (for '#('),
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2043
        HashLeftBrack     (for '#['), 
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2044
        HashLeftBrace     (for '#{'  and AllowQualifiedNames)
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2045
        HashHashLeftParen (for '##(' and AllowDolphinExtensions)
1292
380fa6f65268 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
  2046
        HashHashLeftBrack (for '##[' )
380fa6f65268 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
  2047
        HashHash          (for '##' )
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2048
    "
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2049
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2050
    |nextChar string allowUnderscoreInIdentifier|
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2051
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2052
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2053
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2054
    nextChar := source nextPeek.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2055
    nextChar notNil ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2056
        (nextChar == $( ) ifTrue:[
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2057
            source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2058
            token := '#('.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2059
            tokenType := #HashLeftParen.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2060
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2061
        ].
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2062
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2063
        (nextChar == $[ ) ifTrue:[
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2064
            "ST-80 & ST/X support Constant ByteArrays as #[...]"
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2065
            source next.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2066
            token := '#['.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2067
            tokenType := #HashLeftBrack.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2068
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2069
        ].
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2070
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2071
        (nextChar == ${ ) ifTrue:[
1290
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2072
            " #{ ... } is one of:
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2073
                #{ Foo.Bar.Baz }            VW3 and later qualified name
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2074
                #{ xx-xx-xx-xx-...-xx }     StAgents UUID
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2075
                #{ URL }                    url object qualifier
1074
5539425b66f2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1073
diff changeset
  2076
            "
1290
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2077
            source next.
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2078
            token := '#{'.
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2079
            tokenType := #HashLeftBrace.
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2080
            ^ tokenType
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2081
        ].
ec07b4b3740e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
  2082
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2083
        (nextChar == $' ) ifTrue:[
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2084
            "ST-80 and ST/X support arbitrary symbols as #'...'"
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2085
            self nextString:nextChar.
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2086
            self markSymbolFrom:tokenPosition to:(source position1Based-1).
1385
7cdbe857e075 handle missing closing quote in #'...'
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2087
            tokenType == #EOF ifFalse:[
1488
a6b8a7a14f40 error when a 2-byte symbol is encountered
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2088
                tokenValue bitsPerCharacter > 8 ifTrue:[
a6b8a7a14f40 error when a 2-byte symbol is encountered
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2089
                    self syntaxError:'symbols which require 2-byte characters are not (yet) allowed'
a6b8a7a14f40 error when a 2-byte symbol is encountered
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2090
                            position:tokenPosition to:(source position1Based - 1).
a6b8a7a14f40 error when a 2-byte symbol is encountered
Claus Gittinger <cg@exept.de>
parents: 1485
diff changeset
  2091
                ].
1385
7cdbe857e075 handle missing closing quote in #'...'
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2092
                tokenValue := token := tokenValue asSymbol.
7cdbe857e075 handle missing closing quote in #'...'
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2093
                tokenType := #Symbol.
7cdbe857e075 handle missing closing quote in #'...'
Claus Gittinger <cg@exept.de>
parents: 1371
diff changeset
  2094
            ].
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2095
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2096
        ].
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
  2097
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2098
        (nextChar == $#) ifTrue:[
1294
31c8cc483db9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  2099
            nextChar := source nextPeek.
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2100
            nextChar == $( ifTrue:[
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2101
                parserFlags allowDolphinExtensions == true ifTrue:[
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2102
                "dolphin does computed literals as ##( ... )"
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2103
                    source next.    
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2104
                    token := '##('.
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2105
                    tokenType := #HashHashLeftParen.
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2106
                    ^ tokenType
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2107
                ].
1293
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2108
            ].
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2109
1293
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2110
            nextChar == $[ ifTrue:[
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2111
                source next.    
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2112
                token := '##['.
1293
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2113
                tokenType := #HashHashLeftBrack.
1291
917f975e3e7e oops - HashLeftAngle was wrong.
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  2114
                ^ tokenType
917f975e3e7e oops - HashLeftAngle was wrong.
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
  2115
            ].
1294
31c8cc483db9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  2116
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2117
            parserFlags allowVisualAgeESSymbolLiterals == true ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2118
                (self nextSymbolAfterHash) notNil ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2119
                    tokenType := #ESSymbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2120
                    ^ #ESSymbol
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2121
                ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2122
                (nextChar == $') ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2123
                    source next.    
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2124
                    self nextString:nextChar.
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2125
                    tokenType := #ESSymbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2126
                    ^ #ESSymbol
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2127
                ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2128
            ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2129
1293
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2130
            token := '##'.
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2131
            tokenType := #HashHash.
c33753e28dbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1292
diff changeset
  2132
            ^ tokenType
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2133
        ].
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2134
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2135
        (self nextSymbolAfterHash) notNil ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2136
            ^ #Symbol
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2137
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2138
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2139
        (self isSpecialOrExtendedSpecialCharacter:nextChar) ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2140
            string := source next asString.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2141
            nextChar := source peek.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2142
            nextChar notNil ifTrue:[
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2143
                (self isSpecialOrExtendedSpecialCharacter:nextChar) ifTrue:[
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2144
                    source next.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2145
                    string := string copyWith:nextChar
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2146
                ]
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2147
            ].
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2148
            self markSymbolFrom:tokenPosition to:(source position1Based-1).
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2149
            tokenValue := token := string asSymbol.
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2150
            tokenType := #Symbol.
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2151
            ^ tokenType
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2152
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2153
    ].
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2154
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2155
    "this allows hash to be used as binop -
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2156
     I dont know, if this is correct ..."
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2157
    tokenName := token := '#'.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2158
    tokenType := #BinaryOperator.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2159
    ^ tokenType
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2160
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2161
    "Modified: / 01-08-2006 / 14:57:19 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2162
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2163
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2164
nextId
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2165
    "no longer used here - remains for backwardCompatibility for
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2166
     subclass users ... (sigh)"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2167
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2168
    |nextChar string oldString 
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2169
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2170
     max   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2171
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2172
    nextChar := source peekOrNil.
1470
62844fc53a87 String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  2173
    string := String uninitializedNew:20.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2174
    index := 0.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2175
    max := 10.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2176
    [true] whileTrue:[
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2177
        (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
  2178
            ^ string copyTo:index
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2179
        ].
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2180
        (index == max) ifTrue:[
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2181
            oldString := string.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2182
            string := String basicNew:(max * 2).
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2183
            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
  2184
            max := max * 2
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2185
        ].
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2186
        index := index + 1.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2187
        string at:index put:nextChar.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2188
        nextChar := source nextPeek
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2189
    ]
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2190
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2191
    "Modified: / 5.3.1998 / 02:53:57 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2192
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2193
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2194
nextIdentifier
1510
875c90576897 Fix duplicate assignment to ActionArray for sh
Stefan Vogel <sv@exept.de>
parents: 1509
diff changeset
  2195
    "an alpha character (or underscore if AllowUnderscore) has been read.
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2196
     Return the next identifier."
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2197
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2198
    |nextChar string ok pos ch2 allowUnderscoreInIdentifier|
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2199
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2200
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2201
87
claus
parents: 83
diff changeset
  2202
    hereChar == $_ ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2203
        "/
708
11837544357d made scanner tables instVars - for easier subclassability
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2204
        "/ no need to check for allowUnderscoreInIdentifier here;
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2205
        "/ could not arrive here if it was off
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2206
        "/
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2207
        nextChar := source nextPeek.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2208
        parserFlags allowOldStyleAssignment ifTrue:[
1429
5d46769a95ef ansified (isAlphaNumeric -> isLetterOrDigit)
Claus Gittinger <cg@exept.de>
parents: 1423
diff changeset
  2209
            (nextChar isLetterOrDigit or:[nextChar == $_]) ifFalse:[
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2210
                "oops: a single underscore is an old-style assignement"
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2211
                nextChar ~~ $: ifTrue:[
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2212
                    self warnOldStyleAssignmentAt:tokenPosition.
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2213
                    tokenType := token := $_.
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2214
                    ^ tokenType
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2215
                ]
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  2216
            ].
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2217
        ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2218
        string := '_'.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2219
        self warnUnderscoreAt:tokenPosition.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2220
        [nextChar == $_] whileTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2221
            string := string copyWith:$_.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2222
            nextChar := source nextPeek.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2223
        ].
1429
5d46769a95ef ansified (isAlphaNumeric -> isLetterOrDigit)
Claus Gittinger <cg@exept.de>
parents: 1423
diff changeset
  2224
        nextChar isLetterOrDigit ifTrue:[
467
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  2225
            string := string , source nextAlphaNumericWord.
feaacb47b0b5 allow degenerated keyword '_:'
Claus Gittinger <cg@exept.de>
parents: 462
diff changeset
  2226
        ]
87
claus
parents: 83
diff changeset
  2227
    ] ifFalse:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2228
        string := source nextAlphaNumericWord "self nextId".
87
claus
parents: 83
diff changeset
  2229
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2230
    nextChar := source peekOrNil.
87
claus
parents: 83
diff changeset
  2231
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2232
    (((nextChar == $_) and:[allowUnderscoreInIdentifier]) 
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2233
    or:[((nextChar == $$ ) and:[parserFlags allowDollarInIdentifier])
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2234
    or:[(nextChar notNil and:[nextChar isNationalLetter]) and:[parserFlags allowNationalCharactersInIdentifier]]]) ifTrue:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2235
        pos := source position1Based.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2236
        nextChar == $_ ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2237
            self warnUnderscoreAt:pos.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2238
        ] ifFalse:[
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2239
            nextChar == $$ ifTrue:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2240
                self warnDollarAt:pos.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2241
            ] ifFalse:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2242
                "/ self warnNationalCharacterAt:pos.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2243
            ]
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2244
        ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2245
        ok := true.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2246
        [ok] whileTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2247
            string := string copyWith:nextChar.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2248
            nextChar := source nextPeek.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2249
            nextChar isNil ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2250
                ok := false
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  2251
            ] ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2252
                (nextChar isLetterOrDigit) ifTrue:[
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2253
                    string := string , source nextAlphaNumericWord.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2254
                    nextChar := source peekOrNil.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2255
                ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2256
                ok := ((nextChar == $_) and:[allowUnderscoreInIdentifier]) 
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2257
                      or:[((nextChar == $$ ) and:[parserFlags allowDollarInIdentifier])
1707
28a94a1701c2 more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  2258
                      or:[(nextChar notNil and:[nextChar isNationalLetter]) and:[parserFlags allowNationalCharactersInIdentifier]]].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2259
            ]
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2260
        ].
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  2261
    ].
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  2262
785
14d0ec37a754 added hook for subclasses which do not want to scan
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
  2263
    (nextChar == $: and:[scanColonAsKeyword]) ifTrue:[
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2264
        source next.
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2265
        ch2 := source peekOrNil.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2266
        "/ colon follows - care for '::' (nameSpace separator) or ':=' (assignment)
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2267
        (ch2 == $=) ifFalse:[
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2268
            (ch2 == $:) ifFalse:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2269
                tokenName := token := string copyWith:nextChar.
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2270
                tokenType := #Keyword.
1202
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2271
                inArrayLiteral == true ifTrue:[
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2272
                    (ch2 isLetter 
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2273
                    or:[ch2 == $_ and:[allowUnderscoreInIdentifier]]) ifTrue:[
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2274
                        "/ kludge: recurse to read the rest.
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2275
                        self nextIdentifier.
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2276
                        tokenName := token := (string copyWith:nextChar) , token.   
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2277
                        tokenType ~~ #Keyword ifTrue:[
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2278
                            self syntaxError:'invalid keyword symbol in array constant'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2279
                                    position:tokenPosition to:(source position1Based - 1).
1202
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2280
                        ].
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2281
                        tokenType := #Keyword.
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2282
                    ].
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  2283
                ].
1104
0ffcaab55dbc oops - nextIdentifier must return a tokenType
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2284
                ^ tokenType
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2285
            ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2286
            peekChar := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2287
            peekChar2 := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2288
        ] ifTrue:[
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2289
            peekChar := $:.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2290
            peekChar2 := $=.
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2291
        ]
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2292
    ] ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2293
        (nextChar == $. and:[parserFlags allowQualifiedNames]) ifTrue:[
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2294
            "/ period follows - if next-after character is an identifier character,
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2295
            "/ make peekSym a #NameSpaceSeparator; otherwise a $.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2296
            source next.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2297
            ch2 := source peekOrNil.
1029
aeaed53633d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2298
            (ch2 notNil
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2299
            and:[ch2 isLetter or:[ch2 == $_ and:[allowUnderscoreInIdentifier]]]) ifTrue:[
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2300
                peekChar := #'::'.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2301
            ] ifFalse:[
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2302
                peekChar := $.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2303
            ].
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2304
        ].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2305
    ].
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2306
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2307
    nextChar == $- ifTrue:[
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2308
        pos := source position1Based.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2309
        self
1395
798231203863 warning message
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
  2310
            warnPossibleIncompatibility:'add spaces around ''-'' for compatibility with other systems'
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  2311
            position:pos to:pos.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2312
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2313
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2314
    tokenName := token := string.
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2315
    (self checkForKeyword:string) ifFalse:[
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2316
        tokenType := #Identifier.
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2317
    ].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2318
    ^ tokenType
120
claus
parents: 103
diff changeset
  2319
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2320
    "Created: / 13.9.1995 / 12:56:42 / claus"
802
5c6e7db91d5f bug fix if source ends with underline(-identifier)
Claus Gittinger <cg@exept.de>
parents: 795
diff changeset
  2321
    "Modified: / 2.2.1999 / 22:29:57 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2322
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2323
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2324
nextMantissa:radix
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2325
    "read the mantissa of a radix number"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2326
1351
107757ea7184 Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1349
diff changeset
  2327
    <resource: #obsolete>
107757ea7184 Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1349
diff changeset
  2328
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2329
    ^ (self nextMantissaAndScaledPartWithRadix:radix) first
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2330
!
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2331
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2332
nextMantissaAndScaledPartWithRadix:radix
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2333
    "read the mantissa of a radix number.
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2334
     Since we dont know yet if this is for a Float, LongFloat or a FixedPoint,
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2335
     return info which is useful for all: an array consisting of
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2336
     the mantissa as float/longFloat, the numerator and the scale for a fixedPoint."
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2337
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2338
    |nextChar value fixedPointNumerator fixedPointScale factor|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2339
1433
867b7e92f7c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2340
    value := 0.0.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2341
    fixedPointNumerator := 0.
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2342
    fixedPointScale := 0.
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2343
1431
5ba79dc4c93b avoid loosing precision when reading float literals
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  2344
    factor := 1.0 asLongFloat / radix.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2345
    nextChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2346
    [(nextChar notNil and:[nextChar isDigitRadix:radix])] whileTrue:[
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2347
        fixedPointNumerator := (fixedPointNumerator * 10) + nextChar digitValue.
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2348
        fixedPointScale := fixedPointScale + 1.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2349
        value := value + (nextChar digitValue * factor).
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2350
        factor := factor / radix.
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2351
        nextChar := source nextPeek
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2352
    ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2353
    ^ (Array with:value with:fixedPointNumerator with:fixedPointScale)
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2354
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2355
    "Modified: / 5.3.1998 / 02:54:11 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2356
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2357
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2358
nextNumber
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2359
    "scan a number; handles radix prefix, mantissa and exponent.
1673
3f64c0d10a4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2360
     Allows for e, d or q to be used as exponent limiter."
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2361
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2362
    |pos1 nextChar value integerPart sign 
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2363
     expSign tokenRadix mantissaAndScaledPart d type exp scale|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2364
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2365
    tokenRadix := 10.
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2366
    sign := 1.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2367
    type := #Integer.
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2368
    pos1 := source position1Based.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2369
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2370
    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
  2371
    nextChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2372
    (nextChar == $r) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2373
        tokenRadix := value.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2374
        source next.
820
5db3668f751d syntax error if radix is not in 2..36
Claus Gittinger <cg@exept.de>
parents: 802
diff changeset
  2375
5db3668f751d syntax error if radix is not in 2..36
Claus Gittinger <cg@exept.de>
parents: 802
diff changeset
  2376
        (tokenRadix between:2 and:36) ifFalse:[
5db3668f751d syntax error if radix is not in 2..36
Claus Gittinger <cg@exept.de>
parents: 802
diff changeset
  2377
            self syntaxError:'bad radix (must be 2 .. 36)'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2378
                    position:tokenPosition to:(source position1Based - 1).
820
5db3668f751d syntax error if radix is not in 2..36
Claus Gittinger <cg@exept.de>
parents: 802
diff changeset
  2379
        ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2380
        source peekOrNil == $- ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2381
            source next.
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2382
            sign := -1
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2383
        ].
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2384
        value := Integer readFrom:source radix:tokenRadix.
982
f0cc45f113b3 exponent after [eE] is always taken base 10.
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  2385
        nextChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2386
    ].
821
bc543afcc1e6 give a warning if radix>14 and an e/E is encountered in a float
Claus Gittinger <cg@exept.de>
parents: 820
diff changeset
  2387
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2388
    (nextChar == $.) ifTrue:[
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2389
        nextChar := source nextPeek.
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2390
        (nextChar notNil and:[nextChar isDigitRadix:tokenRadix]) ifTrue:[
821
bc543afcc1e6 give a warning if radix>14 and an e/E is encountered in a float
Claus Gittinger <cg@exept.de>
parents: 820
diff changeset
  2391
            (tokenRadix > 14 and:[nextChar == $e or:[nextChar == $E]]) ifTrue:[
bc543afcc1e6 give a warning if radix>14 and an e/E is encountered in a float
Claus Gittinger <cg@exept.de>
parents: 820
diff changeset
  2392
                self warning:'float with radix > 14 - (e/E are valid digits; not exponent-leaders)'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2393
                    position:tokenPosition to:(source position1Based - 1).
821
bc543afcc1e6 give a warning if radix>14 and an e/E is encountered in a float
Claus Gittinger <cg@exept.de>
parents: 820
diff changeset
  2394
            ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2395
            mantissaAndScaledPart := self nextMantissaAndScaledPartWithRadix:tokenRadix.
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2396
            integerPart := value.
1433
867b7e92f7c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
  2397
            value := integerPart + (mantissaAndScaledPart first).  "could be a longFloat now"
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2398
            type := #Float.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2399
            nextChar := source peekOrNil
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2400
        ] ifFalse:[
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2401
            ('eEdDqQ' includes:nextChar) ifTrue:[
1339
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2402
                "/ allow 5.e-3 - is this standard ?
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2403
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2404
            ] ifFalse:[
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2405
"/                nextChar == (Character cr) ifTrue:[
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2406
"/                    lineNr := lineNr + 1.
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2407
"/                ].
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2408
                nextChar := peekChar := $..
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  2409
            ]
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2410
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2411
    ].
821
bc543afcc1e6 give a warning if radix>14 and an e/E is encountered in a float
Claus Gittinger <cg@exept.de>
parents: 820
diff changeset
  2412
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2413
    ('eEdDqQ' includes:nextChar) ifTrue:[
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2414
        (nextChar == $q or:[nextChar == $Q]) ifTrue:[
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2415
            value := value asLongFloat
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2416
        ] ifFalse:[
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2417
            value := value asFloat.
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2418
        ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2419
        type := #Float.
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2420
        nextChar := source nextPeek.
982
f0cc45f113b3 exponent after [eE] is always taken base 10.
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  2421
        (nextChar notNil and:[(nextChar isDigit"Radix:tokenRadix") or:['+-' includes:nextChar]]) ifTrue:[
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2422
            expSign := 1.
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2423
            (nextChar == $+) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2424
                nextChar := source nextPeek
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2425
            ] ifFalse:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2426
                (nextChar == $-) ifTrue:[
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2427
                    nextChar := source nextPeek.
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2428
                    expSign := -1
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2429
                ]
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2430
            ].
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2431
            exp := (Integer readFrom:source) * expSign.
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2432
            value := value * ((value class unity * tokenRadix) raisedToInteger:exp).
983
Claus Gittinger <cg@exept.de>
parents: 982
diff changeset
  2433
            nextChar := source peek.
982
f0cc45f113b3 exponent after [eE] is always taken base 10.
Claus Gittinger <cg@exept.de>
parents: 947
diff changeset
  2434
        ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2435
    ] ifFalse:[
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2436
        value isLimitedPrecisionReal ifTrue:[
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2437
            "/ no type specified - makes it a float
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2438
            value := value asFloat.
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2439
        ].
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2440
1673
3f64c0d10a4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2441
        parserFlags allowFixedPointLiterals == true ifTrue:[
1676
b8122adeb8a6 comment
Claus Gittinger <cg@exept.de>
parents: 1673
diff changeset
  2442
            "/ ScaledDecimal numbers
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2443
            ('s' includes:nextChar) ifTrue:[
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2444
                nextChar := source nextPeek.
1678
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2445
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2446
                (nextChar notNil and:[(nextChar isDigit)]) ifTrue:[
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2447
                    scale := (Integer readFrom:source).
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2448
                ].
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2449
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2450
                mantissaAndScaledPart isNil ifTrue:[
1678
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2451
                    value := value asFixedPoint:(scale ? 0) 
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2452
                ] ifFalse:[
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2453
                    d := 10 raisedTo:(mantissaAndScaledPart last).
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2454
                    value := FixedPoint 
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2455
                        numerator:((integerPart * d) + mantissaAndScaledPart second)
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2456
                        denominator:d 
1678
edd3a6b568c7 fixedPoint reading
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  2457
                        scale:(scale ? mantissaAndScaledPart last).
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2458
                ].
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2459
                type := #FixedPoint.
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2460
                self
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2461
                    warnPossibleIncompatibility:'fixedPoint literal might be incompatibile with other systems'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2462
                    position:pos1 to:source position1Based.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2463
            ].
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2464
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2465
    ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2466
    
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2467
    nextChar == $- ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2468
        self
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2469
            warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other systems'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2470
            position:(source position1Based) to:(source position1Based).
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2471
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2472
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2473
    tokenValue := token := value * sign.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2474
    tokenType := type.
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  2475
    (tokenValue isLimitedPrecisionReal) ~~ (tokenType == #Float) ifTrue:[
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  2476
        self halt:'unfinished feature'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  2477
    ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  2478
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  2479
"/    self markConstantFrom:tokenPosition to:(source position - 1).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2480
    ^ tokenType
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2481
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  2482
    "Modified: / 1.4.1998 / 13:06:28 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2483
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2484
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2485
nextPrimitive
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2486
    "scan an inline C-primitive."
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2487
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2488
    |nextChar inPrimitive string 
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2489
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2490
     len   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2491
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2492
    nextChar := source nextPeek.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2493
    (nextChar == ${) ifFalse:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2494
        ^ self nextSpecialWith:$%
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2495
    ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2496
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2497
    string := String new:500.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2498
    len := 500.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2499
    index := 1.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2500
    nextChar := source nextPeek.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2501
    inPrimitive := true.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2502
    [inPrimitive] whileTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2503
        [nextChar == $%] whileFalse:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2504
            nextChar isNil ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2505
                self syntaxError:'unterminated primitive'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2506
                        position:tokenPosition to:source position1Based.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2507
                ^ #Error
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2508
            ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2509
            string at:index put:nextChar.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2510
            (index == len) ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2511
                string := string , (String new:len).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2512
                len := len * 2
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  2513
            ].
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2514
            index := index + 1.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2515
            nextChar := source next
505
793f88ee6269 handle end of input while scanning a primitive
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  2516
        ].
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2517
        (source peekOrNil == $}) ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2518
            inPrimitive := false
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2519
        ] ifFalse:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2520
            string at:index put:nextChar.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2521
            (index == len) ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2522
                string := string , (String new:len).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2523
                len := len * 2
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2524
            ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2525
            index := index + 1.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2526
            nextChar := source next
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2527
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2528
    ].
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2529
    source next.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2530
    tokenValue := token := string copyTo:(index - 1).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2531
    tokenType := #Primitive.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2532
    lineNr := lineNr + (tokenValue occurrencesOf:(Character cr)).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2533
    ^ tokenType
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2534
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2535
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2536
nextSpecial
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2537
    "a special character has been read, look for another one.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2538
     also -number is handled here"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2539
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2540
    |firstChar|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2541
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2542
    firstChar := source next.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2543
    ^ self nextSpecialWith:firstChar
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2544
!
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2545
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2546
nextSpecialWith:firstChar
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2547
    "a special character has been read, look for another one.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2548
     also -number is handled here"
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2549
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2550
    |secondChar thirdChar fourthChar string p charType|
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2551
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2552
    secondChar := source peekOrNil.
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
  2553
    ((firstChar == $-) and:[secondChar notNil]) ifTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2554
        secondChar isDigit ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2555
            self nextNumber.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2556
            tokenValue := token := tokenValue negated.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2557
            ^ tokenType
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2558
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2559
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2560
    string := firstChar asString.
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2561
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2562
    secondChar == $# ifTrue:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2563
        parserFlags allowHashAsBinarySelector ifFalse:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2564
            tokenName := token := string.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2565
            tokenType := #BinaryOperator.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2566
            ^ tokenType
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2567
        ].
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2568
    ].
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2569
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2570
    secondChar notNil ifTrue:[
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2571
        (self isSpecialOrExtendedSpecialCharacter:secondChar) ifTrue:[
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2572
            (secondChar == $-) ifTrue:[
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2573
                "special- look if minus belongs to number following"
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2574
                p := source position1Based.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2575
                source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2576
                thirdChar := source peekOrNil.
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2577
                source position1Based:p.
1356
e2877130760c oops care for nil peek-character
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  2578
                (thirdChar notNil and:[thirdChar isDigit]) ifTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2579
                    tokenName := token := string.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2580
                    tokenType := #BinaryOperator.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2581
                    self 
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2582
                        warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other ST systems' 
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2583
                        position:p 
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2584
                        to:p.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2585
                    ^ tokenType
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2586
                ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2587
            ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2588
            source next.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2589
            string := string copyWith:secondChar.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2590
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2591
            thirdChar := source peekOrNil.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2592
            thirdChar notNil ifTrue:[
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2593
                (self isSpecialOrExtendedSpecialCharacter:thirdChar) ifTrue:[
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2594
                    (thirdChar == $-) ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2595
                        "special- look if minus belongs to number following"
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2596
                        p := source position1Based.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2597
                        source next.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2598
                        fourthChar := source peekOrNil.
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2599
                        source position1Based:p.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2600
                        fourthChar isDigit ifTrue:[
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2601
                            tokenName := token := string.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2602
                            tokenType := #BinaryOperator.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2603
                            self 
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2604
                                warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other ST systems' 
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2605
                                position:p 
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2606
                                to:p.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2607
                            ^ tokenType
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2608
                        ]
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2609
                    ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2610
                    source next.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2611
                    string := string copyWith:thirdChar.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2612
                ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  2613
            ].
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2614
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2615
    ].
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2616
    tokenName := token := string.
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
  2617
    tokenType := #BinaryOperator.
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  2618
    ^ tokenType
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
  2619
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2620
    "Modified: / 5.3.1998 / 02:54:54 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2621
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2622
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2623
nextString:delimiter
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2624
    "a single quote has been scanned; scan the string (caring for doubled quotes"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2625
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2626
    |nextChar string pos
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2627
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2628
     len   "{ Class: SmallInteger }"
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2629
     inString peekChar|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2630
1470
62844fc53a87 String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  2631
    string := String uninitializedNew:20.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2632
    len := 20.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2633
    index := 1.
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2634
    pos := source position1Based.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2635
    source next.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2636
    nextChar := source next.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2637
    inString := true.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2638
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2639
    [inString] whileTrue:[
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2640
        nextChar isNil ifTrue:[
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2641
            self syntaxError:'unexpected end-of-input in String'
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2642
                    position:pos to:(source position1Based - 1).
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2643
            self markStringFrom:pos to:source position1Based-1.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2644
            token := nil.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2645
            tokenType := #EOF.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2646
            ^ tokenType
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2647
        ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2648
        (nextChar == Character cr) ifTrue:[
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  2649
            lineNr := lineNr + 1
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2650
        ] ifFalse:[
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2651
            (nextChar == delimiter) ifTrue:[
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2652
                (source peekOrNil == delimiter) ifTrue:[
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2653
                    source next
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2654
                ] ifFalse:[
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2655
                    inString := false
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2656
                ]
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2657
            ] ifFalse:[
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2658
                parserFlags allowExtendedSTXSyntax == true ifTrue:[
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2659
                    (nextChar == $\) ifTrue:[
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2660
                        peekChar := source peekOrNil.    
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2661
                        peekChar notNil ifTrue:[
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2662
                            source next.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2663
                            nextChar := self escapeCharacterFor:peekChar.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2664
                        ]
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2665
                    ]
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2666
                ]
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2667
            ].
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2668
        ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2669
        inString ifTrue:[
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2670
            nextChar notNil ifTrue:[
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
  2671
                nextChar codePoint > 255 ifTrue:[
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
  2672
                    string bitsPerCharacter < nextChar bitsPerCharacter ifTrue:[
1485
f80c22a4f05b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2673
                        string := string asUnicodeString.
f80c22a4f05b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2674
                    ].
f80c22a4f05b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2675
                ].
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2676
                string at:index put:nextChar.
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2677
                (index == len) ifTrue:[
1485
f80c22a4f05b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2678
                    string := string , (string species new:len).
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2679
                    len := len * 2
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2680
                ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2681
                index := index + 1.
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2682
            ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2683
            nextChar := source next
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2684
        ]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2685
    ].
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  2686
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2687
    tokenValue := token := string copyTo:(index - 1).
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2688
    tokenType := #String.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2689
    ^ tokenType
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2690
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2691
    "Created: / 01-08-2006 / 14:56:07 / cg"
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  2692
    "Modified: / 22-08-2006 / 14:10:26 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2693
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2694
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2695
nextSymbolAfterHash
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2696
    "helper: a # has been read - return #Symbol token or nil"
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2697
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2698
    |nextChar string part isNameSpaceSymbol allowUnderscoreInIdentifier|
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2699
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2700
    nextChar := source peek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2701
    nextChar isNil ifTrue:[^ nil].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2702
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2703
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2704
    isNameSpaceSymbol := false.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2705
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2706
    (nextChar isLetter
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2707
    or:[(nextChar == $_) and:[allowUnderscoreInIdentifier]]) ifFalse:[^ nil].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2708
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2709
    string := ''.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2710
    [nextChar notNil 
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2711
     and:[nextChar isLetterOrDigit 
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2712
          or:[nextChar == $_ and:[allowUnderscoreInIdentifier]]
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2713
         ]
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2714
    ] whileTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2715
        nextChar == $_ ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2716
            part := nil.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2717
        ] ifFalse:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2718
            part := source nextAlphaNumericWord.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2719
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2720
        part notNil ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2721
            string := string , part.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2722
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2723
        nextChar := source peek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2724
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2725
        allowUnderscoreInIdentifier == true ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2726
            nextChar == $_ ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2727
                self warnUnderscoreAt:source position1Based.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2728
            ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2729
            [nextChar == $_] whileTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2730
                string := string copyWith:nextChar.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2731
                nextChar := source nextPeek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2732
                (nextChar notNil and:[nextChar isLetterOrDigit]) ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2733
                    string := string , source nextAlphaNumericWord.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2734
                    nextChar := source peek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2735
                ]
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2736
            ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2737
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2738
        (nextChar == $:) ifFalse:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2739
            self markSymbolFrom:tokenPosition to:(source position1Based-1).
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2740
            tokenValue := token := string asSymbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2741
            tokenType := #Symbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2742
            ^ tokenType
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2743
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2744
        string := string copyWith:nextChar.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2745
        nextChar := source nextPeek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2746
        parserFlags allowLiteralNameSpaceSymbols ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2747
            (nextChar == $:) ifTrue:[
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2748
                string := string copyWith:nextChar.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2749
                nextChar := source nextPeek.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2750
                isNameSpaceSymbol := true.      
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2751
            ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2752
        ].
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2753
    ].                   
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2754
    tokenValue := token := string asSymbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2755
    tokenType := #Symbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2756
    ^ tokenType
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2757
!
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2758
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2759
nextToken
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2760
    "return the next token from the source-stream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2761
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2762
    |skipping actionBlock v ch tok|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2763
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2764
    [true] whileTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2765
        peekChar notNil ifTrue:[
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2766
            "/ kludge - should be called peekSym.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2767
            "/ used when xlating Foo.Bar into Foo::Bar
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2768
            peekChar isSymbol ifTrue:[
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2769
                token := nil.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2770
                tokenType := peekChar.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2771
                peekChar := nil.
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2772
                ^ tokenType
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2773
            ].
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2774
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2775
            peekChar isSeparator ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2776
                peekChar == (Character cr) ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2777
                    lineNr := lineNr + 1.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2778
                ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2779
                peekChar := peekChar2.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2780
                peekChar2 := nil.
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
  2781
            ].
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2782
        ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2783
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2784
        peekChar notNil ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2785
            ch := peekChar.
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
  2786
            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
  2787
            peekChar2 := nil.
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2788
            hereChar := nil.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2789
        ] ifFalse:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2790
            skipping := true.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2791
            [skipping] whileTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2792
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2793
                outStream notNil ifTrue:[
1497
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
  2794
                    [
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
  2795
                      hereChar := source peekOrNil.  
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
  2796
                     (hereChar == Character space)
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2797
                     or:[hereChar isSeparator]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2798
                    ] whileTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2799
                        source next.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2800
                        outStream space. 
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2801
                        outCol := outCol + 1.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2802
                    ]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2803
                ] ifFalse:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2804
                    hereChar := source skipSeparatorsExceptCR.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2805
                ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2806
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2807
                hereChar == (Character cr) ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2808
                    lineNr := lineNr + 1.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2809
                    source next.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2810
                    outStream notNil ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2811
                        outStream cr.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2812
                        outCol := 1
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2813
                    ]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2814
                ] ifFalse:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2815
                    hereChar == (Character return) ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2816
                        outStream notNil ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2817
                            outStream nextPut:hereChar.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2818
                            outCol := 1
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2819
                        ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2820
                        source next.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2821
                    ] ifFalse:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2822
                        (self isCommentCharacter:hereChar) ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2823
                            "start of a comment"
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2824
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2825
                            self skipComment.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2826
                            hereChar := source peekOrNil.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2827
                        ] ifFalse:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2828
                            skipping := false
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2829
                        ]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2830
                    ]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2831
                ]
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2832
            ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2833
            hereChar isNil ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2834
                token := nil.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2835
                tokenType := #EOF.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2836
                ^ tokenType
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2837
            ].
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2838
            ch := hereChar
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
  2839
        ].
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2840
        tokenPosition := source position1Based.
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2841
        tokenLineNr := lineNr.
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2842
1489
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
  2843
        (v := ch codePoint) == 0 ifTrue:[
b844ef2acd37 Use #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents: 1488
diff changeset
  2844
            v := Character space codePoint
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2845
        ].
1483
9b05e74599e6 care for non-iso characters
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  2846
        v <= 16rFF ifTrue:[
9b05e74599e6 care for non-iso characters
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  2847
            actionBlock := actionArray at:v.
9b05e74599e6 care for non-iso characters
Claus Gittinger <cg@exept.de>
parents: 1470
diff changeset
  2848
        ].
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2849
        actionBlock notNil ifTrue:[
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2850
            tok := actionBlock value:self value:ch.
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2851
            tok notNil ifTrue:[
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2852
                ^ tok
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  2853
            ].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2854
            "/ a nil token means: continue reading
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2855
        ] ifFalse:[
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2856
            (ch isNationalLetter and:[parserFlags allowNationalCharactersInIdentifier]) ifTrue:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2857
                tok := self nextIdentifier.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2858
                tok notNil ifTrue:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2859
                    ^ tok
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2860
                ].
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2861
            ] ifFalse:[
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2862
                ^ self invalidCharacter:ch.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2863
            ]
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2864
        ]
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
  2865
    ].
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
  2866
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2867
    "Modified: / 13.9.1995 / 12:56:14 / claus"
793
3ee3ebe0145e allow for action to skip something and continue in nextToken
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
  2868
    "Modified: / 22.10.1998 / 22:15:27 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2869
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2870
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2871
nextToken:aCharacter
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2872
    "return a character token"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2873
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2874
    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
  2875
    hereChar notNil ifTrue:[source next].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2876
    ^ 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
  2877
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2878
    "Modified: / 13.5.1998 / 15:10:23 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2879
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2880
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2881
nextUnderline
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2882
    "return a character token"
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2883
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2884
    parserFlags allowUnderscoreInIdentifier ifTrue:[
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2885
        ^ self nextIdentifier
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2886
    ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2887
    ^ self nextToken:$_
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2888
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2889
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  2890
skipComment
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2891
    "skip over a comment; handles ST/X eol comments."
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2892
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2893
    |commentStream commentType commentText startPos endPos stillInComment anyNonBlank|
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2894
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2895
    anyNonBlank := false.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2896
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2897
    saveComments ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2898
        commentStream := WriteStream on:''.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2899
        self beginComment.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2900
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2901
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2902
    outStream notNil ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2903
        outStream nextPut:Character doubleQuote.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2904
        outCol := outCol + 1
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2905
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2906
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2907
    startPos := source position1Based.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2908
    source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2909
    hereChar := source peekOrNil.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2910
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2911
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2912
     special ST/X addition:
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2913
     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
  2914
     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
  2915
     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
  2916
     (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
  2917
      change it without notice)"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2918
1707
28a94a1701c2 more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  2919
    (hereChar == $/ and:[parserFlags allowSTXEOLComments]) ifTrue:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2920
        commentType := #eolComment.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2921
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2922
        hereChar := source nextPeek.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2923
        [hereChar notNil and:[hereChar ~~ Character cr]] whileTrue:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2924
            commentStream notNil ifTrue:[
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2925
                commentStream nextPut:hereChar
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2926
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2927
            outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2928
                outStream nextPut:hereChar.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2929
                outCol := outCol + 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2930
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2931
            hereChar := source nextPeek.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2932
        ].
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2933
        endPos := source position1Based.
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2934
        self markCommentFrom:startPos to:endPos.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  2935
        lineNr := lineNr + 1.
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2936
        self warnSTXSpecialCommentAt:startPos to:endPos.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2937
        outStream notNil ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2938
            outStream cr.
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2939
            outCol := 1
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2940
        ].
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2941
        "skip cr"
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2942
        source next.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2943
    ] ifFalse:[
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2944
        commentType := #regularComment.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2945
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2946
        hereChar == ${ ifTrue:[
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2947
            "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2948
             special ST/X addition:
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2949
             a ${ right after the initial double quote starts a directive
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2950
            "
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2951
            self parseDirective
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2952
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2953
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2954
        stillInComment := true.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2955
        [stillInComment] whileTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2956
            stillInComment := false.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2957
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2958
            [hereChar notNil and:[hereChar ~~ (Character doubleQuote)]] whileTrue:[
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2959
                hereChar isSeparator ifFalse:[
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2960
                    anyNonBlank := true.
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2961
                ].
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2962
                hereChar == (Character cr) ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2963
                    lineNr := lineNr + 1.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2964
                ].
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2965
                commentStream notNil ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2966
                    commentStream nextPut:hereChar
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2967
                ].
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2968
                outStream notNil ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2969
                    outStream nextPut:hereChar.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2970
                    outCol := outCol + 1
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2971
                ].
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2972
                hereChar := source nextPeek
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2973
            ].
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2974
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2975
            hereChar isNil ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2976
                self markCommentFrom:startPos to:(source size).
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2977
                self warning:'unclosed comment' position:startPos to:(source position1Based)
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2978
            ] ifFalse:[
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2979
                self markCommentFrom:startPos to:(source position1Based).
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2980
                outStream notNil ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2981
                    outStream nextPut:(Character doubleQuote).
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2982
                    outCol := outCol + 1
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2983
                ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2984
            ].
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2985
            endPos := source position1Based.
1355
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2986
            "skip final dQuote"
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2987
            source next.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2988
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2989
            (source peek == Character doubleQuote) ifTrue:[
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2990
                stillInComment := true.
39aba48520ed scan comments which include "" as a single big comment
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
  2991
                hereChar := source nextPeek.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2992
            ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  2993
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2994
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2995
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2996
    saveComments ifTrue:[
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2997
        commentText := commentStream contents.
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2998
        self endComment:commentText type:commentType.
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2999
    ].
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3000
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3001
    parserFlags warnAboutBadComments ifTrue:[
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3002
        anyNonBlank ifFalse:[
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3003
            commentType ~~ #eolComment ifTrue:[
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3004
                self warning:'empty comment' position:startPos to:endPos
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3005
            ].
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3006
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3007
    ].
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  3008
666
bf2af3d84787 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
  3009
    "Modified: / 31.3.1998 / 23:45:26 / cg"
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3010
! !
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3011
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3012
!Scanner::Comment methodsFor:'accessing'!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3013
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3014
commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3015
    "return the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3016
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3017
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3018
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3019
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3020
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3021
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3022
commentString:something
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3023
    "set the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3024
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3025
    commentString := something.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3026
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3027
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3028
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3029
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3030
commentString:commentStringArg commentType:commentTypeArg
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3031
    commentString := commentStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3032
    commentType := commentTypeArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3033
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3034
    "Created: / 17.2.1998 / 14:44:33 / cg"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3035
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3036
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3037
commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3038
    ^ commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3039
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3040
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3041
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3042
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3043
commentType:something
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3044
    commentType := something.
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3045
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3046
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3047
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3048
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3049
string
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3050
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3051
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3052
    "Created: / 17.2.1998 / 14:49:52 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3053
! !
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3054
1580
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3055
!Scanner::Comment methodsFor:'converting'!
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3056
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3057
asString
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3058
    ^ commentString.
1583
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3059
!
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3060
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3061
asStringCollection
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3062
    ^ commentString asStringCollection.
1580
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3063
! !
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  3064
1651
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3065
!Scanner::Comment methodsFor:'queries'!
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3066
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3067
isEndOfLineComment
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3068
    ^ commentType == #eolComment
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3069
! !
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  3070
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3071
!Scanner::Directive class methodsFor:'instance creation'!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3072
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3073
newClassDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3074
    ^ ClassDirective new
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3075
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3076
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3077
newClassHintDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3078
    ^ ClassHintDirective new
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3079
! !
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3080
1598
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3081
!Scanner::Directive methodsFor:'queries'!
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3082
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3083
isClassHintDirective
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3084
    ^ false
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3085
! !
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3086
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3087
!Scanner::Directive::ClassDirective methodsFor:'accessing'!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3088
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3089
className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3090
    ^ className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3091
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3092
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3093
className:something
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3094
    className := something.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3095
! !
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3096
1598
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3097
!Scanner::Directive::ClassHintDirective methodsFor:'queries'!
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3098
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3099
isClassHintDirective
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3100
    ^ true
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3101
! !
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  3102
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3103
!Scanner::DoNotShowCompilerWarningAgainActionQuery class methodsFor:'queries'!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3104
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3105
actionQuery
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3106
    ^ self query
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3107
! !
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  3108
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  3109
!Scanner class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  3110
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3111
version
1900
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  3112
    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.223 2006-08-29 17:20:08 cg Exp $'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  3113
! !
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  3114
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3115
Scanner initialize!