Scanner.st
author Claus Gittinger <cg@exept.de>
Fri, 31 Jul 2020 10:25:57 +0200
changeset 4692 d6ddd748f7e3
parent 4688 4022095270be
child 4702 03ceb59050b4
permissions -rw-r--r--
#REFACTORING by exept class: Scanner added: #actionToDisableWarning: changed: #skipComment #warnDollarAt: #warnOldStyleAssignmentAt: #warnParagraphAt: #warnPeriodAt: #warnPossibleIncompatibility:position:to: #warnSTXSpecialCommentAt:to: #warnUnderscoreAt:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
     1
"{ Encoding: utf8 }"
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
     2
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     3
"
4
f6fd83437415 *** empty log message ***
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
     5
	      All Rights Reserved
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
     6
7ad01559b262 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
7ad01559b262 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
7ad01559b262 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
7ad01559b262 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
7ad01559b262 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
7ad01559b262 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
7ad01559b262 Initial revision
claus
parents:
diff changeset
    13
"
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
    14
"{ Package: 'stx:libcomp' }"
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
    15
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
    16
"{ NameSpace: Smalltalk }"
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
    17
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    18
Object subclass:#Scanner
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    19
	instanceVariableNames:'typeArray actionArray source lineNr token tokenType tokenPosition
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    20
		tokenValue tokenName tokenLineNr tokenLastEndPosition hereChar
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    21
		peekChar peekChar2 requestor exitBlock errorFlag ignoreErrors
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    22
		ignoreWarnings saveComments currentComments collectedSource
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    23
		scanColonAsKeyword outStream outCol inArrayLiteral lastDirective
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    24
		parserFlags didWarnAboutSTXSpecialComment
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    25
		didWarnAboutUnderscoreInIdentifier didWarnAboutOldStyleAssignment
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    26
		didWarnAboutDollarInIdentifier didWarnAboutPeriodInSymbol
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    27
		unicodeActions'
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    28
	classVariableNames:'DefaultActionArray DefaultTypeArray DefaultUnicodeActions
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    29
		EmptySourceNotificationSignal'
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    30
	poolDictionaries:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    31
	category:'System-Compiler'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
    32
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
    33
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
    34
Scanner class instanceVariableNames:'TypeArray ActionArray UnicodeActions'
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    35
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    36
"
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    37
 No other class instance variables are inherited by this class.
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    38
"
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    39
!
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    40
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    41
Object subclass:#Comment
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    42
	instanceVariableNames:'commentType commentString startPosition endPosition'
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    43
	classVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    44
	poolDictionaries:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    45
	privateIn:Scanner
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    46
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    47
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    48
Object subclass:#Directive
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    49
	instanceVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    50
	classVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    51
	poolDictionaries:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    52
	privateIn:Scanner
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    53
!
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
Scanner::Directive subclass:#ClassDirective
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    56
	instanceVariableNames:'className'
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    57
	classVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    58
	poolDictionaries:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    59
	privateIn:Scanner::Directive
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    60
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    61
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    62
Scanner::Directive::ClassDirective subclass:#ClassHintDirective
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    63
	instanceVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    64
	classVariableNames:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    65
	poolDictionaries:''
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
    66
	privateIn:Scanner::Directive
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    67
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
    68
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    69
!Scanner class methodsFor:'documentation'!
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    70
901
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    71
bugs
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    72
"
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    73
   array constant containing keywords as in:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    74
	#(
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    75
		foo:bar:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    76
		fee:baz:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    77
	 )
901
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    78
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    79
   is scanned as 4-element array containing ( #foo: #bar: #fee: #baz: )
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    80
   this MUST be fixed.
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    81
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    82
   workaround:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    83
	#(
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    84
		#'foo:bar:'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    85
		#'fee:baz:'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    86
	 )
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
    87
901
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    88
"
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    89
!
8894cc8dda62 documentation
Claus Gittinger <cg@exept.de>
parents: 900
diff changeset
    90
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    91
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    92
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    93
 COPYRIGHT (c) 1989 by Claus Gittinger
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
    94
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    95
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    96
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    97
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    98
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
    99
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   100
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   101
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   102
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   103
!
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   104
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   105
documentation
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   106
"
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   107
    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
   108
    Its main method is #nextToken, which reads and returns the next token
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   109
    Possibly placing additional information (such as tokenValue) into
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   110
    instance variables as a side effect.
75
d8b9d6b39497 *** empty log message ***
claus
parents: 74
diff changeset
   111
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   112
    TODO:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   113
	some testers noticed that ST-80's scanner methods are called
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   114
	xLetter, xDigit etc. For code using these (internals), the nextNumber,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   115
	nextIdentifier etc. methods should be renamed.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   116
	(to me, these seem to be internal private methods;
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   117
	 their public use is not a good idea ..)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   118
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   119
	Scanner is typically subclassed for parsing and #nextToken
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   120
	invoked via #self-sends.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   121
	This should be changed and scanner ought to be an instance variable
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   122
	of Parser - this allows more flexible use of the scanner/parser
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   123
	framework (i.e. changing the scanner without affecting the parser).
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   124
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   125
    Extensions:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   126
	this scanner allows for 3-character binary selectors.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   127
	also, # is a valid selector. (however, ## is currently scanned as a symbol literal).
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   128
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   129
    [author:]
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   130
	Claus Gittinger
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   131
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   132
    [see also:]
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   133
	Parser
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
   134
"
41
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
   135
! !
62214c6ca833 allow turning off warnings
claus
parents: 38
diff changeset
   136
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   137
!Scanner class methodsFor:'initialization'!
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   138
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   139
binarySelectorCharacters
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   140
    "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
   141
3643
1c1031e25cd9 class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3624
diff changeset
   142
    ^ Method binarySelectorCharacters.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   143
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   144
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   145
extendedBinarySelectorCharacters
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   146
    "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
   147
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
   148
    "/ ^ '±×·÷«»'.
2487
d6d546fadbd0 changed:
Stefan Vogel <sv@exept.de>
parents: 2486
diff changeset
   149
    ^ String
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   150
	with:(Character value:16rB1)  "/ plus-minus
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   151
	with:(Character value:16rD7)  "/ times
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   152
	with:(Character value:16rB7)  "/ centered dot
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   153
	with:(Character value:16rF7)  "/ divide
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   154
	with:(Character value:16rAB)  "/ <<
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   155
	with:(Character value:16rBB). "/ >>
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   156
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   157
    "Modified (comment): / 17-11-2016 / 09:22:42 / cg"
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   158
!
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   159
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   160
setupActions
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
   161
    "initialize the scanner's actionTables - these are used to dispatch
2141
de005dc56384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
   162
     into scanner methods as characters are read.
de005dc56384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
   163
     Compatibility note: in previous versions, these tables used to be kept
de005dc56384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
   164
     in classVariables, which made reuse hard as subclasses had no easy way of
de005dc56384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
   165
     defining their own tables. These are now class instance variables."
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   166
4157
b200307a167c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
   167
    |block actionArray typeArray unicodeActions unicodeTypes|
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   168
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   169
    actionArray := Array new:256.
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   170
    typeArray := Array new:256.
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   171
    unicodeActions := Dictionary new.
4157
b200307a167c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
   172
    unicodeTypes := Dictionary new.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   173
1303
f726ae1bc0d2 comment
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
   174
    "/ TODO: later versions should be configurable w.r.t separators.
f726ae1bc0d2 comment
Claus Gittinger <cg@exept.de>
parents: 1302
diff changeset
   175
    "/ #(9 10 12 13 26 32) do: [:i | TypeArray at:(i+1) put: #separator].
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   176
    block := [:s :char | s nextNumber].
3521
826f307a6b9f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3513
diff changeset
   177
    actionArray from:($0 codePoint) to:($9 codePoint) put:block.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   178
87
claus
parents: 83
diff changeset
   179
    block := [:s :char | s nextSpecial].
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   180
    self binarySelectorCharacters do:[:binop |
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   181
	|codePoint|
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   182
	codePoint := binop codePoint.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   183
	codePoint <= typeArray size ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   184
	    typeArray at:codePoint put:#special.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   185
	    actionArray at:codePoint put:block
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   186
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   187
	    unicodeTypes at:codePoint put:#extendedSpecial.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   188
	    unicodeActions at:codePoint put:block
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   189
	].
87
claus
parents: 83
diff changeset
   190
    ].
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   191
2146
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   192
    block := [:s :char | s nextExtendedSpecial:char].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   193
    self extendedBinarySelectorCharacters do:[:binop |
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   194
	|codePoint|
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   195
	codePoint := binop codePoint.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   196
	codePoint <= typeArray size ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   197
	    typeArray at:codePoint put:#extendedSpecial.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   198
	    actionArray at:codePoint put:block
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   199
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   200
	    unicodeTypes at:codePoint put:#extendedSpecial.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   201
	    unicodeActions at:codePoint put:block
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   202
	].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   203
    ].
87
claus
parents: 83
diff changeset
   204
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   205
    "/ that one is a special case (both binarySelector AND syntax).
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   206
    typeArray at:($| codePoint) put:nil.
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   207
87
claus
parents: 83
diff changeset
   208
    block := [:s :char | s nextToken:char].
1510
875c90576897 Fix duplicate assignment to ActionArray for sh
Stefan Vogel <sv@exept.de>
parents: 1509
diff changeset
   209
    ';.^|()[]{}' do:[:ch |
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   210
	actionArray at:(ch codePoint) put:block
87
claus
parents: 83
diff changeset
   211
    ].
claus
parents: 83
diff changeset
   212
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   213
    block := [:s :char | s nextIdentifier].
3521
826f307a6b9f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3513
diff changeset
   214
    actionArray from:($a codePoint) to:($z codePoint) put:block.
826f307a6b9f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3513
diff changeset
   215
    actionArray from:($A codePoint) to:($Z codePoint) put:block.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   216
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   217
    "kludge: action is characterToken, but type is special"
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   218
    typeArray at:($| codePoint) put:#special.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   219
80
101b42803846 *** empty log message ***
claus
parents: 76
diff changeset
   220
    "kludge: action is nextColonOrAssign, but type is special"
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   221
    typeArray at:($: codePoint) put:#special.
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   222
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
   223
    actionArray at:($' codePoint) put:[:s :char | s nextString:char escapeStyle:nil].
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   224
    actionArray at:($$ codePoint) put:[:s :char | s nextCharacter].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   225
    actionArray at:($# codePoint) put:[:s :char | s nextHash].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   226
    actionArray at:($!! codePoint) put:[:s :char | s nextExcla].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   227
    actionArray at:($% codePoint) put:[:s :char | s nextPrimitive].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   228
    actionArray at:($: codePoint) put:[:s :char | s nextColonOrAssign].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   229
    actionArray at:($_ codePoint) put:[:s :char | s nextUnderline].
4291
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
   230
    "/ an experiment to allow 'special' identifiers (in backticks, allowing arbitrary characters inside)
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
   231
    "/ actionArray at:($` codePoint) put:[:s :char | s nextBacktickIdentifier].
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   232
2486
21fcd67e32a0 changed: #setupActions
Stefan Vogel <sv@exept.de>
parents: 2485
diff changeset
   233
    unicodeActions at:2190 "<- left arrow" put:[:s :char | s nextAssignmentArrow].
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   234
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   235
    ActionArray := DefaultActionArray := actionArray.
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   236
    TypeArray := DefaultTypeArray := typeArray.
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   237
    UnicodeActions := DefaultUnicodeActions := unicodeActions.
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   238
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   239
    "
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   240
     Scanner setupActions
2182
bce48a1e1367 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   241
     Scanner withAllSubclassesDo:[:cls | cls setupActions ]
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   242
    "
462
6a29b0b356fc added query for valid binarySelector characters
Claus Gittinger <cg@exept.de>
parents: 460
diff changeset
   243
4157
b200307a167c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
   244
    "Modified: / 02-07-2017 / 01:11:27 / cg"
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
   245
    "Modified: / 08-02-2019 / 19:13:32 / Claus Gittinger"
33
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   246
! !
8985ec2f9e82 *** empty log message ***
claus
parents: 30
diff changeset
   247
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   248
!Scanner class methodsFor:'instance creation'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   249
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   250
for:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   251
    "create & return a new scanner reading from aStringOrStream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   252
1235
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   253
    ^ self basicNew initializeFor:aStringOrStream
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   254
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   255
    "Modified: 23.5.1997 / 12:08:42 / cg"
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   256
!
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   257
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   258
new
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   259
    "create & return a new scanner"
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   260
859
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   261
    ^ self basicNew initialize.
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   262
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   263
    "Modified: / 23.5.1997 / 12:08:42 / cg"
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
   264
    "Created: / 26.5.1999 / 12:02:16 / stefan"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   265
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   266
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   267
!Scanner class methodsFor:'Signal constants'!
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   268
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   269
doNotShowCompilerWarningAgainActionQuery
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   270
    ^ DoNotShowCompilerWarningAgainActionQuery
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   271
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
   272
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   273
emptySourceNotificationSignal
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   274
    ^ EmptySourceNotificationSignal
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   275
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   276
    "Created: / 16.5.1998 / 15:55:14 / cg"
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   277
! !
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   278
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   279
!Scanner class methodsFor:'accessing'!
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   280
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   281
actionArray
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   282
    ActionArray isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   283
	self setupActions
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   284
    ].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   285
    ^ ActionArray ? DefaultActionArray
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   286
!
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   287
2146
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   288
flushActionArray
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   289
    ActionArray := DefaultActionArray := nil.
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   290
    TypeArray := DefaultTypeArray := nil.
4320
ae5699ba7588 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4314
diff changeset
   291
    UnicodeActions := DefaultUnicodeActions := nil.
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   292
2146
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   293
    "
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   294
     Scanner flushActionArray
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   295
     Parser flushActionArray
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   296
     ByteCodeCompiler flushActionArray
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   297
     Explainer flushActionArray
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   298
    "
4320
ae5699ba7588 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4314
diff changeset
   299
ae5699ba7588 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4314
diff changeset
   300
    "Modified: / 11-12-2018 / 11:25:53 / Claus Gittinger"
2146
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   301
!
ef93cbd5af40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   302
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   303
typeArray
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   304
    TypeArray isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   305
	self setupActions
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   306
    ].
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   307
    ^ TypeArray ? DefaultTypeArray
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   308
!
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   309
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   310
unicodeActions
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   311
    UnicodeActions isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   312
	self setupActions
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   313
    ].
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   314
    ^ UnicodeActions ? DefaultUnicodeActions
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   315
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
   316
    "Created: / 25-03-2011 / 13:57:34 / cg"
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   317
! !
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
   318
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   319
!Scanner class methodsFor:'class initialization'!
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   320
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   321
initialize
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   322
    "initialize the classes defaults. Typically, these are changed
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   323
     later in the 'private.rc' file."
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   324
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   325
    EmptySourceNotificationSignal isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   326
	EmptySourceNotificationSignal := QuerySignal new mayProceed:true.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   327
	EmptySourceNotificationSignal notifierString:'empty source given to evaluate'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   328
	EmptySourceNotificationSignal nameClass:self message:#emptySourceNotificationSignal.
717
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   329
    ].
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   330
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   331
    "
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   332
     self initialize
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   333
    "
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   334
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   335
    "Modified: / 16.5.1998 / 15:55:41 / cg"
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   336
! !
627b2379d5ce moved signal to scanner
Claus Gittinger <cg@exept.de>
parents: 714
diff changeset
   337
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
   338
!Scanner class methodsFor:'defaults'!
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   339
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   340
allowDollarInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   341
    <resource: #obsolete>
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   342
    "return true, if $-characters are allowed in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   343
     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
   344
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   345
    ^ ParserFlags allowDollarInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   346
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   347
    "Created: 7.9.1997 / 01:32:18 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   348
    "Modified: 7.9.1997 / 01:39:44 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   349
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   350
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   351
allowDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   352
    "this allows turning on/off $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   353
     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
   354
     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
   355
     but instead are scanned as character-constant prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   356
     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
   357
     dollars are still scanned as constant character prefix.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   358
     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
   359
     before filing them in; i.e.:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   360
	Compiler allowDollarInIdentifiers:false"
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   361
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   362
    ParserFlags allowDollarInIdentifier:aBoolean.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   363
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   364
    "Created: 7.9.1997 / 01:34:49 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   365
    "Modified: 7.9.1997 / 01:39:30 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   366
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   367
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   368
allowDolphinExtensions
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   369
    "return true, if ##(..) computed literal Arrays are allowed"
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   370
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   371
    ^ ParserFlags allowDolphinExtensions
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   372
!
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   373
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   374
allowDolphinExtensions:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   375
    "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
   376
     If you want to fileIn Dolphin classes, enable this with:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   377
	Compiler allowDolphinComputedArrays:true"
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   378
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   379
    ParserFlags allowDolphinExtensions:aBoolean.
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   380
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   381
    "
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   382
     self allowDolphinExtensions:true
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   383
     self allowDolphinExtensions:false
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   384
    "
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   385
!
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   386
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   387
allowLiteralNameSpaceSymbols
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   388
    <resource: #obsolete>
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   389
    "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
   390
3327
9c7c99e0280e class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3312
diff changeset
   391
    ^ ParserFlags allowLiteralNameSpaceSymbols
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   392
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   393
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   394
allowOldStyleAssignment
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   395
    "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
   396
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   397
    ^ ParserFlags allowOldStyleAssignment
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   398
!
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   399
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   400
allowOldStyleAssignment:aBoolean
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   401
    "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
   402
     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
   403
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   404
    ParserFlags allowOldStyleAssignment:aBoolean
1261
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   405
!
3de89ad9de69 allow oldStyleAssignment setting added
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   406
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   407
allowQualifiedNames
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   408
    <resource: #obsolete>
4303
4123d362d0f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
   409
    "return true, if '#{..}' and 'namespace.varName' qualified names are allowed"
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   410
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   411
    ^ ParserFlags allowQualifiedNames
4303
4123d362d0f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
   412
4123d362d0f1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4291
diff changeset
   413
    "Modified (comment): / 23-09-2018 / 01:08:26 / Claus Gittinger"
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   414
!
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   415
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   416
allowQualifiedNames:aBoolean
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   417
    "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
   418
     If you want to fileIn vw3 or later classes, enable this with:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   419
	Compiler allowQualifiedNames:true
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   420
     Notice, that qualified names are not really supported semantically
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   421
     (they are parsed, but treated like regular globals)
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   422
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   423
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   424
    ParserFlags allowQualifiedNames:aBoolean.
922
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   425
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   426
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   427
     self allowQualifiedNames:true
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   428
     self allowQualifiedNames:false
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   429
    "
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   430
!
77c58cc5bebc support for vw3 qualifiedNames
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   431
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   432
allowSqueakExtensions
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   433
    <resource: #obsolete>
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   434
    "return true, if support for squeak extensions
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   435
	computed arrays { .., }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   436
	c/java style arguments in message sends rec foo(arg1, ... argN)
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   437
     is enabled."
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   438
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   439
    ^ ParserFlags allowSqueakExtensions
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   440
!
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   441
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   442
allowSqueakExtensions:aBoolean
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   443
    "this allows turning on/off support for squeak extensions:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   444
	computed arrays { .., }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   445
	c/java style arguments in message sends rec foo(arg1, ... argN)
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   446
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   447
     If you want to fileIn Squeak classes, enable this with:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   448
	Compiler allowSqueakComputedArrays:true"
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   449
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   450
    ParserFlags allowSqueakExtensions:aBoolean.
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   451
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   452
    "
895
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   453
     self allowSqueakExtensions:true
0d44de8940c8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 893
diff changeset
   454
     self allowSqueakExtensions:false
893
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   455
    "
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   456
!
9fcb0294a51e changes to support loading squeak code containing computed
Claus Gittinger <cg@exept.de>
parents: 874
diff changeset
   457
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   458
allowUnderscoreInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   459
    <resource: #obsolete>
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   460
    "return true, if underscores are allowed in identifiers"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   461
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   462
    ^ ParserFlags allowUnderscoreInIdentifier
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   463
!
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
allowUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   466
    "this allows turning on/off underscores in identifiers.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   467
     If turned off (the default), underscores are not allowed in identifiers,
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   468
     but instead scanned as assignment character (old ST/80 syntax).
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   469
     If turned on, underscores are in identifiers are allowed, while extra
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   470
     underscores are still scanned as assignment.
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   471
     If you have to fileIn old VW-Vsn2.x classes,
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   472
     turn them off with:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   473
	Compiler allowUnderscoreInIdentifiers:false"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   474
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   475
    ParserFlags allowUnderscoreInIdentifier:aBoolean.
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   476
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   477
    "Modified: 7.9.1997 / 01:35:19 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   478
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   479
1644
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   480
maxBinarySelectorSize
3643
1c1031e25cd9 class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3624
diff changeset
   481
    ^ Method maxBinarySelectorSize
