21 warnSTXNameSpaceUse warnPossibleIncompatibilities |
21 warnSTXNameSpaceUse warnPossibleIncompatibilities |
22 warnDollarInIdentifier' |
22 warnDollarInIdentifier' |
23 classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings |
23 classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings |
24 WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier |
24 WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier |
25 WarnCommonMistakes WarnPossibleIncompatibilities |
25 WarnCommonMistakes WarnPossibleIncompatibilities |
26 WarnDollarInIdentifier AllowDollarInIdentifier' |
26 WarnDollarInIdentifier AllowDollarInIdentifier |
|
27 EmptySourceNotificationSignal' |
27 poolDictionaries:'' |
28 poolDictionaries:'' |
28 category:'System-Compiler' |
29 category:'System-Compiler' |
29 ! |
30 ! |
30 |
31 |
31 Object subclass:#Comment |
32 Object subclass:#Comment |
89 |
90 |
90 "Created: / 4.1.1997 / 14:13:24 / cg" |
91 "Created: / 4.1.1997 / 14:13:24 / cg" |
91 "Modified: / 27.2.1998 / 02:01:28 / cg" |
92 "Modified: / 27.2.1998 / 02:01:28 / cg" |
92 ! |
93 ! |
93 |
94 |
|
95 setupActions |
|
96 "initialize the scanners actionTables - these are used to dispatch |
|
97 into scanner methods as characters are read" |
|
98 |
|
99 |block| |
|
100 |
|
101 ActionArray := Array new:256. |
|
102 TypeArray := Array new:256. |
|
103 |
|
104 block := [:s :char | s nextNumber]. |
|
105 ($0 asciiValue) to:($9 asciiValue) do:[:index | |
|
106 ActionArray at:index put:block |
|
107 ]. |
|
108 |
|
109 block := [:s :char | s nextSpecial]. |
|
110 self binarySelectorCharacters do:[:binop | |
|
111 TypeArray at:(binop asciiValue) put:#special. |
|
112 ActionArray at:(binop asciiValue) put:block |
|
113 ]. |
|
114 |
|
115 "/ that one is a special case (both binarySelector AND syntax). |
|
116 TypeArray at:($| asciiValue) put:nil. |
|
117 |
|
118 block := [:s :char | s nextToken:char]. |
|
119 #( $; $. $( $) $[ $] "$!!" $^ $| $_ ) do:[:ch | |
|
120 ActionArray at:(ch asciiValue) put:block |
|
121 ]. |
|
122 |
|
123 block := [:s :char | s nextIdentifier]. |
|
124 ($a asciiValue) to:($z asciiValue) do:[:index | |
|
125 ActionArray at:index put:block |
|
126 ]. |
|
127 ($A asciiValue) to:($Z asciiValue) do:[:index | |
|
128 ActionArray at:index put:block |
|
129 ]. |
|
130 AllowUnderscoreInIdentifier ifTrue:[ |
|
131 ActionArray at:$_ asciiValue put:block |
|
132 ]. |
|
133 |
|
134 "kludge: action is characterToken, but type is special" |
|
135 TypeArray at:($| asciiValue) put:#special. |
|
136 |
|
137 "kludge: action is nextColonOrAssign, but type is special" |
|
138 TypeArray at:($: asciiValue) put:#special. |
|
139 |
|
140 ActionArray at:($' asciiValue) put:[:s :char | s nextString]. |
|
141 ActionArray at:($$ asciiValue) put:[:s :char | s nextCharacter]. |
|
142 ActionArray at:($# asciiValue) put:[:s :char | s nextHash]. |
|
143 ActionArray at:($% asciiValue) put:[:s :char | s nextPrimitive]. |
|
144 ActionArray at:($: asciiValue) put:[:s :char | s nextColonOrAssign] |
|
145 |
|
146 " |
|
147 Scanner setupActions |
|
148 " |
|
149 |
|
150 "Modified: 23.5.1997 / 12:07:55 / cg" |
|
151 ! ! |
|
152 |
|
153 !Scanner class methodsFor:'instance creation'! |
|
154 |
|
155 for:aStringOrStream |
|
156 "create & return a new scanner reading from aStringOrStream" |
|
157 |
|
158 ^ (super new) initializeFor:aStringOrStream |
|
159 |
|
160 "Modified: 23.5.1997 / 12:08:42 / cg" |
|
161 ! ! |
|
162 |
|
163 !Scanner class methodsFor:'Signal constants'! |
|
164 |
|
165 emptySourceNotificationSignal |
|
166 ^ EmptySourceNotificationSignal |
|
167 |
|
168 "Created: / 16.5.1998 / 15:55:14 / cg" |
|
169 ! ! |
|
170 |
|
171 !Scanner class methodsFor:'class initialization'! |
|
172 |
94 initialize |
173 initialize |
95 "initialize the classes defaults. Typically, these are changed |
174 "initialize the classes defaults. Typically, these are changed |
96 later in the 'private.rc' file." |
175 later in the 'private.rc' file." |
|
176 |
|
177 EmptySourceNotificationSignal isNil ifTrue:[ |
|
178 EmptySourceNotificationSignal := QuerySignal new mayProceed:true. |
|
179 EmptySourceNotificationSignal notifierString:'empty source given to evaluate'. |
|
180 EmptySourceNotificationSignal nameClass:self message:#emptySourceNotificationSignal. |
|
181 ]. |
97 |
182 |
98 Warnings := true. |
183 Warnings := true. |
99 WarnSTXSpecials := true. |
184 WarnSTXSpecials := true. |
100 WarnUnderscoreInIdentifier := true. |
185 WarnUnderscoreInIdentifier := true. |
101 WarnDollarInIdentifier := true. |
186 WarnDollarInIdentifier := true. |
107 |
192 |
108 " |
193 " |
109 self initialize |
194 self initialize |
110 " |
195 " |
111 |
196 |
112 "Modified: 7.9.1997 / 01:37:57 / cg" |
197 "Modified: / 16.5.1998 / 15:55:41 / cg" |
113 ! |
|
114 |
|
115 setupActions |
|
116 "initialize the scanners actionTables - these are used to dispatch |
|
117 into scanner methods as characters are read" |
|
118 |
|
119 |block| |
|
120 |
|
121 ActionArray := Array new:256. |
|
122 TypeArray := Array new:256. |
|
123 |
|
124 block := [:s :char | s nextNumber]. |
|
125 ($0 asciiValue) to:($9 asciiValue) do:[:index | |
|
126 ActionArray at:index put:block |
|
127 ]. |
|
128 |
|
129 block := [:s :char | s nextSpecial]. |
|
130 self binarySelectorCharacters do:[:binop | |
|
131 TypeArray at:(binop asciiValue) put:#special. |
|
132 ActionArray at:(binop asciiValue) put:block |
|
133 ]. |
|
134 |
|
135 "/ that one is a special case (both binarySelector AND syntax). |
|
136 TypeArray at:($| asciiValue) put:nil. |
|
137 |
|
138 block := [:s :char | s nextToken:char]. |
|
139 #( $; $. $( $) $[ $] "$!!" $^ $| $_ ) do:[:ch | |
|
140 ActionArray at:(ch asciiValue) put:block |
|
141 ]. |
|
142 |
|
143 block := [:s :char | s nextIdentifier]. |
|
144 ($a asciiValue) to:($z asciiValue) do:[:index | |
|
145 ActionArray at:index put:block |
|
146 ]. |
|
147 ($A asciiValue) to:($Z asciiValue) do:[:index | |
|
148 ActionArray at:index put:block |
|
149 ]. |
|
150 AllowUnderscoreInIdentifier ifTrue:[ |
|
151 ActionArray at:$_ asciiValue put:block |
|
152 ]. |
|
153 |
|
154 "kludge: action is characterToken, but type is special" |
|
155 TypeArray at:($| asciiValue) put:#special. |
|
156 |
|
157 "kludge: action is nextColonOrAssign, but type is special" |
|
158 TypeArray at:($: asciiValue) put:#special. |
|
159 |
|
160 ActionArray at:($' asciiValue) put:[:s :char | s nextString]. |
|
161 ActionArray at:($$ asciiValue) put:[:s :char | s nextCharacter]. |
|
162 ActionArray at:($# asciiValue) put:[:s :char | s nextHash]. |
|
163 ActionArray at:($% asciiValue) put:[:s :char | s nextPrimitive]. |
|
164 ActionArray at:($: asciiValue) put:[:s :char | s nextColonOrAssign] |
|
165 |
|
166 " |
|
167 Scanner setupActions |
|
168 " |
|
169 |
|
170 "Modified: 23.5.1997 / 12:07:55 / cg" |
|
171 ! ! |
|
172 |
|
173 !Scanner class methodsFor:'instance creation'! |
|
174 |
|
175 for:aStringOrStream |
|
176 "create & return a new scanner reading from aStringOrStream" |
|
177 |
|
178 ^ (super new) initializeFor:aStringOrStream |
|
179 |
|
180 "Modified: 23.5.1997 / 12:08:42 / cg" |
|
181 ! ! |
198 ! ! |
182 |
199 |
183 !Scanner class methodsFor:'defaults'! |
200 !Scanner class methodsFor:'defaults'! |
184 |
201 |
185 allowDollarInIdentifier |
202 allowDollarInIdentifier |