// $ANTLR start "virtualAttributeDeclaration"
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:410:1: virtualAttributeDeclaration returns [ToolVirtualAttribute att] : ^( VIRTUAL_ATTRIBUTE modifier name type getExpression ( setExpression )? ) ;
public final ToolVirtualAttribute virtualAttributeDeclaration() throws RecognitionException {
ToolVirtualAttribute att = null;
ForteAST.name_return name34 = null;
ForteAST.type_return type35 = null;
ForteAST.modifier_return modifier36 = null;
ForteAST.getExpression_return getExpression37 = null;
ForteAST.setExpression_return setExpression38 = null;
try {
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:411:2: ( ^( VIRTUAL_ATTRIBUTE modifier name type getExpression ( setExpression )? ) )
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:411:4: ^( VIRTUAL_ATTRIBUTE modifier name type getExpression ( setExpression )? )
{
match(input,VIRTUAL_ATTRIBUTE,FOLLOW_VIRTUAL_ATTRIBUTE_in_virtualAttributeDeclaration1359); if (state.failed) return att;
match(input, Token.DOWN, null); if (state.failed) return att;
pushFollow(FOLLOW_modifier_in_virtualAttributeDeclaration1361);
modifier36=modifier();
state._fsp--;
if (state.failed) return att;
pushFollow(FOLLOW_name_in_virtualAttributeDeclaration1363);
name34=name();
state._fsp--;
if (state.failed) return att;
pushFollow(FOLLOW_type_in_virtualAttributeDeclaration1365);
type35=type();
state._fsp--;
if (state.failed) return att;
pushFollow(FOLLOW_getExpression_in_virtualAttributeDeclaration1368);
getExpression37=getExpression();
state._fsp--;
if (state.failed) return att;
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:411:58: ( setExpression )?
int alt35=2;
int LA35_0 = input.LA(1);
if ( (LA35_0==SET_EXPRESSION) ) {
alt35=1;
}
switch (alt35) {
case 1 :
// /Users/peter/Documents/workspace/ToolModel/src/tool/model/grammar/ForteAST.g:0:0: setExpression
{
pushFollow(FOLLOW_setExpression_in_virtualAttributeDeclaration1370);
setExpression38=setExpression();
state._fsp--;
if (state.failed) return att;
}
break;
}
match(input, Token.UP, null); if (state.failed) return att;
if ( state.backtracking==0 ) {
att = new ToolVirtualAttribute(currentType);
att.setToolName((name34!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(name34.start),
input.getTreeAdaptor().getTokenStopIndex(name34.start))):null));
att.setType((type35!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(type35.start),
input.getTreeAdaptor().getTokenStopIndex(type35.start))):null));
att.setVisability((modifier36!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(modifier36.start),
input.getTreeAdaptor().getTokenStopIndex(modifier36.start))):null));
att.setGetExpression((getExpression37!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(getExpression37.start),
input.getTreeAdaptor().getTokenStopIndex(getExpression37.start))):null));
att.setSetExpression((setExpression38!=null?(input.getTokenStream().toString(
input.getTreeAdaptor().getTokenStartIndex(setExpression38.start),
input.getTreeAdaptor().getTokenStopIndex(setExpression38.start))):null));
if (currentType instanceof ToolClass)
((ToolClass)currentType).add(att);
else if (currentType instanceof ToolInterface)