@@ -1413,11 +1413,17 @@ class Token {
14131413 }
14141414
14151415 // Handle array access
1416+ // Handle array access (skip strings inside brackets)
14161417 if (c == " [" .code ) {
14171418 pos ++ ;
14181419 var bracketLevel = 1 ;
14191420 while (pos < this .length && bracketLevel > 0 ) {
14201421 c = input .uCharCodeAt (pos );
1422+ if (c == ' "' .code ) {
1423+ pos = scanStringEnd (pos , false );
1424+ if (pos == - 1 ) return false ;
1425+ continue ;
1426+ }
14211427 if (c == " [" .code ) bracketLevel ++ ;
14221428 if (c == " ]" .code ) bracketLevel -- ;
14231429 pos ++ ;
@@ -1677,12 +1683,20 @@ class Token {
16771683 continue ;
16781684 }
16791685
1680- // Handle bracket access
1686+ // Handle bracket access (skip strings inside brackets)
16811687 if (c == " [" .code ) {
1682- // Skip everything until closing bracket
16831688 pos ++ ;
16841689 while (pos < this .length ) {
1685- if (input .uCharCodeAt (pos ) == " ]" .code ) {
1690+ final bc = input .uCharCodeAt (pos );
1691+ if (bc == ' "' .code ) {
1692+ pos = scanStringEnd (pos , false );
1693+ if (pos == - 1 ) {
1694+ pos = startPos ;
1695+ return false ;
1696+ }
1697+ continue ;
1698+ }
1699+ if (bc == " ]" .code ) {
16861700 pos ++ ;
16871701 break ;
16881702 }
@@ -1776,12 +1790,17 @@ class Token {
17761790 continue ;
17771791 }
17781792
1779- // Handle bracket access
1793+ // Handle bracket access (skip strings inside brackets)
17801794 if (c == " [" .code ) {
1781- // Skip everything until closing bracket
17821795 pos ++ ;
17831796 while (pos < this .length ) {
1784- if (input .uCharCodeAt (pos ) == " ]" .code ) {
1797+ final bc = input .uCharCodeAt (pos );
1798+ if (bc == ' "' .code ) {
1799+ pos = scanStringEnd (pos , false );
1800+ if (pos == - 1 ) return false ;
1801+ continue ;
1802+ }
1803+ if (bc == " ]" .code ) {
17851804 pos ++ ;
17861805 break ;
17871806 }
@@ -1802,6 +1821,11 @@ class Token {
18021821 else if (c == " \r " .code || c == " \n " .code ) {
18031822 return false ;
18041823 }
1824+ else if (c == ' "' .code ) {
1825+ // Skip quoted strings so their content isn't matched as operators
1826+ pos = scanStringEnd (pos , false );
1827+ if (pos == - 1 ) return false ;
1828+ }
18051829 else if (isIdentifierStart (c )) {
18061830 if (! readIdent ()) return false ;
18071831 }
0 commit comments