From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- cli/cli/semantics/expression.hxx | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 cli/cli/semantics/expression.hxx (limited to 'cli/cli/semantics/expression.hxx') diff --git a/cli/cli/semantics/expression.hxx b/cli/cli/semantics/expression.hxx new file mode 100644 index 0000000..e36a0cb --- /dev/null +++ b/cli/cli/semantics/expression.hxx @@ -0,0 +1,76 @@ +// file : cli/semantics/expression.hxx +// author : Boris Kolpackov +// license : MIT; see accompanying LICENSE file + +#ifndef CLI_SEMANTICS_EXPRESSION_HXX +#define CLI_SEMANTICS_EXPRESSION_HXX + +#include +#include + +namespace semantics +{ + // + // + class initialized; + + // + // + class expression: public node + { + public: + enum expression_type + { + string_lit, + char_lit, + bool_lit, + int_lit, + float_lit, + call_expr, + identifier + }; + + expression_type + type () const + { + return type_; + } + + std::string const& + value () const + { + return value_; + } + + public: + initialized& + initializes () const + { + return *initializes_; + } + + public: + expression (path const& file, + size_t line, + size_t column, + expression_type type, + std::string const& value) + : node (file, line, column), type_ (type), value_ (value) + { + } + + void + add_edge_right (initialized& e) + { + initializes_ = &e; + } + + private: + initialized* initializes_; + + expression_type type_; + std::string value_; + }; +} + +#endif // CLI_SEMANTICS_EXPRESSION_HXX -- cgit v1.1