1644
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   482
!
1991a9e37aef numArgs fixed (binOps can now be longer)
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   483
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   484
warnCommonMistakes
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   485
    <resource: #obsolete>
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   486
    "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
   487
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   488
    ^ ParserFlags warnCommonMistakes
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   489
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   490
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   491
warnCommonMistakes:aBoolean
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   492
    "this allows turning on/off warnings about common beginners mistakes.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   493
     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
   494
     run time errors later.
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   495
     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
   496
     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
   497
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   498
	Compiler warnCommonMistakes:false
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   499
     in your 'private.rc' file"
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   500
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   501
    ParserFlags warnCommonMistakes:aBoolean
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   502
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   503
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   504
warnDollarInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   505
    <resource: #obsolete>
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   506
    "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
   507
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   508
    ^ ParserFlags warnDollarInIdentifier
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   509
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   510
    "Created: 7.9.1997 / 01:36:17 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   511
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   512
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   513
warnDollarInIdentifier:aBoolean
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   514
    "this allows turning on/off warnings about $-characters in identifiers.
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   515
     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
   516
     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
   517
     (i.e. VW releases 2.x and maybe others).
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   518
     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
   519
     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
   520
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   521
	Compiler warnDollarInIdentifier:false
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   522
     in your 'private.rc' file"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   523
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   524
    ParserFlags warnDollarInIdentifier:aBoolean
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   525
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   526
    "Created: 7.9.1997 / 01:37:42 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   527
    "Modified: 7.9.1997 / 01:40:02 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   528
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   529
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   530
warnOldStyleAssignment
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   531
    <resource: #obsolete>
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   532
    "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
   533
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   534
    ^ ParserFlags warnOldStyleAssignment
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   535
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   536
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   537
warnOldStyleAssignment:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   538
    "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
   539
     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
   540
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   541
	Compiler warnOldStyleAssignment:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   542
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   543
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   544
    ParserFlags warnOldStyleAssignment:aBoolean
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
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   547
warnPossibleIncompatibilities
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   548
    <resource: #obsolete>
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   549
    "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
   550
     are to be warned about"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   551
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   552
    ^ ParserFlags warnPossibleIncompatibilities
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   553
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   554
    "Modified: 23.5.1997 / 12:02:02 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   555
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   556
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   557
warnPossibleIncompatibilities:aBoolean
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   558
    "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
   559
     on or off.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   560
     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
   561
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   562
	Compiler warnPossibleIncompatibilities:false
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   563
     in your 'private.rc' file."
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   564
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   565
    ParserFlags warnPossibleIncompatibilities:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   566
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   567
    "Created: 23.5.1997 / 12:02:45 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   568
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   569
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   570
warnSTXSpecials
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   571
    <resource: #obsolete>
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   572
    "return true, if ST/X specials are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   573
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   574
    ^ ParserFlags warnSTXSpecials
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   575
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   576
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   577
warnSTXSpecials:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   578
    "this allows turning on/off warnings about stx specials.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   579
     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
   580
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   581
	Compiler warnSTXSpecials:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   582
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   583
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   584
    ParserFlags warnSTXSpecials:aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   585
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   586
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   587
warnUnderscoreInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   588
    <resource: #obsolete>
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   589
    "return true, if underscores in identifiers are to be warned about"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   590
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   591
    ^ ParserFlags warnUnderscoreInIdentifier
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   592
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   593
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   594
warnUnderscoreInIdentifier:aBoolean
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   595
    "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
   596
     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
   597
     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
   598
     (i.e. VW releases 2.x).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   599
     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
   600
     a line as:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   601
	Compiler warnUnderscoreInIdentifier:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   602
     in your 'private.rc' file"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   603
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   604
    ParserFlags warnUnderscoreInIdentifier:aBoolean
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   605
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
   606
    "Modified: 7.9.1997 / 01:37:13 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   607
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   608
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   609
warnings
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   610
    "return true, if any warnings are to be shown"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   611
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   612
    ^ ParserFlags warnings
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   613
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   614
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   615
warnings:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   616
    "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
   617
     You can turn off warnings in your 'private.rc' file with
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   618
	 Compiler warnings:false
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   619
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   620
1663
804edcc95bd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   621
    ParserFlags warnings:aBoolean
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   622
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   623
    "Modified: 23.5.1997 / 12:03:05 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   624
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   625
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   626
!Scanner class methodsFor:'utility scanning'!
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   627
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   628
scanNumberFrom:aStream
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   629
    "utility - helper for Number>>readSmalltalkSyntaxFrom:"
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   630
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   631
    ^ self basicNew scanNumberFrom:aStream
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   632
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   633
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   634
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   635
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   636
     s := '12345abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   637
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   638
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   639
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   640
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   641
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   642
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   643
     s := '16rffffxabcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   644
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   645
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   646
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   647
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   648
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   649
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   650
     s := '1.2345abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   651
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   652
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   653
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   654
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   655
     |s|
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   656
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   657
     s := '1.abcd' readStream.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   658
     Transcript showCR:(self scanNumberFrom:s).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   659
     Transcript showCR:(s upToEnd).
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   660
    "
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   661
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   662
    "Modified: / 18.6.1998 / 23:10:39 / cg"
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   663
! !
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
   664
1417
7e97dd2df5ca method category rename
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
   665
!Scanner methodsFor:'Compatibility-ST80'!
98
claus
parents: 97
diff changeset
   666
claus
parents: 97
diff changeset
   667
endOfLastToken
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   668
    "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
   669
     This method was required by some PD program.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   670
     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
   671
