feat(furc/parser): add pre- and post- conditions
This commit is contained in:
@@ -116,10 +116,16 @@ struct var_decl_node final : public decl_node {
|
||||
struct func_decl_node final : public decl_node {
|
||||
decl_type_e decl_type() const override { return Function; }
|
||||
|
||||
std::string name;
|
||||
ast_type type;
|
||||
std::vector<var_decl_node> params;
|
||||
std::optional<comp_stmt_node> body;
|
||||
struct def_s {
|
||||
comp_stmt_node body;
|
||||
std::vector<expr_node*> preConds;
|
||||
std::vector<expr_node*> postConds;
|
||||
};
|
||||
|
||||
std::string name;
|
||||
ast_type type;
|
||||
std::vector<var_decl_node> params;
|
||||
std::optional<def_s> def;
|
||||
};
|
||||
|
||||
class expr_node : public stmt_node {
|
||||
|
||||
@@ -76,6 +76,8 @@ struct token {
|
||||
While, /**< `while` */
|
||||
Public, /**< `public` */
|
||||
Private, /**< `private` */
|
||||
Pre, /**< `pre` */
|
||||
Post, /**< `post` */
|
||||
|
||||
Pointerof, /**< `pointerof` */
|
||||
Sizeof, /**< `sizeof` */
|
||||
@@ -186,6 +188,8 @@ struct token {
|
||||
case token::While: return os << "while";
|
||||
case token::Public: return os << "public";
|
||||
case token::Private: return os << "private";
|
||||
case token::Pre: return os << "pre";
|
||||
case token::Post: return os << "post";
|
||||
case token::Pointerof: return os << "pointerof";
|
||||
case token::Sizeof: return os << "sizeof";
|
||||
case token::Lengthof: return os << "lengthof";
|
||||
|
||||
Reference in New Issue
Block a user