Browse Source

Sol Part 65.1: It's Actually Just Cool This Time™

master
Graham Northup 4 years ago
parent
commit
c8114e6d5a
Signed by: grissess GPG Key ID: 5D000E6F539376FB
  1. 5260
      parser.output
  2. 898
      parser.tab.c
  3. 13
      parser.y
  4. 3
      tests/lang_macro.sol

5260
parser.output
File diff suppressed because it is too large
View File

898
parser.tab.c
File diff suppressed because it is too large
View File

13
parser.y

@ -437,6 +437,19 @@ funcdecl_expr:
AS_EX($$)->funcdecl->body->ret->ret = $6;
AS_EX($$)->funcdecl->flags = 0;
}
| MACRO LAMBDA any_lparen param_list RPAREN maybe_anno expr END {
$$ = NEW_EX();
AS_EX($$)->type = EX_FUNCDECL;
AS_EX($$)->funcdecl = NEW(funcdecl_node);
AS_EX($$)->funcdecl->name = NULL;
AS_EX($$)->funcdecl->params = $4;
AS_EX($$)->funcdecl->anno = $6;
AS_EX($$)->funcdecl->body = NEW_ST();
AS_EX($$)->funcdecl->body->type = ST_RET;
AS_EX($$)->funcdecl->body->ret = NEW(ret_node);
AS_EX($$)->funcdecl->body->ret->ret = $7;
AS_EX($$)->funcdecl->flags = FUNC_IS_MACRO;
}
| index_expr { $$ = $1; }
;

3
tests/lang_macro.sol

@ -12,3 +12,6 @@ macro stupid(ex)
end
assert_eq(stupid(this_var_does_not_exist - 7), 70, "macro 2")
stuff = macro lambda(n) n({q = 3}) end
assert_eq(stuff(q), 3, "macro lambda 1")
Loading…
Cancel
Save