3268
6cf0aa88857b class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3245
diff changeset
   672
    ^ source position + 1
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   673
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
   674
    "Modified: 23.5.1997 / 12:14:27 / cg"
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   675
!
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   676
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   677
scan:aStringOrStream
630
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   678
    "initialize the scanner: set the source-stream and
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   679
     preread the first token"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   680
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   681
    self initializeFor:aStringOrStream.
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   682
    self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   683
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   684
    "Created: / 30.10.1997 / 16:59:39 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   685
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   686
2139
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   687
scanDoing:aBlock
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   688
    "scan, evaluating aBlock for every scanned token."
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   689
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   690
    |t|
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   691
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   692
    [(t := self nextToken) ~~ #EOF] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   693
	aBlock value:t.
2139
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   694
    ].
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   695
!
ff81d8aadd3f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   696
630
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   697
scanToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   698
    "read the next token from my input stream"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   699
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   700
    ^ self nextToken
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   701
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   702
    "Created: / 30.10.1997 / 17:00:16 / cg"
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   703
!
f2f75975b22e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 620
diff changeset
   704
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   705
scanTokens:aStringOrStream
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   706
    "return a collection of symbolic tokens from the passed input,
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   707
     similar to what would be read when reading '#( <string> )'"
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   708
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   709
    |tokens readArray|
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   710
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   711
    self initializeFor:aStringOrStream.
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   712
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   713
    readArray :=
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   714
	[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   715
	    |elements|
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   716
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   717
	    elements := OrderedCollection new.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   718
	    [ (token ~~ $) ) and:[ token notNil ] ] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   719
		token == $( ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   720
		    self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   721
		    elements add:(readArray value)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   722
		] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   723
		    elements add:token.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   724
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   725
		self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   726
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   727
	    elements asArray
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   728
	].
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   729
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   730
    tokens := OrderedCollection new.
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   731
    self nextToken.
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   732
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   733
    [token notNil] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   734
	token == $( ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   735
	    self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   736
	    tokens add:(readArray value)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   737
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   738
	    tokens add:token
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   739
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   740
	self nextToken
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   741
    ].
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   742
    ^ tokens
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   743
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   744
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   745
     Scanner new scanTokens:'name ident #sym ''string'' 8r12'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   746
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   747
     Scanner new scanTokens:'translate (200px 100px)'
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
   748
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   749
     Scanner new
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   750
	scanTokens:'Boolean subclass:#True
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   751
				instanceVariableNames:''''
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   752
				classVariableNames:''''
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   753
				poolDictionaries:''''
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   754
				category:''Kernel-Objects''
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   755
	'
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   756
    "
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
   757
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   758
    "Modified: / 23-08-2017 / 23:58:03 / cg"
98
claus
parents: 97
diff changeset
   759
! !
claus
parents: 97
diff changeset
   760
3730
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   761
!Scanner methodsFor:'Compatibility-Squeak'!
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   762
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   763
notify:message at:codeStreamPosition
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   764
    "Squeak compatibility"
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   765
3730
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   766
    ^ self notifyWarning:message position:codeStreamPosition to:nil
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   767
! !
511fb00c40d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3712
diff changeset
   768
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   769
!Scanner methodsFor:'accessing'!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   770
3755
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   771
atEnd
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   772
    "true if the scanned source stream's end has been reached"
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   773
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   774
    ^ source atEnd
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   775
!
c959f71c27c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3730
diff changeset
   776
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   777
comments
1584
0df14b652d03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1583
diff changeset
   778
    ^ currentComments ? #()
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   779
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   780
1509
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   781
exitBlock:aBlock
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   782
    exitBlock := aBlock
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   783
!
05509b7471c0 +exitBlock:
ca
parents: 1501
diff changeset
   784
4418
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   785
expectToken:expectedToken
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   786
    token = expectedToken ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   787
	self parseError:('expected "',expectedToken asString,'"').
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   788
	^ false.
4418
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   789
    ].
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   790
    self nextToken.
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   791
    ^ true.
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   792
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   793
    "Created: / 25-05-2019 / 23:32:54 / Claus Gittinger"
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   794
!
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   795
2742
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   796
getCollectedComments
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   797
    "retrieve the so far collected comments, reset comment collection"
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   798
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   799
    |comments|
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   800
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   801
    (comments := currentComments) isEmptyOrNil ifTrue:[^ nil].
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   802
    currentComments := nil.
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   803
    ^ comments
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   804
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   805
    "Created: / 05-10-2011 / 10:09:01 / cg"
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   806
!
1da09935db64 added: #getCollectedComments
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
   807
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   808
hasError
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   809
    "return true if there where any errors (valid after parsing)"
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   810
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   811
    ^ errorFlag
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   812
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   813
    "Created: / 23-05-2019 / 09:26:39 / Claus Gittinger"
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   814
!
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   815
1202
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   816
inArrayLiteral:aBoolean
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   817
    inArrayLiteral := aBoolean
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   818
!
95abdd4272cd scanning of keyword symbols in array consts fixed
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   819
859
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   820
lineNumber
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   821
    ^ lineNr
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   822
!
0e5dd0e35301 access to lineNumber added
Claus Gittinger <cg@exept.de>
parents: 854
diff changeset
   823
795
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   824
newSourceStream:aStream
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   825
    source := aStream.
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   826
    self nextToken.
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   827
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   828
    "Created: / 29.10.1998 / 21:59:33 / cg"
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   829
!
d2c567b79091 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   830
1497
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   831
outStream:aStream
4419
4e04c315d976 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4418
diff changeset
   832
    "if set, this stream gets the parsed comments as it is read.
4e04c315d976 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4418
diff changeset
   833
     Useful to collect comments while reading"
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   834
1497
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   835
    outStream := aStream.
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   836
    outCol := outCol ? 1.
4418
edd3f5086910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4415
diff changeset
   837
4419
4e04c315d976 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4418
diff changeset
   838
    "Modified (comment): / 25-05-2019 / 23:45:57 / Claus Gittinger"
1497
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   839
!
96166a974288 *** empty log message ***
ca
parents: 1492
diff changeset
   840
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
   841
requestor
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
   842
    ^ requestor
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
   843
!
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
   844
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   845
saveComments:aBoolean
1582
701f40070c8a comments returns a collection
Claus Gittinger <cg@exept.de>
parents: 1580
diff changeset
   846
    saveComments := aBoolean.
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   847
2737
4f75ad8cb18d comment
Claus Gittinger <cg@exept.de>
parents: 2712
diff changeset
   848
    "Created: / 20-04-1996 / 20:03:56 / cg"
4f75ad8cb18d comment
Claus Gittinger <cg@exept.de>
parents: 2712
diff changeset
   849
    "Modified: / 23-05-1997 / 12:14:49 / cg"
4f75ad8cb18d comment
Claus Gittinger <cg@exept.de>
parents: 2712
diff changeset
   850
    "Modified (comment): / 04-10-2011 / 15:35:51 / cg"
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   851
!
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   852
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   853
sourcePosition
3268
6cf0aa88857b class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3245
diff changeset
   854
    ^ source position + 1
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   855
!
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   856
2678
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   857
sourcePositionWithoutPeeks
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   858
    | pos |
4569
90dcb81b0e8a #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4562
diff changeset
   859
2678
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   860
    pos := self sourcePosition.
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   861
    peekChar2 notNil ifTrue:[^ pos - 2].
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   862
    peekChar  notNil ifTrue:[^ pos - 1].
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   863
    ^pos
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   864
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   865
    "Created: / 25-08-2011 / 11:19:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   866
!
fc0df237f01e Fixes in start/endPosition for Variable node
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2612
diff changeset
   867
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   868
sourceStream
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   869
    ^ source
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   870
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
   871
    "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
   872
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   873
3334
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   874
tokenEndPosition
3335
ee38f5eb4360 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3334
diff changeset
   875
    ^ tokenPosition + tokenName size - 1.
3334
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   876
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   877
    "Created: / 22-10-2013 / 00:30:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3335
ee38f5eb4360 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3334
diff changeset
   878
    "Modified: / 22-10-2013 / 03:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3334
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   879
!
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   880
1235
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   881
tokenLineNr
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   882
    ^ tokenLineNr
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   883
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   884
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   885
tokenName
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   886
    ^ tokenName
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   887
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   888
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   889
tokenPosition
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   890
    ^ tokenPosition
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   891
!
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   892
3334
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   893
tokenStartPosition
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   894
    ^ tokenPosition
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   895
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   896
    "Created: / 22-10-2013 / 00:29:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   897
!
900fb0ffd825 class: Scanner
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3327
diff changeset
   898
1235
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   899
tokenType
fc0ccb509f4e accessors (to allow using scanner as instVar in parser)
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   900
    ^ tokenType
1238
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   901
!
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   902
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   903
tokenValue
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   904
    ^ tokenValue
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   905
dbdc690e7170 token access
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   906
    "Created: / 21.12.2001 / 22:38:08 / cg"
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   907
! !
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   908
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   909
!Scanner methodsFor:'accessing-flags'!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   910
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   911
allowDollarInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   912
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   913
    ^ parserFlags allowDollarInIdentifier
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   914
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   915
1511
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   916
allowDollarInIdentifier:something
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   917
    parserFlags allowDollarInIdentifier:something
1511
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   918
!
c28bade9caf6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 1510
diff changeset
   919
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   920
allowLiteralNameSpaceSymbols
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   921
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   922
    ^ parserFlags allowLiteralNameSpaceSymbols
1572
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
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   925
allowLiteralNameSpaceSymbols:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   926
    parserFlags allowLiteralNameSpaceSymbols:aBoolean
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   927
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
   928
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   929
allowOldStyleAssignment
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   930
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   931
    ^ parserFlags allowOldStyleAssignment
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   932
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   933
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   934
allowOldStyleAssignment:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   935
    parserFlags allowOldStyleAssignment:aBoolean
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   936
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   937
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   938
allowSqueakExtensions
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   939
    <resource: #obsolete>
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   940
    "return true, if support for squeak extensions
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   941
	computed arrays { .., }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   942
	c/java style arguments in message sends rec foo(arg1, ... argN)
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   943
     is enabled."
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   944
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   945
    ^ parserFlags allowSqueakExtensions
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   946
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   947
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   948
allowSqueakExtensions:aBoolean
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   949
    "this allows turning on/off support for squeak extensions:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   950
	computed arrays { .., }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
   951
	c/java style arguments in message sends rec foo(arg1, ... argN)
1530
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   952
    "
ed400d564510 comments
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
   953
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   954
    parserFlags allowSqueakExtensions:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   955
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   956
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   957
allowUnderscoreInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   958
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   959
    ^ parserFlags allowUnderscoreInIdentifier
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   960
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   961
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   962
allowUnderscoreInIdentifier:aBoolean
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   963
    parserFlags allowUnderscoreInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   964
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   965
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
   966
didWarnAboutOldStyleAssignment
3571
617b63e557be class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
   967
    ^ didWarnAboutOldStyleAssignment ? false
617b63e557be class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
   968
!
617b63e557be class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
   969
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   970
parserFlags
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   971
    ^ parserFlags
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   972
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   973
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   974
parserFlags:aParserFlagsInstance
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   975
    parserFlags := aParserFlagsInstance
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   976
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
   977
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   978
scanColonAsKeyword
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   979
    "/ not used here, but eases subclassing for other languages.
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   980
    ^ scanColonAsKeyword
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   981
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   982
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   983
warnCommonMistakes
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   984
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   985
    ^ parserFlags warnCommonMistakes
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   986
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   987
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   988
warnCommonMistakes:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   989
    parserFlags warnCommonMistakes:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   990
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   991
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   992
warnDollarInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
   993
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   994
    ^ parserFlags warnDollarInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   995
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   996
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   997
warnDollarInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
   998
    parserFlags warnDollarInIdentifier:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
   999
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1000
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1001
warnOldStyleAssignment
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
  1002
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1003
    ^ parserFlags warnOldStyleAssignment
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1004
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1005
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1006
warnOldStyleAssignment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1007
    parserFlags warnOldStyleAssignment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1008
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1009
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1010
warnPossibleIncompatibilities
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
  1011
    <resource: #obsolete>
2058
3d2daea65184 comment
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  1012
    "return true, if possible incompatibilities (with other ST systems)
3d2daea65184 comment
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  1013
     are to be warned about"
3d2daea65184 comment
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  1014
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1015
    ^ parserFlags warnPossibleIncompatibilities
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1016
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1017
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1018
warnPossibleIncompatibilities:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1019
    parserFlags warnPossibleIncompatibilities:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1020
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1021
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1022
warnSTXNameSpaceUse
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1023
    ^ parserFlags warnSTXNameSpaceUse
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1024
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1025
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1026
warnSTXNameSpaceUse:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1027
    parserFlags warnSTXNameSpaceUse:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1028
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1029
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1030
warnSTXSpecialComment
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1031
    ^ parserFlags warnSTXSpecialComment
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1032
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1033
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1034
warnSTXSpecialComment:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1035
    parserFlags warnSTXSpecialComment:aBoolean
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1036
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1037
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  1038
warnUnderscoreInIdentifier
4304
c13ecd4fe7cf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4303
diff changeset
  1039
    <resource: #obsolete>
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1040
    ^ parserFlags warnUnderscoreInIdentifier
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1041
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1042
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1043
warnUnderscoreInIdentifier:aBoolean
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1044
    parserFlags warnUnderscoreInIdentifier:aBoolean
254
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1045
! !
edfcf93d821f changes to allow parsing for comments
Claus Gittinger <cg@exept.de>
parents: 241
diff changeset
  1046
81
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
  1047
!Scanner methodsFor:'directives'!
37ebe600119c *** empty log message ***
claus
parents: 80
diff changeset
  1048
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1049
parseClassDirective
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
     Class: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1052
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1053
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1054
    |className|
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
    className := self parseDirectiveClassNameArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1057
    className isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1058
	Transcript showCR:'Scanner [warning]: unrecognized ''Class'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1059
	^ false
1596
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
    lastDirective := Directive newClassDirective className:className.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1062
    ^ true
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
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1065
parseClassHintDirective
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
     ClassHint: className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1068
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1069
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1070
    |className|
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
    className := self parseDirectiveClassNameArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1073
    className isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1074
	Transcript showCR:'Scanner [warning]: unrecognized ''ClassHint'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1075
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1076
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1077
    lastDirective := Directive newClassHintDirective className:className.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1078
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1079
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1080
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1081
parseDirective
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1082
    "parse a directive inside a comment (introduced with '{').
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1083
     This is an ST/X special"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1084
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1085
    |directive|
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1086
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1087
    source next.
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1088
    source skipSeparatorsExceptCR.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1089
    hereChar := source peekOrNil.
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1090
    hereChar isLetter ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1091
	directive := source nextAlphaNumericWord asLowercase.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1092
	source peekOrNil == $: ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1093
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1094
	    source skipSeparatorsExceptCR.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1095
	    hereChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1096
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1097
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1098
	     Package: 'name-of-package'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1099
	     Package: packageId
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1100
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1101
	    directive = 'package' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1102
		self parsePackageDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1103
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1104
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1105
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1106
	     Namespace: 'nameSpaceIdentifier'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1107
	     Namespace: nameSpaceIdentifier
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1108
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1109
	    (directive = 'namespace') ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1110
		self parseNamespaceDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1111
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1112
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1113
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1114
	     Uses: 'nameSpace1', ... , 'nameSpaceN'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1115
	     Uses: nameSpaceId1, ... , nameSpaceIdN
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1116
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1117
	    directive = 'uses' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1118
		self parseUsesDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1119
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1120
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1121
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1122
	     reuires: 'name-of-feature'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1123
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1124
	    directive = 'requires' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1125
		self parseRequiresDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1126
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1127
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1128
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1129
	     Prerequisites: 'name-of-package', ... , 'name-of-package'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1130
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1131
	    directive = 'prerequisites' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1132
		self parsePrerequisitesDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1133
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1134
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1135
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1136
	     Syntax: 'name-of-dialect'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1137
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1138
	    directive = 'syntax' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1139
		self parseSyntaxDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1140
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1141
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1142
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1143
	     Class: className
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1144
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1145
	    directive = 'class' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1146
		self parseClassDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1147
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1148
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1149
	     ClassHint: className
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1150
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1151
	    directive = 'classhint' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1152
		self parseClassHintDirective.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1153
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1154
	]
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  1155
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1156
    hereChar := source peekOrNil.
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1157
    ^ true.
413
cdd4919c2e7f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 359
diff changeset
  1158
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1159
    "Modified: / 06-12-2006 / 16:14:54 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1160
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1161
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1162
parseDirectiveClassNameArg
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1163
    "helper for parsing a directive"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1164
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1165
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1166
	parseDirectiveStringArg:[:ch | ch isLetterOrUnderline]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1167
			   rest:[:ch | ch isLetterOrDigit or:[ch == $_ or:[ch == $:]]]
1949
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1168
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1169
    "Modified: / 18-11-2006 / 14:48:07 / cg"
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1170
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1171
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1172
parseDirectiveStringArg
3624
9dbeff263c43 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
  1173
    "helper for parsing a directive.
9dbeff263c43 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
  1174
     scans a word starting with a letter or underline,
9dbeff263c43 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
  1175
     and consisting of letters, digits, underlines or dots."
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1176
3577
318c9c3a5d7a class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3571
diff changeset
  1177
    ^ self parseDirectiveStringArg:[:ch | ch isLetterOrUnderline]
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1178
			      rest:[:ch | ch isLetterOrDigit or:[ch == $_ or:[ch == $.]]]
1949
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1179
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1180
    "Modified: / 18-11-2006 / 14:47:12 / cg"
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1181
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1182
1949
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1183
parseDirectiveStringArg:firstCharacterCheckBlock rest:restCharacterCheckBlock
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1184
    "helper for parsing a directive"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1185
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1186
    |strBuffer|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1187
3994
d59ebb2f6bec #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3954
diff changeset
  1188
    strBuffer := WriteStream on:''.
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1189
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1190
    hereChar == $' ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1191
	hereChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1192
	[hereChar ~~ $'] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1193
	    strBuffer nextPut:hereChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1194
	    hereChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1195
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1196
	hereChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1197
	^ strBuffer contents
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1198
    ].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1199
1949
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1200
    (firstCharacterCheckBlock value:hereChar) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1201
	strBuffer nextPut:hereChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1202
	hereChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1203
	[restCharacterCheckBlock value:hereChar] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1204
	    strBuffer nextPut:hereChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1205
	    hereChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1206
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1207
	^ strBuffer contents
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1208
    ].
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1209
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1210
    ^ nil
460
c023e3713433 handle identifier in directives;
Claus Gittinger <cg@exept.de>
parents: 453
diff changeset
  1211
1949
709ca062cf98 oops: namespace directive scanned the ns-argument wrong (ignored digits)
Claus Gittinger <cg@exept.de>
parents: 1948
diff changeset
  1212
    "Created: / 18-11-2006 / 14:46:09 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1213
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1214
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1215
parseDirectiveStringListArg
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1216
    "helper for parsing a directive"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1217
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1218
    |list|
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1219
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1220
    list := OrderedCollection new.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1221
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1222
    [hereChar == $'] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1223
	list addLast:self parseDirectiveStringArg.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1224
	source skipSeparatorsExceptCR.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1225
	hereChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1226
	(hereChar == $,) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1227
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1228
	    source skipSeparatorsExceptCR.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1229
	    hereChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1230
	].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1231
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1232
    ^ list
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1233
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1234
    "Modified: / 5.3.1998 / 02:55:40 / cg"
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1235
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1236
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1237
parseNamespaceDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1238
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1239
     Namespace: 'nameSpace'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1240
     Namespace: nameSpace
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1241
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1242
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1243
    |namespace target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1244
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1245
    namespace := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1246
    namespace isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1247
	Transcript showCR:'Scanner [warning]: unrecognized ''Namespace'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1248
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1249
    ].
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1250
    target := (requestor notNil and:[ requestor respondsTo:#setNameSpace: ]) ifTrue:[requestor] ifFalse:[self].
3360
a7b5a21a169f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3335
diff changeset
  1251
    Error handle:[:ex |
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1252
	ParseError raiseErrorString:ex description
3360
a7b5a21a169f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3335
diff changeset
  1253
    ] do:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1254
	target setNameSpace:namespace.
3360
a7b5a21a169f class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3335
diff changeset
  1255
    ].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1256
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1257
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1258
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1259
parsePackageDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1260
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1261
     Package: 'name-of-package'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1262
     Package: packageId
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1263
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1264
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1265
    |packageName target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1266
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1267
    packageName := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1268
    packageName isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1269
	Transcript showCR:'Scanner [warning]: unrecognized ''Package'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1270
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1271
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1272
    packageName := packageName asSymbol.
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1273
    target := (requestor notNil and:[ requestor respondsTo:#setPackage: ]) ifTrue:[requestor] ifFalse:[self].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1274
    target setPackage:packageName.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1275
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1276
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1277
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1278
parsePrerequisitesDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1279
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1280
     Prerequisites: 'name-of-package1', ... , 'name-of-packageN'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1281
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1282
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1283
    |list|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1284
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1285
    list := self parseDirectiveStringListArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1286
    list isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1287
	Transcript showCR:'Scanner [warning]: unrecognized ''Prerequisites'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1288
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1289
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1290
    (requestor notNil and:[requestor respondsTo:#requirePackages:]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1291
	requestor requirePackages:list
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1292
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1293
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1294
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1295
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1296
parseRequiresDirective
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1297
    "
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1298
     Require: 'name-of-feature', ... , 'name-of-featureN'
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1299
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1300
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1301
    |list|
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1302
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1303
    list := self parseDirectiveStringListArg.
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1304
    list isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1305
	Transcript showCR:'Scanner [warning]: unrecognized ''Requires'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1306
	^ false
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1307
    ].
2064
42c037a6e20d sharedPool access in doIts
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1308
"/ self halt.
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1309
    (requestor notNil and:[requestor respondsTo:#requireFeatures:]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1310
	requestor requireFeatures:list
1960
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1311
    ].
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1312
    ^ true
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1313
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1314
    "Created: / 06-12-2006 / 16:14:43 / cg"
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1315
!
e691057e14c2 requires directive.
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  1316
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1317
parseSyntaxDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1318
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1319
     Syntax: 'st-syntax-id'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1320
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1321
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1322
    |syntax target|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1323
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1324
    syntax := self parseDirectiveStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1325
    syntax isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1326
	Transcript showCR:'Scanner [warning]: unrecognized ''Syntax'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1327
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1328
    ].
1649
f2ee84d53383 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
  1329
    target := (requestor notNil and:[ requestor respondsTo:#setSyntax: ]) ifTrue:[requestor] ifFalse:[self].
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1330
    target setSyntax:syntax.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1331
    ^ true
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1332
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1333
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1334
parseUsesDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1335
    "
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1336
     Uses: 'nameSpace1', ... , 'nameSpaceN'
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1337
     Uses: nameSpaceId1, ... , nameSpaceIdN
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1338
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1339
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1340
    |list|
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1341
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1342
    list := self parseDirectiveStringListArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1343
    list isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1344
	Transcript showCR:'Scanner [warning]: unrecognized ''Uses'' directive'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1345
	^ false
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1346
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1347
    (requestor notNil and:[requestor respondsTo:#addNameSpaces:]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1348
	requestor addNameSpaces:list
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1349
    ].
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1350
    ^ true
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1351
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1352
1418
4aae7d34124a method category rename
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  1353
!Scanner methodsFor:'dummy-syntax highlighting'!
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1354
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1355
markCommentFrom:pos1 to:pos2
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1356
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1357
    "Created: / 31.3.1998 / 13:34:45 / cg"
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1358
!
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1359
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1360
markConstantFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1361
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1362
    "Created: / 1.4.1998 / 13:02:56 / cg"
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1363
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1364
4262
d0846daed377 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  1365
markErrorFrom:pos1 to:pos2
d0846daed377 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  1366
d0846daed377 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  1367
    "Created: / 31.3.1998 / 13:34:45 / cg"
d0846daed377 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  1368
!
d0846daed377 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  1369
661
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1370
markStringFrom:pos1 to:pos2
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1371
ffb42bda9e5a more syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 659
diff changeset
  1372
    "Created: / 31.3.1998 / 16:37:18 / cg"
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1373
!
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1374
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1375
markSymbolFrom:pos1 to:pos2
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1376
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  1377
    "Created: / 1.4.1998 / 12:58:42 / cg"
659
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1378
! !
2bbc270156c7 support for syntaxHighlighting
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
  1379
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1380
!Scanner methodsFor:'error handling'!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1381
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1382
actionToDisableWarning:warningSelector
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1383
    "return an action for the do-not-show-again dialogs"
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1384
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1385
    ^ [ 
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1386
        |sel|
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1387
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1388
        sel := warningSelector asMutator.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1389
        ParserFlags perform:sel with:false. 
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1390
        parserFlags perform:sel with:false ifNotUnderstood:[]. 
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1391
    ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1392
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1393
    "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1394
     self basicNew actionToDisableWarning:#warnAboutDeadCodeAndFixMe
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1395
    "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1396
!
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1397
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1398
clearErrorFlag
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1399
    errorFlag := false.
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1400
!
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1401
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1402
correctableError:message position:pos1 to:pos2
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1403
    "report an error which can be corrected by compiler -
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1404
     return non-false, if correction is wanted
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1405
     (there is more than true/false returned here)"
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1406
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1407
    |correctIt|
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1408
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1409
    requestor isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1410
	"/ self showErrorMessage:message position:pos1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1411
	correctIt := false
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1412
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1413
	self isDoIt ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1414
	    requestor warning:message position:pos1 to:pos2 from:self.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1415
	    correctIt := false.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1416
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1417
	    correctIt := requestor correctableError:message position:pos1 to:pos2 from:self
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1418
	].
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1419
    ].
1492
943f98b9334d handle #Error from correctableError
penk
parents: 1489
diff changeset
  1420
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1421
    ("correctIt == false or:["correctIt == #Error"]") ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1422
	self setErrorFlag.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1423
	exitBlock value
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1424
    ].
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1425
    ^ correctIt
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1426
2877
8575935bb3b5 changed: #correctableError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
  1427
    "Created: / 13-05-1998 / 16:45:56 / cg"
4274
d604349a9c8a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
  1428
    "Modified: / 13-06-2018 / 12:46:32 / Claus Gittinger"
4276
05b51337c941 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 4274
diff changeset
  1429
    "Modified: / 15-06-2018 / 14:55:26 / Stefan Vogel"
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1430
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1431
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1432
correctableSelectorWarning:message position:pos1 to:pos2
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1433
    "report a warning which can be corrected by compiler -
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1434
     return non-false, if correction is wanted (there is more than
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1435
     true/false returned here)"
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1436
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1437
    |correctIt|
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1438
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1439
    requestor isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1440
	correctIt := false
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1441
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1442
	DoNotShowCompilerWarningAgainActionQuery handle:[:ex |
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1443
	    parserFlags warnAboutPossiblyUnimplementedSelectors:false.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1444
	    ParserFlags warnAboutPossiblyUnimplementedSelectors:false.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1445
	    ex proceed.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1446
	] do:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1447
	    correctIt := requestor correctableSelectorWarning:message position:pos1 to:pos2 from:self
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1448
	]
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1449
    ].
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1450
    correctIt == false ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1451
	exitBlock value
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1452
    ].
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1453
    ^ correctIt
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1454
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1455
    "Created: / 19-01-2000 / 16:28:03 / cg"
1023
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1456
!
6d16edd3b99c correctable selectors.
Claus Gittinger <cg@exept.de>
parents: 1020
diff changeset
  1457
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1458
correctableWarning:aMessage doNotShowAgainAction:doNotShowAgainAction doNotShowAgainForThisMethodAction:doNotShowAgainForThisMethodAction position:position to:endPos
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1459
    "notify requestor of a warning - if there is no requestor, just ignore it.
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1460
     Return the result passed back from the requestor (or false, if there is none)."
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1461
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1462
    |answer warnAction realAction real2Action|
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1463
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1464
    ignoreWarnings ifTrue:[ ^ false ].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1465
    parserFlags warnings ifFalse:[^ false].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1466
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1467
    requestor isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1468
	^ false
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1469
    ].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1470
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1471
    warnAction := [ answer := requestor correctableWarning:aMessage position:position to:endPos from:self ].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1472
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1473
    doNotShowAgainAction notNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1474
	realAction := warnAction.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1475
	warnAction :=
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1476
	    [
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1477
		DoNotShowCompilerWarningAgainActionQuery
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1478
		    answer:doNotShowAgainAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1479
		    do:realAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1480
	    ].
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1481
    ].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1482
    (doNotShowAgainForThisMethodAction notNil and:[ self isDoIt not ]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1483
	real2Action := warnAction.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1484
	warnAction :=
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1485
	    [
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1486
		DoNotShowCompilerWarningAgainForThisMethodActionQuery
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1487
		    answer:doNotShowAgainForThisMethodAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1488
		    do:real2Action
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1489
	    ].
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1490
    ].
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1491
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1492
    warnAction value.
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1493
    ^ answer
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1494
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1495
    "Created: / 28-02-2012 / 08:42:01 / cg"
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1496
!
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1497
2452
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1498
correctableWarning:message position:pos1 to:pos2
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1499
    "report an error which can be corrected by compiler -
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1500
     return non-false, if correction is wanted
3283
22fb2ba70dd9 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  1501
     (there is more than true/false returned here - i.e. a symbol, describing how to fix it)"
2452
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1502
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1503
    |correctIt|
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1504
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1505
    requestor isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1506
	"/ self showErrorMessage:message position:pos1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1507
	correctIt := false
2452
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1508
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1509
	correctIt := requestor correctableWarning:message position:pos1 to:pos2 from:self
2452
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1510
    ].
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1511
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1512
    (correctIt == false or:[correctIt == #Error]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1513
	exitBlock value
2452
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1514
    ].
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1515
    ^ correctIt
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1516
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1517
    "Created: / 02-11-2010 / 13:32:32 / cg"
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1518
!
68a907bd9bd1 added: #correctableWarning:position:to:
Claus Gittinger <cg@exept.de>
parents: 2395
diff changeset
  1519
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1520
disableWarningsOnCurrentMethodFor:flagName
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1521
    "ignored here"
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1522
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1523
    "Created: / 28-02-2012 / 14:44:43 / cg"
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1524
!
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1525
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1526
errorFlag:flagArg
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1527
    errorFlag := flagArg
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1528
!
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1529
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1530
errorMessagePrefix
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1531
    ^ 'Error:'
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1532
!
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  1533
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1534
ignorableParseError:message
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1535
    self parseError:message.
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1536
    "/ if proceeded, install method anyway (used with non-st/x primitives)
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1537
    self clearErrorFlag
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1538
!
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1539
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1540
invalidCharacter:ch
4688
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1541
    |errMsg codePoint|
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1542
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1543
    codePoint := ch codePoint.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1544
    codePoint = 16r2190 "back arrow" ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1545
        errMsg := 'old style arrow for assignment: "' , ch asString , '" (' , (codePoint radixPrintStringRadix:16) , '). Please change this to ":="'.
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1546
    ] ifFalse:[
4688
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1547
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1548
        ch isPrintable ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1549
            errMsg := 'Invalid character: ''' , ch asString , ''' ', '(' , (codePoint radixPrintStringRadix:16) , ').'.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1550
        ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1551
            errMsg := 'Invalid character: ' , (codePoint radixPrintStringRadix:16) , '.'.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1552
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1553
        codePoint > 16r7F ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1554
            errMsg := errMsg , '
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1555
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1556
    Notice:
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1557
      Only 7-bit ascii allowed (for compatibility with other Smalltalk dialects).
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1558
      You can enable some of the special characters via the compiler-settings dialog
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1559
      or by setting "allowNationalCharactersInIdentifier" / "allowGreekCharactersInIdentifier"
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1560
      in the ParserFlags.'.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  1561
        ].
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1562
    ].
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1563
    self syntaxError:errMsg position:tokenPosition to:tokenPosition.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1564
    source next.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1565
    tokenName := token := nil.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1566
    tokenType := #Error.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1567
    ^ #Error
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1568
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1569
    "Modified: / 17-11-2016 / 09:37:52 / cg"
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  1570
    "Modified: / 08-06-2019 / 18:14:06 / Claus Gittinger"
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1571
!
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1572
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1573
lastTokenLineNumber
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1574
    "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
  1575
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1576
    ^ tokenLineNr
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1577
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1578
    "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
  1579
    "Modified: 23.5.1997 / 12:16:12 / cg"
431
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1580
!
058e1ce760ea added access to lastTokenLineNr
Claus Gittinger <cg@exept.de>
parents: 426
diff changeset
  1581
4562
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1582
notifyError:aMessage as:errorClassOrNil position:position to:endPos lineNr:lineNrOrNil
4331
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1583
    "notify requestor of an error - if there is no requestor
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1584
     put it on the transcript. Requestor is typically the CodeView
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1585
     in which the accept/doIt was triggered, or the PositionableStream
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1586
     which does the fileIn. The requestor may decide how to highlight the
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1587
     error (and/or to abort the compile).
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1588
     Return the result passed back by the requestor."
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1589
4228
c7d5c6eb99ec #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4190
diff changeset
  1590
    (Smalltalk isInitialized not and:[Smalltalk isDebuggableApp]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1591
	"/ error during startup, but sometimes we expect an error and want to suppress it
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1592
	Parser parseWarningSignal query ~~ #ignore ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1593
	    (self className,' [error]: error during initialization:') errorPrint.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1594
	    aMessage errorPrintCR.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1595
	    thisContext fullPrintAll.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1596
	].
2785
87cfec5ba268 changed: #notifyError:position:to:
az
parents: 2766
diff changeset
  1597
    ].
87cfec5ba268 changed: #notifyError:position:to:
az
parents: 2766
diff changeset
  1598
3066
4f9c89ea8698 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3056
diff changeset
  1599
    ignoreErrors ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1600
	"/ usually done, when syntax highlighting or looking for used variables
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1601
	"/ self halt.
3066
4f9c89ea8698 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3056
diff changeset
  1602
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1603
	"/ Raise an error.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1604
	"/ For backward compatibility, if requestor
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1605
	"/ IS set, then dispatch to requestor.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1606
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1607
	"/ backward compatibility - will vanish eventually (use a handler, Luke)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1608
	requestor notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1609
	    requestor error:aMessage position:position to:endPos from:self.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1610
	    ^ self
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1611
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1612
	(errorClassOrNil ? ParseError) new
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1613
	    errorMessage:aMessage startPosition:position endPosition:endPos;
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1614
	    parameter:self;
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1615
	    lineNumber:(lineNrOrNil ? tokenLineNr); "lineNr"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1616
	    raiseRequest.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1617
    ].
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1618
4331
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1619
    "Created: / 08-02-2019 / 11:15:37 / Claus Gittinger"
4453
da91ed5bc7fa #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4443
diff changeset
  1620
    "Modified: / 28-06-2019 / 09:11:44 / Claus Gittinger"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1621
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1622
4562
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1623
notifyError:aMessage position:position to:endPos
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1624
    "notify requestor of an error - if there is no requestor
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1625
     put it on the transcript. Requestor is typically the CodeView
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1626
     in which the accept/doIt was triggered, or the PositionableStream
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1627
     which does the fileIn. The requestor may decide how to highlight the
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1628
     error (and/or to abort the compile).
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1629
     Return the result passed back by the requestor."
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1630
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1631
    ^ self notifyError:aMessage position:position to:endPos lineNr:nil
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1632
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1633
    "Modified: / 18-01-2012 / 14:54:22 / Alexander Zottnick"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1634
    "Modified: / 19-01-2012 / 10:18:36 / cg"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1635
    "Modified: / 02-05-2014 / 14:51:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1636
    "Modified: / 19-04-2018 / 10:39:56 / stefan"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1637
    "Modified: / 08-02-2019 / 11:15:59 / Claus Gittinger"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1638
!
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1639
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1640
notifyError:aMessage position:position to:endPos lineNr:lineNrOrNil
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1641
    "notify requestor of an error - if there is no requestor
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1642
     put it on the transcript. Requestor is typically the CodeView
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1643
     in which the accept/doIt was triggered, or the PositionableStream
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1644
     which does the fileIn. The requestor may decide how to highlight the
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1645
     error (and/or to abort the compile).
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1646
     Return the result passed back by the requestor."
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1647
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1648
    self notifyError:aMessage as:nil position:position to:endPos lineNr:lineNrOrNil
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1649
!
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1650
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1651
notifyWarning:aMessage doNotShowAgainAction:doNotShowAgainAction doNotShowAgainForThisMethodAction:doNotShowAgainForThisMethodAction position:position to:endPos
2455
acdcc9b42d41 comment/format in: #notifyWarning:doNotShowAgainAction:position:to:
Claus Gittinger <cg@exept.de>
parents: 2452
diff changeset
  1652
    "notify requestor of a warning - if there is no requestor, just ignore it.
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  1653
     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
  1654
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1655
    |answer warnAction realAction real2Action|
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1656
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1657
    ignoreWarnings ifTrue:[ ^ false ].
2478
21ef13183fb5 changed: #notifyWarning:doNotShowAgainAction:position:to:
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1658
    parserFlags warnings ifFalse:[^ false].
21ef13183fb5 changed: #notifyWarning:doNotShowAgainAction:position:to:
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1659
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1660
    requestor isNil ifTrue:[
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1661
"/        self showErrorMessage:aMessage position:position.
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1662
	^ false
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1663
    ].
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1664
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1665
    warnAction := [ answer := requestor warning:aMessage position:position to:endPos from:self ].
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1666
1457
e71ddaf82e50 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1667
    doNotShowAgainAction notNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1668
	realAction := warnAction.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1669
	warnAction :=
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1670
	    [
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1671
		DoNotShowCompilerWarningAgainActionQuery
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1672
		    answer:doNotShowAgainAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1673
		    do:realAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1674
	    ].
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1675
    ].
2846
d7ddf430ff69 changed: #notifyWarning:doNotShowAgainAction:doNotShowAgainForThisMethodAction:position:to:
Claus Gittinger <cg@exept.de>
parents: 2833
diff changeset
  1676
    (doNotShowAgainForThisMethodAction notNil and:[ self isDoIt not ]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1677
	real2Action := warnAction.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1678
	warnAction :=
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1679
	    [
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1680
		DoNotShowCompilerWarningAgainForThisMethodActionQuery
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1681
		    answer:doNotShowAgainForThisMethodAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1682
		    do:real2Action
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1683
	    ].
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1684
    ].
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1685
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1686
    warnAction value.
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1687
    ^ answer
2455
acdcc9b42d41 comment/format in: #notifyWarning:doNotShowAgainAction:position:to:
Claus Gittinger <cg@exept.de>
parents: 2452
diff changeset
  1688
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1689
    "Created: / 28-02-2012 / 08:42:01 / cg"
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1690
!
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1691
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1692
notifyWarning:aMessage doNotShowAgainAction:doNotShowAgainAction position:position to:endPos
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1693
    "notify requestor of a warning - if there is no requestor, just ignore it.
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1694
     Return the result passed back from the requestor (or false, if there is none)."
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1695
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1696
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1697
	notifyWarning:aMessage
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1698
	doNotShowAgainAction:doNotShowAgainAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1699
	doNotShowAgainForThisMethodAction:nil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1700
	position:position to:endPos
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1701
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1702
    "Modified: / 28-02-2012 / 08:44:45 / cg"
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1703
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  1704
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1705
notifyWarning:aMessage position:position to:endPos
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1706
    "notify requestor of an warning - if there is no requestor
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1707
     put it on the transcript.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1708
     Return the result passed back by the requestor."
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1709
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1710
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1711
	notifyWarning:aMessage
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1712
	doNotShowAgainAction:nil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1713
	position:position to:endPos.
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1714
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1715
    "Modified (format): / 28-02-2012 / 08:44:13 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1716
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1717
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1718
parseError:aMessage
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1719
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1720
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1721
    ^ self parseError:aMessage position:tokenPosition to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1722
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1723
    "Created: / 13.5.1998 / 16:45:13 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1724
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1725
4562
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1726
parseError:aMessage as:errorClassOrNil position:position to:endPos
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1727
    "report an error"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1728
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1729
    |fullMessage|
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1730
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1731
    Smalltalk isInitialized ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1732
	(self className,' [error]: error during initialization:') errorPrint.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1733
	aMessage errorPrintCR.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1734
	thisContext fullPrintAll.
4562
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1735
    ].
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1736
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1737
    "/ fullMessage := (self errorMessagePrefix) , ' ' , (aMessage ? '???').
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1738
    fullMessage := (aMessage ? 'Unspecified error').
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1739
    self setErrorFlag.
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1740
    self notifyError:fullMessage as:errorClassOrNil position:position to:endPos lineNr:nil.
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1741
    exitBlock value.
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1742
    ^ false
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1743
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1744
    "Created: / 13-05-1998 / 16:44:55 / cg"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1745
    "Modified: / 22-08-2006 / 14:13:11 / cg"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1746
    "Modified: / 28-06-2019 / 09:11:48 / Claus Gittinger"
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1747
!
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1748
1900
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1749
parseError:aMessage line:lNr
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1750
    "report an error"
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1751
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1752
    |position|
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1753
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1754
    tokenLineNr := lNr.
1948
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1755
    position := self positionFromLineNumber:lNr.
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1756
    ^ self parseError:aMessage position:position to:nil
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1757
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1758
    "Created: / 13-05-1998 / 16:45:05 / cg"
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1759
    "Modified: / 16-11-2006 / 14:29:00 / cg"
1900
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1760
!
66c65b0abf72 error messages (line based)
Claus Gittinger <cg@exept.de>
parents: 1856
diff changeset
  1761
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1762
parseError:aMessage position:position
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1763
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1764
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1765
    ^ self parseError:aMessage position:position to:nil
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1766
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1767
    "Created: / 13.5.1998 / 16:45:05 / cg"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1768
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1769
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1770
parseError:aMessage position:position to:endPos
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1771
    "report an error"
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1772
4562
73eef83b197e #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4533
diff changeset
  1773
    self parseError:aMessage as:nil position:position to:endPos
709
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1774
!
b4351947a598 moved error methods up
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  1775
1948
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1776
positionFromLineNumber:lNr
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1777
    (requestor notNil and:[requestor isTextView]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1778
	^ requestor characterPositionOfLine:lNr col:1.
1948
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1779
    ].
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1780
    ^ nil
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1781
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1782
    "Created: / 16-11-2006 / 14:28:37 / cg"
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1783
!
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  1784
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1785
setErrorFlag
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1786
    errorFlag := true.
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1787
!
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1788
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1789
showErrorMessage:aMessage position:pos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1790
    "show an errormessage on the Transcript"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1791
1976
d335a3fa358f When writing error messages to Transcript, say who generated them
Stefan Vogel <sv@exept.de>
parents: 1972
diff changeset
  1792
    (ignoreErrors or:[Smalltalk silentLoading]) ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1793
	Transcript showCR:('Scanner [<4p> line:<1p> off:<2p>]: <3p>'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1794
			    expandMacrosWith:tokenLineNr
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1795
			    with:pos with:aMessage with:source).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1796
    ]
274
8e120bd82c69 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 266
diff changeset
  1797
4331
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1798
    "Modified: / 18-05-1996 / 15:44:35 / cg"
b4baf7ebed5a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4320
diff changeset
  1799
    "Modified (format): / 08-02-2019 / 11:05:35 / Claus Gittinger"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1800
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1801
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1802
syntaxError:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1803
    "a syntax error happened - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1804
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1805
    ^ self syntaxError:aMessage position:tokenPosition
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1806
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1807
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1808
syntaxError:aMessage position:position
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1809
    "a syntax error happened - only start position is known"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1810
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1811
    ^ self syntaxError:aMessage position:position to:nil
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1812
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  1813
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1814
syntaxError:aMessage position:position to:endPos
2523
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1815
    "a syntax error happened.
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1816
     Return true for correction, false if not"
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1817
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1818
    |fullMessage ret|
1856
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1819
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1820
    "/ fullMessage := self errorMessagePrefix , ' ' , aMessage.
209089a85ed3 error messages shortened and cleanup
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1821
    fullMessage := aMessage.
2523
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1822
    ret := self notifyError:fullMessage position:position to:endPos.
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1823
    "/ exitBlock value.
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1824
    "/ ^ false
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1825
    self setErrorFlag.
2523
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1826
    ^ ret.
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1827
4fc32fe8edc7 changed: #syntaxError:position:to:
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  1828
    "Modified: / 30-06-2011 / 19:49:19 / cg"
87
claus
parents: 83
diff changeset
  1829
!
claus
parents: 83
diff changeset
  1830
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1831
warnCommonMistake:msg at:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1832
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1833
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1834
    self warnCommonMistake:msg position:position to:position
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1835
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1836
    "Modified: 23.5.1997 / 12:16:34 / cg"
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1837
!
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1838
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1839
warnCommonMistake:msg position:pos1 to:pos2
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1840
    "warn about a common beginners mistake"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1841
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1842
    ignoreWarnings ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1843
	parserFlags warnings ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1844
	    parserFlags warnCommonMistakes ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1845
		self
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1846
		    warning:msg
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1847
		    position:pos1 to:pos2.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1848
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  1849
	]
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1850
    ]
311
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1851
1fcbd4311698 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1852
    "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
  1853
    "Modified: 23.5.1997 / 12:16:39 / cg"
310
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1854
!
27ed956b591e beginners common error warnings
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
  1855
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1856
warnDollarAt:position
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1857
    "warn about $-character in an identifier"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1858
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1859
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1860
        didWarnAboutDollarInIdentifier ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1861
            parserFlags warnDollarInIdentifier ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1862
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1863
                    warning:'$-characters in identifiers/symbols are nonportable'
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1864
                    doNotShowAgainAction:(self actionToDisableWarning:#warnDollarInIdentifier)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1865
                    position:position to:position.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1866
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1867
                 only warn once (per method)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1868
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1869
                didWarnAboutDollarInIdentifier := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1870
            ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1871
        ]
608
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1872
    ]
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1873
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1874
    "Created: 7.9.1997 / 01:50:24 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1875
    "Modified: 7.9.1997 / 01:51:13 / cg"
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1876
!
faa97ce2db56 allow dollars in identifiers
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1877
87
claus
parents: 83
diff changeset
  1878
warnOldStyleAssignmentAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1879
    "warn about an oldStyle assignment"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1880
87
claus
parents: 83
diff changeset
  1881
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1882
        didWarnAboutOldStyleAssignment ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1883
            parserFlags warnOldStyleAssignment ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1884
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1885
                    warning:'Old style assignment - please change to use '':='''
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1886
                    doNotShowAgainAction:(self actionToDisableWarning:#warnOldStyleAssignment)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1887
                    position:position to:position.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1888
            ].
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1889
            "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1890
             only warn once (per method)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1891
            "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1892
            didWarnAboutOldStyleAssignment := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1893
        ]
