// $ANTLR start "attributeDeclaration"
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:394:1: attributeDeclaration returns [ToolAttribute att] : ^( ATTRIBUTE_DECLARATION modifier name type ( GENERATED )? ) ;
public final ToolAttribute attributeDeclaration() throws RecognitionException {
ToolAttribute att = null;
ForteAST.name_return name31 = null;
ForteAST.type_return type32 = null;
ForteAST.modifier_return modifier33 = null;
try {
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:395:3: ( ^( ATTRIBUTE_DECLARATION modifier name type ( GENERATED )? ) )
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:395:5: ^( ATTRIBUTE_DECLARATION modifier name type ( GENERATED )? )
{
match(input,ATTRIBUTE_DECLARATION,FOLLOW_ATTRIBUTE_DECLARATION_in_attributeDeclaration1303); if (state.failed) return att;
match(input, Token.DOWN, null); if (state.failed) return att;
pushFollow(FOLLOW_modifier_in_attributeDeclaration1305);
modifier33=modifier();
state._fsp--;
if (state.failed) return att;
pushFollow(FOLLOW_name_in_attributeDeclaration1307);
name31=name();
state._fsp--;
if (state.failed) return att;
pushFollow(FOLLOW_type_in_attributeDeclaration1309);
type32=type();
state._fsp--;
if (state.failed) return att;
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:395:49: ( GENERATED )?
int alt34=2;
int LA34_0 = input.LA(1);
if ( (LA34_0==GENERATED) ) {
alt34=1;
}
switch (alt34) {
case 1 :
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:0:0: GENERATED
{
match(input,GENERATED,FOLLOW_GENERATED_in_attributeDeclaration1312); if (state.failed) return att;
}
break;
}
match(input, Token.UP, null); if (state.failed) return att;
if ( state.backtracking==0 ) {
att = new ToolAttribute(currentType);
att.setToolName((name31!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(name31.start),
input.getTreeAdaptor().getTokenStopIndex(name31.start))):null));
att.setType((type32!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(type32.start),
input.getTreeAdaptor().getTokenStopIndex(type32.start))):null));
att.setVisability((modifier33!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(modifier33.start),
input.getTreeAdaptor().getTokenStopIndex(modifier33.start))):null));
if (currentType instanceof ToolClass)
((ToolClass)currentType).add(att);