@@ -80,7 +80,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
8080 // tokenizers
8181 function tokenBase ( stream , state ) {
8282 // Handle multiline comments
83- if ( stream . match ( / ^ # = / , false ) ) {
83+ if ( stream . match ( '#=' , false ) ) {
8484 state . tokenize = tokenComment ;
8585 return state . tokenize ( stream , state ) ;
8686 }
@@ -141,10 +141,10 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
141141 }
142142
143143 if ( inArray ( state ) ) {
144- if ( state . lastToken == "end" && stream . match ( / ^ : / ) ) {
144+ if ( state . lastToken == "end" && stream . match ( ':' ) ) {
145145 return "operator" ;
146146 }
147- if ( stream . match ( / ^ e n d / ) ) {
147+ if ( stream . match ( ' end' ) ) {
148148 return "number" ;
149149 }
150150 }
@@ -201,7 +201,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
201201 }
202202
203203 // Handle Chars
204- if ( stream . match ( / ^ ' / ) ) {
204+ if ( stream . match ( '\'' ) ) {
205205 state . tokenize = tokenChar ;
206206 return state . tokenize ( stream , state ) ;
207207 }
@@ -263,7 +263,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
263263 state . scopes . push ( '(' ) ;
264264 charsAdvanced += match [ 1 ] . length ;
265265 }
266- if ( currentScope ( state ) == '(' && stream . match ( / ^ \) / ) ) {
266+ if ( currentScope ( state ) == '(' && stream . match ( ')' ) ) {
267267 state . scopes . pop ( ) ;
268268 charsAdvanced += 1 ;
269269 if ( state . scopes . length <= state . firstParenPos ) {
@@ -295,10 +295,10 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
295295 }
296296
297297 function tokenAnnotation ( stream , state ) {
298- stream . match ( / .* ?(? = , | ; | { | } | \( | \) | = | $ | \s ) / ) ;
299- if ( stream . match ( / ^ { / ) ) {
298+ stream . match ( / .* ?(? = [ , ; { } ( ) = \s ] | $ ) / ) ;
299+ if ( stream . match ( '{' ) ) {
300300 state . nestedParameters ++ ;
301- } else if ( stream . match ( / ^ } / ) && state . nestedParameters > 0 ) {
301+ } else if ( stream . match ( '}' ) && state . nestedParameters > 0 ) {
302302 state . nestedParameters -- ;
303303 }
304304 if ( state . nestedParameters > 0 ) {
@@ -310,13 +310,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
310310 }
311311
312312 function tokenComment ( stream , state ) {
313- if ( stream . match ( / ^ # = / ) ) {
313+ if ( stream . match ( '#=' ) ) {
314314 state . nestedComments ++ ;
315315 }
316316 if ( ! stream . match ( / .* ?(? = ( # = | = # ) ) / ) ) {
317317 stream . skipToEnd ( ) ;
318318 }
319- if ( stream . match ( / ^ = # / ) ) {
319+ if ( stream . match ( '=#' ) ) {
320320 state . nestedComments -- ;
321321 if ( state . nestedComments == 0 )
322322 state . tokenize = tokenBase ;
@@ -347,7 +347,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
347347 return "string" ;
348348 }
349349 if ( ! stream . match ( / ^ [ ^ ' ] + (? = ' ) / ) ) { stream . skipToEnd ( ) ; }
350- if ( stream . match ( / ^ ' / ) ) { state . tokenize = tokenBase ; }
350+ if ( stream . match ( '\'' ) ) { state . tokenize = tokenBase ; }
351351 return "error" ;
352352 }
353353
0 commit comments