Skip to content

Commit b06fcc9

Browse files
authored
Clean up a few details of lex yaml printing (#4845)
- Escape dumped token strings (what got me here) - Change the quoting from backticks to quotes - Also add a `FormatEscaped` helper function for this, updating other `.write_escaped` uses
1 parent 22c0198 commit b06fcc9

24 files changed

+255
-247
lines changed

common/ostream.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ class Printable {
5353
}
5454
};
5555

56+
// Helper class for printing strings with escapes.
57+
//
58+
// For example:
59+
// stream << FormatEscaped(str);
60+
// Is equivalent to:
61+
// stream.write_escaped(str);
62+
class FormatEscaped : public Printable<FormatEscaped> {
63+
public:
64+
explicit FormatEscaped(llvm::StringRef str, bool use_hex_escapes = false)
65+
: str_(str), use_hex_escapes_(use_hex_escapes) {}
66+
67+
auto Print(llvm::raw_ostream& out) const -> void {
68+
out.write_escaped(str_, use_hex_escapes_);
69+
}
70+
71+
private:
72+
llvm::StringRef str_;
73+
bool use_hex_escapes_;
74+
};
75+
5676
// Returns the result of printing the value.
5777
template <typename T>
5878
requires std::derived_from<T, Printable<T>>

testing/file_test/file_test_base.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class FileTestBase : public testing::Test {
2929
friend void PrintTo(const TestFile& f, std::ostream* os) {
3030
// Print content escaped.
3131
llvm::raw_os_ostream os_wrap(*os);
32-
os_wrap << "TestFile(" << f.filename << ", \"";
33-
os_wrap.write_escaped(f.content);
34-
os_wrap << "\")";
32+
os_wrap << "TestFile(" << f.filename << ", \"" << FormatEscaped(f.content)
33+
<< "\")";
3534
}
3635

3736
std::string filename;

toolchain/check/dump.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ static auto DumpNoNewline(const Context& context, SemIR::LocId loc_id) -> void {
4040
auto line = context.tokens().GetLineNumber(token);
4141
auto col = context.tokens().GetColumnNumber(token);
4242
const char* implicit = loc_id.is_implicit() ? " implicit" : "";
43-
llvm::errs() << "LocId(";
44-
llvm::errs().write_escaped(context.sem_ir().filename());
45-
llvm::errs() << ":" << line << ":" << col << implicit << ")";
43+
llvm::errs() << "LocId(" << FormatEscaped(context.sem_ir().filename())
44+
<< ":" << line << ":" << col << implicit << ")";
4645
} else {
4746
CARBON_CHECK(loc_id.is_import_ir_inst_id());
4847

@@ -52,9 +51,8 @@ static auto DumpNoNewline(const Context& context, SemIR::LocId loc_id) -> void {
5251
.ir_id;
5352
const auto* import_file =
5453
context.sem_ir().import_irs().Get(import_ir_id).sem_ir;
55-
llvm::errs() << "LocId(import from \"";
56-
llvm::errs().write_escaped(import_file->filename());
57-
llvm::errs() << "\")";
54+
llvm::errs() << "LocId(import from \""
55+
<< FormatEscaped(import_file->filename()) << "\")";
5856
}
5957
}
6058

toolchain/check/import_cpp.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ static auto GenerateCppIncludesHeaderCode(
2727
std::string code;
2828
llvm::raw_string_ostream code_stream(code);
2929
for (const auto& [path, _] : imports) {
30-
code_stream << "#include \"";
31-
code_stream.write_escaped(path);
32-
code_stream << "\"\n";
30+
code_stream << "#include \"" << FormatEscaped(path) << "\"\n";
3331
}
3432
return code;
3533
}

toolchain/lex/testdata/basic_syntax.carbon

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/basic_syntax.carbon
1313
// CHECK:STDOUT: - filename: basic_syntax.carbon
1414
// CHECK:STDOUT: tokens:
15-
// CHECK:STDOUT: - { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '' }
15+
// CHECK:STDOUT: - { index: 0, kind: "FileStart", line: {{ *\d+}}, column: 1, indent: 1, spelling: "" }
1616

1717
fn run(String program) {
18-
// CHECK:STDOUT: - { index: 1, kind: 'Fn', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'fn', has_leading_space: true }
19-
// CHECK:STDOUT: - { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: 'run', identifier: 0, has_leading_space: true }
20-
// CHECK:STDOUT: - { index: 3, kind: 'OpenParen', line: {{ *}}[[@LINE-3]], column: 7, indent: 1, spelling: '(', closing_token: 6 }
21-
// CHECK:STDOUT: - { index: 4, kind: 'StringTypeLiteral', line: {{ *}}[[@LINE-4]], column: 8, indent: 1, spelling: 'String' }
22-
// CHECK:STDOUT: - { index: 5, kind: 'Identifier', line: {{ *}}[[@LINE-5]], column: 15, indent: 1, spelling: 'program', identifier: 1, has_leading_space: true }
23-
// CHECK:STDOUT: - { index: 6, kind: 'CloseParen', line: {{ *}}[[@LINE-6]], column: 22, indent: 1, spelling: ')', opening_token: 3 }
24-
// CHECK:STDOUT: - { index: 7, kind: 'OpenCurlyBrace', line: {{ *}}[[@LINE-7]], column: 24, indent: 1, spelling: '{', closing_token: 11, has_leading_space: true }
18+
// CHECK:STDOUT: - { index: 1, kind: "Fn", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "fn", has_leading_space: true }
19+
// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "run", identifier: 0, has_leading_space: true }
20+
// CHECK:STDOUT: - { index: 3, kind: "OpenParen", line: {{ *}}[[@LINE-3]], column: 7, indent: 1, spelling: "(", closing_token: 6 }
21+
// CHECK:STDOUT: - { index: 4, kind: "StringTypeLiteral", line: {{ *}}[[@LINE-4]], column: 8, indent: 1, spelling: "String" }
22+
// CHECK:STDOUT: - { index: 5, kind: "Identifier", line: {{ *}}[[@LINE-5]], column: 15, indent: 1, spelling: "program", identifier: 1, has_leading_space: true }
23+
// CHECK:STDOUT: - { index: 6, kind: "CloseParen", line: {{ *}}[[@LINE-6]], column: 22, indent: 1, spelling: ")", opening_token: 3 }
24+
// CHECK:STDOUT: - { index: 7, kind: "OpenCurlyBrace", line: {{ *}}[[@LINE-7]], column: 24, indent: 1, spelling: "{", closing_token: 11, has_leading_space: true }
2525
return True;
26-
// CHECK:STDOUT: - { index: 8, kind: 'Return', line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: 'return', has_leading_space: true }
27-
// CHECK:STDOUT: - { index: 9, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 10, indent: 3, spelling: 'True', identifier: 2, has_leading_space: true }
28-
// CHECK:STDOUT: - { index: 10, kind: 'Semi', line: {{ *}}[[@LINE-3]], column: 14, indent: 3, spelling: ';' }
26+
// CHECK:STDOUT: - { index: 8, kind: "Return", line: {{ *}}[[@LINE-1]], column: 3, indent: 3, spelling: "return", has_leading_space: true }
27+
// CHECK:STDOUT: - { index: 9, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 10, indent: 3, spelling: "True", identifier: 2, has_leading_space: true }
28+
// CHECK:STDOUT: - { index: 10, kind: "Semi", line: {{ *}}[[@LINE-3]], column: 14, indent: 3, spelling: ";" }
2929
}
30-
// CHECK:STDOUT: - { index: 11, kind: 'CloseCurlyBrace', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '}', opening_token: 7, has_leading_space: true }
30+
// CHECK:STDOUT: - { index: 11, kind: "CloseCurlyBrace", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", opening_token: 7, has_leading_space: true }
3131

32-
// CHECK:STDOUT: - { index: 12, kind: 'FileEnd', line: {{ *}}[[@LINE+0]], column: {{ *\d+}}, indent: 1, spelling: '', has_leading_space: true }
32+
// CHECK:STDOUT: - { index: 12, kind: "FileEnd", line: {{ *}}[[@LINE+0]], column: {{ *\d+}}, indent: 1, spelling: "", has_leading_space: true }

toolchain/lex/testdata/fail_bad_raw_identifier.carbon

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,72 +19,72 @@
1919
// CHECK:STDERR: ^
2020
// CHECK:STDERR:
2121
r#
22-
// CHECK:STDOUT: - { index: 1, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
23-
// CHECK:STDOUT: - { index: 2, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#' }
22+
// CHECK:STDOUT: - { index: 1, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
23+
// CHECK:STDOUT: - { index: 2, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#" }
2424

2525
// Not a valid identifier.
2626
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
2727
// CHECK:STDERR: r#3
2828
// CHECK:STDERR: ^
2929
// CHECK:STDERR:
3030
r#3
31-
// CHECK:STDOUT: - { index: 3, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
32-
// CHECK:STDOUT: - { index: 4, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#' }
33-
// CHECK:STDOUT: - { index: 5, kind: 'IntLiteral', line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: '3', value: `3` }
31+
// CHECK:STDOUT: - { index: 3, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
32+
// CHECK:STDOUT: - { index: 4, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#" }
33+
// CHECK:STDOUT: - { index: 5, kind: "IntLiteral", line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: "3", value: "3" }
3434

3535
// Non ascii start to identifier.
3636
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
3737
// CHECK:STDERR: r#á
3838
// CHECK:STDERR: ^
3939
// CHECK:STDERR:
4040
r#á
41-
// CHECK:STDOUT: - { index: 6, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
42-
// CHECK:STDOUT: - { index: 7, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#á' }
41+
// CHECK:STDOUT: - { index: 6, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
42+
// CHECK:STDOUT: - { index: 7, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#\xC3\xA1" }
4343

4444
// Raw `r` identifier doesn't start a second raw identifier.
4545
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:4: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
4646
// CHECK:STDERR: r#r#foo
4747
// CHECK:STDERR: ^
4848
// CHECK:STDERR:
4949
r#r#foo
50-
// CHECK:STDOUT: - { index: 8, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
51-
// CHECK:STDOUT: - { index: 9, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: '#' }
52-
// CHECK:STDOUT: - { index: 10, kind: 'Identifier', line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: 'foo', identifier: 1 }
50+
// CHECK:STDOUT: - { index: 8, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
51+
// CHECK:STDOUT: - { index: 9, kind: "Error", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "#" }
52+
// CHECK:STDOUT: - { index: 10, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "foo", identifier: 1 }
5353

5454
// Other identifier characters don't start a raw identifier.
5555
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:2: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
5656
// CHECK:STDERR: s#foo
5757
// CHECK:STDERR: ^
5858
// CHECK:STDERR:
5959
s#foo
60-
// CHECK:STDOUT: - { index: 11, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 's', identifier: 2, has_leading_space: true }
61-
// CHECK:STDOUT: - { index: 12, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#' }
62-
// CHECK:STDOUT: - { index: 13, kind: 'Identifier', line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: 'foo', identifier: 1 }
60+
// CHECK:STDOUT: - { index: 11, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "s", identifier: 2, has_leading_space: true }
61+
// CHECK:STDOUT: - { index: 12, kind: "Error", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#" }
62+
// CHECK:STDOUT: - { index: 13, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 3, indent: 1, spelling: "foo", identifier: 1 }
6363

6464
// Identifier ending in `r` doesn't start a raw identifier.
6565
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:4: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
6666
// CHECK:STDERR: arr#foo
6767
// CHECK:STDERR: ^
6868
// CHECK:STDERR:
6969
arr#foo
70-
// CHECK:STDOUT: - { index: 14, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'arr', identifier: 3, has_leading_space: true }
71-
// CHECK:STDOUT: - { index: 15, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: '#' }
72-
// CHECK:STDOUT: - { index: 16, kind: 'Identifier', line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: 'foo', identifier: 1 }
70+
// CHECK:STDOUT: - { index: 14, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "arr", identifier: 3, has_leading_space: true }
71+
// CHECK:STDOUT: - { index: 15, kind: "Error", line: {{ *}}[[@LINE-2]], column: 4, indent: 1, spelling: "#" }
72+
// CHECK:STDOUT: - { index: 16, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: "foo", identifier: 1 }
7373

7474
// Whitespace between `r` and `#` isn't allowed.
7575
// CHECK:STDERR: fail_bad_raw_identifier.carbon:[[@LINE+4]]:3: error: encountered unrecognized characters while parsing [UnrecognizedCharacters]
7676
// CHECK:STDERR: r #foo
7777
// CHECK:STDERR: ^
7878
// CHECK:STDERR:
7979
r #foo
80-
// CHECK:STDOUT: - { index: 17, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
81-
// CHECK:STDOUT: - { index: 18, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: '#', has_leading_space: true }
82-
// CHECK:STDOUT: - { index: 19, kind: 'Identifier', line: {{ *}}[[@LINE-3]], column: 4, indent: 1, spelling: 'foo', identifier: 1 }
80+
// CHECK:STDOUT: - { index: 17, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
81+
// CHECK:STDOUT: - { index: 18, kind: "Error", line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: "#", has_leading_space: true }
82+
// CHECK:STDOUT: - { index: 19, kind: "Identifier", line: {{ *}}[[@LINE-3]], column: 4, indent: 1, spelling: "foo", identifier: 1 }
8383

8484
// This is an `r` identifier followed by a string literal.
8585
r#"hello"#
86-
// CHECK:STDOUT: - { index: 20, kind: 'Identifier', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: 'r', identifier: 0, has_leading_space: true }
87-
// CHECK:STDOUT: - { index: 21, kind: 'StringLiteral', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: '#"hello"#', value: `hello` }
86+
// CHECK:STDOUT: - { index: 20, kind: "Identifier", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "r", identifier: 0, has_leading_space: true }
87+
// CHECK:STDOUT: - { index: 21, kind: "StringLiteral", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "#\"hello\"#", value: "hello" }
8888

8989
// --- fail_hash_at_start_of_file.carbon
9090
// CHECK:STDOUT: - filename: fail_hash_at_start_of_file.carbon
@@ -96,5 +96,5 @@ r#"hello"#
9696
// CHECK:STDERR: ^
9797
// CHECK:STDERR:
9898
#foo
99-
// CHECK:STDOUT: - { index: 1, kind: 'Error', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '#', has_leading_space: true }
100-
// CHECK:STDOUT: - { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: 'foo', identifier: 0 }
99+
// CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "#", has_leading_space: true }
100+
// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-2]], column: 2, indent: 1, spelling: "foo", identifier: 0 }

toolchain/lex/testdata/fail_block_string_second_line.carbon

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ var s: String = '''
1919
// CHECK:STDERR:
2020
// CHECK:STDOUT: - filename: fail_block_string_second_line.carbon
2121
// CHECK:STDOUT: tokens:
22-
// CHECK:STDOUT: - { index: 1, kind: 'Var', line: {{ *}}[[@LINE-17]], column: 1, indent: 1, spelling: 'var', has_leading_space: true }
23-
// CHECK:STDOUT: - { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-18]], column: 5, indent: 1, spelling: 's', identifier: 0, has_leading_space: true }
24-
// CHECK:STDOUT: - { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-19]], column: 6, indent: 1, spelling: ':' }
25-
// CHECK:STDOUT: - { index: 4, kind: 'StringTypeLiteral', line: {{ *}}[[@LINE-20]], column: 8, indent: 1, spelling: 'String', has_leading_space: true }
26-
// CHECK:STDOUT: - { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-21]], column: 15, indent: 1, spelling: '=', has_leading_space: true }
27-
// CHECK:STDOUT: - { index: 6, kind: 'StringLiteral', line: {{ *}}[[@LINE-22]], column: 17, indent: 1, spelling: ''''
28-
// CHECK:STDOUT: error here: '''', value: `error here: `, has_leading_space: true }
22+
// CHECK:STDOUT: - { index: 1, kind: "Var", line: {{ *}}[[@LINE-17]], column: 1, indent: 1, spelling: "var", has_leading_space: true }
23+
// CHECK:STDOUT: - { index: 2, kind: "Identifier", line: {{ *}}[[@LINE-18]], column: 5, indent: 1, spelling: "s", identifier: 0, has_leading_space: true }
24+
// CHECK:STDOUT: - { index: 3, kind: "Colon", line: {{ *}}[[@LINE-19]], column: 6, indent: 1, spelling: ":" }
25+
// CHECK:STDOUT: - { index: 4, kind: "StringTypeLiteral", line: {{ *}}[[@LINE-20]], column: 8, indent: 1, spelling: "String", has_leading_space: true }
26+
// CHECK:STDOUT: - { index: 5, kind: "Equal", line: {{ *}}[[@LINE-21]], column: 15, indent: 1, spelling: "=", has_leading_space: true }
27+
// CHECK:STDOUT: - { index: 6, kind: "StringLiteral", line: {{ *}}[[@LINE-22]], column: 17, indent: 1, spelling: "'''\n error here: '''", value: "error here: ", has_leading_space: true }

toolchain/lex/testdata/fail_mismatched_brackets.carbon

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
// CHECK:STDERR: ^
1616
// CHECK:STDERR:
1717
}
18-
// CHECK:STDOUT: - { index: 1, kind: 'Error', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '}', has_leading_space: true }
18+
// CHECK:STDOUT: - { index: 1, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "}", has_leading_space: true }
1919

