@@ -87,7 +87,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
8787 else {
8888 stream . eatWhile ( / [ \w \$ _ ] / ) ;
8989 var word = stream . current ( ) , known = keywords . propertyIsEnumerable ( word ) && keywords [ word ] ;
90- return known ? ret ( known . type , known . style , word ) :
90+ return ( known && state . kwAllowed ) ? ret ( known . type , known . style , word ) :
9191 ret ( "variable" , "variable" , word ) ;
9292 }
9393 }
@@ -316,6 +316,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
316316 return {
317317 tokenize : jsTokenBase ,
318318 reAllowed : true ,
319+ kwAllowed : true ,
319320 cc : [ ] ,
320321 lexical : new JSLexical ( ( basecolumn || 0 ) - indentUnit , 0 , "block" , false ) ,
321322 localVars : null ,
@@ -334,6 +335,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
334335 var style = state . tokenize ( stream , state ) ;
335336 if ( type == "comment" ) return style ;
336337 state . reAllowed = type == "operator" || type == "keyword c" || type . match ( / ^ [ \[ { } \( , ; : ] $ / ) ;
338+ state . kwAllowed = type != '.' ;
337339 return parseJS ( state , style , type , content , stream ) ;
338340 } ,
339341
0 commit comments