@@ -18,8 +18,8 @@ class LineCheckBase extends Check {
1818 commentStartRE = ~/ \/ ([\/ *] )/ ;
1919 commentBlockEndRE = ~/ \*\/ / ;
2020 stringStartRE = ~/ ['"] / ;
21- stringInterpolatedEndRE = ~/ ( ? <! \\ ) '/ ;
22- stringLiteralEndRE = ~/ ( ? <! \\ ) "/ ;
21+ stringInterpolatedEndRE = ~/ ^ (?: [ ^ ' \\ ] | \\ \S ) * '/ ;
22+ stringLiteralEndRE = ~/ ^ (?: [ ^ " \\ ] | \\ \S ) * "/ ;
2323 }
2424
2525 override public function run (checker : Checker ): Array <CheckMessage > {
@@ -90,16 +90,11 @@ class LineCheckBase extends Check {
9090
9191 function handleStringState (line : String , ranges : Array <Range >, currentStart : Int , isInterpolated : Bool ): Int {
9292 var adjustedStart = currentStart + (skipOverInitialQuote ? 1 : 0 );
93- skipOverInitialQuote = false ;
94- if (isInterpolated && stringInterpolatedEndRE .matchSub (line , adjustedStart )) {
95- var stringEnd = stringInterpolatedEndRE .matchedPos ().pos + 1 ;
96- ranges .push ({ type : currentState , start : currentStart , end : stringEnd });
97-
98- currentState = TEXT ;
99- return stringEnd ;
100- }
101- else if (! isInterpolated && stringLiteralEndRE .matchSub (line , adjustedStart )) {
102- var stringEnd = stringLiteralEndRE .matchedPos ().pos + 1 ;
93+ skipOverInitialQuote = false ;
94+ var re = isInterpolated ? stringInterpolatedEndRE : stringLiteralEndRE ;
95+ if (re .match (line .substring (adjustedStart ))) {
96+ var matchedPos = re .matchedPos ();
97+ var stringEnd = adjustedStart + matchedPos .pos + matchedPos .len ;
10398 ranges .push ({ type : currentState , start : currentStart , end : stringEnd });
10499
105100 currentState = TEXT ;
0 commit comments