// $ANTLR start "eventDeclaration"
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:486:1: eventDeclaration returns [ToolEvent event] : ^( EVENT_DECLARATION modifier IDENTIFIER ( formalParameterDecls )? ) ;
public final ToolEvent eventDeclaration() throws RecognitionException {
ToolEvent event = null;
CommonTree IDENTIFIER42=null;
try {
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:487:2: ( ^( EVENT_DECLARATION modifier IDENTIFIER ( formalParameterDecls )? ) )
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:487:4: ^( EVENT_DECLARATION modifier IDENTIFIER ( formalParameterDecls )? )
{
match(input,EVENT_DECLARATION,FOLLOW_EVENT_DECLARATION_in_eventDeclaration1625); if (state.failed) return event;
match(input, Token.DOWN, null); if (state.failed) return event;
pushFollow(FOLLOW_modifier_in_eventDeclaration1627);
modifier();
state._fsp--;
if (state.failed) return event;
IDENTIFIER42=(CommonTree)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_eventDeclaration1629); if (state.failed) return event;
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:487:45: ( formalParameterDecls )?
int alt47=2;
int LA47_0 = input.LA(1);
if ( (LA47_0==PARAMETER) ) {
alt47=1;
}
switch (alt47) {
case 1 :
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:0:0: formalParameterDecls
{
pushFollow(FOLLOW_formalParameterDecls_in_eventDeclaration1632);
formalParameterDecls();
state._fsp--;
if (state.failed) return event;
}
break;
}
match(input, Token.UP, null); if (state.failed) return event;
if ( state.backtracking==0 ) {
event = new ToolEvent(currentType);
event.setToolName((IDENTIFIER42!=null?IDENTIFIER42.getText():null));
if (currentType instanceof ToolClass)
((ToolClass)currentType).add(event);
else if (currentType instanceof ToolInterface)
((ToolInterface)currentType).add(event);