87
claus
parents: 83
diff changeset
  1894
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1895
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1896
    "Modified: 23.5.1997 / 12:16:48 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1897
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1898
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1899
warnParagraphAt:position
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  1900
    "warn about §-character in an identifier"
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1901
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1902
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1903
        "/ didWarnAboutParagraphInIdentifier ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1904
            parserFlags warnParagraphInIdentifier ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1905
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1906
                    warning:'§-characters in identifiers/symbols are nonportable'
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1907
                    doNotShowAgainAction:(self actionToDisableWarning:#warnParagraphInIdentifier)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1908
                    position:position to:position.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1909
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1910
                 only warn once (per method)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1911
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1912
                parserFlags := parserFlags copy.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1913
                parserFlags warnParagraphInIdentifier:false.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1914
                "/ didWarnAboutParagraphInIdentifier := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1915
            ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1916
        "/ ]
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1917
    ]
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1918
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1919
    "Created: / 17-11-2016 / 09:16:22 / cg"
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1920
!
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  1921
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1922
warnPeriodAt:position
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1923
    "warn about a period in an identifier"
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1924
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1925
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1926
        didWarnAboutPeriodInSymbol ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1927
            parserFlags warnAboutPeriodInSymbol ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1928
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1929
                    warning:'Period in symbols are nonportable'
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1930
                    doNotShowAgainAction:(self actionToDisableWarning:#warnAboutPeriodInSymbol)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1931
                    position:position to:position.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1932
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1933
                 only warn once (per method)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1934
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1935
                didWarnAboutPeriodInSymbol := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1936
            ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1937
        ]
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1938
    ]
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1939
!
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  1940
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1941
warnPossibleIncompatibility:msg position:pos1 to:pos2
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1942
    "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
  1943
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1944
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1945
        parserFlags warnPossibleIncompatibilities ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1946
            self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1947
                warning:('Possible incompatibility.\\' , msg) withCRs
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1948
                doNotShowAgainAction:(self actionToDisableWarning:#warnPossibleIncompatibilities)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1949
                position:pos1 to:pos2.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1950
        ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1951
    ]
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1952
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1953
    "Created: 23.5.1997 / 12:17:54 / cg"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1954
    "Modified: 23.5.1997 / 12:22:37 / cg"
87
claus
parents: 83
diff changeset
  1955
!
claus
parents: 83
diff changeset
  1956
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1957
warnSTXSpecialCommentAt:position to:endPosition
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1958
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1959
        didWarnAboutSTXSpecialComment ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1960
            parserFlags warnSTXSpecialComment ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1961
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1962
                    warning:'End-of-line comments are a nonstandard feature of ST/X'
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1963
                    doNotShowAgainAction:(self actionToDisableWarning:#warnSTXSpecials)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1964
                    doNotShowAgainForThisMethodAction: [ self disableWarningsOnCurrentMethodFor: #warnSTXSpecials ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1965
                    position:position to:endPosition.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1966
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1967
                 only warn once
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1968
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1969
                didWarnAboutSTXSpecialComment := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1970
            ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1971
        ]
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1972
    ].
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  1973
2854
64b0decefcec changed: #warnSTXSpecialCommentAt:to:
Claus Gittinger <cg@exept.de>
parents: 2846
diff changeset
  1974
    "Modified: / 16-03-2012 / 18:37:11 / cg"
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1975
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  1976
87
claus
parents: 83
diff changeset
  1977
warnUnderscoreAt:position
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1978
    "warn about an underscore in an identifier"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1979
87
claus
parents: 83
diff changeset
  1980
    ignoreWarnings ifFalse:[
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1981
        didWarnAboutUnderscoreInIdentifier ifFalse:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1982
            parserFlags warnUnderscoreInIdentifier ifTrue:[
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1983
                self
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1984
                    warning:'Underscores in identifiers/symbols are nonportable'
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1985
                    doNotShowAgainAction:(self actionToDisableWarning:#warnUnderscoreInIdentifier)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1986
                    position:position to:position.
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1987
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1988
                 only warn once (per method)
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1989
                "
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1990
                didWarnAboutUnderscoreInIdentifier := true
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1991
            ]
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  1992
        ]
87
claus
parents: 83
diff changeset
  1993
    ]
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1994
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  1995
    "Modified: 23.5.1997 / 12:17:06 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1996
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1997
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1998
warning:aMessage
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  1999
    "a warning - position is not known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2000
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2001
    ^ self warning:aMessage position:tokenPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2002
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2003
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2004
warning:aMessage doNotShowAgainAction:doNotShowAgainAction doNotShowAgainForThisMethodAction:doNotShowAgainForThisMethodAction position:position to:endPos
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  2005
    "a warning"
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  2006
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2007
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2008
	notifyWarning:((self warningMessagePrefix) , ' ' , aMessage)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2009
	doNotShowAgainAction:doNotShowAgainAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2010
	doNotShowAgainForThisMethodAction:doNotShowAgainForThisMethodAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2011
	position:position to:endPos
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2012
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2013
    "Created: / 28-02-2012 / 08:38:16 / cg"
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2014
!
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2015
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2016
warning:aMessage doNotShowAgainAction:doNotShowAgainAction position:position to:endPos
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2017
    "a warning"
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2018
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2019
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2020
	warning:aMessage
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2021
	doNotShowAgainAction:doNotShowAgainAction
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2022
	doNotShowAgainForThisMethodAction:nil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2023
	position:position to:endPos
2831
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2024
48764c0239d6 per method warning control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
  2025
    "Modified: / 28-02-2012 / 08:43:00 / cg"
1454
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  2026
!
d3c4be472930 support doNotSHowThisWarningDialogAgain
Claus Gittinger <cg@exept.de>
parents: 1434
diff changeset
  2027
1948
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2028
warning:aMessage line:lNr
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2029
    "a warning - only start position is known"
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2030
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2031
    |position|
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2032
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2033
    position := self positionFromLineNumber:lNr.
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2034
    ^ self warning:aMessage position:position to:nil
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2035
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2036
    "Created: / 16-11-2006 / 14:29:30 / cg"
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2037
!
40baccddc2f6 warn code
Claus Gittinger <cg@exept.de>
parents: 1930
diff changeset
  2038
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2039
warning:aMessage position:position
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2040
    "a warning - only start position is known"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2041
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2042
    ^ self warning:aMessage position:position to:nil
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2043
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2044
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2045
warning:aMessage position:position to:endPos
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2046
    "a warning"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2047
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2048
    ^ self
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2049
	notifyWarning:((self warningMessagePrefix) , ' ' , aMessage)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2050
	doNotShowAgainAction:nil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2051
	position:position to:endPos
1073
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2052
!
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2053
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2054
warningMessagePrefix
d6041f6d680c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
  2055
    ^ 'Warning:'
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2056
! !
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2057
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2058
!Scanner methodsFor:'general scanning'!
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2059
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2060
scanNumberFrom:aStringOrStream
3143
a63efacc46fe class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2061
    "scan aSourceString for the next number in smalltalk syntax.
3144
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2062
     Return the number or nil. Leave the position of the stream after the number
3143
a63efacc46fe class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2063
     or unchanged (if no number is coming)
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2064
     Extension:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2065
	since constant fractions (int/int) are treated like lexical tokens (not messages)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2066
	in Smalltalk/X, this also reads fractions."
3143
a63efacc46fe class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2067
3144
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2068
    |oldPos posAfter denominator numerator parentized sign|
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2069
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2070
    self initializeFor:aStringOrStream.
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2071
    oldPos := source position.
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2072
    self nextToken.
3144
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2073
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2074
    sign := 1.
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2075
    tokenType == #BinaryOperator ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2076
	tokenName = '+' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2077
	    self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2078
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2079
	    tokenName = '-' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2080
		sign := -1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2081
		self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2082
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2083
	].
3144
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2084
    ].
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2085
    (parentized := tokenType == $( ) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2086
	self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2087
	tokenType == #BinaryOperator ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2088
	    tokenName = '+' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2089
		self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2090
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2091
		tokenName = '-' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2092
		    sign := sign negated.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2093
		    self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2094
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2095
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2096
	].
3144
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2097
    ].
4b5bd511d848 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3143
diff changeset
  2098
3143
a63efacc46fe class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2099
    (tokenValue isNumber) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2100
	"/ must keep stream positioned correctly
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2101
	"/ (undo lookahead)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2102
	posAfter := source position.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2103
	peekChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2104
	    peekChar2 notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2105
		posAfter := posAfter - 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2106
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2107
	    posAfter := posAfter - 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2108
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2109
	tokenValue isInteger ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2110
	    source skipSeparators == $/ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2111
		numerator := tokenValue.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2112
		self nextToken. "/ skip /
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2113
		"/ oops - must check for //
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2114
		tokenName = '/' ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2115
		    parentized ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2116
			"/ nothing at all
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2117
			source position:oldPos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2118
			^ nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2119
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2120
		    "/ only an integer
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2121
		    source position:posAfter.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2122
		    ^ tokenValue
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2123
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2124
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2125
		self nextToken. "/ get denominator
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2126
		tokenType == #BinaryOperator ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2127
		    tokenName = '+' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2128
			self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2129
		    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2130
			tokenName = '-' ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2131
			    sign := sign negated.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2132
			    self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2133
			].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2134
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2135
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2136
		(tokenType == #Integer and:[tokenValue isInteger]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2137
		    denominator := tokenValue.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2138
		    tokenValue := Fraction numerator:numerator denominator:denominator.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2139
		    posAfter := source position.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2140
		    peekChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2141
			peekChar2 notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2142
			    posAfter := posAfter - 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2143
			].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2144
			posAfter := posAfter - 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2145
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2146
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2147
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2148
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2149
	parentized ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2150
	    tokenType == $) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2151
		self nextToken
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2152
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2153
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2154
	    source position:posAfter.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2155
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2156
	sign == -1 ifTrue:[^ tokenValue negated].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2157
	^ tokenValue
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2158
    ].
996
53dbf13d1aa0 keep stream positioned correctly after scanNumberFrom:
Claus Gittinger <cg@exept.de>
parents: 983
diff changeset
  2159
    "/ backup in case of error; return nil
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  2160
    source position:oldPos.
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2161
    ^ nil.
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2162
4415
0f61a2a48a65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4414
diff changeset
  2163
    "Created: / 18-06-1998 / 23:05:22 / cg"
0f61a2a48a65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4414
diff changeset
  2164
    "Modified: / 19-11-1999 / 18:25:52 / cg"
0f61a2a48a65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4414
diff changeset
  2165
    "Modified (comment): / 23-05-2019 / 11:06:51 / Claus Gittinger"
4572
88aa6f2bcfbd #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 4571
diff changeset
  2166
    "Modified: / 28-09-2019 / 15:21:32 / Stefan Vogel"
737
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2167
!
4062aa740959 support for readSmalltalkSyntax
Claus Gittinger <cg@exept.de>
parents: 717
diff changeset
  2168
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2169
scanPositionsFor:aTokenString inString:aSourceString
3712
34ebeff819a2 #DOCUMENTATION
mawalch
parents: 3711
diff changeset
  2170
    "scan aSourceString for occurrences of aTokenString.
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2171
     Return a collection of start positions.
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  2172
     Added for VW compatibility (to support simple syntax-highlight)."
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2173
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2174
    |searchType searchName searchValue positions t|
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2175
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  2176
    aTokenString notNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2177
	"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2178
	 first, look what kind of token we have to search for
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2179
	"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2180
	self initializeFor:(ReadStream on:aTokenString).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2181
	self nextToken.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2182
	searchType := tokenType.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2183
	searchName := tokenName.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2184
	searchValue := tokenValue.
1577
31648db46af5 scan support
Claus Gittinger <cg@exept.de>
parents: 1572
diff changeset
  2185
    ].
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2186
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2187
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2188
     start the real work ...
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2189
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2190
    self initializeFor:(ReadStream on:aSourceString).
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2191
    positions := OrderedCollection new.
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2192
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2193
    [(t := self nextToken) ~~ #EOF] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2194
	searchType == t ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2195
	    (searchName isNil or:[tokenName = searchName]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2196
		(searchValue isNil or:[tokenValue = searchValue]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2197
		    positions add:tokenPosition.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2198
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2199
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2200
	]
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2201
    ].
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2202
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2203
    ^ positions
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2204
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2205
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2206
     Scanner new scanPositionsFor:'hello' inString:'foo bar hello baz hello'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2207
     Scanner new scanPositionsFor:'3.14' inString:'foo 3.145 bar hello 3.14 baz hello 3.14'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2208
     Scanner new scanPositionsFor:'16' inString:'foo 16 bar hello 16r10 baz hello 2r10000'
17
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2209
    "
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2210
! !
f06d70d785dc *** empty log message ***
claus
parents: 15
diff changeset
  2211
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2212
!Scanner methodsFor:'initialization'!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2213
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2214
initialize
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2215
    "initialize the scanner"
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2216
4121
aa655f2c52a5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4117
diff changeset
  2217
    "/ <modifier: #super> "must be called if redefined"
4112
98944176f360 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4083
diff changeset
  2218
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2219
    errorFlag := false.
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2220
    tokenPosition := 1.
610
0aa21dd74161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
  2221
    tokenLineNr := lineNr := 1.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2222
    currentComments := nil.
2740
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  2223
    "/ allow for these to be already set (kludge)
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  2224
    saveComments isNil ifTrue:[ saveComments := false ].
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  2225
    parserFlags isNil ifTrue:[ parserFlags := ParserFlags new ].
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2226
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2227
    ignoreErrors := false.
1930
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2228
    ignoreWarnings := parserFlags warnings not.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2229
    didWarnAboutSTXSpecialComment := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2230
    didWarnAboutUnderscoreInIdentifier := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2231
    didWarnAboutDollarInIdentifier := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2232
    didWarnAboutOldStyleAssignment := false.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2233
900
2914b42fa972 comment
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
  2234
    "/ not used here, but eases subclassing for other languages.
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2235
    scanColonAsKeyword isNil ifTrue:[ scanColonAsKeyword := true ].
1930
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2236
    self initializeActionTable.
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2237
4121
aa655f2c52a5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4117
diff changeset
  2238
    "Modified: / 13-02-2017 / 13:45:51 / cg"
1930
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2239
!
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2240
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2241
initializeActionTable
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
  2242
    actionArray := self class actionArray.
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2243
    unicodeActions := self class unicodeActions.
2140
f9b4ef3e9368 type- and actionArray are now class-instance variables
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
  2244
    typeArray := self class typeArray.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2245
1930
ff11ddb6de58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
  2246
    "Created: / 18-10-2006 / 23:10:55 / cg"
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2247
    "Modified: / 25-03-2011 / 13:57:50 / cg"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2248
!
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2249
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2250
initializeFlagsFrom:aScanner
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2251
    "initialize flags from another scanner"
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2252
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2253
    ignoreErrors := aScanner ignoreErrors.
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2254
    ignoreWarnings := aScanner ignoreWarnings.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2255
    parserFlags := aScanner parserFlags copy.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2256
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2257
    "/ not used here, but eases subclassing for other languages.
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2258
    scanColonAsKeyword := aScanner scanColonAsKeyword.
1362
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2259
!
b51578f0182e separated instance creation from scanning
penk
parents: 1356
diff changeset
  2260
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2261
initializeFor:aStringOrStream
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2262
    "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
  2263
2741
cdf6aa380b3e changed: #initializeFor:
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
  2264
    actionArray isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2265
	"/ if not already initialized...
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2266
	self initialize.
2741
cdf6aa380b3e changed: #initializeFor:
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
  2267
    ].
