- Statement(): valid(false), line(0) { }
- std::string get_location() const
- { std::ostringstream ss; ss<<source<<':'<<line; return ss.str(); }
+ Statement() = default;
+ Statement(const std::string &);
+ std::string get_location() const;
+ std::string get_signature() const;
+
+ template<typename T>
+ Statement &append(const T &v)
+ {
+ args.push_back(v);
+ return *this;
+ }
+
+ Statement &append_from_token(const Token &);
+
+ template<typename T>
+ Statement &operator,(const T &v)
+ { return append(v); }
+};
+
+struct StatementKey
+{
+ std::string keyword;
+ std::string signature;
+
+ StatementKey() = default;
+ StatementKey(const std::string &k, const std::string &s): keyword(k), signature(s) { }
+
+ bool operator<(const StatementKey &o) const
+ { return keyword<o.keyword || (keyword==o.keyword && signature<o.signature); }
+};
+
+struct StatementInfo
+{
+ StatementKey key;
+ std::size_t args_size = 0;
+ std::vector<std::size_t> arg_offsets;
+
+ StatementInfo() = default;
+ StatementInfo(const std::string &, const std::string &);