@@ -255,41 +255,43 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
255
255
}
256
256
257
257
function tokenCallOrDef ( stream , state ) {
258
- var match = stream . match ( / ^ ( \( \s * ) / ) ;
259
- if ( match ) {
260
- if ( state . firstParenPos < 0 )
261
- state . firstParenPos = state . scopes . length ;
262
- state . scopes . push ( '(' ) ;
263
- state . charsAdvanced += match [ 1 ] . length ;
264
- }
265
- if ( currentScope ( state ) == '(' && stream . match ( / ^ \) / ) ) {
266
- state . scopes . pop ( ) ;
267
- state . charsAdvanced += 1 ;
268
- if ( state . scopes . length <= state . firstParenPos ) {
269
- var isDefinition = stream . match ( / ^ ( \s * w h e r e \s + [ ^ \s = ] + ) * \s * ?= (? ! = ) / , false ) ;
270
- stream . backUp ( state . charsAdvanced ) ;
258
+ for ( ; ; ) {
259
+ var match = stream . match ( / ^ ( \( \s * ) / ) , charsAdvanced = 0 ;
260
+ if ( match ) {
261
+ if ( state . firstParenPos < 0 )
262
+ state . firstParenPos = state . scopes . length ;
263
+ state . scopes . push ( '(' ) ;
264
+ charsAdvanced += match [ 1 ] . length ;
265
+ }
266
+ if ( currentScope ( state ) == '(' && stream . match ( / ^ \) / ) ) {
267
+ state . scopes . pop ( ) ;
268
+ charsAdvanced += 1 ;
269
+ if ( state . scopes . length <= state . firstParenPos ) {
270
+ var isDefinition = stream . match ( / ^ ( \s * w h e r e \s + [ ^ \s = ] + ) * \s * ?= (? ! = ) / , false ) ;
271
+ stream . backUp ( charsAdvanced ) ;
272
+ state . firstParenPos = - 1 ;
273
+ state . tokenize = tokenBase ;
274
+ if ( isDefinition )
275
+ return "def" ;
276
+ return "builtin" ;
277
+ }
278
+ }
279
+ // Unfortunately javascript does not support multiline strings, so we have
280
+ // to undo anything done upto here if a function call or definition splits
281
+ // over two or more lines.
282
+ if ( stream . match ( / ^ $ / g, false ) ) {
283
+ stream . backUp ( charsAdvanced ) ;
284
+ while ( state . scopes . length > state . firstParenPos )
285
+ state . scopes . pop ( ) ;
271
286
state . firstParenPos = - 1 ;
272
- state . charsAdvanced = 0 ;
273
287
state . tokenize = tokenBase ;
274
- if ( isDefinition )
275
- return "def" ;
276
288
return "builtin" ;
277
289
}
290
+ if ( ! stream . match ( / ^ [ ^ ( ) ] + / ) ) {
291
+ stream . next ( )
292
+ return null
293
+ }
278
294
}
279
- // Unfortunately javascript does not support multiline strings, so we have
280
- // to undo anything done upto here if a function call or definition splits
281
- // over two or more lines.
282
- if ( stream . match ( / ^ $ / g, false ) ) {
283
- stream . backUp ( state . charsAdvanced ) ;
284
- while ( state . scopes . length > state . firstParenPos )
285
- state . scopes . pop ( ) ;
286
- state . firstParenPos = - 1 ;
287
- state . charsAdvanced = 0 ;
288
- state . tokenize = tokenBase ;
289
- return "builtin" ;
290
- }
291
- state . charsAdvanced += stream . match ( / ^ ( [ ^ ( ) ] * ) / ) [ 1 ] . length ;
292
- return state . tokenize ( stream , state ) ;
293
295
}
294
296
295
297
function tokenAnnotation ( stream , state ) {
@@ -383,7 +385,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
383
385
nestedComments : 0 ,
384
386
nestedGenerators : 0 ,
385
387
nestedParameters : 0 ,
386
- charsAdvanced : 0 ,
387
388
firstParenPos : - 1
388
389
} ;
389
390
} ,
0 commit comments