From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fu Yuan Newsgroups: gmane.emacs.devel Subject: Re: feature/tree-sitter ac4cafd66e 1/5: * src/treesit.c (make_ts_parser): Initialize timestamp field. Date: Tue, 30 Aug 2022 11:14:51 -0700 Message-ID: <8BA1A04C-C991-4A8A-BA0B-2F2541D6D7C0@gmail.com> References: <87y1v6plqc.fsf@yahoo.com> Mime-Version: 1.0 (1.0) 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="32746"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 30 20:17:07 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 1oT5nO-0008Ig-8o for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Aug 2022 20:17:06 +0200 Original-Received: from localhost ([::1]:43178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oT5nN-0004ea-8B for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Aug 2022 14:17:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oT5lJ-0003li-Qt for emacs-devel@gnu.org; Tue, 30 Aug 2022 14:14:57 -0400 Original-Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:43778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oT5lI-0000DQ-CF for emacs-devel@gnu.org; Tue, 30 Aug 2022 14:14:57 -0400 Original-Received: by mail-qk1-x72e.google.com with SMTP id j6so9060915qkl.10 for ; Tue, 30 Aug 2022 11:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc; bh=Iu/lsJv5eIFb90f03UtlJgLWo6RSo7VGShTVDSdThpI=; b=YloVwMPFN/CTb0NKEjI5w621GsKlAs/Z+VleZW5guMPvn+xYTb/vsDO1ASPXmJ4ZNK x5UiyWvYNB7+ULw97MTB/2tnNGowT25vj3pNVwdK9bHnsiifG1miDRjg00lf20p3XRBG lZyhGQNzcdpbMEqubW5yA3pRkyfw1ZR39/VxN1N6uvBHfomj4WGS18LaiBa8czo3FwDo SwSXeXDYd9D9Hu4USvETFiBQXVt/a69/D8ofyI7Zo18EwqERRKrVSzDEjExPlBfu+0jk H774MuVAhh1OhiPMgoEgbWOxf9Xx/lj40vFsfYDRRdsw23eECVDamo8ahgz0F838hMb/ FN1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc; bh=Iu/lsJv5eIFb90f03UtlJgLWo6RSo7VGShTVDSdThpI=; b=oGvB5AO50X0Nahd669pkqhuFfPg+S727BBpJeXEqoZ5OgTmmxaSVOO9ZPF2Xfoec03 n92iVAgc7rVhf1PvojT600T9TDvnYUBmiaVyvhsPcxiC/2tjGxE0UDnZEgOsAFr5WSK1 Me3O+8i9iiFRTOxmA++Fs9P0lAnkOArmRBs9tQF+YRa+djMRMlqCPB+Zpk7mL5rFWP0F qtb4HOOKs8OoL9rY+x+SChqNQ8oJoGrcjWc/69R8FzWAH8obRVbJjdp9cgeNxMulop/B Yc2qiM261DocWMThInLzmTeJI+aJN11VRsmZEUyRBUIb9Ns/dpQ9YQ6omILy9dfVSmVW g8lA== X-Gm-Message-State: ACgBeo1YP7VC0LB9NjZqrp3gBTYtEYOHi+xClL6qE/ZBBnnOZ3eOBAUd rPCV0b+pGO5/WaJJbFuXqtU= X-Google-Smtp-Source: AA6agR7IAotQnI0OlSlsjbtjhzTJaLHNBwzTq5fJ2lhg8olmo2l2caJPVl5BcDveHIw1tRF1/TX8Ow== X-Received: by 2002:a05:620a:170d:b0:6bb:3f82:6a7d with SMTP id az13-20020a05620a170d00b006bb3f826a7dmr12669071qkb.166.1661883293710; Tue, 30 Aug 2022 11:14:53 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:7d5b:8e5e:e37f:4906]) by smtp.gmail.com with ESMTPSA id bl8-20020a05620a1a8800b006bbdcb3fff7sm7906305qkb.69.2022.08.30.11.14.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Aug 2022 11:14:53 -0700 (PDT) In-Reply-To: <87y1v6plqc.fsf@yahoo.com> X-Mailer: iPhone Mail (19G71) Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=casouri@gmail.com; helo=mail-qk1-x72e.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.devel:294377 Archived-At: > =EF=BB=BFYuan Fu writes: >=20 >> * src/treesit.c (make_ts_parser): Initialize timestamp field. >=20 > Hmm... Out of curiosity, what is this timestamp field used for? If you retrieve an ast node from the parsed ast tree, then make some edit to= the buffer and thus change the ast tree, the node you retrieved will be out= dated. Each parser and node has a timestamp, parser=E2=80=99s timestamp incr= ements when an edit is made. Treesit checks if the node=E2=80=99s timestamp e= quals to that of its associated parser whenever we use a node. Though because parsers are lazy, even if the buffer content has changed, a n= ode won=E2=80=99t be marked outdated until the parser parses the change. Yuan=