public
Description: Reia is a Ruby/Python-like language for BEAM, the Erlang VM
Homepage: http://reia-lang.org
Clone URL: git://github.com/tarcieri/reia.git
Function calls via Module.function(arg1, arg2, arg3)
Tony Arcieri (author)
Tue Aug 05 00:01:31 -0700 2008
commit  3e4d18a2ae8baa38eeba7fed7dafa6caba3309a0
tree    56a5bcbf20ddce75b131b05ffcf788fab86e0569
parent  fc313ef68c6852f718f803d1c73238b9be53b150
...
88
89
90
91
 
 
 
 
 
92
93
94
95
96
 
 
97
98
99
...
88
89
90
 
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
0
@@ -88,12 +88,18 @@ forms(Ast = {float, _, _}) ->
0
 forms(Ast = {atom, _, _}) ->
0
   Ast;
0
   
0
-%% Strings and regular expressions
0
+%% Constants
0
+forms({constant, Line, Name}) ->
0
+ {tuple, Line, [{atom, Line, constant}, {atom, Line, Name}]};
0
+
0
+%% Strings
0
 forms({string, Line, String}) ->
0
   {tuple, Line, [
0
     {atom, Line, string},
0
     {bin, Line, [{bin_element, Line, {string, Line, String}, default, default}]}
0
   ]};
0
+
0
+%% Regexes
0
 forms({regexp, Line, Pattern}) ->
0
   {tuple, Line, [
0
     {atom, Line, regexp},
...
25
26
27
 
 
28
29
30
...
44
45
46
47
 
48
49
50
...
25
26
27
28
29
30
31
32
...
46
47
48
 
49
50
51
52
0
@@ -25,6 +25,8 @@ funcall(Receiver, to_internal, []) ->
0
       reia_erl:e2r(Receiver)
0
   end;
0
 
0
+funcall(Receiver = {constant, Name}, Method, Arguments) ->
0
+ apply(Name, Method, Arguments);
0
 funcall(Receiver, Method, Arguments) when is_integer(Receiver) or is_float(Receiver) ->
0
   'Numeric':funcall(Receiver, Method, silly_list_hack(Arguments));
0
 funcall(Receiver, Method, Arguments) when is_atom(Receiver) ->
0
@@ -44,7 +46,7 @@ funcall(Receiver = {lambda, _}, Method, Arguments) ->
0
 funcall(Receiver = {regexp, _}, Method, Arguments) ->
0
   'Regex':funcall(Receiver, Method, silly_list_hack(Arguments));
0
 funcall(_, _, _) ->
0
- throw(unknown_receiver).
0
+ throw({error, unknown_receiver}).
0
   
0
 %%
0
 %% Funcalls that take blocks
...
146
147
148
 
149
150
151
...
146
147
148
149
150
151
152
0
@@ -146,6 +146,7 @@ max_expr -> tuple : '$1'.
0
 max_expr -> dict : '$1'.
0
 max_expr -> binary : '$1'.
0
 max_expr -> atom : '$1'.
0
+max_expr -> constant : '$1'.
0
 max_expr -> lambda : '$1'.
0
 max_expr -> case_expr : '$1'.
0
 max_expr -> if_expr : '$1'.

Comments

    No one has commented yet.