dcsimg
How to count the number of parameters in a functions
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Prasad_Nandagiri
Posted On:   Monday, April 16, 2012 05:17 AM

I am trying to parse a function which is having the following format " function (param1, param2)" With the grammar I am able to generate the AST specifying the function name and also able to display param type and param name. But I would like to have another node which should contain number of parameters in the function. Please advise me on how to achieve it. My Grammar : parameter_sub : ('READONLY')? ('REF')? data_type_name decimal_decl_sub? identifier_name array_decl_sub? -> ^('PARAMETER' ^('PARAMETERTYPE' data_type_name?) ^('PARAMETERNAME' identifier_name?) ) ; parameters_list_sub :   More>>


I am trying to parse a function which is having the following format " function (param1, param2)"




With the grammar I am able to generate the AST specifying the function name and also able to display param type and param name. But I would like to have another node which should contain number of parameters in the function. Please advise me on how to achieve it.


My Grammar :



parameter_sub
:
('READONLY')? ('REF')? data_type_name decimal_decl_sub? identifier_name array_decl_sub?
-> ^('PARAMETER' ^('PARAMETERTYPE' data_type_name?) ^('PARAMETERNAME' identifier_name?) )
;

parameters_list_sub

:
parameter_sub (COMMA parameter_sub)* -> ^('PARAMETERS' parameter_sub+)
;

   <<Less
About | Sitemap | Contact