public override Node VisitTensorDecl(ML4DParser.TensorDeclContext context) { TensorDCLNode tensorDclNode; if (context.init is not null) { tensorDclNode = new TensorDCLNode(context.type.Text, context.id.Text, int.Parse(context.rows.Text), int.Parse(context.coloumns.Text), (TensorInitNode)Visit(context.init)); } else { tensorDclNode = new TensorDCLNode(context.type.Text, context.id.Text, int.Parse(context.rows.Text), int.Parse(context.coloumns.Text), (ExpressionNode)Visit(context.assignInit)); } return(tensorDclNode); }
/// <summary> /// Exit a parse tree produced by the <c>tensorDecl</c> /// labeled alternative in <see cref="ML4DParser.dcl"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitTensorDecl([NotNull] ML4DParser.TensorDeclContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>tensorDecl</c> /// labeled alternative in <see cref="ML4DParser.dcl"/>. /// <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 VisitTensorDecl([NotNull] ML4DParser.TensorDeclContext context) { return(VisitChildren(context)); }