refactor(dev): 移动头文件位置

This commit is contained in:
jing
2026-03-12 10:34:02 +08:00
parent 7f1b0aaead
commit d0a4c7d6d2
8 changed files with 1 additions and 1 deletions

14
include/utils/CLI.h Normal file
View File

@@ -0,0 +1,14 @@
// 简易命令行解析:支持帮助、输入文件与输出阶段选择。
#pragma once
#include <string>
struct CLIOptions {
std::string input;
bool emit_parse_tree = false;
bool emit_ir = true;
bool emit_asm = false;
bool show_help = false;
};
CLIOptions ParseCLI(int argc, char** argv);

20
include/utils/Log.h Normal file
View File

@@ -0,0 +1,20 @@
// 轻量日志接口。
#pragma once
#include <cstddef>
#include <exception>
#include <iosfwd>
#include <string>
#include <string_view>
void LogInfo(std::string_view msg, std::ostream& os);
void LogError(std::string_view msg, std::ostream& os);
std::string FormatError(std::string_view stage, std::string_view msg);
std::string FormatErrorAt(std::string_view stage, std::size_t line,
std::size_t column, std::string_view msg);
bool HasErrorPrefix(std::string_view msg, std::string_view stage);
void PrintException(std::ostream& os, const std::exception& ex);
// 打印命令行帮助信息(用于 `compiler --help`)。
void PrintHelp(std::ostream& os);