Skip to content

Commit 36ecc07

Browse files
committed
Make brace-matching ignore braces in character literals
Closes #732
1 parent f2f70ed commit 36ecc07

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8A08:1411"
1+
"8A08:1847"

source/io.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,16 @@ auto process_cpp2_line(
721721
else {
722722
switch (line[i]) {
723723
break;case '{':
724-
braces.found_open_brace(lineno);
724+
if (prev != '\'') { // ignore character literals
725+
braces.found_open_brace(lineno);
726+
}
725727

726728
break;case '}':
727-
braces.found_close_brace( source_position(lineno, i) );
728-
if (braces.current_depth() < 1) {
729-
found_end = true;
729+
if (prev != '\'') { // ignore character literals
730+
braces.found_close_brace( source_position(lineno, i) );
731+
if (braces.current_depth() < 1) {
732+
found_end = true;
733+
}
730734
}
731735

732736
break;case ';':

0 commit comments

Comments
 (0)