/// <summary>Gets an IStatement from a StatementContext.</summary>
        /// <param name="scope">The scope the statement was created in.</param>
        /// <param name="statementContext">The context of the statement.</param>
        public IStatement GetStatement(Scope scope, IParseStatement statementContext)
        {
            IStatement statement = StatementFromContext(scope, statementContext);

            // Apply related output comment.
            if (statementContext.Comment != null)
            {
                statement.OutputComment(Script.Diagnostics, statementContext.Comment.Range, statementContext.Comment.GetContents());
            }

            return(statement);
        }
        /// <summary>Gets an IStatement from a StatementContext.</summary>
        /// <param name="scope">The scope the statement was created in.</param>
        /// <param name="statementContext">The context of the statement.</param>
        public IStatement GetStatement(Scope scope, DeltinScriptParser.Documented_statementContext statementContext)
        {
            IStatement statement = StatementFromContext(scope, statementContext);

            // Apply related output comment.
            if (statementContext.DOCUMENTATION() != null)
            {
                string   text  = statementContext.DOCUMENTATION().GetText().Substring(1).Trim();
                DocRange range = DocRange.GetRange(statementContext.DOCUMENTATION());
                statement.OutputComment(Script.Diagnostics, range, text);
            }

            return(statement);
        }
        /// <summary>Gets an IStatement from a StatementContext.</summary>
        /// <param name="scope">The scope the statement was created in.</param>
        /// <param name="statementContext">The context of the statement.</param>
        public IStatement GetStatement(Scope scope, IParseStatement statementContext)
        {
            IStatement statement = StatementFromContext(scope, statementContext);

            // Apply related output comment.
            if (statementContext is ICommentableStatement comment && comment.ActionComment != null)
            {
                string   text  = comment.ActionComment.Text.Substring(1).Trim();
                DocRange range = comment.ActionComment.Range;
                statement.OutputComment(Script.Diagnostics, range, text);
            }

            return(statement);
        }