contrib/objcwrapper grammar: accepts parameters without a type
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 26 Aug 2015 20:12:57 +0000 (16:12 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 27 Aug 2015 19:26:50 +0000 (15:26 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/objcwrapper/grammar/objc.sablecc
contrib/objcwrapper/src/objc_visitor.nit

index b997614..f5c90c8 100644 (file)
@@ -121,11 +121,13 @@ Parser
         {instance:} '-';
 
     parameter =
-        {named:} [left:]term ':' lpar parameter_type rpar attribute? [right:]term |
+        {named:} [left:]term ':' parameter_type_in_par? attribute? [right:]term |
         {single:} term |
         {comma:} comma '...' |
         {macro:} macro_name;
 
+    parameter_type_in_par = lpar parameter_type rpar;
+
     parameter_type =
         {normal:} type |
         {anonymous:} type anonymous |
index 3d51935..487713d 100644 (file)
@@ -167,7 +167,12 @@ redef class Nparameter_named
                var param = new Param
                param.variable_name = n_right.collect_text
                param.name = n_left.collect_text
-               param.return_type = n_parameter_type.to_type
+
+               var n_type = n_parameter_type_in_par
+               param.return_type = if n_type != null then
+                       n_type.n_parameter_type.to_type
+               else  "NSObject"
+
                return param
        end
 end