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.bugs Subject: bug#60484: 29.0.60; c-ts-mode: short tokens are not identified as type_identifier Date: Sat, 7 Jan 2023 16:57:50 -0800 Message-ID: References: <677a429cb107ff200396e0c59eefecda@sadiqpk.org> 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="30491"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sadiq@sadiqpk.org To: 60484-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 08 01:58:09 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pEK0n-0007f7-JH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Jan 2023 01:58:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEK0k-0006yc-8F; Sat, 07 Jan 2023 19:58:06 -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 1pEK0g-0006yJ-H6 for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 19:58:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEK0g-0005m1-9C for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 19:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pEK0g-0002mi-5M for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 19:58:02 -0500 In-Reply-To: <677a429cb107ff200396e0c59eefecda@sadiqpk.org> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jan 2023 00:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 60484 X-GNU-PR-Package: emacs Mail-Followup-To: 60484@debbugs.gnu.org, casouri@gmail.com, sadiq@sadiqpk.org Original-Received: via spool by 60484-done@debbugs.gnu.org id=D60484.167313948010689 (code D ref 60484); Sun, 08 Jan 2023 00:58:01 +0000 Original-Received: (at 60484-done) by debbugs.gnu.org; 8 Jan 2023 00:58:00 +0000 Original-Received: from localhost ([127.0.0.1]:59381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEK0d-0002mL-QX for submit@debbugs.gnu.org; Sat, 07 Jan 2023 19:58:00 -0500 Original-Received: from mail-pl1-f171.google.com ([209.85.214.171]:35347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pEK0c-0002m7-1h for 60484-done@debbugs.gnu.org; Sat, 07 Jan 2023 19:57:58 -0500 Original-Received: by mail-pl1-f171.google.com with SMTP id y1so5757000plb.2 for <60484-done@debbugs.gnu.org>; Sat, 07 Jan 2023 16:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=gDdHF6i0iesuov8JfG/dJ4ri58hb0q9ebYh9tCKe3AI=; b=gg0cks6nLGJsBihKWx3rcyjzHDPXax+OjD2QN8isP7sPdt8kjyBlg0DQ5hnvNkxewW 5LzNVdmXADfRFTTzxRdTgzufaNr/r+bephuZzwizZJKrnn6RwJCjcd8e+Tuu5QTzW0h5 EOynKldGE9L5r4Qv3RrxL2MdFfjAFN1QTbPbwHzrqYaJ8HYCfoumSt5yDvupzK+ziRe2 E1utb9p237uh2yC3/EaWu09ZGtTF2n6G3gAL5SA3a3pcmZgMLr2GywH0O+PH044WRQM3 cnBfh4lBgLAYfUBC2EWoikZuXU7xcq8+o6CPFs/pmGvmGzVdH/4HEDDR1XXSUSpncNiK 4VUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gDdHF6i0iesuov8JfG/dJ4ri58hb0q9ebYh9tCKe3AI=; b=F9P9/j12LxIdWVwxokL1XtvysEObJdlYtxkhaJaApbjuHjLwds0T7CXT/I+Xxrp9pe G/v0rtLR7lUOftqYxPc/olO5p2HMStTJZ8h7Y5dL+Cy29EiUCls0cYiBssPhkv/HnOCC Z6AG0Ub9uDryiadq5GmIjMStjQzkoBUBVl/dVRO7LA2kJ8HxiLpMNa+uMpCEWOaBwxxa RtGMG/Xxb/Sf8MNryh0vWaHKSJUzQtJhvn0FiF0zO+xGmbrx7pGIW4K5eMi/bWJq9cBg WMaMZsJug5TEY5IqkBIkQV/YKxpsXQpxBLBKuiojn1AQC4JzQpdzXFX/Ub3lySZwCw5P 0G0A== X-Gm-Message-State: AFqh2kqXQ3amWwzUfr2F2QrTBm9jf9zTb5g/m1imFgLR0ATppq4uZAXj FzVRGPRKvfQXdV8+29gjwUlnGUUDZ1U6fg== X-Google-Smtp-Source: AMrXdXsjCjgM5gy7MG04UN3FROU5ULsvwXejuSywJ+34S0tVA+C78uZFEs5l9yEJJBtLvFp/dv/fLw== X-Received: by 2002:a17:90a:e656:b0:226:b783:674 with SMTP id ep22-20020a17090ae65600b00226b7830674mr13486753pjb.37.1673139472078; Sat, 07 Jan 2023 16:57:52 -0800 (PST) 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 a7-20020a17090abe0700b002268905b280sm2954172pjs.9.2023.01.07.16.57.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jan 2023 16:57:51 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252853 Archived-At: Yuan Fu writes: > Eli Zaretskii writes: > >>> Date: Mon, 02 Jan 2023 18:13:34 +0530 >>> From: Mohammed Sadiq >>> Cc: 60484@debbugs.gnu.org >>>=20 >>> On 2023-01-02 17:45, Eli Zaretskii wrote: >>> >> Date: Mon, 02 Jan 2023 10:22:09 +0530 >>> >> From: Mohammed Sadiq >>> >>=20 >>> >> Short tokens are not identified as type_identifier in GNU Emacs >>> >> c-ts-mode, but does work fine with tree-sitter playground[0]. >>> >>=20 >>> >> Say for example, 'a_type' in an empty buffer is identified as a >>> >> type_identifier in tree-sitter playground, but not in c-ts-mode, >>> >> while say, some longer tokens like 'window_type' is identified as >>> >> type_identifier. >>> >=20 >>> > Where is it written that FOO_type is a type identifier? is this >>> > something new in some recent C Standard? Or is it just a popular >>> > convention? >>>=20 >>> 'a_type' was just a made up example, it can be any valid token, say >>> 'g_file', or whatever. I was pointing out a disparity in handling = of >>> some token in c-ts-mode and tree-sitter: tree-sitter identifiers a 6 >>> byte length token as an identifier, but c-ts-mode requires it to be >>> at least 11 byte sized for custom types. >> >> I'm not sure I see a problem here. It sounds like different >> heuristics to me. Nothing says that g_file is a type, only its >> parsing can tell. > > The parse tree of a buffer with only a_type in it is this: > > (translation_unit (ERROR (identifier))) > > So tree-sitter-c parses it as a parse error instead of a type. I = suppose > the difference is due to different version of tree-sitter-c used by > Emacs (the latest) and the tree-sitter playground website? Maybe the > playground is using an older version. The "cutoff" point for the > playground version seems to be 5 bytes: a_typ is considered an error = but > a_type a type. > > Yuan Since it=E2=80=99s a parser problem, I=E2=80=99m closing this. Yuan