Skip to content

Commit

Permalink
Fixed bug #345 : Javascript regex not tokenized when inside array
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Dec 10, 2014
1 parent 14a01a7 commit b3b4b02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
22 changes: 12 additions & 10 deletions CodeSniffer/Tokenizers/JS.php
Expand Up @@ -852,21 +852,23 @@ public function tokenizeString($string, $eolChar='\n')
public function getRegexToken($char, $string, $chars, $tokens, $eolChar)
{
$beforeTokens = array(
T_EQUAL => true,
T_OPEN_PARENTHESIS => true,
T_RETURN => true,
T_BOOLEAN_OR => true,
T_BOOLEAN_AND => true,
T_BITWISE_OR => true,
T_BITWISE_AND => true,
T_COMMA => true,
T_COLON => true,
T_TYPEOF => true,
T_EQUAL => true,
T_OPEN_PARENTHESIS => true,
T_OPEN_SQUARE_BRACKET => true,
T_RETURN => true,
T_BOOLEAN_OR => true,
T_BOOLEAN_AND => true,
T_BITWISE_OR => true,
T_BITWISE_AND => true,
T_COMMA => true,
T_COLON => true,
T_TYPEOF => true,
);

$afterTokens = array(
',' => true,
')' => true,
']' => true,
';' => true,
' ' => true,
'.' => true,
Expand Down
1 change: 1 addition & 0 deletions package.xml
Expand Up @@ -33,6 +33,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Thanks to Sertan Danis for the patch
- Fixed bug #337 : False positive with anonymous functions in Generic_Sniffs_WhiteSpace_ScopeIndentSniff
- Fixed bug #342 : Nested ternary operators not tokenized correctly
- Fixed bug #345 : Javascript regex not tokenized when inside array
</notes>
<contents>
<dir name="/">
Expand Down

0 comments on commit b3b4b02

Please sign in to comment.