@@ -23,13 +23,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
2323
2424 var keywords = function ( ) {
2525 function kw ( type ) { return { type : type , style : "keyword" } ; }
26- var A = kw ( "keyword a" ) , B = kw ( "keyword b" ) , C = kw ( "keyword c" ) ;
26+ var A = kw ( "keyword a" ) , B = kw ( "keyword b" ) , C = kw ( "keyword c" ) , D = kw ( "keyword d" ) ;
2727 var operator = kw ( "operator" ) , atom = { type : "atom" , style : "atom" } ;
2828
2929 var jsKeywords = {
3030 "if" : kw ( "if" ) , "while" : A , "with" : A , "else" : B , "do" : B , "try" : B , "finally" : B ,
31- "return" : C , "break" : C , "continue" : C , "new" : kw ( "new" ) , "delete" : C , "void" : C , "throw" : C , "debugger " : C ,
32- "var" : kw ( "var" ) , "const" : kw ( "var" ) , "let" : kw ( "var" ) ,
31+ "return" : D , "break" : D , "continue" : D , "new" : kw ( "new" ) , "delete" : C , "void" : C , "throw" : C ,
32+ "debugger" : kw ( "debugger" ) , " var" : kw ( "var" ) , "const" : kw ( "var" ) , "let" : kw ( "var" ) ,
3333 "function" : kw ( "function" ) , "catch" : kw ( "catch" ) ,
3434 "for" : kw ( "for" ) , "switch" : kw ( "switch" ) , "case" : kw ( "case" ) , "default" : kw ( "default" ) ,
3535 "in" : operator , "typeof" : operator , "instanceof" : operator ,
@@ -357,6 +357,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
357357 if ( type == "var" ) return cont ( pushlex ( "vardef" , value . length ) , vardef , expect ( ";" ) , poplex ) ;
358358 if ( type == "keyword a" ) return cont ( pushlex ( "form" ) , parenExpr , statement , poplex ) ;
359359 if ( type == "keyword b" ) return cont ( pushlex ( "form" ) , statement , poplex ) ;
360+ if ( type == "keyword d" ) return cx . stream . match ( / ^ \s * $ / , false ) ? cont ( ) : cont ( pushlex ( "stat" ) , maybeexpression , expect ( ";" ) , poplex ) ;
361+ if ( type == "debugger" ) return cont ( expect ( ";" ) ) ;
360362 if ( type == "{" ) return cont ( pushlex ( "}" ) , block , poplex ) ;
361363 if ( type == ";" ) return cont ( ) ;
362364 if ( type == "if" ) {
@@ -412,7 +414,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
412414 if ( atomicTypes . hasOwnProperty ( type ) ) return cont ( maybeop ) ;
413415 if ( type == "function" ) return cont ( functiondef , maybeop ) ;
414416 if ( type == "class" ) return cont ( pushlex ( "form" ) , classExpression , poplex ) ;
415- if ( type == "keyword c" || type == "async" ) return cont ( noComma ? maybeexpressionNoComma : maybeexpression ) ;
417+ if ( type == "keyword c" || type == "async" ) return cont ( noComma ? expressionNoComma : expression ) ;
416418 if ( type == "(" ) return cont ( pushlex ( ")" ) , maybeexpression , expect ( ")" ) , poplex , maybeop ) ;
417419 if ( type == "operator" || type == "spread" ) return cont ( noComma ? expressionNoComma : expression ) ;
418420 if ( type == "[" ) return cont ( pushlex ( "]" ) , arrayLiteral , poplex , maybeop ) ;
0 commit comments