public override StatementNode VisitMemberAssignStatement([NotNull] CoronaParser.MemberAssignStatementContext context) { BuildValueAst valueVisitor = new BuildValueAst(); BuildExpressionAst exprVisitor = new BuildExpressionAst(); try { // Get GridPoint GridValueNode gridPoint = null; if (context.gridPoint() != null) { gridPoint = (GridValueNode)valueVisitor.Visit(context.gridPoint()); } // Get Member IdentifierValueNode memberID = new IdentifierValueNode(context.identifierValue().GetText()); // Get value ValueNode value; if (context.expr() != null) { value = exprVisitor.Visit(context.expr()); } else { value = new StringValueNode(context.STRING().GetText()); } return(new MemberAssignmentStatementNode(gridPoint, memberID, value)); } catch (TheLanguageErrorException e) { throw new TheLanguageErrorException("Member assignment statement", e); } }
/// <summary> /// Visit a parse tree produced by the <c>MemberAssignStatement</c> /// labeled alternative in <see cref="CoronaParser.assignmentStatement"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitMemberAssignStatement([NotNull] CoronaParser.MemberAssignStatementContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by the <c>MemberAssignStatement</c> /// labeled alternative in <see cref="CoronaParser.assignmentStatement"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitMemberAssignStatement([NotNull] CoronaParser.MemberAssignStatementContext context) { }