847
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  2268
    self source:aStringOrStream.
2741
cdf6aa380b3e changed: #initializeFor:
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
  2269
cdf6aa380b3e changed: #initializeFor:
Claus Gittinger <cg@exept.de>
parents: 2740
diff changeset
  2270
    "Modified: / 05-10-2011 / 09:24:00 / cg"
847
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  2271
!
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  2272
1962
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2273
requestor:anObject
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2274
    "set the requestor to be notified"
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2275
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2276
    requestor := anObject
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2277
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2278
    "Created: / 07-12-2006 / 18:13:13 / cg"
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2279
!
ed2bc05cbf65 + requestor:
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  2280
4420
eee7da6ae1e2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2281
setSource:newSourceStream
eee7da6ae1e2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2282
    source := newSourceStream
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  2283
4291
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2284
    "Modified: / 07-08-2018 / 07:46:57 / Claus Gittinger"
4420
eee7da6ae1e2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4419
diff changeset
  2285
    "Modified (format): / 25-05-2019 / 23:47:16 / Claus Gittinger"
1242
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  2286
!
52bc5f333553 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
  2287
847
7decf59c15ba added #source:
Claus Gittinger <cg@exept.de>
parents: 828
diff changeset
  2288
source:aStringOrStream
2766
638d8e48b77d changed: #source:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  2289
    "prepare for reading from aStringOrStream;
638d8e48b77d changed: #source:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  2290
     notice: if token is nonNil, it is preserved. This allows for scanning
638d8e48b77d changed: #source:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  2291
     across streams."
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2292
854
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  2293
    errorFlag := false.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  2294
    tokenPosition := 1.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  2295
    tokenLineNr := lineNr := 1.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  2296
    currentComments := nil.
4ccfe0a30d08 initialize scanner on #new
Stefan Vogel <sv@exept.de>
parents: 847
diff changeset
  2297
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2298
    aStringOrStream isStream ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2299
	source := ReadStream on:aStringOrStream string
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2300
    ] ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2301
	source := aStringOrStream.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2302
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2303
2762
66c6028c085d changed: #source:
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
  2304
    "Modified: / 26-05-1999 / 12:02:16 / stefan"
2766
638d8e48b77d changed: #source:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  2305
    "Modified: / 06-12-2011 / 00:45:50 / cg"
4341
f37f304d57f2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4337
diff changeset
  2306
    "Modified: / 10-02-2019 / 15:49:28 / Claus Gittinger"
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2307
! !
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  2308
1237
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2309
!Scanner methodsFor:'parser interface'!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2310
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2311
token
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2312
    ^ token
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2313
!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2314
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2315
tokenLineNr:lineNumberArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2316
    tokenLineNr := lineNumberArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2317
!
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2318
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2319
tokenPosition:positionArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2320
    tokenPosition := positionArg
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2321
! !
4c8cd98c5778 more refactorings for easier subclassing
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
  2322
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2323
!Scanner methodsFor:'private'!
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  2324
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2325
backupPosition
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2326
    "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
  2327
     one token too many"
20
f8dd8ba75205 *** empty log message ***
claus
parents: 17
diff changeset
  2328
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2329
    (tokenType == #EOF) ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2330
	source position:tokenPosition-1
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2331
    ]
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2332
!
15
992c3d87edbf *** empty log message ***
claus
parents: 10
diff changeset
  2333
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2334
beginComment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2335
    ^ self
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2336
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2337
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2338
characterNamed:name
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2339
    |idx|
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2340
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2341
    idx := #(
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2342
	     'nul' 'soh' 'stx' 'etx' 'eot' 'enq' 'ack' 'bel'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2343
	     'bs'  'ht'  'lf'  'vt'  'ff'  'cr'  'so'  'si'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2344
	     'dle' 'dc1' 'dc2' 'dc3' 'dc4' 'nak' 'syn' 'etb'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2345
	     'can' 'em'  'sub' 'esc' 'fs'  'gs'  'rs'  'us' ) indexOf:name.
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2346
    idx == 0 ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2347
	name = 'tab' ifTrue:[ ^ Character tab ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2348
	^ nil
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2349
    ].
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2350
    ^ Character value:idx-1
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2351
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2352
    "Created: / 08-02-2019 / 19:12:23 / Claus Gittinger"
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2353
!
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2354
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2355
checkForKeyword:string
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2356
    "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
  2357
     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
  2358
     or 'thisContext'.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2359
     '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
  2360
     identifier, if declared locally."
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2361
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2362
    |firstChar|
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2363
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2364
    firstChar := string at:1.
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2365
    (firstChar == $s) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2366
	(string = 'self')  ifTrue:[tokenType := #Self. ^true].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2367
	(string = 'super') ifTrue:[tokenType := #Super. ^true]
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2368
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2369
    (firstChar == $n) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2370
	(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
  2371
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2372
    (firstChar == $t) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2373
	(string = 'true') ifTrue:[tokenType := #True. tokenValue := true. ^true].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2374
	(string = 'thisContext') ifTrue:[tokenType := #ThisContext. ^true]
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2375
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2376
    (firstChar == $f) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2377
	(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
  2378
    ].
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2379
    ^ false
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2380
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2381
    "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
  2382
!
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2383
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2384
collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2385
    ^ collectedSource
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2386
!
74
fee7c3091f71 *** empty log message ***
claus
parents: 71
diff changeset
  2387
1236
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2388
eatPeekChar
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2389
    peekChar isNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2390
	source next.
1236
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2391
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2392
	peekChar := nil.
1236
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2393
    ].
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2394
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2395
    "Created: / 24.10.1998 / 17:25:39 / cg"
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2396
!
f613f961fd99 eatPeekChar moved
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
  2397
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2398
endComment:comment
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2399
    saveComments ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2400
	currentComments isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2401
	    currentComments := OrderedCollection with:comment
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2402
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2403
	    currentComments add:comment
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2404
	]
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  2405
    ].
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  2406
!
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  2407
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2408
endComment:commentString type:commentType
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2409
    "obsolete; left for backward compatibility"
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2410
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2411
    ^ self endComment:commentString type:commentType start:nil end:nil
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2412
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2413
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  2414
endComment:commentString type:commentType start:startPos end:endPos
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2415
    |comment|
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2416
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2417
    saveComments ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2418
	comment := Comment new commentString:commentString commentType:commentType.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2419
	comment startPosition:startPos endPosition:endPos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2420
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2421
	currentComments isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2422
	    currentComments := OrderedCollection with:comment
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2423
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2424
	    currentComments add:comment
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2425
	]
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2426
    ].
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2427
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2428
    "Created: / 17.2.1998 / 14:48:49 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2429
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  2430
2481
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2431
eolIsWhiteSpace
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2432
    ^ true
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2433
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2434
    "Created: / 14-03-2011 / 14:11:46 / cg"
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2435
!
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  2436
4345
e252e163a32c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4341
diff changeset
  2437
escapeCharacterFor:aCharacter escapeStyle:escapeStyle
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  2438
    "only if AllowExtendedSTXSyntax or AllowCStrings
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  2439
     or AllowEStrings is true
4345
e252e163a32c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4341
diff changeset
  2440
     For now: only use c-style, since stc does not support others.
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2441
	'c' - C-style escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2442
			\n,\t,\r,\b,\xXX,\uXXXX,\UXXXXXX,
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2443
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2444
     much like character escapes in C-literals;
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2445
     expands:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2446
	\n      newLine
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2447
	\r      return
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2448
	\t      tab
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2449
	\b      backspace
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2450
	\f      formfeed
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2451
	\g      bell
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2452
	\0      nul
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2453
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2454
	\\        backSlash
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2455
	\ ...\    (backslash-separator) ignored up to next backslash
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2456
	\xNN      hexCharacter
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2457
	\uNNNN    hex UnicodeCharacter
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2458
	\UNNNNNN  hex UnicodeCharacter
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2459
	\<name>   named character
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2460
    "
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2461
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2462
    |ascii nextChar fetchNext name pos1|
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2463
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2464
    aCharacter == $n ifTrue:[^ Character nl].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2465
    aCharacter == $r ifTrue:[^ Character return].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2466
    aCharacter == $t ifTrue:[^ Character tab].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2467
    aCharacter == $b ifTrue:[^ Character backspace].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2468
    aCharacter == $f ifTrue:[^ Character ff].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2469
    aCharacter == $g ifTrue:[^ Character bell].
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2470
    aCharacter == $0 ifTrue:[^ Character null].
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2471
    aCharacter == $\ ifTrue:[^ aCharacter].
