From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Newsgroups: gmane.emacs.devel Subject: Re: Code navigation for sh-mode with Tree-sitter Date: Tue, 6 Dec 2022 14:55:55 -0700 Message-ID: References: <1B9F9B3A-A757-4A65-9653-CD0112EB8895@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000f2bf4e05ef2fdef4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16195"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 06 22:57:01 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2fvx-0003zW-8H for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Dec 2022 22:57:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2fvB-0003Zc-JJ; Tue, 06 Dec 2022 16:56:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2fv8-0003ZJ-UT for emacs-devel@gnu.org; Tue, 06 Dec 2022 16:56:11 -0500 Original-Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2fv6-0007DG-8Y for emacs-devel@gnu.org; Tue, 06 Dec 2022 16:56:10 -0500 Original-Received: by mail-ed1-x52a.google.com with SMTP id f7so22353964edc.6 for ; Tue, 06 Dec 2022 13:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wCF5t3XXIzsGomBq3OB9zYPsy9MKXn+4M1coULungwc=; b=iaIqehc7x2UXTHjihWyIxYS6ArpET+P3d0pzr2919JQ8oxkOm7Ae7feMPRZ8Eim0NQ ZbiH+TIeJVbGkOfd0jxdyG6LsDLf6IolYMv9RMQANIhmw4okPo3bMO3YXdl0iTq0TgSB B7J/PTBJiXP1Elep28z0tee7ONhmPIbf2qpDogb12pkVoK9oZT9yBR+LTPKijhR/Od8q b+YA6MUCt3VY0Ov3bj1L+ocr0OVfX5ndDhXjfLuIya/4rsTYi5QYY7HWlhc3PxENCHrj yEYhaQqvh0E5ZWs66+PC5i6JwspSFoNIE4xRuQIE3m8DeyqX+z/ajc+QdYee+aavV8Ig OxWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wCF5t3XXIzsGomBq3OB9zYPsy9MKXn+4M1coULungwc=; b=fwzv+9S03qraDhmFT4xKsGveKbnEcn+D19YVgXbX9SYMRcmSLQe1LzB6Kr51YWMMyi 7hh8jR0mzH8LImGuJzf8PkhddP+oySfazDsZFTXgJTbP7S156DxSu0tIm7WiotRgviGh u/C+tqkTBwqzzSNx7RDhn5T1Ln5RAuQmplxI2tm9/2hdih5JWePflrrD4pHaghA5yxN4 jl8PguJ1DQ6R3JS4aIOhpOEYTKSbWsMJE0ljnGX7IAAD5F3U5rXqiy5KOfQoWmzHnLkg Gr/+nb8nWaiRtPptOOKoMlBc4ACThtGsf23kIVuzSt63zvkIUjEXDXVGbi8I5BSenGxM x6TA== X-Gm-Message-State: ANoB5pmc7D1Wqd1C/FVQGQY7FPPmhkbUrloHpjpEyvcM4SMBiZdV1FYo CkaDyfuhwbDJTb0UncrAcHg5WM8YlgTW925V5fQ= X-Google-Smtp-Source: AA0mqf5WcSewgGeOiEBEDyVZ7L2J9G9+ZX65zJSG+42e8v+V1aV2m9Et/hZJV2zI7bxZFG+88NI8fLUDguKVuVRj4WY= X-Received: by 2002:a05:6402:1145:b0:46a:d5ee:d150 with SMTP id g5-20020a056402114500b0046ad5eed150mr43627406edw.312.1670363766485; Tue, 06 Dec 2022 13:56:06 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=jaopaulolc@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300986 Archived-At: --000000000000f2bf4e05ef2fdef4 Content-Type: multipart/alternative; boundary="000000000000f2bf4b05ef2fdef2" --000000000000f2bf4b05ef2fdef2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I completed my patch to add basic navigation to bash-ts-mode. It works consistently when the new navigation functions (`sh-mode--treesit-beginning-of-defun' and `sh-mode--treesit-end-of-defun') are bound directly to C-M-a/e. However, if those functions are bound to `beginning-of-defun-function' and `end-of-defun-function', C-M-e does not work with negative arguments inside of functions. In the example below C-u - 1 C-M-e goes to the beginning of foo and not to end of bar when point is inside foo, and anywhere after bar: function foo { function bar { echo "Hello from bar" } if [[ $1 > 0 ]]; then return 42 else return 24 fi echo bar } Any comments and feedback on the patch are welcomed. On Tue, Dec 6, 2022 at 2:46 PM Jo=C3=A3o Paulo Labegalini de Carvalho < jaopaulolc@gmail.com> wrote: > > > Should we make it configurable, then? A variable that makes >> > > tree-sitter defun navigation switch between two modes: top-level onl= y >> > > and not top-level only. >> >> In CC Mode, it has been configurable via the user option c-defun-tactic >> for somewhere between ten and fifteen years. When c-defun-tactic is t, >> C-M-a/e go to the start/end of the top level defuns. When it is the >> symbol go-outward, C-M-a/e move to the next start/end of defun, if any, >> at the current level of class/namespace nesting, and move outwards to >> the next level of class/namespace nesting when a class/namespace boundar= y >> is reached. >> > > The 'go-outward behavior is the one I have implemented. > > I don't remember any complaints about this mechanism. >> >> > And for functions nested in a class: if you type C-M-e at the beginnin= g >> > of a class, should it go to the end of the first function in that >> > class, or should it go to the end of the class? Right now because of >> > how end-of-defun works, it will jump to the end of the class if point >> > is at the beginning of the class (1), and jump to the first function i= f >> > point is before the beginning of the class (2). >> >> This doesn't seem sensible. >> > > I tend to agree. I would expect it to go to the nearest node (either clas= s > or function) and not bypass a class node in favor of function nodes. > > -- > Jo=C3=A3o Paulo L. de Carvalho > Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil > Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - > Canada > joao.carvalho@ic.unicamp.br > joao.carvalho@ualberta.ca > --=20 Jo=C3=A3o Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canad= a joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca --000000000000f2bf4b05ef2fdef2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I completed my patch to add basic navigation=C2=A0to bash-= ts-mode.

