// Encapsulates a value to be scrutinized by a `match` with its resolved // options and the name of the selector class ResolvedSelector : public UObject { public:
ResolvedSelector() {}
ResolvedSelector(const FunctionName& fn,
Selector* selector,
FunctionOptions&& options,
FormattedPlaceholder&& value); // Used either for errors, or when selector isn't yet known explicit ResolvedSelector(FormattedPlaceholder&& value); bool hasSelector() const { return selector.isValid(); } const FormattedPlaceholder& argument() const { return value; }
FormattedPlaceholder&& takeArgument() { return std::move(value); } const Selector* getSelector() {
U_ASSERT(selector.isValid()); return selector.getAlias();
}
FunctionOptions&& takeOptions() { return std::move(options);
} const FunctionName& getSelectorName() const { return selectorName; } virtual ~ResolvedSelector();
ResolvedSelector& operator=(ResolvedSelector&&) noexcept;
ResolvedSelector(ResolvedSelector&&); private:
FunctionName selectorName; // For error reporting
LocalPointer<Selector> selector;
FunctionOptions options;
FormattedPlaceholder value;
}; // class ResolvedSelector
// Closures and environments // -------------------------
class Environment;
// A closure represents the right-hand side of a variable // declaration, along with an environment giving values // to its free variables class Closure : public UMemory { public: const Expression& getExpr() const { return expr;
} const Environment& getEnv() const { return env;
}
Closure(const Expression& expression, const Environment& environment) : expr(expression), env(environment) {}
Closure(Closure&&) = default;
virtual ~Closure(); private:
// An unevaluated expression const Expression& expr; // The environment mapping names used in this // expression to other expressions const Environment& env;
};
// An environment is represented as a linked chain of // non-empty environments, terminating at an empty environment. // It's searched using linear search. class Environment : public UMemory { public: virtualbool has(const VariableName&) const = 0; virtualconst Closure& lookup(const VariableName&) const = 0; static Environment* create(UErrorCode&); static Environment* create(const VariableName&, Closure&&, Environment*, UErrorCode&); virtual ~Environment();
};
class NonEmptyEnvironment; class EmptyEnvironment : public Environment { public:
EmptyEnvironment() = default; virtual ~EmptyEnvironment();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.