Skip to content

Commit

Permalink
Make brace-matching ignore braces in character literals
Browse files Browse the repository at this point in the history
  • Loading branch information
hsutter committed Oct 8, 2023
1 parent f2f70ed commit 36ecc07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/build.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"8A08:1411"
"8A08:1847"
12 changes: 8 additions & 4 deletions source/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -721,12 +721,16 @@ auto process_cpp2_line(
else {
switch (line[i]) {
break;case '{':
braces.found_open_brace(lineno);
if (prev != '\'') { // ignore character literals
braces.found_open_brace(lineno);
}

break;case '}':
braces.found_close_brace( source_position(lineno, i) );
if (braces.current_depth() < 1) {
found_end = true;
if (prev != '\'') { // ignore character literals
braces.found_close_brace( source_position(lineno, i) );
if (braces.current_depth() < 1) {
found_end = true;
}
}

break;case ';':
Expand Down

0 comments on commit 36ecc07

Please sign in to comment.