It works consistently when the new navigation functions=C2= =A0(`sh-mode--treesit-beginning-of-defun' and `sh-mode--treesit-end-of-= defun') are bound directly to C-M-a/e. However, if those functions are = bound to `beginning-of-defun-function' and `end-of-defun-function',= C-M-e does not work with=C2=A0negative arguments inside of functions.
<= br>In the example below C-u - 1 C-M-e goes to the beginning of foo and not = to end of bar when point is inside foo, and anywhere after bar:

function foo {
=C2=A0 =C2=A0 function bar {
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 echo "Hello from bar"
=C2=A0 =C2=A0 }=
=C2=A0 =C2=A0 if [[ $1 > 0 ]]; then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 r= eturn 42
=C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 24
= =C2=A0 =C2=A0 fi
=C2=A0 =C2=A0 echo bar
}

Any comments = and feedback on the patch are welcomed.

On Tue, Dec 6, 2022 at 2:46 PM Jo=C3= =A3o Paulo Labegalini de Carvalho <jaopaulolc@gmail.com> wrote:
> > Should we make it confi= gurable, then? A variable that makes
> > tree-sitter defun navigation switch between two modes: top-level = only
> > and not top-level only.

In CC Mode, it has been configurable via the user option c-defun-tactic
for somewhere between ten and fifteen years.=C2=A0 When c-defun-tactic is t= ,
C-M-a/e go to the start/end of the top level defuns.=C2=A0 When it is the symbol go-outward, C-M-a/e move to the next start/end of defun, if any,
at the current level of class/namespace nesting, and move outwards to
the next level of class/namespace nesting when a class/namespace boundary is reached.

The 'go-outward behavio= r is the one I have implemented.

I don't remember any complaints about this mechanism.

> And for functions nested in a class: if you type C-M-e at the beginnin= g
> of a class, should it go to the end of the first function in that
> class, or should it go to the end of the class? Right now because of > how end-of-defun works, it will jump to the end of the class if point<= br> > is at the beginning of the class (1), and jump to the first function i= f
> point is before the beginning of the class (2).

This doesn't seem sensible.

I tend to agree. I= would expect it to go to the nearest node (either class or function) and n= ot bypass a class node in favor of function nodes.=C2=A0
--
Jo=C3=A3o Paulo L. de Carvalho
Ph.D Computer Science | =C2=A0IC-UNICA= MP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of= Alberta | Edmonton, AB - Canada


--
Jo= =C3=A3o Paulo L. de Carvalho
Ph.D Computer Science | =C2=A0IC-UNICAMP | = Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Albe= rta | Edmonton, AB - Canada
--000000000000f2bf4b05ef2fdef2-- --000000000000f2bf4e05ef2fdef4 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Basic-navigation-for-bash-ts-mode.patch" Content-Disposition: attachment; filename="0001-Basic-navigation-for-bash-ts-mode.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lbcrfnc90 RnJvbSBlMzY5MWQ5MjYxMjMzMjQxZDM0OWRkNGQzOWI3MmRkYjE0NGY2ZjFiIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiA9P1VURi04P3E/Sm89QzM9QTNvPTIwUD0yRT0yMEw9MkU9MjBk ZT0yMENhcnZhbGhvPz0KIDxqYW9wYXVsb2xjQGdtYWlsLmNvbT4KRGF0ZTogU2F0LCAzIERlYyAy MDIyIDEyOjU1OjI3IC0wNzAwClN1YmplY3Q6IFtQQVRDSF0gQmFzaWMgbmF2aWdhdGlvbiBmb3Ig YmFzaC10cy1tb2RlCgpFbmFibGVzIG5hdmlnYXRpb24gdG8gYmVnaW5uaW5nL2VuZCBvZiBmdW5j dGlvbiBpbiBiYXNoLXRzLW1vZGUuCiAgKiBsaXNwL3Byb2dtb2Rlcy9zaC1zY3JpcHQuZWwgKGJh c2gtdHMtbW9kZSk6IGVuYWJsZSBuYXZlZ2F0aW9uIHZpYQogIG5ldyBpbnRlcm5hbCBuYXZpZ2F0 aW9uIGZ1bmN0aW9ucy4KICAoc2gtbW9kZS0tdHJlZXNpdC1iZWdpbm5pbmctb2Yt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IpICJmdW5jdGlvbiIpCisg ICAgICAgICAgICAgIChzZXRxIGN1cnIgKHRyZWVzaXQtbm9kZS1wYXJlbnQgY3VycikpKQorICAg ICAgICAgIChzZXRxIHRhcmdldCAoc2gtbW9kZS0tdHJlZXNpdC1wYXJlbnQtZGVmdW4gY3Vycikp CisgICAgICAgICAgKHVubGVzcyB0YXJnZXQKKyAgICAgICAgICAgIChsZXQgKChtYXliZS10YXJn ZXQgbmlsKSkKKyAgICAgICAgICAgICAgKHNldHEgbWF5YmUtdGFyZ2V0ICh0cmVlc2l0LXNlYXJj aC1mb3J3YXJkIGN1cnIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGZ1bmN0aW9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICB0KSkKKyAgICAgICAgICAgICAgKHNldHEgdGFyZ2V0 IChvciAodHJlZXNpdC1ub2RlLXRvcC1sZXZlbCBtYXliZS10YXJnZXQpCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgbWF5YmUtdGFyZ2V0KSkpKQorICAgICAgICAgICh3aGVuIHRhcmdl dAorICAgICAgICAgICAgKHNldHEgY3VyciB0YXJnZXQpKQorICAgICAgICAgIChzZXRxIGFyZyAo MS0gYXJnKSkpCisgICAgICA7OyBHbyBmb3J3YXJkLgorICAgICAgKHdoaWxlIChhbmQgKDwgYXJn IDApIGN1cnIpCisgICAgICAgIChzZXRxIHRhcmdldCBuaWwpCisgICAgICAgIChpZiAoc2gtbW9k ZS0tdHJlZXNpdC1kZWZ1bi1wIGN1cnIpCisgICAgICAgICAgICAoc2V0cSBjdXJyICh0cmVlc2l0 LW5vZGUtYXQKKyAgICAgICAgICAgICAgICAgICAgICAgICh0cmVlc2l0LW5vZGUtZW5kCisgICAg ICAgICAgICAgICAgICAgICAgICAgKHRyZWVzaXQtbm9kZS1wYXJlbnQgY3VycikpKSkpCisgICAg ICAgIChsZXQgKChwYXJlbnQtZGVmdW4gKHNoLW1vZGUtLXRyZWVzaXQtcGFyZW50LWRlZnVuIGN1 cnIpKSkKKyAgICAgICAgICAod2hpbGUgKGFuZCAobm90IHRhcmdldCkKKyAgICAgICAgICAgICAg ICAgICAgICBwYXJlbnQtZGVmdW4pCisgICAgICAgICAgICAoc2V0cSB0YXJnZXQgKHNoLW1vZGUt LXRyZWVzaXQtbmV4dC1zaWJsaW5nLWRlZnVuIGN1cnIpKQorICAgICAgICAgICAgKHVubGVzcyB0 YXJnZXQKKyAgICAgICAgICAgICAgKHNldHEgY3VyciAodHJlZXNpdC1ub2RlLW5leHQtc2libGlu ZyBwYXJlbnQtZGVmdW4pKQorICAgICAgICAgICAgICAoc2V0cSBwYXJlbnQtZGVmdW4KKyAgICAg ICAgICAgICAgICAgICAgKHNoLW1vZGUtLXRyZWVzaXQtcGFyZW50LWRlZnVuIGN1cnIpKSkpCisg ICAgICAgICAgKHVubGVzcyB0YXJnZXQKKyAgICAgICAgICAgIChsZXQgKChtYXliZS10YXJnZXQg bmlsKSkKKyAgICAgICAgICAgICAgKHNldHEgbWF5YmUtdGFyZ2V0ICh0cmVlc2l0LXNlYXJjaC1m b3J3YXJkIGN1cnIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIGZ1bmN0aW9uKSkKKyAgICAgICAgICAgICAgKHNldHEgdGFyZ2V0IChvciAo dHJlZXNpdC1ub2RlLXRvcC1sZXZlbCBtYXliZS10YXJnZXQpCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgbWF5YmUtdGFyZ2V0KSkpKQorICAgICAgICAgICh3aGVuIHRhcmdldAorICAg ICAgICAgICAgKHNldHEgY3VyciB0YXJnZXQpKSkKKyAgICAgICAgKHNldHEgYXJnICgxKyBhcmcp KSkpCisgICAgKHdoZW4gdGFyZ2V0CisgICAgICAoZ290by1jaGFyICh0cmVlc2l0LW5vZGUtc3Rh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IHRh cmdldAorICAgICAgICAgICAgKHNldHEgdGFyZ2V0ICh0cmVlc2l0LXNlYXJjaC1mb3J3YXJkIGN1 cnIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmdW5j dGlvbikpCisgICAgICAgICAgICAod2hlbiAoYW5kIHRhcmdldAorICAgICAgICAgICAgICAgICAg ICAgICAoc2gtbW9kZS0tdHJlZXNpdC1wYXJlbnQtZGVmdW4gdGFyZ2V0KSkKKyAgICAgICAgICAg ICAgKHNldHEgdGFyZ2V0ICh0cmVlc2l0LW5vZGUtdG9wLWxldmVsIHRhcmdldCkpKSkKKyAgICAg ICAgICAod2hlbiB0YXJnZXQKKyAgICAgICAgICAgIChzZXRxIGN1cnIgdGFyZ2V0KSkKKyAgICAg ICAgICAoc2V0cSBhcmcgKDEtIGFyZykpKQorICAgICAgOzsgR28gYmFja3dhcmQuCisgICAgICAo d2hpbGUgKGFuZCAoPCBhcmcgMCkgY3VycikKKyAgICAgICAgKHNldHEgdGFyZ2V0IG5pbCkKKyAg ICAgICAgKGlmIChzaC1tb2RlLS10cmVlc2l0LXBhcmVudC1kZWZ1biBjdXJyKQorICAgICAgICAg ICAgKHNldHEgY3VycgorICAgICAgICAgICAgICAgICAgKG9yIChzaC1tb2RlLS10cmVlc2l0LW9s ZGVzdC1wYXJlbnQtaW4tZGVmdW4gY3VycikKKyAgICAgICAgICAgICAgICAgICAgICBjdXJyKSkp CisgICAgICAgIChsZXQqICgocHJldi1kZWZ1biAoc2gtbW9kZS0tdHJlZXNpdC1wcmV2LXNpYmxp bmctZGVmdW4gY3VycikpCisgICAgICAgICAgICAgICAocHJldi1kZWZ1bi1lbmQgKHRyZWVzaXQt bm9kZS1hdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodHJlZXNpdC1ub2RlLWVu ZCBwcmV2LWRlZnVuKSkpKQorICAgICAgICAgIChpZiAoYW5kIHByZXYtZGVmdW4gKHRyZWVzaXQt bm9kZS1lcSBjdXJyIHByZXYtZGVmdW4tZW5kKSkKKyAgICAgICAgICAgICAgKHNldHEgY3VyciBw cmV2LWRlZnVuKSkpCisgICAgICAgIChsZXQgKChwYXJlbnQtZGVmdW4gKHNoLW1vZGUtLXRyZWVz aXQtcGFyZW50LWRlZnVuIGN1cnIpKSkKKyAgICAgICAgICAod2hpbGUgKGFuZCAobm90IHRhcmdl dCkKKyAgICAgICAgICAgICAgICAgICAgICBwYXJlbnQtZGVmdW4pCisgICAgICAgICAgICAoc2V0 cSB0YXJnZXQgKHNoLW1vZGUtLXRyZWVzaXQtcHJldi1zaWJsaW5nLWRlZnVuIGN1cnIpKQorICAg ICAgICAgICAgKHVubGVzcyB0YXJnZXQKKyAgICAgICAgICAgICAgKHNldHEgY3VyciAodHJlZXNp dC1ub2RlLXByZXYtc2libGluZyBwYXJlbnQtZGVmdW4pKQorICAgICAgICAgICAgICAoc2V0cSBw YXJlbnQtZGVmdW4KKyAgICAgICAgICAgICAgICAgICAgKHNoLW1vZGUtLXRyZWVzaXQtcGFyZW50 LWRlZnVuIGN1cnIpKSkpCisgICAgICAgICAgKHVubGVzcyB0YXJnZXQKKyAgICAgICAgICAgIChs ZXQgKChtYXliZS10YXJnZXQgbmlsKSkKKyAgICAgICAgICAgICAgKHNldHEgbWF5YmUtdGFyZ2V0 ICh0cmVlc2l0LXNlYXJjaC1mb3J3YXJkIGN1cnIKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0KSkKKyAgICAgICAgICAg ICAgKHNldHEgdGFyZ2V0IChvciAodHJlZXNpdC1ub2RlLXRvcC1sZXZlbCBtYXliZS10YXJnZXQp CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWF5YmUtdGFyZ2V0KSkpKQorICAgICAg ICAgICh3aGVuIHRhcmdldAorICAgICAgICAgICAgKHNldHEgY3VyciB0YXJnZXQpKSkKKyAgICAg ICAgKHNldHEgYXJnICgxKyBhcmcpKSkpCisgICAgKHdoZW4gdGFyZ2V0CisgICAgICAoZ290by1j aGFyICh0cmVlc2l0LW5vZGUtZW5kIHRhcmdldCkpKSkpCisKIChwcm92aWRlICdzaC1zY3JpcHQp CiA7Ozsgc2gtc2NyaXB0LmVsIGVuZHMgaGVyZQotLSAKMi4zMS4xCgo= --000000000000f2bf4e05ef2fdef4--