2020
// CHECK:STDERR: fail_mismatched_brackets.carbon:[[@LINE+4]]:3: error: closing symbol without a corresponding opening symbol [UnmatchedClosing]
2121
// CHECK:STDERR: ( } )
2222
// CHECK:STDERR: ^
2323
// CHECK:STDERR:
2424
( } )
25-
// CHECK:STDOUT: - { index: 2, kind: 'OpenParen', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '(', closing_token: 4, has_leading_space: true }
26-
// CHECK:STDOUT: - { index: 3, kind: 'Error', line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: '}', has_leading_space: true }
27-
// CHECK:STDOUT: - { index: 4, kind: 'CloseParen', line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: ')', opening_token: 2, has_leading_space: true }
25+
// CHECK:STDOUT: - { index: 2, kind: "OpenParen", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "(", closing_token: 4, has_leading_space: true }
26+
// CHECK:STDOUT: - { index: 3, kind: "Error", line: {{ *}}[[@LINE-2]], column: 3, indent: 1, spelling: "}", has_leading_space: true }
27+
// CHECK:STDOUT: - { index: 4, kind: "CloseParen", line: {{ *}}[[@LINE-3]], column: 5, indent: 1, spelling: ")", opening_token: 2, has_leading_space: true }
2828

2929
// CHECK:STDERR: fail_mismatched_brackets.carbon:[[@LINE+4]]:1: error: opening symbol without a corresponding closing symbol [UnmatchedOpening]
3030
// CHECK:STDERR: [
3131
// CHECK:STDERR: ^
3232
// CHECK:STDERR:
3333
[
34-
// CHECK:STDOUT: - { index: 5, kind: 'Error', line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: '[', has_leading_space: true }
34+
// CHECK:STDOUT: - { index: 5, kind: "Error", line: {{ *}}[[@LINE-1]], column: 1, indent: 1, spelling: "[", has_leading_space: true }

0 commit comments

Comments
 (0)