From: Alexis Laferrière Date: Wed, 26 Aug 2015 20:12:57 +0000 (-0400) Subject: contrib/objcwrapper grammar: accepts parameters without a type X-Git-Tag: v0.7.8~61^2~3 X-Git-Url: http://nitlanguage.org contrib/objcwrapper grammar: accepts parameters without a type Signed-off-by: Alexis Laferrière --- diff --git a/contrib/objcwrapper/grammar/objc.sablecc b/contrib/objcwrapper/grammar/objc.sablecc index b997614..f5c90c8 100644 --- a/contrib/objcwrapper/grammar/objc.sablecc +++ b/contrib/objcwrapper/grammar/objc.sablecc @@ -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 | diff --git a/contrib/objcwrapper/src/objc_visitor.nit b/contrib/objcwrapper/src/objc_visitor.nit index 3d51935..487713d 100644 --- a/contrib/objcwrapper/src/objc_visitor.nit +++ b/contrib/objcwrapper/src/objc_visitor.nit @@ -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