Browse Source

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

Graham Northup 3 years ago
parent
commit
c8114e6d5a
Signed by: Graham Northup <grissess@nexusg.org> GPG Key ID: 5D000E6F539376FB
4 changed files with 3246 additions and 2928 deletions
  1. 2771
    2489
      parser.output
  2. 459
    439
      parser.tab.c
  3. 13
    0
      parser.y
  4. 3
    0
      tests/lang_macro.sol

+ 2771
- 2489
parser.output
File diff suppressed because it is too large
View File


+ 459
- 439
parser.tab.c
File diff suppressed because it is too large
View File


+ 13
- 0
parser.y View File

@@ -437,6 +437,19 @@ funcdecl_expr:
437 437
 	AS_EX($$)->funcdecl->body->ret->ret = $6;
438 438
 	AS_EX($$)->funcdecl->flags = 0;
439 439
 }
440
+| MACRO LAMBDA any_lparen param_list RPAREN maybe_anno expr END {
441
+	$$ = NEW_EX();
442
+	AS_EX($$)->type = EX_FUNCDECL;
443
+	AS_EX($$)->funcdecl = NEW(funcdecl_node);
444
+	AS_EX($$)->funcdecl->name = NULL;
445
+	AS_EX($$)->funcdecl->params = $4;
446
+	AS_EX($$)->funcdecl->anno = $6;
447
+	AS_EX($$)->funcdecl->body = NEW_ST();
448
+	AS_EX($$)->funcdecl->body->type = ST_RET;
449
+	AS_EX($$)->funcdecl->body->ret = NEW(ret_node);
450
+	AS_EX($$)->funcdecl->body->ret->ret = $7;
451
+	AS_EX($$)->funcdecl->flags = FUNC_IS_MACRO;
452
+}
440 453
 | index_expr { $$ = $1; }
441 454
 ;
442 455
 

+ 3
- 0
tests/lang_macro.sol View File

@@ -12,3 +12,6 @@ macro stupid(ex)
12 12
 end
13 13
 
14 14
 assert_eq(stupid(this_var_does_not_exist - 7), 70, "macro 2")
15
+
16
+stuff = macro lambda(n) n({q = 3}) end
17
+assert_eq(stuff(q), 3, "macro lambda 1")

Loading…
Cancel
Save