4345
e252e163a32c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4341
diff changeset
  2472
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2473
    aCharacter == $< ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2474
	pos1 := source position.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2475
	name := ''.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2476
	nextChar := source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2477
	[nextChar notNil and:[nextChar ~~ $>]] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2478
	    nextChar isLetter ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2479
		self syntaxError:'letter expected in character name escape in string literal'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2480
		     position:pos1 to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2481
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2482
	    name size > 10 ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2483
		self syntaxError:'long character name escape in string literal'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2484
		     position:pos1 to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2485
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2486
	    name := name , nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2487
	    nextChar := source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2488
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2489
	nextChar := self characterNamed:name.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2490
	nextChar isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2491
	    self syntaxError:'invalid character name escape in string literal'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2492
		 position:pos1 to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2493
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2494
	^ nextChar
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2495
    ].
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2496
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2497
    aCharacter isSeparator ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2498
	nextChar := source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2499
	[nextChar notNil and:[nextChar ~~ $\]] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2500
	    (nextChar == Character cr) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2501
		lineNr := lineNr + 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2502
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2503
	    nextChar := source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2504
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2505
	^ nil
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2506
    ].
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2507
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2508
    (aCharacter == $x
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  2509
      or:[ (aCharacter == $u)
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  2510
      or:[ (aCharacter == $U) ]]
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  2511
    ) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2512
	pos1 := source position.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2513
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2514
	fetchNext :=
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2515
	    [
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2516
		nextChar := source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2517
		(nextChar notNil and:[nextChar isDigitRadix:16]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2518
		    self syntaxError:'hex digit expected in string literal'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2519
			 position:pos1 to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2520
		    0
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2521
		] ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2522
		    nextChar digitValue
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2523
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2524
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2525
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2526
	ascii := fetchNext value.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2527
	ascii := (ascii bitShift:4) bitOr:(fetchNext value).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2528
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2529
	((aCharacter == $u ) or:[(aCharacter == $U )]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2530
	    ascii := (ascii bitShift:4) bitOr:(fetchNext value).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2531
	    ascii := (ascii bitShift:4) bitOr:(fetchNext value).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2532
	    (aCharacter == $U) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2533
		ascii := (ascii bitShift:4) bitOr:(fetchNext value).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2534
		ascii := (ascii bitShift:4) bitOr:(fetchNext value).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2535
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2536
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2537
	^ Character value:ascii.
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2538
    ].
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2539
    ^ aCharacter
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2540
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2541
    "
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2542
     ParserFlags allowExtendedSTXSyntax:true
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2543
    "
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2544
    "
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2545
     'hello\nworld'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2546
     'hello\x0Dworld'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2547
     'hello\x08world'
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2548
     'hello\
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2549
    \world'
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2550
    "
1681
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2551
    "
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2552
     ParserFlags allowExtendedSTXSyntax:false
2fd6c846b159 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  2553
    "
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  2554
4345
e252e163a32c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4341
diff changeset
  2555
    "Created: / 11-02-2019 / 12:27:25 / Claus Gittinger"
4460
54ff9d1c05bd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  2556
    "Modified: / 21-07-2019 / 08:20:08 / Claus Gittinger"
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2557
!
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  2558
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2559
ignoreErrors
1365
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2560
    "return the flag which controls notification of errors"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2561
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2562
    ^ ignoreErrors
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2563
!
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2564
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2565
ignoreErrors:aBoolean
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2566
    "enable/disable notification of errors"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2567
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2568
    ignoreErrors := aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2569
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2570
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2571
ignoreWarnings
1365
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2572
    "return the flag which controls notification of warnings"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2573
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2574
    ^ ignoreWarnings
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2575
!
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2576
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2577
ignoreWarnings:aBoolean
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2578
    "enable/disable notification of warnings"
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2579
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1362
diff changeset
  2580
    ignoreWarnings := aBoolean
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2581
!
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2582
714
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2583
isCommentCharacter:ch
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2584
    "return true, if ch is the comment-start character.
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2585
     Brought into a separate method to allow for easier subclassing"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2586
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2587
    ^ ch == $"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2588
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2589
    "Created: / 14.5.1998 / 20:51:42 / cg"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2590
    "Modified: / 14.5.1998 / 20:53:01 / cg"
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2591
!
09f35b01bbcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  2592
2983
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  2593
isDoIt
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  2594
    ^ false
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  2595
!
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  2596
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2597
isSpecialOrExtendedSpecialCharacter:ch
2027
69396e6c797c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  2598
    |code charType|
69396e6c797c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  2599
69396e6c797c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  2600
    code := ch codePoint.
3621
706bc503cdb4 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3578
diff changeset
  2601
    (code between:1 and: typeArray size) ifFalse:[^ false].
2027
69396e6c797c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  2602
69396e6c797c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  2603
    charType := typeArray at:code.
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2604
    ^ (charType == #special)
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2605
       or:[ (charType == #extendedSpecial) and:[parserFlags allowExtendedBinarySelectors] ]
2290
d84dd6eff7ea changed:
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  2606
d84dd6eff7ea changed:
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  2607
    "
d84dd6eff7ea changed:
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  2608
     self basicNew isSpecialOrExtendedSpecialCharacter:$-
d84dd6eff7ea changed:
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  2609
    "
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2610
!
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2611
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2612
notifying:anObject
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2613
    "set the requestor to be notified"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2614
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2615
    requestor := anObject
426
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2616
!
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2617
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2618
setNameSpace:aNameSpace
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2619
    "/ ignored here
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2620
871231a532fc remember nameSpace as scanned from directive
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
  2621
    "Created: 8.11.1996 / 13:33:10 / cg"
1247
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2622
!
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2623
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2624
setPackage:aNameSpace
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2625
    "/ ignored here
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2626
ce0d19140248 care for package directive (remember)
Claus Gittinger <cg@exept.de>
parents: 1242
diff changeset
  2627
    "Created: 8.11.1996 / 13:33:10 / cg"
1572
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  2628
!
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  2629
9cd64860e593 +literal nameSpace symbols
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  2630
setSyntax:aSyntax
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2631
! !
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2632
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2633
!Scanner methodsFor:'reading next token'!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2634
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2635
continueEscapedString
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2636
    "after escaping out of a string with \{,
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2637
     an expression was read by the parser and it found the terminating $}.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2638
     It calls this to continue reading the string..."
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2639
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2640
    ^ self xnextString:$' escapeStyle:'e'
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2641
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2642
    "Created: / 22-05-2019 / 20:24:51 / Claus Gittinger"
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2643
!
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  2644
2484
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2645
nextAssignmentArrow
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2646
    "return a left-arrow"
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2647
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2648
    ^ self nextToken:$_
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2649
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2650
    "Created: / 25-03-2011 / 13:58:50 / cg"
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2651
!
88c45a8910f2 experimental left-arrow
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2652
4291
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2653
nextBacktickIdentifier
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2654
    "a single back-quote has been scanned;
4291
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2655
     scan up to the next back-tick, and return it as an identifier"
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2656
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2657
    self nextString:$`.
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2658
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2659
    tokenName := tokenValue.
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2660
    tokenType := #Identifier.
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2661
    ^ tokenType
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2662
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2663
    "Created: / 07-08-2018 / 07:37:51 / Claus Gittinger"
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2664
!
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  2665
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2666
nextCharacter
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2667
    "a $ has been read - return a character token"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2668
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  2669
    |nextChar t|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2670
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2671
    source next.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2672
    nextChar := source next.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2673
    nextChar notNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2674
	t := nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2675
	tokenType := #Character.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2676
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2677
	t := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2678
	tokenType := #EOF
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2679
    ].
1240
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
  2680
    tokenValue := token := t.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2681
    ^ tokenType
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2682
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2683
    "Modified: / 13.5.1998 / 15:09:50 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2684
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2685
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2686
nextColonOrAssign
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2687
    "colon has been read - look for = to make it an assign"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2688
3181
581f5023f221 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 3175
diff changeset
  2689
    |thirdChar|
1722
fc1fcce91650 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2690
120
claus
parents: 103
diff changeset
  2691
    "/ special kludge for identifier:= (without spaces inbetween)
claus
parents: 103
diff changeset
  2692
    "/ here we needed two characters lookahead after the identifier ...
claus
parents: 103
diff changeset
  2693
claus
parents: 103
diff changeset
  2694
    peekChar == $= ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2695
	source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2696
	peekChar := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2697
	tokenType := token := #':='.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2698
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2699
	thirdChar := source peek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2700
	thirdChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2701
	    (self isSpecialOrExtendedSpecialCharacter:thirdChar) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2702
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2703
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2704
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2705
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2706
	^ tokenType
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2707
    ].
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2708
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2709
    "/ special kludge for nameSpace:: (without spaces inbetween)
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2710
    "/ here we needed two characters lookahead after the identifier ...
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2711
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2712
    peekChar == $: ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2713
	source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2714
	peekChar := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2715
	tokenType := token := #'::'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2716
	^ tokenType
120
claus
parents: 103
diff changeset
  2717
    ].
claus
parents: 103
diff changeset
  2718
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2719
    (source nextPeek == $=) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2720
	source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2721
	tokenType := token := #':='
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2722
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2723
	tokenType := token := $:
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2724
    ].
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2725
    ^ tokenType
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  2726
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  2727
    "Modified: / 13.5.1998 / 15:10:04 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2728
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2729
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2730
nextExcla
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2731
    "a !! has been read - return either
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2732
	the !! binarySelector,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2733
	ExclaLeftParen     (for '!!('),
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2734
	ExclaLeftBrack     (for '!!['),
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2735
	ExclaLeftBrace     (for '!!{')
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2736
    "
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2737
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2738
    |nextChar|
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2739
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2740
    nextChar := source nextPeek.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2741
    parserFlags allowExtendedSTXSyntax == true ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2742
	(nextChar == $( ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2743
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2744
	    token := '!!('.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2745
	    tokenType := #ExclaLeftParen.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2746
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2747
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2748
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2749
	(nextChar == $[ ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2750
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2751
	    token := '!!['.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2752
	    tokenType := #ExclaLeftBrack.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2753
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2754
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2755
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2756
	(nextChar == ${ ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2757
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2758
	    token := '!!{'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2759
	    tokenType := #ExclaLeftBrace.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2760
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2761
	].
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2762
    ].
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2763
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2764
    "this allows excla to be used as binop -
4037
9be91cda4b4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  2765
     I don't know, if this is correct ..."
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2766
1307
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2767
"/    tokenName := token := '!!'.
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2768
"/    tokenType := #BinaryOperator.
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2769
"/    ^ tokenType
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2770
a91664d148ad also allow multi-character binary selectors starting with excla
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  2771
    ^ self nextSpecialWith:$!!.
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2772
!
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2773
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2774
nextExtendedSpecial:ch
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2775
    parserFlags allowExtendedBinarySelectors ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2776
	^ self nextSpecial
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2777
    ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2778
    ^ self invalidCharacter:source peek.
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2779
!
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2780
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2781
nextHash
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2782
    "a # has been read - return either
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2783
	a symbol,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2784
	HashLeftParen     (for '#('),
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2785
	HashLeftBrack     (for '#['),
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2786
	HashLeftBrace     (for '#{'  and AllowQualifiedNames/inline objects)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2787
	HashHashLeftParen (for '##(' and AllowDolphinExtensions)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2788
	HashHashLeftBrack (for '##[' )
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2789
	HashHash          (for '##' )
3948
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  2790
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  2791
     extended syntax (scheme-style literal arrays):
4426
49123df91ffa #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2792
     (requires ParserFlags allowSTXExtendedArrayLiterals:true)
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2793
	HashTypedArrayParen   (for '#u8(', '#s8(' , '#u16(' ...)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2794
	type in tokenValue: u1, u8, u16, u32, u64, s8, s16, s32, s64,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2795
			    f16, f32, f64, f, d, b, B
1226
c0c9fcf964fb dolphin compatibility
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
  2796
    "
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2797
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  2798
    |nextChar string allowUnderscoreInIdentifier|
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2799
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  2800
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2801
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2802
    nextChar := source nextPeek.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2803
    nextChar notNil ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2804
	(nextChar == $( ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2805
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2806
	    token := '#('.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2807
	    tokenType := #HashLeftParen.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2808
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2809
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2810
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2811
	(nextChar == $[ ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2812
	    "ST-80 & ST/X support Constant ByteArrays as #[...]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2813
	     now all Smalltalk dialects do."
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2814
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2815
	    token := '#['.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2816
	    tokenType := #HashLeftBrack.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2817
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2818
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2819
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2820
	(nextChar == ${ ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2821
	    " #{ ... } is one of:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2822
		#{ Foo.Bar.Baz }            VW3 and later qualified name
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2823
		#{ xx-xx-xx-xx-...-xx }     StAgents UUID
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2824
		#{ URL }                    url object qualifier
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2825
		#{ key: value ... }         inline literal object
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2826
	    "
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2827
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2828
	    token := '#{'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2829
	    tokenType := #HashLeftBrace.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2830
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2831
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2832
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2833
	(nextChar == $' ) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2834
	    "ST-80 and ST/X support arbitrary symbols as #'...'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2835
	     now all dialects do"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2836
	    self nextString:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2837
	    self markSymbolFrom:tokenPosition to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2838
	    tokenType == #EOF ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2839
		tokenValue isWideString ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2840
		    self syntaxError:'symbols which require 2-byte characters are not (yet) allowed'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2841
			    position:tokenPosition to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2842
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2843
		tokenValue := token := tokenValue asSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2844
		tokenType := #Symbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2845
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2846
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2847
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2848
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2849
	(nextChar == $#) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2850
	    nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2851
	    nextChar == $( ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2852
		parserFlags allowDolphinExtensions == true ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2853
		    "dolphin does computed literals as ##( expression )"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2854
		    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2855
		    token := '##('.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2856
		    tokenType := #HashHashLeftParen.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2857
		    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2858
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2859
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2860
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2861
	    nextChar == $[ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2862
		source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2863
		token := '##['.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2864
		tokenType := #HashHashLeftBrack.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2865
		^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2866
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2867
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2868
	    parserFlags allowVisualAgeESSymbolLiterals == true ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2869
		"V'age has special ESsymbols as ##name or ##'name'"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2870
		(self nextSymbolAfterHash) notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2871
		    tokenType := #ESSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2872
		    ^ #ESSymbol
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2873
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2874
		(nextChar == $') ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2875
		    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2876
		    self nextString:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2877
		    tokenType := #ESSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2878
		    ^ #ESSymbol
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2879
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2880
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2881
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2882
	    token := '##'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2883
	    tokenType := #HashHash.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2884
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2885
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2886
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2887
	"/ scheme-style typed literal arrays:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2888
	"/    #uXX( ... )  XX = { 1, 8, 16, 32, 64 } - bit, uint8, uint16, uint32 or uint64 array
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2889
	"/    #iXX( ... )  XX = { 8, 16, 32, 64 }    - int8, int16, int32 or int64 array
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2890
	"/    #fXX( ... )  XX = { 16, 32, 64 }       - IEEE half, single or double array
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2891
	"/    #f( ... ) - IEEE single float array (same as #f32)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2892
	"/    #d( ... ) - IEEE double array       (same as #f64)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2893
	"/    #b( ... ) - bit array               (same as #u1)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2894
	"/    #B( ... ) - boolean array
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2895
	('usfdbB' includes:nextChar) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2896
	    |prefix|
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2897
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2898
	    "/ collec tuntil we know what we get...
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2899
	    prefix := String with:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2900
	    nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2901
	    [nextChar notNil and:[nextChar isDigit]] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2902
		prefix := prefix copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2903
		nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2904
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2905
	    nextChar == $( ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2906
		parserFlags allowSTXExtendedArrayLiterals ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2907
		    self parseError:c'Non-Standard ST/X extension used: #XXX( .. ) unboxed array literal.\nPlease enable "allowSTXExtendedArrayLiterals" in the ParserFlags'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2908
			 position:tokenPosition to:source position
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2909
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2910
		source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2911
		(
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2912
		    #( 'f' 'd' 'b' 'B'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2913
		       'u1' 'u8' 'u16' 'u32' 'u64'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2914
		       's8' 's16' 's32' 's64'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2915
		       'f16' 'f32' 'f64'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2916
		    ) includes:prefix
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2917
		) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2918
		    tokenType := #HashTypedArrayParen.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2919
		    tokenValue := prefix asSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2920
		    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2921
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2922
		self parseError:'unsupported literal array type: ',prefix.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2923
		tokenType := #HashLeftParen.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2924
		^ #HashLeftParen
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2925
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2926
	    ^ self nextSymbolAfterHash:prefix.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2927
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2928
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2929
	(self nextSymbolAfterHash) notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2930
	    ^ #Symbol
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2931
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2932
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2933
	(self isSpecialOrExtendedSpecialCharacter:nextChar) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2934
	    string := source next asString.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2935
	    nextChar := source peek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2936
	    nextChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2937
		(self isSpecialOrExtendedSpecialCharacter:nextChar) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2938
		    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2939
		    string := string copyWith:nextChar
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2940
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2941
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2942
	    self markSymbolFrom:tokenPosition to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2943
	    tokenValue := token := string asSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2944
	    tokenType := #Symbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2945
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2946
	]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2947
    ].
1298
878c759441d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2948
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  2949
    "this allows hash to be used as binop -
4037
9be91cda4b4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  2950
     I don't know, if this is correct ..."
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  2951
    tokenName := token := '#'.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2952
    tokenType := #BinaryOperator.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2953
    ^ tokenType
500
d0679fcc520e handle #foo_:_:_: symbols
Claus Gittinger <cg@exept.de>
parents: 499
diff changeset
  2954
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  2955
    "Modified: / 01-08-2006 / 14:57:19 / cg"
2712
eddb351cf9c2 comment/format in: #nextHash
Claus Gittinger <cg@exept.de>
parents: 2678
diff changeset
  2956
    "Modified (format): / 30-09-2011 / 12:23:04 / cg"
4426
49123df91ffa #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2957
    "Modified: / 30-05-2019 / 19:06:36 / Claus Gittinger"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2958
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2959
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2960
nextId
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2961
    "no longer used here - remains for backwardCompatibility for
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2962
     subclass users ... (sigh)"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2963
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2964
    |nextChar string oldString
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2965
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2966
     max   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2967
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2968
    nextChar := source peekOrNil.
1470
62844fc53a87 String new -> uninitializedNew: / basicNew:
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  2969
    string := String uninitializedNew:20.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2970
    index := 0.
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2971
    max := 10.
3405
f99df2454629 [true] whileTrue: -> #loop
Stefan Vogel <sv@exept.de>
parents: 3381
diff changeset
  2972
    [
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2973
	(nextChar notNil and:[nextChar isLetterOrDigit]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2974
	    ^ string copyTo:index
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2975
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2976
	(index == max) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2977
	    oldString := string.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2978
	    string := String basicNew:(max * 2).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2979
	    string replaceFrom:1 to:max with:oldString.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2980
	    max := max * 2
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2981
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2982
	index := index + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2983
	string at:index put:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2984
	nextChar := source nextPeek
3405
f99df2454629 [true] whileTrue: -> #loop
Stefan Vogel <sv@exept.de>
parents: 3381
diff changeset
  2985
    ] loop.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2986
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2987
    "Modified: / 5.3.1998 / 02:53:57 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2988
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2989
7ad01559b262 Initial revision
claus
parents:
diff changeset
  2990
nextIdentifier
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2991
    "an alpha character
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  2992
     (or underscore if AllowUnderscore,
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  2993
      or greek if allowGreekCharactersInIdentifier
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2994
      or national letter if allowNationalCharactersInIdentifier)
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  2995
     has been read.
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2996
     Return the next identifier."
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2997
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  2998
    |nextChar string ok pos ch2
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  2999
     allowUnderscoreInIdentifier allowDollarInIdentifier
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3000
     allowParagraphInIdentifier
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3001
     allowNationalCharactersInIdentifier allowGreekCharactersInIdentifier|
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  3002
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  3003
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  3004
    allowDollarInIdentifier := parserFlags allowDollarInIdentifier.
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3005
    allowParagraphInIdentifier := parserFlags allowParagraphInIdentifier.
3449
3857b52841ba class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  3006
    allowNationalCharactersInIdentifier := parserFlags allowNationalCharactersInIdentifier.
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3007
    allowGreekCharactersInIdentifier := parserFlags allowGreekCharactersInIdentifier.
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3008
87
claus
parents: 83
diff changeset
  3009
    hereChar == $_ ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3010
	"/
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3011
	"/ no need to check for allowUnderscoreInIdentifier here;
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3012
	"/ could not arrive here if it was off
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3013
	"/
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3014
	nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3015
	parserFlags allowOldStyleAssignment ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3016
	    (nextChar notNil and:[ nextChar isLetterOrDigitOrUnderline]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3017
		"oops: a single underscore is an old-style assignement"
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3018
		nextChar == $: ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3019
		    self warnOldStyleAssignmentAt:tokenPosition.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3020
		    tokenType := token := $_.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3021
		    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3022
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3023
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3024
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3025
	string := '_'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3026
	self warnUnderscoreAt:tokenPosition.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3027
	[nextChar == $_] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3028
	    string := string copyWith:$_.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3029
	    nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3030
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3031
	(nextChar notNil and:[nextChar isLetterOrDigit]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3032
	    string := string , source nextAlphaNumericWord.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3033
	]
87
claus
parents: 83
diff changeset
  3034
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3035
	nextChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3036
	(nextChar notNil and:[nextChar isLetterOrDigit]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3037
	    string := source nextAlphaNumericWord "self nextId".
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3038
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3039
	    string := ''
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3040
	]
87
claus
parents: 83
diff changeset
  3041
    ].
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  3042
    nextChar := source peekOrNil.
87
claus
parents: 83
diff changeset
  3043
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3044
    ((nextChar == $')
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  3045
      and:[ (string size == 1)
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3046
      and:[ ((parserFlags allowCStrings and:[string = 'c'])
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3047
	    or:[(parserFlags allowEStrings and:[string = 'e'])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3048
	    or:[(parserFlags allowRStrings and:[string = 'r'])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3049
	    or:[parserFlags allowExtendedSTXSyntax ]]]) ]]
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  3050
    ) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3051
	source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3052
	^ self xnextString:$' escapeStyle:string
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3053
    ].
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3054
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3055
    (((nextChar == $_) and:[allowUnderscoreInIdentifier])
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3056
      or:[ (allowDollarInIdentifier and:[nextChar == $$ ])
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  3057
      or:[ (nextChar == $§ and:[ allowParagraphInIdentifier])
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3058
      or:[ (allowNationalCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3059
      or:[ (allowGreekCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3060
    ]]]]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3061
	pos := source position + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3062
	nextChar == $_ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3063
	    self warnUnderscoreAt:pos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3064
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3065
	    nextChar == $$ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3066
		self warnDollarAt:pos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3067
	    ] ifFalse:[
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  3068
		nextChar == $§ ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3069
		    self warnParagraphAt:pos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3070
		] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3071
		    "/ self warnNationalCharacterAt:pos.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3072
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3073
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3074
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3075
	ok := true.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3076
	[ok] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3077
	    string := string copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3078
	    nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3079
	    nextChar isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3080
		ok := false
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3081
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3082
		(nextChar isLetterOrDigit) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3083
		    string := string , source nextAlphaNumericWord.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3084
		    nextChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3085
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3086
		ok := ((nextChar == $_) and:[allowUnderscoreInIdentifier])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3087
			or:[((nextChar == $$ ) and:[allowDollarInIdentifier])
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  3088
			or:[((nextChar == $§ ) and:[allowParagraphInIdentifier])
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3089
			or:[(nextChar notNil and:[allowNationalCharactersInIdentifier and:[nextChar isNationalLetter]])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3090
			or:[(nextChar notNil and:[allowGreekCharactersInIdentifier and:[nextChar isGreekLetter]])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3091
		      ]]]].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3092
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3093
	].
60
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  3094
    ].
0db697f03def *** empty log message ***
claus
parents: 53
diff changeset
  3095
785
14d0ec37a754 added hook for subclasses which do not want to scan
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
  3096
    (nextChar == $: and:[scanColonAsKeyword]) ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3097
	source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3098
	ch2 := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3099
	"/ colon follows - care for '::' (nameSpace separator) or ':=' (assignment)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3100
	(ch2 == $=) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3101
	    (ch2 == $:) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3102
		tokenName := token := string copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3103
		tokenType := #Keyword.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3104
		inArrayLiteral == true ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3105
		    (ch2 isLetter
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3106
		    or:[ch2 == $_ and:[allowUnderscoreInIdentifier]]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3107
			"/ kludge: recurse to read the rest.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3108
			self nextIdentifier.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3109
			tokenName := token := (string copyWith:nextChar) , token.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3110
			tokenType ~~ #Keyword ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3111
			    self syntaxError:'invalid keyword symbol in array constant'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3112
				    position:tokenPosition to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3113
			].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3114
			tokenType := #Keyword.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3115
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3116
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3117
		^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3118
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3119
	    peekChar := $:.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3120
	    peekChar2 := $:.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3121
	] ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3122
	    peekChar := $:.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3123
	    peekChar2 := $=.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3124
	]
1027
c944d9be2a69 silently scan Foo.Bar as Foo::Bar,
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3125
    ] ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3126
	(nextChar == $. and:[parserFlags allowQualifiedNames]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3127
	    "/ period follows - if next-after character is an identifier character,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3128
	    "/ make peekSym a #NameSpaceSeparator; otherwise a $.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3129
	    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3130
	    ch2 := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3131
	    (ch2 notNil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3132
	    and:[ch2 isLetter or:[ch2 == $_ and:[allowUnderscoreInIdentifier]]]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3133
		peekChar := #'::'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3134
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3135
		peekChar := $.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3136
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3137
	].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3138
    ].
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3139
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3140
    nextChar == $- ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3141
	pos := source position + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3142
	self
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3143
	    warnPossibleIncompatibility:'add spaces around ''-'' for compatibility with other systems'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3144
	    position:pos to:pos.
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3145
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3146
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  3147
    tokenName := token := string.
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3148
    (self checkForKeyword:string) ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3149
	tokenType := #Identifier.
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3150
    ].
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3151
    ^ tokenType
120
claus
parents: 103
diff changeset
  3152
1954
3c20721e963c care for end-of-text when parsing a single underline identifier.
Claus Gittinger <cg@exept.de>
parents: 1949
diff changeset
  3153
    "Created: / 13-09-1995 / 12:56:42 / claus"
4042
a9137b4a88bc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4037
diff changeset
  3154
    "Modified: / 17-11-2016 / 09:19:46 / cg"
4441
a834368786b5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4438
diff changeset
  3155
    "Modified: / 08-06-2019 / 18:25:35 / Claus Gittinger"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3156
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3157
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3158
nextMantissa:radix
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3159
    "read the mantissa of a radix number"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3160
1351
107757ea7184 Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1349
diff changeset
  3161
    <resource: #obsolete>
107757ea7184 Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1349
diff changeset
  3162
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3163
    ^ (self nextMantissaAndScaledPartWithRadix:radix) first
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3164
!
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3165
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3166
nextMantissaAndScaledPartWithRadix:radix
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3167
    "read the mantissa of a radix number.
4037
9be91cda4b4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  3168
     Since we don't know yet if this is for a Float, LongFloat or a FixedPoint,
1430
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  3169
     return info which is useful for all: an array consisting of
c3df4cc918d4 number reading
Claus Gittinger <cg@exept.de>
parents: 1429
diff changeset
  3170
     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
  3171
1972
f52b7e609f1f common code with Number-reading
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3172
    ^ Number readMantissaAndScaleFrom:source radix:radix
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3173
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3174
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3175
nextNumber
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3176
    "scan a number; handles radix prefix, mantissa and exponent.
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3177
     Allows for
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3178
        e, d or q to be used as exponent limiter (for float or long float),
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3179
        s for scaled fixpoint numbers,
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3180
        f for single precision floats (controlled by parserFlags).
4422
a06688034985 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4420
diff changeset
  3181
4312
3a16f0c3192d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4304
diff changeset
  3182
     i.e. 1e5 -> float (technically a double precision IEEE)
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3183
          1d5 -> float (also, a double precision IEEE)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3184
          1q5 -> long float (a c-long double / extended or quad precision IEEE, dep. on CPU)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3185
          1Q5 -> quad float (quad precision IEEE)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3186
          1QD5 -> qDouble float (4*double precision)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3187
          1QL5 -> large float (arbitrary precision)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3188
          1s  -> a fixed point with precision from number of digits given.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3189
          1s5 -> a fixed point with 5 digits precision.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3190
          1d  -> float (technically a double precision IEEE float).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3191
          1q  -> long float (technically a c-long double / extended or quad precision IEEE float, dep. on CPU).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3192
          1Q  -> quad float (quad precision IEEE)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3193
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3194
          1f5 -> shortFloat (technically a single precision IEEE float) or float, dep on parserFlags.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3195
          1f  -> shortFloat (technically a single precision IEEE float) or float, dep on parserFlags.
3705
8f6f4f52202d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  3196
     support for scaled decimals can be disabled, if code needs to be read,
4592
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  3197
     which does not know about them (very unlikely).
d14e38aec6de #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
  3198
     support for single prec. floats with f/F is controlled by a parser flag"
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3199
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3200
    |pos1 nextChar value integerPart sign
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3201
     expSign tokenRadix mantissaAndScaledPart d type exp scale
4610
addf2512f74f #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4604
diff changeset
  3202
     kindChar kindClass chars |
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3203
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3204
    tokenRadix := 10.
1679
c568383eb5ec reading signed radix numbers
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  3205
    sign := 1.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3206
    type := #Integer.
3268
6cf0aa88857b class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3245
diff changeset
  3207
    pos1 := source position + 1.
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3208
4479
0e8ec14d0a83 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  3209
    parserFlags allowCIntegers ifTrue:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3210
        source peek == $0 ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3211
            nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3212
            nextChar == $x ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3213
                source next.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3214
                ((source peek ? $.) isDigitRadix:16) ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3215
                    self syntaxError:'invalid cStyle integer (hex digit expected)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3216
                         position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3217
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3218
                value := Integer readFrom:source radix:16.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3219
                sign < 0 ifTrue:[ value := value negated ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3220
                tokenValue := token := value.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3221
                tokenType := type.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3222
                ^ tokenType
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3223
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3224
            nextChar == $o ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3225
                source next.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3226
                ((source peek ? $.) isDigitRadix:8) ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3227
                    self syntaxError:'invalid cStyle integer (octal digit expected)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3228
                         position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3229
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3230
                value := Integer readFrom:source radix:8.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3231
                sign < 0 ifTrue:[ value := value negated ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3232
                tokenValue := token := value.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3233
                tokenType := type.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3234
                ^ tokenType
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3235
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3236
            nextChar == $b ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3237
                source next.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3238
                ((source peek ? $.) isDigitRadix:2) ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3239
                    self syntaxError:'invalid cStyle integer (binary digit expected)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3240
                         position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3241
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3242
                value := Integer readFrom:source radix:2.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3243
                sign < 0 ifTrue:[ value := value negated ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3244
                tokenValue := token := value.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3245
                tokenType := type.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3246
                ^ tokenType
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3247
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3248
            (nextChar notNil
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3249
            and:[ nextChar isDigit or:[nextChar == $.]]) ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3250
                tokenValue := token := 0.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3251
                tokenType := type.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3252
                ^ tokenType
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3253
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3254
            value := 0.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3255
        ].
4479
0e8ec14d0a83 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  3256
    ].
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3257
    nextChar == $. ifFalse:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3258
        value := Integer readFrom:source radix:tokenRadix.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3259
        nextChar := source peekOrNil.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3260
        (nextChar == $r) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3261
            tokenRadix := value.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3262
            source next.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3263
            (tokenRadix between:2 and:36) ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3264
                self syntaxError:'bad radix (must be 2 .. 36)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3265
                        position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3266
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3267
            source peekOrNil == $- ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3268
                source next.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3269
                sign := -1
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3270
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3271
            pos1 := source position + 1.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3272
            value := Integer readFrom:source radix:tokenRadix.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3273
            nextChar := source peekOrNil.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3274
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3275
    ].
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
  3276
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3277
    (nextChar == $.) ifTrue:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3278
        nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3279
        (nextChar notNil and:[nextChar isDigitRadix:tokenRadix]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3280
            (tokenRadix > 13) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3281
                (nextChar == $d or:[nextChar == $D]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3282
                    self warning:'float with radix > 13 - (d/D are valid digits; not exponent-leaders)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3283
                         position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3284
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3285
                (tokenRadix > 14) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3286
                    (nextChar == $e or:[nextChar == $E]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3287
                        self warning:'float with radix > 14 - (e/E are valid digits; not exponent-leaders)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3288
                             position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3289
                    ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3290
                    (tokenRadix > 15) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3291
                        (nextChar == $f or:[nextChar == $F]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3292
                            self warning:'float with radix > 15 - (f/F are valid digits; not exponent-leaders)'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3293
                                 position:tokenPosition to:(source position).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3294
                        ]
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3295
                    ]
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3296
                ]
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3297
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3298
            mantissaAndScaledPart := self nextMantissaAndScaledPartWithRadix:tokenRadix.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3299
            integerPart := value.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3300
            value := integerPart + (mantissaAndScaledPart first).  "could be a longFloat now"
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3301
            type := #Float.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3302
            nextChar := source peekOrNil
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3303
        ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3304
            ('eEdDqQfF' includes:nextChar) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3305
                "/ allow 5.e-3 - is this standard ?
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3306
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3307
            ] ifFalse:[
1339
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  3308
"/                nextChar == (Character cr) ifTrue:[
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  3309
"/                    lineNr := lineNr + 1.
7dd363978456 start to migrate towards raising ParseError.
Claus Gittinger <cg@exept.de>
parents: 1321
diff changeset
  3310
"/                ].
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3311
                nextChar := peekChar := $..
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3312
            ]
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3313
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3314
    ].
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
  3315
4148
4fc143114250 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  3316
    ('eEdDqQfF' includes:nextChar) ifTrue:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3317
        kindClass := Float.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3318
        kindChar := nextChar.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3319
        nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3320
        (kindChar == $q or:[kindChar == $Q]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3321
            (kindChar == $Q) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3322
                nextChar == $D ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3323
                    kindClass := QDouble.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3324
                    value := value asQDouble.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3325
                    nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3326
                ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3327
                    nextChar == $L ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3328
                        kindClass := LargeFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3329
                        value := value asLargeFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3330
                        nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3331
                    ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3332
                        kindClass := QuadFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3333
                        value := value asQuadFloat
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3334
                    ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3335
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3336
            ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3337
                kindClass := LongFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3338
                value := value asLongFloat
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3339
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3340
        ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3341
            ((kindChar == $f or:[kindChar == $F]) and:[parserFlags singlePrecisionFloatF]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3342
                kindClass := ShortFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3343
                value := value asShortFloat
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3344
            ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3345
                value := value asFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3346
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3347
        ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3348
        type := #Float.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3349
        (nextChar notNil and:[(nextChar isDigit"Radix:tokenRadix") or:['+-' includes:nextChar]]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3350
            expSign := 1.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3351
            (nextChar == $+) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3352
                nextChar := source nextPeek
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3353
            ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3354
                (nextChar == $-) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3355
                    nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3356
                    expSign := -1
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3357
                ]
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3358
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3359
            exp := (Integer readFrom:source) * expSign.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3360
            value := value * ((value class unity * tokenRadix) raisedToInteger:exp).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3361
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3362
            nextChar := source peek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3363
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3364
            "/ due to a strange overflow, we might get a Nan, although we
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3365
            "/ are actually still in the float range.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3366
            "/ happens eg. for 1.7976931348623157e+308
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3367
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3368
            "/ Also, the above raisedToInteger generates an additional error,
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3369
            "/ which is not present, if we use the strtox functions from the C-library.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3370
            "/ Therefore, always use the low level fastFromString: converter.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3371
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3372
            "/ However: it only accepts decimal radix
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3373
            tokenRadix = 10 ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3374
                Error handle:[:ex |
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3375
                    "/ self halt.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3376
                ] do:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3377
                    chars := (source collection copyFrom:pos1 to:source position) string asSingleByteStringIfPossible.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3378
                    value := kindClass fastFromString:chars at:1.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3379
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3380
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3381
        ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3382
    ] ifFalse:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3383
        value isLimitedPrecisionReal ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3384
            "/ fastFromString only accepts decimal radix
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3385
            tokenRadix = 10 ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3386
                "/ no type specified - makes it a float
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3387
                "/ value := value asFloat.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3388
                Error handle:[:ex |
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3389
                    value := value asFloat
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3390
                ] do:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3391
                    chars := (source collection copyFrom:pos1 to:source position) asSingleByteStringIfPossible.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3392
                    value := Float fastFromString:chars at:1.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3393
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3394
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3395
        ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3396
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3397
        parserFlags allowFixedPointLiterals ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3398
            "/ ScaledDecimal numbers
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3399
            ('s' includes:nextChar) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3400
                nextChar := source nextPeek.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3401
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3402
                (nextChar notNil and:[(nextChar isDigit)]) ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3403
                    scale := (Integer readFrom:source).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3404
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3405
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3406
                mantissaAndScaledPart isNil ifTrue:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3407
                    value := value asFixedPoint:(scale ? 0)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3408
                ] ifFalse:[
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3409
                    d := 10 raisedTo:(mantissaAndScaledPart last).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3410
                    value := FixedPoint
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3411
                        numerator:((integerPart * d) + mantissaAndScaledPart second)
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3412
                        denominator:d
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3413
                        scale:(scale ? mantissaAndScaledPart last).
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3414
                ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3415
                type := #FixedPoint.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3416
                self
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3417
                    warnPossibleIncompatibility:'fixedPoint literal might be incompatibile with other systems'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3418
                    position:pos1 to:source position + 1.
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3419
            ].
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3420
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3421
    ].
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3422
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3423
    nextChar == $- ifTrue:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3424
        self
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3425
            warnPossibleIncompatibility:'add a space before ''-'' for compatibility with other systems'
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3426
            position:(source position + 1) to:(source position + 1).
526
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3427
    ].
adb8aed3a691 added compatibility warnings for '-' without whitespace
Claus Gittinger <cg@exept.de>
parents: 505
diff changeset
  3428
4598
9733fe6a560f #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4596
diff changeset
  3429
    tokenValue := token := (sign < 0) ifTrue:[value negated] ifFalse:[value].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3430
    tokenType := type.
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3431
    (tokenValue isLimitedPrecisionReal) ~~ (tokenType == #Float) ifTrue:[
4637
1f1869c7b7ad #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4612
diff changeset
  3432
        self shouldImplement.
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  3433
    ].
1347
6168b045f2ef preps for fixedPoint literals
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  3434
671
8361d4bedc9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 666
diff changeset
  3435
"/    self markConstantFrom:tokenPosition to:(source position - 1).
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3436
    ^ tokenType
313
ee72a11af9a2 handle trailing 'd' after a float (ST-80 compatible Doubles)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  3437
4148
4fc143114250 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4121
diff changeset
  3438
    "Modified: / 15-06-2017 / 11:07:52 / cg"
4443
6b8be5255d89 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4441
diff changeset
  3439
    "Modified: / 11-06-2019 / 00:41:00 / Claus Gittinger"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3440
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3441
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3442
nextPrimitive
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3443
    "scan an inline C-primitive."
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3444
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3445
    |nextChar inPrimitive string stringCollector
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3446
     index "{ Class: SmallInteger }"
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3447
     len   "{ Class: SmallInteger }" |
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3448
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3449
    nextChar := source nextPeek.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3450
    (nextChar == ${) ifFalse:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3451
	^ self nextSpecialWith:$%
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3452
    ].
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3453
3705
8f6f4f52202d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  3454
    stringCollector := CharacterWriteStream new.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3455
    nextChar := source nextPeek.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3456
    inPrimitive := true.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3457
    [inPrimitive] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3458
	[nextChar == $%] whileFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3459
	    nextChar isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3460
		self syntaxError:'unterminated primitive'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3461
			position:tokenPosition to:source position + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3462
		^ #Error
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3463
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3464
	    stringCollector nextPut:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3465
	    nextChar := source next
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3466
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3467
	(source peekOrNil == $}) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3468
	    inPrimitive := false
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3469
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3470
	    stringCollector nextPut:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3471
	    nextChar := source next
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3472
	]
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3473
    ].
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3474
    source next.
3705
8f6f4f52202d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  3475
    tokenValue := token := stringCollector contents.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3476
    tokenType := #Primitive.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3477
    lineNr := lineNr + (tokenValue occurrencesOf:(Character cr)).
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3478
    ^ tokenType
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3479
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3480
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3481
nextSpecial
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3482
    "a special character has been read, look for another one.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3483
     also -number is handled here"
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3484
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3485
    |firstChar|
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3486
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3487
    firstChar := source next.
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3488
    ^ self nextSpecialWith:firstChar
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3489
!
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3490
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3491
nextSpecialWith:firstChar
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3492
    "a special character has been read, look for another one.
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3493
     also -number is handled here"
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3494
2155
163e7d5a0730 dont allow x# as selector
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  3495
    |secondChar thirdChar fourthChar string p|
1302
68c857cffd5a allow 3 character binopsö
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
  3496
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  3497
    secondChar := source peekOrNil.
4675
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3498
    ((firstChar == $-) 
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3499
      and:[secondChar notNil
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3500
      and:[secondChar isDigit 
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3501
    ]]) ifTrue:[
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3502
        self nextNumber.
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3503
        tokenValue := token := tokenValue negated.
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3504
        ^ tokenType
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3505
    ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3506
    string := firstChar asString.
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3507
2155
163e7d5a0730 dont allow x# as selector
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  3508
    "/ changed: do not allow second char to be a hash
163e7d5a0730 dont allow x# as selector
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  3509
    "/ unless the first is also.
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3510
    secondChar == $# ifTrue:[
4612
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3511
        (parserFlags allowHashAsBinarySelector
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3512
        and:[firstChar == $#]) ifFalse:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3513
            tokenName := token := string.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3514
            tokenType := #BinaryOperator.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3515
            ^ tokenType
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3516
        ].
1705
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3517
    ].
19fff84a354a more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  3518
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3519
    secondChar notNil ifTrue:[
4612
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3520
        (secondChar == $-) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3521
            "special- look ahead if minus belongs to number following"
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3522
            p := source position.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3523
            source next.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3524
            thirdChar := source peekOrNil.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3525
            source position:p.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3526
            (thirdChar notNil and:[thirdChar isDigit]) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3527
                tokenName := token := string.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3528
                tokenType := #BinaryOperator.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3529
                self
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3530
                    warnPossibleIncompatibility:'add a space before ''-'' for compatibility with stc and other ST systems'
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3531
                    position:p+1
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3532
                    to:p+1.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3533
                ^ tokenType
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3534
            ]
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3535
        ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3536
        (self isSpecialOrExtendedSpecialCharacter:secondChar) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3537
            source next.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3538
            string := string copyWith:secondChar.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3539
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3540
            thirdChar := source peekOrNil.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3541
            thirdChar notNil ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3542
                (self isSpecialOrExtendedSpecialCharacter:thirdChar) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3543
                    p := source position.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3544
                    source next.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3545
                    fourthChar := source peekOrNil.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3546
                    source position:p.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3547
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3548
                    (thirdChar == $-) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3549
                        "special- look ahead if minus belongs to number following"
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3550
                        (fourthChar notNil and:[fourthChar isDigit]) ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3551
                            tokenName := token := string.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3552
                            tokenType := #BinaryOperator.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3553
                            self
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3554
                                warnPossibleIncompatibility:'add a space before ''-'' for compatibility with stc and other ST systems'
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3555
                                position:p+1
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3556
                                to:p+1.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3557
                            ^ tokenType
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3558
                        ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3559
                    ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3560
                    thirdChar == $# ifTrue:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3561
                        (fourthChar notNil and:[fourthChar isSeparator]) ifFalse:[
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3562
                            "/ in sth. like ->#foo, the binop is NOT ->#
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3563
                            tokenName := token := string.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3564
                            tokenType := #BinaryOperator.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3565
                            ^ tokenType
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3566
                        ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3567
                    ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3568
                    source next.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3569
                    string := string copyWith:thirdChar.
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3570
                ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3571
            ].
6e212516ccfc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4611
diff changeset
  3572
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3573
    ].
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  3574
    tokenName := token := string.
45
e8331ba8ad5d *** empty log message ***
claus
parents: 41
diff changeset
  3575
    tokenType := #BinaryOperator.
3
b63b8a6b71fb *** empty log message ***
claus
parents: 0
diff changeset
  3576
    ^ tokenType
241
418eb41350d3 no debugger when parsing '-' (which is wrong anyway ...)
Claus Gittinger <cg@exept.de>
parents: 148
diff changeset
  3577
4675
40b4f76e9d34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3578
    "Modified: / 05-06-2020 / 11:09:25 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3579
!
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3580
1781
3d5065c74df5 string scanning hooks
Claus Gittinger <cg@exept.de>
parents: 1755
diff changeset
  3581
nextString:delimiter
4291
bd7354a6b7d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4276
diff changeset
  3582
    "a quote has been scanned; scan the string (caring for doubled quotes)"
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3583
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  3584
    source next.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  3585
    ^ self xnextString:delimiter escapeStyle:nil
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3586
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3587
    "
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3588
     old style ST80 string (no escapes):
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3589
	'hello\new world'
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3590
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3591
     ParserFlags allowCStrings:true.
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3592
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3593
     new style STX c-string (c escapes):
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3594
	c'hello\nnew world'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3595
	c'hello\tnew world'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3596
	c'hello\<tab>new world'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3597
	c'a\0b'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3598
	c'a\n\\\nb'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3599
	c'a\r\\\nb'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3600
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3601
     ParserFlags allowCStrings:false.
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3602
4571
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3603
     ParserFlags allowEStrings:true.
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3604
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3605
     new style strings with embedded expressions:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3606
	e'Hello, this is a computed value: {3 factorial}'
4571
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3607
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3608
     ParserFlags allowEStrings:false.
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3609
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3610
     ParserFlags allowRStrings:true.
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3611
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3612
     STX regex:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3613
	r'a+b+'
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3614
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3615
     ParserFlags allowRStrings:false.
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3616
    "
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3617
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3618
    "Created: / 01-08-2006 / 14:56:07 / cg"
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3619
    "Modified: / 22-08-2006 / 14:10:26 / cg"
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  3620
    "Modified: / 22-05-2019 / 20:32:14 / Claus Gittinger"
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  3621
    "Modified (comment): / 03-06-2019 / 11:16:00 / Claus Gittinger"
4571
2e505427eda3 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 4569
diff changeset
  3622
    "Modified (comment): / 24-09-2019 / 11:52:28 / Stefan Vogel"
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3623
!
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3624
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3625
nextString:delimiter escapeStyle:escapeStyle
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3626
    "a quote has been scanned; scan the string (caring for doubled quotes).
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3627
     escapeStyle may be:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3628
	nil - old style ST80 strings (no character escapes)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3629
     ot a single char string:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3630
	'c' - C-style escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3631
			\n,\t,\r,\b,\xXX,\uXXXX,\UXXXXXX,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3632
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3633
	'e' - C-style plus embedded escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3634
			e'...{ expr1 } ... { exprN }' will generate:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3635
			'...%1 ... %N' bindWithArguments:{ expr1 . ... . exprN }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3636
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3637
	'x' - extended-style escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3638
			as yet unsupported
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3639
	'r' - regex
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3640
			as yet unsupported
4345
e252e163a32c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4341
diff changeset
  3641
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3642
    "
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3643
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  3644
    source next.
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  3645
    ^ self xnextString:delimiter escapeStyle:escapeStyle
546
db5ce842f64f added #scanTokens for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 526
diff changeset
  3646
4334
96211fc814c7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4331
diff changeset
  3647
    "Created: / 08-02-2019 / 19:07:57 / Claus Gittinger"
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  3648
    "Modified: / 22-05-2019 / 20:33:04 / Claus Gittinger"
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  3649
    "Modified (comment): / 23-05-2019 / 08:52:46 / Claus Gittinger"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3650
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3651
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3652
nextSymbolAfterHash
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3653
    "helper: a # has been read - return #Symbol token or nil"
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3654
3948
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3655
    ^ self nextSymbolAfterHash:''
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3656
!
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3657
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3658
nextSymbolAfterHash:prefix
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3659
    "helper: #<prefix> has been read - return #Symbol token or nil"
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3660
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  3661
    |nextChar string part isNameSpaceSymbol allowUnderscoreInIdentifier
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  3662
     allowPeriodInSymbol|
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3663
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3664
    nextChar := source peek.
3948
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3665
    (nextChar isNil and:[prefix isEmpty]) ifTrue:[^ nil].
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3666
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3667
    allowUnderscoreInIdentifier := parserFlags allowUnderscoreInIdentifier.
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  3668
    allowPeriodInSymbol := parserFlags allowPeriodInSymbol.
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3669
    isNameSpaceSymbol := false.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3670
3948
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3671
    prefix isEmpty ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3672
	nextChar isLetter ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3673
	    ((nextChar == $_) and:[allowUnderscoreInIdentifier]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3674
		((nextChar == $.) and:[allowPeriodInSymbol]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3675
		    (nextChar isDigit and:[parserFlags allowSymbolsStartingWithDigit]) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3676
			"/ just for the better error message
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3677
			(nextChar isNationalAlphaNumeric) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3678
			    |errMsg|
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3679
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3680
			    errMsg := 'Invalid character: ''' , nextChar asString , ''' ', '(' , (nextChar codePoint radixPrintStringRadix:16) , ').'.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3681
			    errMsg := errMsg , '\\Notice:\  Only 7-bit ascii allowed (for compatibility with other Smalltalk dialects).' withCRs.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3682
			    errMsg := errMsg , '\  If you need symbols with 8-bit characters, use the #''...'' form, or ''...'' asSymbol.' withCRs.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3683
			    self syntaxError:errMsg position:tokenPosition to:source position+1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3684
			].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3685
			^ nil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3686
		    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3687
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3688
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3689
	].
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  3690
    ].
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3691
3948
afef44d0436b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3925
diff changeset
  3692
    string := prefix.
2180
891d45ffad68 allowPeriodInSymbol - to read old st80/squeak code
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
  3693
    [
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3694
	nextChar notNil
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3695
	and:[nextChar isLetterOrDigit
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3696
	    or:[(nextChar == $_ and:[allowUnderscoreInIdentifier])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3697
	    or:[nextChar == $. and:[allowPeriodInSymbol and:[source peek isLetter]]]]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3698
	 ]
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3699
    ] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3700
	nextChar == $_ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3701
	    part := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3702
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3703
	    (allowPeriodInSymbol and:[nextChar == $.]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3704
		part := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3705
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3706
		part := source nextAlphaNumericWord.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3707
	    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3708
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3709
	part notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3710
	    string := string , part.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3711
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3712
	nextChar := source peek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3713
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3714
	((allowUnderscoreInIdentifier and:[nextChar == $_])
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3715
	or:[ allowPeriodInSymbol and:[nextChar == $.] ]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3716
	    nextChar == $_ ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3717
		self warnUnderscoreAt:source position + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3718
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3719
		self warnPeriodAt:source position + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3720
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3721
	    [(nextChar == $_) or:[(allowPeriodInSymbol and:[nextChar == $.])]] whileTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3722
		string := string copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3723
		nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3724
		(nextChar notNil and:[nextChar isLetterOrDigit]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3725
		    string := string , source nextAlphaNumericWord.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3726
		    nextChar := source peek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3727
		] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3728
		    (allowPeriodInSymbol and:[string last == $.]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3729
			peekChar := nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3730
			nextChar := $..
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3731
			string := string copyButLast:1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3732
			tokenValue := token := string asSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3733
			tokenType := #Symbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3734
			^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3735
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3736
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3737
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3738
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3739
	(nextChar == $:) ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3740
	    self markSymbolFrom:tokenPosition to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3741
	    tokenValue := token := string asSymbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3742
	    tokenType := #Symbol.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3743
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3744
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3745
	string := string copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3746
	nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3747
	parserFlags allowLiteralNameSpaceSymbols ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3748
	    (nextChar == $:) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3749
		string := string copyWith:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3750
		nextChar := source nextPeek.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3751
		isNameSpaceSymbol := true.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3752
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3753
	].
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3754
    ].
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3755
    tokenValue := token := string asSymbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3756
    tokenType := #Symbol.
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3757
    ^ tokenType
4150
475f9690e560 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4148
diff changeset
  3758
475f9690e560 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4148
diff changeset
  3759
    "Modified (format): / 18-06-2017 / 16:31:56 / cg"
1656
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3760
!
04303a87cae4 V'Age ESSymbols
Claus Gittinger <cg@exept.de>
parents: 1653
diff changeset
  3761
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3762
nextToken
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3763
    "return the next token from the source-stream"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3764
4688
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3765
    |skipping actionBlock codePoint ch tok|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3766
4529
11206dcad874 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 4518
diff changeset
  3767
    tokenLastEndPosition := source position+1.
2612
6c04d60c1403 More fixes to keep node position in the source. Not yet fully implemented
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2523
diff changeset
  3768
3405
f99df2454629 [true] whileTrue: -> #loop
Stefan Vogel <sv@exept.de>
parents: 3381
diff changeset
  3769
    [
4688
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3770
        peekChar notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3771
            "/ kludge - should be called peekSym.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3772
            "/ used when xlating Foo.Bar into Foo::Bar
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3773
            peekChar isSymbol ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3774
                token := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3775
                tokenType := peekChar.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3776
                peekChar := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3777
                ^ tokenType
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3778
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3779
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3780
            (peekChar isSeparator or:[ peekChar codePoint == 16rFEFF ]) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3781
                peekChar == (Character cr) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3782
                    lineNr := lineNr + 1.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3783
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3784
                hereChar := peekChar.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3785
                peekChar := peekChar2.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3786
                peekChar2 := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3787
                (hereChar == Character cr) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3788
                    (self eolIsWhiteSpace) ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3789
                        token := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3790
                        tokenType := #EOL.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3791
                        ^ tokenType
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3792
                    ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3793
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3794
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3795
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3796
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3797
        peekChar notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3798
            ch := peekChar.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3799
            peekChar := peekChar2.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3800
            peekChar2 := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3801
            hereChar := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3802
        ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3803
            skipping := true.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3804
            [skipping] whileTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3805
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3806
                outStream notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3807
                    [
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3808
                        hereChar := source peekOrNil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3809
                        (hereChar notNil
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3810
                            and:[(hereChar == Character space) or:[hereChar isSeparator]])
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3811
                    ] whileTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3812
                        source next.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3813
                        outStream space.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3814
                        outCol := outCol + 1.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3815
                        hereChar == (Character cr) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3816
                            self eolIsWhiteSpace ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3817
                                source isPositionable ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3818
                                    tokenPosition := source position.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3819
                                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3820
                                token := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3821
                                tokenType := #EOL.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3822
                                ^ tokenType
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3823
                            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3824
                        ]
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3825
                    ]
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3826
                ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3827
                    hereChar := source skipSeparatorsExceptCR.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3828
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3829
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3830
                hereChar isNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3831
                    skipping := false
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3832
                ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3833
                    hereChar == (Character cr) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3834
                        lineNr := lineNr + 1.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3835
                        source next.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3836
                        outStream notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3837
                            outStream cr.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3838
                            outCol := 1
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3839
                        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3840
                        self eolIsWhiteSpace ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3841
                            source isPositionable ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3842
                                tokenPosition := source position.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3843
                            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3844
                            token := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3845
                            tokenType := #EOL.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3846
                            ^ tokenType
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3847
                        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3848
                    ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3849
                        hereChar == (Character return) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3850
                            outStream notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3851
                                outStream nextPut:hereChar.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3852
                                outCol := 1
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3853
                            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3854
                            source next.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3855
                        ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3856
                            (self isCommentCharacter:hereChar) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3857
                                "start of a comment"
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3858
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3859
                                self skipComment.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3860
                                hereChar := source peekOrNil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3861
                            ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3862
                                skipping := false
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3863
                            ]
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3864
                        ]
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3865
                    ]
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3866
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3867
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3868
            hereChar isNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3869
                source isPositionable ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3870
                    tokenPosition := source position + 1.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3871
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3872
                token := nil.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3873
                tokenType := #EOF.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3874
                ^ tokenType
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3875
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3876
            ch := hereChar
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3877
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3878
        source isPositionable ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3879
            tokenPosition := source position + 1.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3880
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3881
        tokenLineNr := lineNr.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3882
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3883
        (codePoint := ch codePoint) == 0 ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3884
            codePoint := Character space codePoint
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3885
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3886
        codePoint <= 16rFF ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3887
            actionBlock := actionArray at:codePoint.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3888
        ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3889
            actionBlock := unicodeActions at:codePoint ifAbsent:nil
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3890
        ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3891
        actionBlock notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3892
            tok := actionBlock value:self value:ch.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3893
            tok notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3894
                ^ tok
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3895
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3896
            "/ a nil token means: continue reading
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3897
        ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3898
            ((ch isNationalLetter and:[parserFlags allowNationalCharactersInIdentifier])
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3899
              or:[ (ch == $§ and:[parserFlags allowParagraphInIdentifier])
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3900
              or:[ (ch isGreekLetter and:[parserFlags allowGreekCharactersInIdentifier])
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3901
            ]]) ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3902
                tok := self nextIdentifier.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3903
                tok notNil ifTrue:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3904
                    ^ tok
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3905
                ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3906
                "/ a nil token means: continue reading
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3907
            ] ifFalse:[
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3908
                ^ self invalidCharacter:ch.
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3909
            ].
4022095270be #REFACTORING by bg
Claus Gittinger <cg@exept.de>
parents: 4683
diff changeset
  3910
        ]
3405
f99df2454629 [true] whileTrue: -> #loop
Stefan Vogel <sv@exept.de>
parents: 3381
diff changeset
  3911
    ] loop.
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
  3912
2481
ea879f38ff03 added: #eolIsWhiteSpace
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  3913
    "Modified: / 13-09-1995 / 12:56:14 / claus"
2612
6c04d60c1403 More fixes to keep node position in the source. Not yet fully implemented
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2523
diff changeset
  3914
    "Modified: / 27-07-2011 / 15:36:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4117
2a63f28f9650 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3915
    "Modified: / 12-02-2017 / 11:27:59 / cg"
4438
bd363f7ca282 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4433
diff changeset
  3916
    "Modified: / 08-06-2019 / 14:59:14 / Claus Gittinger"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3917
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3918
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3919
nextToken:aCharacter
1026
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3920
    "return a character token"
831aa102111f comments
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3921
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  3922
    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
  3923
    hereChar notNil ifTrue:[source next].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3924
    ^ 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
  3925
707
2fe4b3a7708a extracted keyword detection into a separate method for easier
Claus Gittinger <cg@exept.de>
parents: 671
diff changeset
  3926
    "Modified: / 13.5.1998 / 15:10:23 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3927
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3928
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3929
nextUnderline
3380
d4d09495435a class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3362
diff changeset
  3930
    "return either an identifier, or an underline (sometimes an assignment)  token"
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3931
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  3932
    parserFlags allowUnderscoreInIdentifier ifTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  3933
	^ self nextIdentifier
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  3934
    ].
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1622
diff changeset
  3935
    ^ self nextToken:$_
1501
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3936
!
ca87aed7eb82 allowUnderline etc. are inst-flags
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3937
264
f10298cba622 oops - corrupted version checked in
Claus Gittinger <cg@exept.de>
parents: 263
diff changeset
  3938
skipComment
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3939
    "skip over a comment;
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3940
     handles ST/X eol comments (dquote-slash)
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3941
     and multiline-delimiter comment (dquote-less-less).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3942
     Multiline-delimiter comments start with dquote<<TOKEN and end in a line which starts with TOKEN, where TOKEN is any word with no separators"
2983
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  3943
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  3944
    |commentStream commentType commentText startPos endPos stillInComment anyNonBlank
3456
a8e3abd9cc74 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3454
diff changeset
  3945
     delimiter line|
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3946
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3947
    anyNonBlank := false.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3948
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3949
    saveComments ifTrue:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3950
        commentStream := CharacterWriteStream on:''.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3951
        self beginComment.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3952
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3953
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3954
    outStream notNil ifTrue:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3955
        outStream nextPut:Character doubleQuote.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3956
        outCol := outCol + 1
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3957
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3958
3268
6cf0aa88857b class: Scanner
Stefan Vogel <sv@exept.de>
parents: 3245
diff changeset
  3959
    startPos := source position + 1.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3960
    source next.
656
e4249b285fd8 using #peekOrNil makes it some 10% faster when scanning
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  3961
    hereChar := source peekOrNil.
2983
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  3962
    commentType := #regularComment.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3963
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3964
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3965
     special ST/X addition:
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3966
     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
  3967
     which is very useful to comment out parts of filed-in source code.
3312
2c069ef9726e class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
  3968
     Since this is non-standard, you loose compatibility with other Smalltalks, if you use it.
2c069ef9726e class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
  3969
     (however, it is so convenient - I don't want to miss it)
2c069ef9726e class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3288
diff changeset
  3970
    "
1707
28a94a1701c2 more support for filein of ST/V code
Claus Gittinger <cg@exept.de>
parents: 1705
diff changeset
  3971
    (hereChar == $/ and:[parserFlags allowSTXEOLComments]) ifTrue:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3972
        hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3973
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3974
        self skipToEndOfLineRememberingIn:commentStream.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3975
        endPos := source position.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3976
        self markCommentFrom:startPos to:endPos+1.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3977
        commentType := #eolComment.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3978
        self warnSTXSpecialCommentAt:startPos to:endPos.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3979
        outStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3980
            outStream cr.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3981
            outCol := 1
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3982
        ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3983
        "skip cr"
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3984
        source next.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  3985
    ] ifFalse:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3986
        (hereChar == $< and:[parserFlags allowSTXDelimiterComments]) ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3987
            hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3988
            (hereChar == $<) ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3989
                "
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3990
                 another special ST/X addition:
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3991
                 a << right after the initial double quote makes it a token delimited comment,
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3992
                 which continues up to a line starting with the token.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3993
                 This is very useful to comment out which contain any other type of comment.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3994
                 Since this is non-standard, you loose compatibility with other Smalltalks, if you use it.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3995
                "
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3996
                commentStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3997
                    commentStream nextPutAll:'<<'
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3998
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  3999
                hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4000
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4001
                delimiter := String streamContents:[:s | self skipToEndOfLineRememberingIn:s].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4002
                delimiter := delimiter withoutSeparators.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4003
                delimiter isEmpty ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4004
                    self parseError:'invalid delimiter in comment'.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4005
                    ^  self
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4006
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4007
                ((delimiter first isLetterOrUnderline)
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4008
                and:[delimiter from:2 conform:[:ch | ch isLetterOrDigit]]) ifFalse:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4009
                    "/ treat as regular comment
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4010
                    commentType := #regularComment.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4011
                    source position:startPos.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4012
                ] ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4013
                    "/ delimiter comment
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4014
                    hereChar == Character cr ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4015
                        hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4016
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4017
                    commentStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4018
                        commentStream nextPutLine:delimiter
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4019
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4020
                    stillInComment := true.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4021
                    [stillInComment and:[hereChar notNil]] whileTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4022
                        line := String streamContents:[:s | self skipToEndOfLineRememberingIn:s].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4023
                        commentStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4024
                            commentStream nextPutLine:line
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4025
                        ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4026
                        hereChar == Character cr ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4027
                            hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4028
                        ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4029
                        stillInComment := (line startsWith:delimiter) not.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4030
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4031
                    stillInComment ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4032
                        self markCommentFrom:startPos to:(source collectionSize).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4033
                        self warning:'unclosed comment (missing delimiter: "',delimiter,'")' position:startPos to:(source position + 1)
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4034
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4035
                    self markCommentFrom:startPos to:(source position + 1).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4036
                    commentType := #delimiterComment.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4037
                ]
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4038
            ] ifFalse:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4039
                commentStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4040
                    commentStream nextPut:$<
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4041
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4042
            ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4043
        ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4044
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4045
        (commentType == #regularComment) ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4046
            hereChar == ${ ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4047
                "
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4048
                 special ST/X addition:
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4049
                 a ${ right after the initial double quote starts a directive
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4050
                "
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4051
                self parseDirective
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4052
            ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4053
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4054
            stillInComment := true.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4055
            [stillInComment] whileTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4056
                stillInComment := false.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4057
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4058
                [hereChar notNil and:[hereChar ~~ (Character doubleQuote)]] whileTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4059
                    hereChar isSeparator ifFalse:[ anyNonBlank := true ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4060
                    hereChar == (Character cr) ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4061
                        lineNr := lineNr + 1.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4062
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4063
                    commentStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4064
                        commentStream nextPut:hereChar
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4065
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4066
                    outStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4067
                        outStream nextPut:hereChar.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4068
                        outCol := outCol + 1
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4069
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4070
                    hereChar := source nextPeek
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4071
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4072
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4073
                hereChar isNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4074
                    self markCommentFrom:startPos to:(source collectionSize).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4075
                    self warning:'unclosed comment' position:startPos to:(source position + 1)
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4076
                ] ifFalse:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4077
                    self markCommentFrom:startPos to:(source position + 1).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4078
                    outStream notNil ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4079
                        outStream nextPut:(Character doubleQuote).
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4080
                        outCol := outCol + 1
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4081
                    ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4082
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4083
                "skip final dQuote"
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4084
                source next.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4085
                endPos := source position.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4086
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4087
                (source peek == Character doubleQuote) ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4088
                    stillInComment := true.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4089
                    hereChar := source nextPeek.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4090
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4091
            ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4092
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4093
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4094
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4095
    saveComments ifTrue:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4096
        commentText := commentStream contents.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4097
        self endComment:commentText type:commentType start:startPos end:endPos.
1653
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  4098
    ].
db35fa50902a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  4099
3288
a98543e59971 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3283
diff changeset
  4100
    ignoreWarnings ifFalse:[
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4101
        parserFlags warnAboutBadComments ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4102
            anyNonBlank ifFalse:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4103
                commentType == #regularComment ifTrue:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4104
                    self isDoIt ifFalse:[
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4105
                        self
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4106
                            warning:'empty comment'
4692
d6ddd748f7e3 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 4688
diff changeset
  4107
                            doNotShowAgainAction:(self actionToDisableWarning:#warnAboutBadComments)
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4108
                            position:startPos to:endPos+1.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4109
                        parserFlags warnAboutBadComments:false.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4110
                    ]
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4111
                ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4112
            ].
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4113
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4114
    ].
4173
33b6dd806e42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
  4115
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4116
    "Modified: / 14-07-2020 / 10:54:23 / cg"
2138
330345945d40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
  4117
!
330345945d40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
  4118
330345945d40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
  4119
skipToEndOfLineRememberingIn:commentStreamOrNil
330345945d40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
  4120
    [hereChar notNil and:[hereChar ~~ Character cr]] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4121
	commentStreamOrNil notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4122
	    commentStreamOrNil nextPut:hereChar
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4123
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4124
	outStream notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4125
	    outStream nextPut:hereChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4126
	    outCol := outCol + 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4127
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4128
	hereChar := source nextPeek.
2138
330345945d40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2134
diff changeset
  4129
    ].
2983
3d721bb07c48 class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
  4130
    lineNr := lineNr + 1.
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4131
!
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4132
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4133
xnextString:delimiter escapeStyle:escapeStyle
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4134
    "a quote has been scanned; scan the string (caring for doubled quotes).
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4135
     escapeStyle may be:
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4136
	nil - old style ST80 strings (no character escapes)
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4137
     or a single char string:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4138
	'c' - C-style escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4139
			\n,\t,\r,\b,\xXX,\uXXXX,\UXXXXXX,
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4140
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4141
	'e' - C-style plus embedded escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4142
			e'...{ expr1 } ... { exprN }' will generate:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4143
			'...%1 ... %N' bindWithArguments:{ expr1 . ... . exprN }
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4144
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4145
	'r' - regex
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4146
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4147
	'x' - extended-style escapes:
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4148
			as yet unsupported
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4149
    "
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4150
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4151
    |nextChar string pos
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4152
     index "{ Class: SmallInteger }"
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4153
     len   "{ Class: SmallInteger }"
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  4154
     inString peekChar
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  4155
     isCString isEString isRString|
4414
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  4156
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  4157
    isEString := (escapeStyle = 'e').
026efea8147d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  4158
    isCString := (escapeStyle = 'c').
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  4159
    isRString := (escapeStyle = 'r').
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4160
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4161
    string := String uninitializedNew:20.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4162
    len := 20.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4163
    index := 1.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4164
    pos := source position.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4165
    nextChar := source next.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4166
    inString := true.
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4167
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4168
    [inString] whileTrue:[
4611
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4169
	nextChar isNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4170
	    self syntaxError:'unexpected end-of-input in String'
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4171
		    position:pos to:(source position).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4172
	    self markStringFrom:pos to:source position.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4173
	    token := nil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4174
	    tokenType := #EOF.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4175
	    ^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4176
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4177
	(nextChar == Character cr) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4178
	    lineNr := lineNr + 1
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4179
	] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4180
	    (nextChar == delimiter) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4181
		(source peekOrNil == delimiter) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4182
		    source next
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4183
		] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4184
		    inString := false
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4185
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4186
	    ] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4187
		(escapeStyle notNil and:[isRString not]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4188
		    ((nextChar == ${) and:[isEString]) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4189
			"/ bail out, to read one expression
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4190
			tokenValue := token := string copyTo:(index - 1).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4191
			tokenType := #StringFragment.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4192
			^ tokenType
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4193
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4194
		    (nextChar == $\) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4195
			peekChar := source peekOrNil.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4196
			peekChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4197
			    source next.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4198
			    nextChar := self escapeCharacterFor:peekChar escapeStyle:escapeStyle.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4199
			]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4200
		    ]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4201
		]
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4202
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4203
	].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4204
	inString ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4205
	    nextChar notNil ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4206
		nextChar codePoint > 255 ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4207
		    string bitsPerCharacter < nextChar bitsPerCharacter ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4208
			nextChar codePoint > 16rFFFF ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4209
			    string := string asUnicode32String
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4210
			] ifFalse:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4211
			    string := string asUnicode16String.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4212
			].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4213
		    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4214
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4215
		string at:index put:nextChar.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4216
		(index == len) ifTrue:[
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4217
		    string := string , (string species new:len).
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4218
		    len := len * 2
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4219
		].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4220
		index := index + 1.
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4221
	    ].
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4222
	    nextChar := source next
d24d3658cc98 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  4223
	]
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4224
    ].
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4225
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4226
    tokenValue := token := string copyTo:(index - 1).
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  4227
    tokenType := isRString ifTrue:[#RegexString] ifFalse:[#String].
4410
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4228
    ^ tokenType
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4229
caeca6ae1339 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4345
diff changeset
  4230
    "Created: / 22-05-2019 / 20:31:36 / Claus Gittinger"
4432
fef0c840421e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4426
diff changeset
  4231
    "Modified: / 03-06-2019 / 11:10:24 / Claus Gittinger"
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4232
! !
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4233
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4234
!Scanner::Comment methodsFor:'accessing'!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4235
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4236
commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4237
    "return the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4238
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4239
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4240
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4241
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4242
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4243
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4244
commentString:aString
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4245
    "set the value of the instance variable 'commentString' (automatically generated)"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4246
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4247
    commentString := aString.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4248
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4249
    "Created: / 17-02-1998 / 14:44:33 / cg"
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4250
    "Modified (format): / 14-07-2020 / 10:21:33 / cg"
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4251
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4252
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4253
commentString:commentStringArg commentType:commentTypeArg
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4254
    commentString := commentStringArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4255
    commentType := commentTypeArg.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4256
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4257
    "Created: / 17.2.1998 / 14:44:33 / cg"
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4258
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4259
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4260
commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4261
    ^ commentType
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4262
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4263
    "Created: / 17.2.1998 / 14:44:33 / cg"
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4264
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4265
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4266
commentType:typeSymbol
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4267
    commentType := typeSymbol.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4268
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4269
    "Created: / 17-02-1998 / 14:44:33 / cg"
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4270
    "Modified (format): / 14-07-2020 / 10:21:23 / cg"
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4271
!
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4272
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4273
endPosition
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4274
    ^ endPosition
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4275
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4276
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4277
endPosition:anInteger
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4278
    endPosition := anInteger.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4279
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4280
    "Modified (format): / 14-07-2020 / 10:21:12 / cg"
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4281
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4282
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4283
startPosition
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4284
    ^ startPosition
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4285
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4286
4683
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4287
startPosition:anInteger
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4288
    startPosition := anInteger.
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4289
1dce65b9c24c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4682
diff changeset
  4290
    "Modified (format): / 14-07-2020 / 10:20:59 / cg"
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4291
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4292
4188
699afeef7a20 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  4293
startPosition:startPositionArg endPosition:endPositionArg
3551
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4294
    startPosition := startPositionArg.
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4295
    endPosition := endPositionArg.
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4296
!
06bf6e8dbe5c class: Scanner
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
  4297
648
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4298
string
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4299
    ^ commentString
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4300
f2e96d4456ec fixed keepComments.
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  4301
    "Created: / 17.2.1998 / 14:49:52 / cg"
0
7ad01559b262 Initial revision
claus
parents:
diff changeset
  4302
! !
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4303
1580
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4304
!Scanner::Comment methodsFor:'converting'!
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4305
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4306
asString
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4307
    ^ commentString.
1583
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  4308
!
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  4309
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  4310
asStringCollection
031fae13e533 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  4311
    ^ commentString asStringCollection.
1580
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4312
! !
c4b1c5e36c67 +comment asString
Claus Gittinger <cg@exept.de>
parents: 1577
diff changeset
  4313
4682
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4314
!Scanner::Comment methodsFor:'printing & storing'!
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4315
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4316
displayOn:aStream
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4317
    aStream nextPutAll:(self class name).
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4318
    aStream nextPutAll:'('.
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4319
    aStream print:commentType.
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4320
    aStream nextPutAll:'; string: "'. 
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4321
    commentString displayOn:aStream.
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4322
    aStream nextPutAll:'")'.
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4323
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4324
    "Created: / 14-07-2020 / 09:46:49 / cg"
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4325
! !
b20b5f18bcd3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 4675
diff changeset
  4326
1651
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4327
!Scanner::Comment methodsFor:'queries'!
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4328
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4329
isEndOfLineComment
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4330
    ^ commentType == #eolComment
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4331
! !
bf51380bee3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1649
diff changeset
  4332
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4333
!Scanner::Directive class methodsFor:'instance creation'!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4334
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4335
newClassDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4336
    ^ ClassDirective new
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4337
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4338
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4339
newClassHintDirective
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4340
    ^ ClassHintDirective new
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4341
! !
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4342
1598
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4343
!Scanner::Directive methodsFor:'queries'!
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4344
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4345
isClassHintDirective
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4346
    ^ false
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4347
! !
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4348
1596
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4349
!Scanner::Directive::ClassDirective methodsFor:'accessing'!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4350
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4351
className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4352
    ^ className
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4353
!
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4354
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4355
className:something
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4356
    className := something.
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4357
! !
482fb73aa844 directive parsing
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  4358
1598
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4359
!Scanner::Directive::ClassHintDirective methodsFor:'queries'!
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4360
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4361
isClassHintDirective
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4362
    ^ true
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4363
! !
cf7e99bd8ce3 classHint stuff
Claus Gittinger <cg@exept.de>
parents: 1596
diff changeset
  4364
359
5c3718455360 support for nameSpaces (space::name)
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  4365
!Scanner class methodsFor:'documentation'!
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  4366
2740
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  4367
version
3695
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  4368
    ^ '$Header$'
2740
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  4369
!
0a71a9bb034f changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
  4370
2290
d84dd6eff7ea changed:
Claus Gittinger <cg@exept.de>
parents: 2196
diff changeset
  4371
version_CVS
3695
Claus Gittinger <cg@exept.de>
parents: 3643
diff changeset
  4372
    ^ '$Header$'
148
ef0e604209ec version method at the end
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
  4373
! !
1321
e34f7e7d28a0 preps for character escapes
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  4374
3056
86aabb90772d class: Scanner
Claus Gittinger <cg@exept.de>
parents: 2990
diff changeset
  4375
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
  4376
Scanner initialize!