lang: add var keyword for variable declarations
the var keyword allows greater control over what scope a particular variable exists in. it clarifies whether a new variable is being defined or an existing variable is being assigned to. it will also facilitate the implementation of global variables.
This commit is contained in:
@@ -16,6 +16,7 @@ extern struct ast_node_type expr_node_ops;
|
||||
extern struct ast_node_type block_node_ops;
|
||||
extern struct ast_node_type msg_node_ops;
|
||||
extern struct ast_node_type op_node_ops;
|
||||
extern struct ast_node_type var_node_ops;
|
||||
extern struct ast_node_type ident_node_ops;
|
||||
extern struct ast_node_type int_node_ops;
|
||||
extern struct ast_node_type double_node_ops;
|
||||
@@ -51,6 +52,7 @@ static const struct ast_node_type *node_ops[] = {
|
||||
[IVY_AST_BLOCK] = &block_node_ops,
|
||||
[IVY_AST_MSG] = &msg_node_ops,
|
||||
[IVY_AST_OP] = &op_node_ops,
|
||||
[IVY_AST_VAR] = &var_node_ops,
|
||||
[IVY_AST_IDENT] = &ident_node_ops,
|
||||
[IVY_AST_INT] = &int_node_ops,
|
||||
[IVY_AST_DOUBLE] = &double_node_ops,
|
||||
@@ -268,6 +270,7 @@ const char *ivy_ast_node_type_to_string(enum ivy_ast_node_type v)
|
||||
ENUM_STR(IVY_AST_UNIT_IMPORT);
|
||||
ENUM_STR(IVY_AST_DISCARD);
|
||||
ENUM_STR(IVY_AST_INT);
|
||||
ENUM_STR(IVY_AST_VAR);
|
||||
ENUM_STR(IVY_AST_DOUBLE);
|
||||
ENUM_STR(IVY_AST_STRING);
|
||||
ENUM_STR(IVY_AST_FSTRING);
|
||||
|
||||
Reference in New Issue
Block a user