From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: arthur miller Newsgroups: gmane.emacs.devel Subject: Re: Using incremental parsing in Emacs Date: Mon, 6 Jan 2020 16:48:32 +0000 Message-ID: References: <83blrkj1o1.fsf@gnu.org> <20200105141900.GA71296@breton.holly.idiocy.org> <83eewdg3vy.fsf@gnu.org> <834kx9g08y.fsf@gnu.org> <83v9ppdzed.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="37640"; mail-complaints-to="usenet@blaine.gmane.org" Cc: HaiJun Zhang , "emacs-devel@gnu.org" , Eli Zaretskii , "alan@idiocy.org" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 06 17:49:40 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ioVZU-0009gS-Bf for ged-emacs-devel@m.gmane.org; Mon, 06 Jan 2020 17:49:40 +0100 Original-Received: from localhost ([::1]:54872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioVZT-0005RX-3l for ged-emacs-devel@m.gmane.org; Mon, 06 Jan 2020 11:49:39 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55725) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioVYS-0004ZZ-08 for emacs-devel@gnu.org; Mon, 06 Jan 2020 11:48:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioVYQ-00073N-Ov for emacs-devel@gnu.org; Mon, 06 Jan 2020 11:48:35 -0500 Original-Received: from mail-oln040092075089.outbound.protection.outlook.com ([40.92.75.89]:48195 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ioVYQ-00070M-HU; Mon, 06 Jan 2020 11:48:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhkaxv5pl2svi2c26095kps+1BiAGOChlDRRPnCcwPqbg1CQL8KElSsxj4zcvWUNus0lRuDEzUK77D8ssliB7a2DCTsXwWx7TqVA9EkNt3YbzTyJ49hNKVvK41cIBCUe1DePjhdlZbo9aBoq4JG4QQwWnBeoS18SA8ZR5dGsUX5+OOXyDIyVIKcNq/MnkRK49svvtshKAKfqUxUgnoawBT9J8Th63hwgcEf0nT7SXZ2BwFcoFoHB7ohP1EnIcaLf4CCf7giz8A12V/XXzAnR7xZXQW3NrWPCOmVUvzm9Pw8VkWNLghSp9tn/7Uk9+6Ke4Z2uZywz5vCAX2pKBvO+oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p60QJJ2xhv8ZH4TIKB/66aOdyiFQPqAmYVO5JwopmRc=; b=ZW6EC/NxMmGDIdFeczZi5aMDqnDgPCozCocSxlfBzdw9R0LAm2b6tbHDSuCnAP8NT8DXI3g5+xMEsvoMoS2nonpBME96P05GzRsmzqAkI1EOaeVc69w3K+8Ds1LgTKubAg1GdbMSA6gokFitHjFMl+6HeiGvmsWVL1yqEKp0bFre1WJubgEvZd8gmZVsO5XukUX/w/PmzG+nYRnTp9L9fH3Oed6isXTqrG16mWB45qFMbXMLMWbNk6sqwPVkeXcjvmlvWu1ZMUstExnKskHDDOztjEBf2Nx0uWzKyPP72LVwZwIbSK8tLy7TYVyRxRs85sTqgZhLTNHw05nfZ8SDBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p60QJJ2xhv8ZH4TIKB/66aOdyiFQPqAmYVO5JwopmRc=; b=a8/oAR3HpvmLN9wbCvObyGgQ143pVox3/9VE+0jqVlKqX2ZlcxZq5zMP/OIfymsqE/G/yQcog2b50AWxJcJehAlbaUlT4DuJWPdXK/kJdk9+wYuzWU31gU0fFEH+yTwY/qsqjch8fXlMZ/hblZN1zmWkMpt9ZlL+jCRpL0sewTnHdcAWUGJN+H0ybPOOTDqMxq7+vVEUvr+JuN//PUaHjnZpZsvq1aswEjuTjFLUEkx1pkhGtA2l0wGCfy6RouhMnRTwghfCE+7gGhm1V8PrW/okoR3UCqfC3zrFzy7VtxR+sIFugEFtlSgGoxmr68BJ58t2GYKx+tXC8PWepsCHyg== Original-Received: from DB3EUR04FT022.eop-eur04.prod.protection.outlook.com (10.152.24.58) by DB3EUR04HT190.eop-eur04.prod.protection.outlook.com (10.152.25.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Mon, 6 Jan 2020 16:48:32 +0000 Original-Received: from VI1P194MB0429.EURP194.PROD.OUTLOOK.COM (10.152.24.52) by DB3EUR04FT022.mail.protection.outlook.com (10.152.25.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Mon, 6 Jan 2020 16:48:32 +0000 Original-Received: from VI1P194MB0429.EURP194.PROD.OUTLOOK.COM ([fe80::35f2:9ea2:efd6:1d46]) by VI1P194MB0429.EURP194.PROD.OUTLOOK.COM ([fe80::35f2:9ea2:efd6:1d46%5]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020 16:48:32 +0000 Original-Received: from pascal.homepc (90.230.29.56) by AM7PR04CA0030.eurprd04.prod.outlook.com (2603:10a6:20b:110::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10 via Frontend Transport; Mon, 6 Jan 2020 16:48:31 +0000 Thread-Topic: Using incremental parsing in Emacs Thread-Index: AQHVwh1Uy8tVxqoXLEaWXDDoUSKGMA== In-Reply-To: (Stefan Monnier's message of "Mon, 06 Jan 2020 08:47:31 -0500") Accept-Language: sv-SE, en-US Content-Language: en-US x-clientproxiedby: AM7PR04CA0030.eurprd04.prod.outlook.com (2603:10a6:20b:110::40) To VI1P194MB0429.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:41::33) x-incomingtopheadermarker: OriginalChecksum:7797DBDC5CDE81C1F9EC27BB3799F4CFF438AAB15A7F1560DABE986CFBBC4B67; UpperCasedChecksum:E4E6D9F9C6ABF7792F3F6D1922CC179C1ADFF5423B3432D9FCBDC733F0E276AB; SizeAsReceived:8104; Count:50 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [JdUlBMT8jFv2m24/VPsgU6TEsUxuGf4V] x-microsoft-original-message-id: <875zhoil9d.fsf@live.com> x-ms-publictraffictype: Email x-incomingheadercount: 50 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: ca71a4e2-153d-4ef8-ad27-08d792c8434c x-ms-exchange-slblob-mailprops: q+fD6XS3/ULD3VaDn2jKBsRcNW91Dr7pDsGQHLh50aWISse05XLrZAtSCJbK2z+k7VpHxOUHUSURkWuLVpkn3EKkiYyq3wvRtqkPANyn6FlcDC8xFDt0RYocC3XQPUalMKAK7Uav8HOZrEtQ2J9KK+4wVIloG/AxFJpi7wpd8ZR628MbdFguh/HjiBFWPWkAx2o0zEC3Ad+oZcWEHM4idzn6ASchJoFRfYHycTVMSP9V4zm7y777JbBZxmRNyrItD1/u9/JGk08+jDBUtFNt3c8UPYGXi40jlZzvTe1KFZlGila8nRRNDtx8B2nR2ds3kl7Pv0Pmj5+z2lvs34eVYWdJRhazhDAqBumAQ5dQICOeiRkEDnaH/vaaG+uJBLfWnJpEYYPmh2WLV/nNFspcgtGb+0J4kq/ksnRA7VaxLkklXee7zO/IPMWnjSSjSMv9ZK7Iy/yxevA4uei3nESz7YP1vtTORq6qPgKRC46tOdh7j/WnvapLlZT6yCX1FL4YlkK68HnWgDlxDMF4W3fw3vR218q4bximKrsMu8DnGjyoXhZLiChf4OzBGZOU4XZuVC9C+/qyEpjLat7hpFnPaBvP4Z0biedlSRMhArPiidrScflzhHy3IxrL6QF8ffaRA/oftb67HSD99qB1u1s0opdHxvDRJf1uy/AuekVvskuJK/eHHOd3Yg8DtJn8N3rJDBBc51jdUV34A3oMGuA3uw== x-ms-traffictypediagnostic: DB3EUR04HT190: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h3WBlnu+Y5SUhNb6PsPS8Y10zzZBrO01Yq6gYpyGI6/KoWTc4xqeoQ5qmAGZuBACepi8XvUE/5bOa0N8G8o9t4+N0Vd+LUyB5detlrVofvsLtBsCSCCPAPQbreFBdwlzKkprphjT+RjHg+5UW/ZAu4Qux5xov7cCydn31iEZvO0i9Jv7tPlYkzUOMAsxqvbN x-ms-exchange-transport-forked: True X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ca71a4e2-153d-4ef8-ad27-08d792c8434c X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 16:48:32.0265 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3EUR04HT190 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.92.75.89 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:244035 Archived-At: Stefan Monnier writes: >> I see the buffer is fontified correctly. Does it parse the whole buffer? > > We have different levels of parsing. At the bottom we have > `syntax-ppss` (whose workhorse, implemented in C, is > `parse-partial-sexp`) which only counts parentheses and looks for > comment and string markers. In the above case, `syntax-ppss` indeed > parses the whole buffer, but given its limited scope this parsing is > usually fast (it can be slow in some cases, because `parse-partial-sexp` > is supplemented by `syntax-propertize-function` to handle the "unusual" > cases of "strings/comments" (a typical example would be here-documents > in shell scripts) and this is all implemented in Elisp using regexp > searches). > > After this parsing is done, font-lock looks at the few lines actually > displayed using its Elisp/regexps rules to apply the actual highlighting. > This may look at more parts of the buffer, tho, depending on the actual > font-lock rules. > > > Stefan Thanks for the overview. /a