@@ -21,7 +21,7 @@ function Context(indented, column, type, info, align, prev) {
2121}
2222function pushContext ( state , col , type , info ) {
2323 var indent = state . indented ;
24- if ( state . context && state . context . type ! = "statement" && type != "statement" )
24+ if ( state . context && state . context . type = = "statement" && type != "statement" )
2525 indent = state . context . indented ;
2626 return state . context = new Context ( indent , col , type , info , null , state . context ) ;
2727}
@@ -64,8 +64,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
6464 isPunctuationChar = parserConfig . isPunctuationChar || / [ \[ \] { } \( \) , ; \: \. ] / ,
6565 numberStart = parserConfig . numberStart || / [ \d \. ] / ,
6666 number = parserConfig . number || / ^ (?: 0 x [ a - f \d ] + | 0 b [ 0 1 ] + | (?: \d + \. ? \d * | \. \d + ) (?: e [ - + ] ? \d + ) ? ) ( u | l l ? | l | f ) ? / i,
67- isOperatorChar = parserConfig . isOperatorChar || / [ + \- * & % = < > ! ? | \/ ] / ,
68- endStatement = parserConfig . endStatement || / ^ [ ; : , ] $ / ;
67+ isOperatorChar = parserConfig . isOperatorChar || / [ + \- * & % = < > ! ? | \/ ] / ;
6968
7069 var curPunc , isDefKeyword ;
7170
@@ -177,7 +176,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
177176 if ( style == "comment" || style == "meta" ) return style ;
178177 if ( ctx . align == null ) ctx . align = true ;
179178
180- if ( endStatement . test ( curPunc ) ) while ( state . context . type == "statement" ) popContext ( state ) ;
179+ if ( curPunc == ";" || curPunc == ":" || ( curPunc == "," && stream . match ( / ^ \s * (?: \/ \/ .* ) ? $ / , false ) ) )
180+ while ( state . context . type == "statement" ) popContext ( state ) ;
181181 else if ( curPunc == "{" ) pushContext ( state , stream . column ( ) , "}" ) ;
182182 else if ( curPunc == "[" ) pushContext ( state , stream . column ( ) , "]" ) ;
183183 else if ( curPunc == "(" ) pushContext ( state , stream . column ( ) , ")" ) ;
@@ -432,7 +432,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
432432 defKeywords : words ( "class interface package enum" ) ,
433433 typeFirstDefinitions : true ,
434434 atoms : words ( "true false null" ) ,
435- endStatement : / ^ [ ; : ] $ / ,
436435 number : / ^ (?: 0 x [ a - f \d _ ] + | 0 b [ 0 1 _ ] + | (?: [ \d _ ] + \. ? \d * | \. \d + ) (?: e [ - + ] ? [ \d _ ] + ) ? ) ( u | l l ? | l | f ) ? / i,
437436 hooks : {
438437 "@" : function ( stream ) {
0 commit comments