Home | History | Annotate | Download | only in functional
      1 grammar t016actions;
      2 options {
      3   language = JavaScript;
      4 }
      5 
      6 declaration returns [name]
      7     :   functionHeader ';'
      8         {$name = $functionHeader.name;}
      9     ;
     10 
     11 functionHeader returns [name]
     12     :   type ID
     13 	{$name = $ID.text;}
     14     ;
     15 
     16 type
     17     :   'int'   
     18     |   'char'  
     19     |   'void'
     20     ;
     21 
     22 ID  :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
     23     ;
     24 
     25 WS  :   (   ' '
     26         |   '\t'
     27         |   '\r'
     28         |   '\n'
     29         )+
     30         {_channel=HIDDEN}
     31     ;    
     32