From patchwork Fri Oct 8 19:09:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Sixt X-Patchwork-Id: 12546231 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5E88C433EF for ; Fri, 8 Oct 2021 19:10:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C79A260F6E for ; Fri, 8 Oct 2021 19:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240937AbhJHTMG (ORCPT ); Fri, 8 Oct 2021 15:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240771AbhJHTL5 (ORCPT ); Fri, 8 Oct 2021 15:11:57 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F9B9C061755 for ; Fri, 8 Oct 2021 12:10:01 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id m22so32784633wrb.0 for ; Fri, 08 Oct 2021 12:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=TprPzN7R7X3HwMszuUqbxuwew16H0gOGT7C4dUNg7yI=; b=VUx4/bKOeCbslG8Yl5evi95/V6lV9BSmGOByTT4OdzuRAadKBoKDs+dR22d486WAma bZSF4suvcaeZ5RsQ2FFd1FKr7lR6hOmBRG8T6UW0DuOsVC7Ew0n16f49RHuh9ghCtirq tYkKiHPiOk8Xs6hos1rsEH1wsEiiRcirtWRMPmM85jzMKCGcaTy0QcnaBSGHibVK5uZO nSLWVIacRALZuxV3LVpII6qfSODFHQ+kbk8rDPW2TKX3qLdXiAp/VUAvtLzigHQpV9UU 8ttBzDr2IHqjZ/nVjjkmD/IDa1WyLqfGqp3CpRFQGOknKLw80VCBMuSMODbAweJh96HI Lrqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=TprPzN7R7X3HwMszuUqbxuwew16H0gOGT7C4dUNg7yI=; b=Pk3gD6/jyd3+Q6zuinWEiLvUPBnkKwBtj5WjDZtCRPOAMMvnEkIdtRt9nNtGdJ5esE zQnNy7vYpJWJ4ST4+mJhXJ86+H3nmmeuQEG0l382bNDLCQQDleJakA+J/phUEviBitb0 1AMtpFNSvv/NIhTKIB7j091IN6k3RFjNeNqmeDIA5jcwyuhgKc2UT6KsxXwx3BfXvx8M oUgFA7lvGaim4pWLRKkv9wQa1Gq2GpWUFqKmfaYPzSM2eafcHm+6opyvtEkr8MZK04ot ZE5m3q/+oOqvf1dXwc1wkS80Wsk5BhwqBTAQDKUJ1d39amK0/49h3X6MhQ7aunro3ck7 Ht3g== X-Gm-Message-State: AOAM532YBSqTZ/TSUsw3EfLefe+Xq3m1FMIZBHwzML/ueq6ORhuSTLwz XpFujIy7us9fUTwWKuqIOoqalrkHrEQ= X-Google-Smtp-Source: ABdhPJz2spvCIU+0ggddfza6NXeaaMMyuLNHW+SIlk8EWtZyFzIBHCCdPzUgkhVmC+oLQMB0CfQaxw== X-Received: by 2002:a1c:2c2:: with SMTP id 185mr5406683wmc.85.1633720199985; Fri, 08 Oct 2021 12:09:59 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r27sm163550wrr.70.2021.10.08.12.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 12:09:59 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Fri, 08 Oct 2021 19:09:56 +0000 Subject: [PATCH v2 4/5] userdiff-cpp: permit the digit-separating single-quote in numbers Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Johannes Sixt , Johannes Sixt Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Sixt From: Johannes Sixt Since C++17, the single-quote can be used as digit separator: 3.141'592'654 1'000'000 0xdead'beaf Make it known to the word regex of the cpp driver, so that numbers are not split into separate tokens at the single-quotes. Signed-off-by: Johannes Sixt --- t/t4034/cpp/expect | 10 +++++----- t/t4034/cpp/post | 8 ++++---- t/t4034/cpp/pre | 8 ++++---- userdiff.c | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/t/t4034/cpp/expect b/t/t4034/cpp/expect index 46c9460a968..a3a234f5461 100644 --- a/t/t4034/cpp/expect +++ b/t/t4034/cpp/expect @@ -1,5 +1,5 @@ diff --git a/pre b/post -index 1229cdb..3feae6f 100644 +index 60f3640..f6fbf7b 100644 --- a/pre +++ b/post @@ -1,30 +1,30 @@ @@ -7,15 +7,15 @@ Foo() : x(0&&1&42) { foo0bar cout<<"Hello World!?\n"<(1 -+1e10 0xabcdef) 'xy' // long double -3.141592653e-10l3.141592654e+10l +3.141'592'653e-10l3.141'592'654e+10l // float 120E5f120E6f // hex -0xdeadbeaf0xdeadBeaf+8ULL7ULL +0xdead'beaf0xdead'Beaf+8ULL7ULL // octal -0123456701234560 +0123'45670123'4560 // binary -0b10000b1100+e1 +0b10'000b11'00+e1 // expression 1.5-e+23+f // another one diff --git a/t/t4034/cpp/post b/t/t4034/cpp/post index 3feae6f430f..f6fbf7bc04c 100644 --- a/t/t4034/cpp/post +++ b/t/t4034/cpp/post @@ -2,15 +2,15 @@ Foo() : x(0&42) { bar(x.Find); } cout<<"Hello World?\n"<%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"), PATTERNS("csharp", /* Keywords */