File tree Expand file tree Collapse file tree 1 file changed +23
-25
lines changed
cmd/internal/migrations/v3 Expand file tree Collapse file tree 1 file changed +23
-25
lines changed Original file line number Diff line number Diff line change @@ -379,28 +379,20 @@ func findErrorBlockEndFallback(lines []string, startIdx int) int {
379379
380380 // Handle string literals
381381 if inString {
382- if ch == stringChar {
383- if j > 0 && line [j - 1 ] == '\\' {
384- // Escaped quote, continue in string
385- continue
386- }
382+ if ch == stringChar && (j == 0 || line [j - 1 ] != '\\' ) {
387383 inString = false
388384 }
389385 continue
390386 }
391387
392388 // Handle comments
393389 if inComment {
394- if isLineComment {
395- if ch == '\n' {
396- inComment = false
397- isLineComment = false
398- }
399- } else { // block comment
400- if ch == '*' && j + 1 < len (line ) && line [j + 1 ] == '/' {
401- inComment = false
402- j ++ // skip the '/'
403- }
390+ if isLineComment && ch == '\n' {
391+ inComment = false
392+ isLineComment = false
393+ } else if ! isLineComment && ch == '*' && j + 1 < len (line ) && line [j + 1 ] == '/' {
394+ inComment = false
395+ j ++ // skip the '/'
404396 }
405397 continue
406398 }
@@ -411,16 +403,20 @@ func findErrorBlockEndFallback(lines []string, startIdx int) int {
411403 inString = true
412404 stringChar = ch
413405 case '/' :
414- if j + 1 < len (line ) {
415- if line [j + 1 ] == '/' {
416- inComment = true
417- isLineComment = true
418- j ++ // skip the second '/'
419- } else if line [j + 1 ] == '*' {
420- inComment = true
421- isLineComment = false
422- j ++ // skip the '*'
423- }
406+ if j + 1 >= len (line ) {
407+ continue
408+ }
409+ switch line [j + 1 ] {
410+ case '/' :
411+ inComment = true
412+ isLineComment = true
413+ j ++ // skip the second '/'
414+ case '*' :
415+ inComment = true
416+ isLineComment = false
417+ j ++ // skip the '*'
418+ default :
419+ // Not a comment, continue
424420 }
425421 case '{' :
426422 braceCount ++
@@ -429,6 +425,8 @@ func findErrorBlockEndFallback(lines []string, startIdx int) int {
429425 if braceCount == 0 {
430426 return i
431427 }
428+ default :
429+ // Ignore other characters
432430 }
433431 }
434432 }
You can’t perform that action at this time.
0 commit comments