13class Lexer :
public fe::Lexer<3, Lexer> {
14 using Super = fe::Lexer<3, Lexer>;
19 Lexer(
World&
world, std::istream& istream,
const fs::path*
path =
nullptr, std::ostream* md =
nullptr);
22 const fs::path*
path()
const {
return loc_.path; }
23 Loc
loc()
const {
return loc_; }
28 auto res = Super::next();
30 if (res == fe::utf8::EoF) {
34 bool success = fe::utf8::encode(*md_, res);
35 assert_unused(success);
43 Loc cache_trailing_dot();
46 std::optional<Tok> parse_lit();
47 void parse_digits(
int base = 10);
48 bool parse_exp(
int base = 10);
50 bool start_md()
const {
return ahead(0) ==
'/' && ahead(1) ==
'/' && ahead(2) ==
'/'; }
51 void emit_md(
bool start_of_file =
false);
53 if (md_) *md_ <<
"```\n";
59 fe::SymMap<Tok::Tag> keywords_;
60 std::optional<Tok> cache_ = std::nullopt;
62 friend class fe::Lexer<3,
Lexer>;