Hi!
Support for the equivalent of #include has been added to "neos" the
universal compiler that can compile any programming language:
class source_package_import : public
semantic_concept<source_package_import>
{
// types
public:
using data_type = neolib::string;
// construction
public:
source_package_import() :
semantic_concept{ "source.package.import", neos::language::emit_type::Infix }
{
}
// emit
public:
bool can_fold() const override
{
return holds_data();
}
bool can_fold(const i_semantic_concept& aRhs) const override
{
return aRhs.name() == "source.package.name";
}
// emit
protected:
void do_fold(i_context& aContext,
neolib::i_ref_ptr<i_semantic_concept>& aResult) override
{
language::source_fragment file{ data<neolib::string>() };
file.set_imported();
aContext.load_fragment(file);
aContext.compiler().compile(std::move(file));
}
void do_fold(i_context& aContext, const i_semantic_concept& aRhs, neolib::i_ref_ptr<i_semantic_concept>& aResult) override
{
data<neolib::string>() = aRhs.data<neolib::i_string>();
aResult.reset(this);
}
};
/Flibble
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,029 |
Nodes: | 10 (1 / 9) |
Uptime: | 182:40:48 |
Calls: | 13,337 |
Calls today: | 4 |
Files: | 186,574 |
D/L today: |
5,560 files (1,540M bytes) |
Messages: | 3,356,614 |