Bracket the tokenized buffer output. (#2446)

This makes TokenizedBuffer more consistent with ParseTree and SemanticsIR, which also wrap with [] to produce a sequence value.

It also makes it possible in driver.cpp to just prefix the line with a name, so it ends up with:

var_name: [
  (content)
]
Noticed this due to bracketing comments on #2443 and trying to think of better answers. With this, we can also say that the [] bracket a variable.
This commit is contained in:
Jon Ross-Perkins
2022-12-07 11:22:33 -08:00
committed by GitHub
parent 5f85822caa
commit 04f0288cd2
7 changed files with 118 additions and 121 deletions
+3 -3
View File
@@ -171,7 +171,7 @@ auto Driver::RunDumpSubcommand(DiagnosticConsumer& consumer,
tokenized_source.Print(output_stream_);
return !tokenized_source.has_errors();
}
CARBON_VLOG() << tokenized_source;
CARBON_VLOG() << "tokenized_buffer: " << tokenized_source;
CARBON_VLOG() << "*** ParseTree::Parse ***\n";
auto parse_tree = ParseTree::Parse(tokenized_source, consumer, vlog_stream_);
@@ -181,7 +181,7 @@ auto Driver::RunDumpSubcommand(DiagnosticConsumer& consumer,
parse_tree.Print(output_stream_, parse_tree_preorder);
return !tokenized_source.has_errors() && !parse_tree.has_errors();
}
CARBON_VLOG() << parse_tree;
CARBON_VLOG() << "parse_tree: " << parse_tree;
const SemanticsIR builtin_ir = SemanticsIR::MakeBuiltinIR();
CARBON_VLOG() << "*** SemanticsIR::MakeFromParseTree ***\n";
@@ -194,7 +194,7 @@ auto Driver::RunDumpSubcommand(DiagnosticConsumer& consumer,
// TODO: Return false when SemanticsIR has errors (not supported right now).
return !tokenized_source.has_errors() && !parse_tree.has_errors();
}
CARBON_VLOG() << semantics_ir;
CARBON_VLOG() << "semantics_ir: " << semantics_ir;
llvm_unreachable("should handle all dump modes");
}