36#include <gtest/gtest.h>
47 const auto global = bindings.
declare(Compiler_Symbol_Kind::Global,
"value", {});
52 const auto local = bindings.
declare(Compiler_Symbol_Kind::Local,
"temp", {});
69 const auto first = bindings.
declare(Compiler_Symbol_Kind::Global,
"answer", {});
72 const auto duplicate = bindings.
declare(Compiler_Symbol_Kind::Global,
"answer", {});
74 EXPECT_EQ(duplicate.symbol_id, first.symbol_id);
77 const auto shadow = bindings.
declare(Compiler_Symbol_Kind::Local,
"answer", {});
80 EXPECT_EQ(shadow.related_symbol_id, first.symbol_id);
88 bindings.enter_scope();
89 (
void) bindings.declare(Compiler_Symbol_Kind::Parameter,
"x",
Source_Span{});
91 const auto dump = bindings.dump_symbols();
Reusable lexical bindings and symbol records for frontends.
size_t size_t int32_t value
Reusable lexical symbol table with stable ids and scope tracking.
Compiler_Symbol_Declare_Result declare(const Compiler_Symbol_Kind kind, const std::string &name, const Source_Span &span)
Declares one symbol in the current scope.
const Compiler_Symbol & symbol(const Compiler_Symbol_Id id) const
Returns one symbol by its stable 1-based identifier.
const Compiler_Symbol_Id * lookup(const std::string &name) const noexcept
Looks up one visible symbol id by name.
size_t symbol_count() const noexcept
Returns the number of recorded symbols.
size_t enter_scope()
Enters one nested lexical scope.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
Compiler_Symbol_Kind kind
Symbol category.
Half-open byte range inside a source file.