getify / literalizer

Specialized heuristic lexer for JS to identify complex literals
16 stars 2 forks source link

heuristics for "block_allowed" after a : don't properly account for switch clauses #15

Closed getify closed 11 years ago

getify commented 11 years ago

Currently, literalizer only treats a { } pair after a : as being a block if the : was from a statement label.

However:

switch (foo) {
   case 'bar': 
      { blah(); }
      /b/g;
}

Fails to identify the /b/g regex, because the { .. } before it is not seen as a block.