Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions src/bind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ namespace broma {
one<'='>,
sep,
list<opt<
sep,
tagged_platform<bind>,
sep,
tagged_rule<bind, sor<hex, keyword_default, keyword_inline>>
sor<seq<
sep,
tagged_platform<bind>,
sep,
tagged_rule<bind, sor<hex, keyword_default, keyword_inline>>
>, tagged_rule<bind, keyword_inline>>
>, one<','>>,
sep
>, sor<function_body, one<';'>>> {};
Expand Down Expand Up @@ -49,13 +51,29 @@ namespace broma {
}
};

template <>
struct run_action<tagged_rule<bind, keyword_inline>> {
template <typename T>
static void apply(T& input, Root* root, ScratchData* scratch) {
auto text = input.string();

scratch->wip_has_explicit_inline = true;
for (auto& platform : {&scratch->wip_bind.imac, &scratch->wip_bind.m1, &scratch->wip_bind.ios,
&scratch->wip_bind.win, &scratch->wip_bind.android32, &scratch->wip_bind.android64}) {
if (*platform == 0) { // don't replace already specified ones
*platform = -2;
}
}
}
};

template <>
struct run_action<tagged_rule<bind, sor<hex, keyword_default, keyword_inline>>> {
template <typename T>
static void apply(T& input, Root* root, ScratchData* scratch) {
auto text = input.string();

std::size_t out = -1;
std::ptrdiff_t out = -1;
if (text == "default") {
// special internal constant used for normalization
// feel free to increment if needed (it isn't exposed anywhere public)
Expand Down
Loading