From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Stylistic changes to tree-sitter code Date: Fri, 28 Oct 2022 21:19:19 -0700 Message-ID: <0E4C5439-B28D-420A-9E4A-BA059269AD57@gmail.com> References: <87h6zp75nt.fsf.ref@yahoo.com> <87h6zp75nt.fsf@yahoo.com> <87h6zptloj.fsf@gmail.com> <87y1t06apv.fsf@yahoo.com> <87k04ksa4f.fsf@gmail.com> <87k04k5stm.fsf@yahoo.com> <875yg34aas.fsf@yahoo.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17530"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Robert Pluim , emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 29 07:37:08 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 1ooeWq-0004RX-CY for ged-emacs-devel@m.gmane-mx.org; Sat, 29 Oct 2022 07:37:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooeUB-0002gF-CB; Sat, 29 Oct 2022 01:34:23 -0400 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 1oodJe-0008J9-Ss for emacs-devel@gnu.org; Sat, 29 Oct 2022 00:19:26 -0400 Original-Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oodJc-00071r-Ut for emacs-devel@gnu.org; Sat, 29 Oct 2022 00:19:26 -0400 Original-Received: by mail-pj1-x1033.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so11593886pji.1 for ; Fri, 28 Oct 2022 21:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fBJcpXRuXE6ey4Su680Cfo9sUMkZLRMKMc+QtG32/pU=; b=OaoUdDbHU2TXcOVbyhfyC5FK0v0Pfcdya2ldfsVhXCPkVEAgmh8vzc/gkvyUyXIN2B otntywKJEKmLT9i+jeyhz41fANZNPnRxLGrhERhewNguOC+8Y9c4zxqaXIiZPdr2O9SP h/JvrizRgE6gxo6B+q/AtlKbpEm9ZBNyQZ1K3hJWgvHsOUBkmo1rNRwsfgaZ2CRHfpJW Vbr0C7WZIx57jVr8Xsc4nPi0bX6gFJPM6h4Y/KJfM8QdNTdWCAbAW4WLmYqoe8481Kng f27K94Xx6JfAfNIwnwIsTUEhTd8giVXKD2Nltagd3FSbxSkp/JZdDaLzyBiVMEZ2toIW azeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fBJcpXRuXE6ey4Su680Cfo9sUMkZLRMKMc+QtG32/pU=; b=UHRMi0s9iuYiV/RBVvOuIL466uMqoalADlc4VvxSb6zRHcFkyccZAyNa3ptPYBznac ZghOR+3MQBuf/7lx2HLtEPQhRajNBKi+oKXPZxdNea0D2TWVjQsDSV8LGSXUnPi+jgbQ c1/7FXVZSPlxv+t3qdA8f1ZdFmSdKfZE8A7DFikAZDEbsQxkeM6rY9zDc1qvMEaqp8/8 XyYje60+vsEFqVN5mflP5OzeTa18Af9+MeTxRsBlhLPQLUkTfPNK60Rc0yJODbx6p2RU fZnMFHC3XkZXRiPlSo956b6NO8bxPWTqiMUhUdAqMRMs6RB1UYEBoWNe15tMwWGNTnm1 L1wQ== X-Gm-Message-State: ACrzQf0fnI5JjhkSvBiMsUEWgBlBmaJMWYpFLmW795BVA+KsbIUddXst rY9KpE4WIYzbm7tR0a/jaag= X-Google-Smtp-Source: AMsMyM4F002Csl+rlPYOvMswcxqsBX5PK9cJbbU7hkqvQuH72Mq1/mcUTC2bafM6ROHESEqK4gc3tg== X-Received: by 2002:a17:903:2452:b0:187:99b:c8fe with SMTP id l18-20020a170903245200b00187099bc8femr220260pls.113.1667017162284; Fri, 28 Oct 2022 21:19:22 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id z11-20020a1709027e8b00b00186f81a074fsm241305pla.290.2022.10.28.21.19.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2022 21:19:21 -0700 (PDT) In-Reply-To: <875yg34aas.fsf@yahoo.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=casouri@gmail.com; helo=mail-pj1-x1033.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, 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: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298714 Archived-At: Ah, yes, the patch compiles fine, though there is a segfault: I believe = you forgot to initialized the tem variable. @@ -449,21 +453,28 @@ treesit_symbol_to_c_name (char *symbol_name) treesit_find_override_name (Lisp_Object language_symbol, Lisp_Object = *name, Lisp_Object *c_symbol) { + Lisp_Object tem; + CHECK_LIST (Vtreesit_load_name_override_list); - for (Lisp_Object list =3D Vtreesit_load_name_override_list; - !NILP (list); list =3D XCDR (list)) + + FOR_EACH_TAIL (tem) { - Lisp_Object lang =3D XCAR (XCAR (list)); + Lisp_Object lang =3D XCAR (XCAR (tem)); CHECK_SYMBOL (lang); + if (EQ (lang, language_symbol)) { - *name =3D Fnth (make_fixnum (1), XCAR (list)); + *name =3D Fnth (make_fixnum (1), XCAR (tem)); CHECK_STRING (*name); - *c_symbol =3D Fnth (make_fixnum (2), XCAR (list)); + *c_symbol =3D Fnth (make_fixnum (2), XCAR (tem)); CHECK_STRING (*c_symbol); + return true; } } + + CHECK_LIST_END (tem, Vtreesit_load_name_override_list); + return false; } =20 Also, out of curiosity, I thought active voice is good and passive voice = is bad? Though the subject here doesn=E2=80=99t add any useful = information, I recon. - - It doesn't expose a syntax tree. We put the syntax tree in the - parser object, and updating the tree is handled on the C level. + - It doesn't expose a syntax tree. The syntax tree is placed in + the parser object, and updating the tree is handled at the C + level. =20 - - We don't expose tree cursor either. I think Lisp is slow enough - to nullify any performance advantage of using a cursor, though I - don't have evidence. Also I want to minimize the number of new - types we introduce. Currently we only add parser and node type. + - The tree cursor is not exposed either. I think Lisp is slow + enough to nullify any performance advantage of using a cursor, + though I don't have evidence. Also I want to minimize the number + of new types we introduce. Currently we only add parser and node + type. Yuan=