Skip to content

Commit

Permalink
case
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoqi committed Aug 18, 2018
1 parent c08ddc5 commit edd4af3
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 69 deletions.
8 changes: 5 additions & 3 deletions example-case.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
define_public_lambda_withTypeOfBody(CaSe(var(x, int)) __ int)(
case_const_number(x, int)(
((1,2) __ 3;),
(_ __ 4;)
);
)
(_ __ 4;),);)
define_public_lambda_withTypeOfBody(CaSe2(var(x, int)) __ int)(
case_const_number(x, int)(
((1,2) __ 3;),
((0) __ 4;),);)

#include ">module"
3 changes: 2 additions & 1 deletion make.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,11 @@ LANG_define => 全局定義
for_in_from_to(j, 1, i, { \
X(LANG_prefix"case_const_number_hELPEr_each")X(" _")Nat(j)X(" ") \
}) \
X("}"LANG_prefix"case_const_number_tEMp;})"))}) \
/*分号为了多出来的逗号*/X(";}"LANG_prefix"case_const_number_tEMp;})"))}) \
DEFINE_FUNCTION(X(LANG_prefix"case_const_number_hELPEr_each0"),X("x"), \
Call1(X(TOOLS_prefix"expand"), X(LANG_prefix"case_const_number_hELPEr_each")X(" x"))) \
DEFINE_FUNCTION(X(LANG_prefix"case_const_number_hELPEr_append"),X("x,y"),X("x y")) \
LINE(X("static const int "LANG_prefix"case_const_number_hELPEr_each;"))/*多出来的逗号*/ \
DEFINE_FUNCTION(X(LANG_prefix"case_const_number_hELPEr_each"),X("cond,..."), \
Call3(X(TOOLS_prefix"if"),Call1(X(TOOLS_prefix"null_p"), X("cond")),/*匹配任何*/ \
X("default:") \
Expand Down
Loading

0 comments on commit edd4af3

Please sign in to comment.