diff options
author | Björn Gustavsson <[email protected]> | 2018-04-04 14:10:21 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2018-04-04 14:10:21 +0200 |
commit | db1447e1423aaaafa02d52ca0b57115631990780 (patch) | |
tree | afa43c1de02f6156535ce991470db9af648bc4d5 /lib/compiler/src/core_parse.yrl | |
parent | f99860259ee557851acc865519a315f04d1d4d51 (diff) | |
parent | 63e1c58d27ab695a19897423fc75e607f69ff51b (diff) | |
download | otp-db1447e1423aaaafa02d52ca0b57115631990780.tar.gz otp-db1447e1423aaaafa02d52ca0b57115631990780.tar.bz2 otp-db1447e1423aaaafa02d52ca0b57115631990780.zip |
Merge pull request #1725 from michalmuskala/fun-literals
Compile external fun expressions to literals
OTP-15003
Diffstat (limited to 'lib/compiler/src/core_parse.yrl')
-rw-r--r-- | lib/compiler/src/core_parse.yrl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/compiler/src/core_parse.yrl b/lib/compiler/src/core_parse.yrl index 85444023c6..11c4cd8b50 100644 --- a/lib/compiler/src/core_parse.yrl +++ b/lib/compiler/src/core_parse.yrl @@ -36,7 +36,7 @@ other_pattern atomic_pattern tuple_pattern cons_pattern tail_pattern binary_pattern segment_patterns segment_pattern expression single_expression -literal literals atomic_literal tuple_literal cons_literal tail_literal +literal literals atomic_literal tuple_literal cons_literal tail_literal fun_literal nil tuple cons tail binary segments segment @@ -267,6 +267,7 @@ single_expression -> cons : '$1'. single_expression -> binary : '$1'. single_expression -> variable : '$1'. single_expression -> function_name : '$1'. +single_expression -> fun_literal : '$1'. single_expression -> fun_expr : '$1'. single_expression -> let_expr : '$1'. single_expression -> letrec_expr : '$1'. @@ -303,6 +304,9 @@ tail_literal -> ']' : #c_literal{val=[]}. tail_literal -> '|' literal ']' : '$2'. tail_literal -> ',' literal tail_literal : c_cons('$2', '$3'). +fun_literal -> 'fun' atom ':' atom '/' integer : + #c_literal{val = erlang:make_fun(tok_val('$2'), tok_val('$4'), tok_val('$6'))}. + tuple -> '{' '}' : c_tuple([]). tuple -> '{' anno_expressions '}' : c_tuple('$2'). |