@@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) {
154154 return f ( stream , state ) ;
155155 }
156156
157- var type , content ;
158-
159- function ret ( _type , style , _content ) {
160- type = _type ;
161- content = _content ;
162- return style ;
163- }
164-
165157 function tokenBase ( stream , state ) {
166158 // String
167159 var ch = stream . peek ( ) ;
168160 if ( ch == "'" || ch == '"' ) {
169161 stream . next ( ) ;
170- return chain ( stream , state , tokenString ( ch , "string" , "string" ) ) ;
162+ return chain ( stream , state , tokenString ( ch , "string" ) ) ;
171163 }
172164 // Comment
173165 else if ( ch == "/" ) {
@@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) {
176168 return chain ( stream , state , tokenComment ) ;
177169 } else if ( stream . eat ( "/" ) ) {
178170 stream . skipToEnd ( ) ;
179- return ret ( "comment" , "comment" ) ;
171+ return "comment" ;
180172 } else {
181173 stream . skipTo ( " " ) ;
182- return ret ( "operator" , "operator" ) ;
174+ return "operator" ;
183175 }
184176 }
185177 // Decimal
186178 else if ( / \d / . test ( ch ) ) {
187179 stream . match ( / ^ \d * (?: \. \d * ) ? (?: e [ + \- ] ? \d + ) ? / ) ;
188- return ret ( "number" , "number" ) ;
180+ return "number" ;
189181 }
190182 // Hash
191183 else if ( ch == "#" ) {
@@ -194,55 +186,55 @@ CodeMirror.defineMode("dylan", function(_config) {
194186 ch = stream . peek ( ) ;
195187 if ( ch == '"' ) {
196188 stream . next ( ) ;
197- return chain ( stream , state , tokenString ( '"' , "symbol" , " string-2") ) ;
189+ return chain ( stream , state , tokenString ( '"' , "string-2" ) ) ;
198190 }
199191 // Binary number
200192 else if ( ch == "b" ) {
201193 stream . next ( ) ;
202194 stream . eatWhile ( / [ 0 1 ] / ) ;
203- return ret ( "number" , "number" ) ;
195+ return "number" ;
204196 }
205197 // Hex number
206198 else if ( ch == "x" ) {
207199 stream . next ( ) ;
208200 stream . eatWhile ( / [ \d a - f ] / i) ;
209- return ret ( "number" , "number" ) ;
201+ return "number" ;
210202 }
211203 // Octal number
212204 else if ( ch == "o" ) {
213205 stream . next ( ) ;
214206 stream . eatWhile ( / [ 0 - 7 ] / ) ;
215- return ret ( "number" , "number" ) ;
207+ return "number" ;
216208 }
217209 // Hash symbol
218210 else {
219211 stream . eatWhile ( / [ - a - z A - Z ] / ) ;
220- return ret ( "hash" , " keyword") ;
212+ return " keyword";
221213 }
222214 } else if ( stream . match ( "end" ) ) {
223- return ret ( "end" , " keyword") ;
215+ return " keyword";
224216 }
225217 for ( var name in patterns ) {
226218 if ( patterns . hasOwnProperty ( name ) ) {
227219 var pattern = patterns [ name ] ;
228220 if ( ( pattern instanceof Array && pattern . some ( function ( p ) {
229221 return stream . match ( p ) ;
230222 } ) ) || stream . match ( pattern ) )
231- return ret ( name , patternStyles [ name ] , stream . current ( ) ) ;
223+ return patternStyles [ name ] ;
232224 }
233225 }
234226 if ( stream . match ( "define" ) ) {
235- return ret ( "definition" , " def") ;
227+ return " def";
236228 } else {
237229 stream . eatWhile ( / [ \w \- ] / ) ;
238230 // Keyword
239231 if ( wordLookup [ stream . current ( ) ] ) {
240- return ret ( wordLookup [ stream . current ( ) ] , styleLookup [ stream . current ( ) ] , stream . current ( ) ) ;
232+ return styleLookup [ stream . current ( ) ] ;
241233 } else if ( stream . current ( ) . match ( symbol ) ) {
242- return ret ( "variable" , "variable" ) ;
234+ return "variable" ;
243235 } else {
244236 stream . next ( ) ;
245- return ret ( "other" , " variable-2") ;
237+ return " variable-2";
246238 }
247239 }
248240 }
@@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) {
257249 }
258250 maybeEnd = ( ch == "*" ) ;
259251 }
260- return ret ( "comment" , "comment" ) ;
252+ return "comment" ;
261253 }
262254
263- function tokenString ( quote , type , style ) {
255+ function tokenString ( quote , style ) {
264256 return function ( stream , state ) {
265257 var next , end = false ;
266258 while ( ( next = stream . next ( ) ) != null ) {
@@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) {
271263 }
272264 if ( end )
273265 state . tokenize = tokenBase ;
274- return ret ( type , style ) ;
266+ return style ;
275267 } ;
276268 }
277269
0 commit comments