From patchwork Thu Aug 1 14:56:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 1967744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=a2kQftG+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZXVY3KS3z1ybV for ; Fri, 2 Aug 2024 01:11:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A58D83861035 for ; Thu, 1 Aug 2024 15:11:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id C1819385DDD1 for ; Thu, 1 Aug 2024 14:58:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1819385DDD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C1819385DDD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524353; cv=none; b=h1LInE+mRAZnzFCUCEP54BnEaAS/NwB4W8Nyk7DK7kIYHFLjwFoBu9R1YQvAkXfaEYoPLKCOr/Wwf4I+ytYCtJVI+FN58MMIF+KThd8zRck0F/R6LRPK7XCjPJz7RjQVnITb5HEZA6zCYC1NgK3c5Lok+cZfeSyGzzggnQ9jm9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524353; c=relaxed/simple; bh=QDX1mj5vNtLnEflCXF7RkzxG8T9b09GorbhZfQpvsyk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=p4QhRW0qu9Utm1N+jFvmKWkiY2vtmtCUYNs52MZ++B00wT3dEDQKlgcQVmVoFZb/LJhAJj0xX+0vSTftuTFmFdN5n/2ADesioOk9iwSsJTLeSQ9ZwH3Qv8qyA6yYLiXGTv//Bz/bJqZ8XfefzHSqTBnuEqu1nrJsupr8jxYDeJM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-530ad969360so3385221e87.0 for ; Thu, 01 Aug 2024 07:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1722524334; x=1723129134; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DkaJg3Q1LxsXMGs9pP3CKlQ2XiQGD6RLwCnAkinBqSQ=; b=a2kQftG+Ie8zDkX0l5GAh4dp6vW0ZilTB06jtF9GLgwrJAnbchVkEGnT0ReWzhxoby VDBxJ8i/fnhuo+eT1TRijtiiPhFTMq7j5b0ClnfHAx9zA2rWbQSQ8XGwnS6x6UUWQcHX 2ar8j2KFx2bwVF58ISK4H6zVlZedCcq/Sk3+6v4xN8Vh7oKrHw6FTEm+mR7J29RW18Mn /GA8CRZCVv5I2f8uiHqSCLFXOXO7lnobzIqySrBvmGSiKoteG2y66rQjr2twT9NqkTD0 DiCOTM1/3pQFn8VgST4YL13Q1kkiQPsazns3HdDyOc+kpvm9oZOVYRwMXP6HgyO/xm7E ChSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722524334; x=1723129134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DkaJg3Q1LxsXMGs9pP3CKlQ2XiQGD6RLwCnAkinBqSQ=; b=XjQalYcSXfFJO6l3cTI6HWTL4yobBFLz7PgsAhbBzAkGNU5HLc29kcBzMyPsZOXd3b s6/7clynCgyVaoD7DZ5FqWBMDUWzsmxSg2OwkOZuFka8DbCtUVVoLhHXxp4FPHt+VYoi +hq1BCly41C8PM97pT7B4QkGfWAfQqVFUTDPUg3BCDb/XpZXzfbYEu+o/EoBQHJa4VWS DmPtLmDJXkyy8Gf5qWwO84YWQGdcp/0GXZDvQM2ksb8badvhgjsucx73u6X6gXSojCyP bJFKxGjdgYwKCVEOOrYv4lVV+0+anT/qzPfbmmBlSCGabABj28oht7Vq4Qbzl3FNpcnM GnVg== X-Gm-Message-State: AOJu0YzWhnvdt/f/1hKJP1Vu5xdWB94QdthMwLJbBlX5cYQQgoSueXtI KiczcOu77dPuV+0OjLMBjcHZ5pw5V1TBc7MokcGx1oiMYbaEkxe7WVeS/vcjy0lWqkDaYk+o7or FALvc X-Google-Smtp-Source: AGHT+IGWeNl0NRUd6wHCvpM7lqsHQ5AFArUhsxz+Ang4PgRZjBWlDHM5Qj9x3l64TMuqai86Yh5FPg== X-Received: by 2002:a05:6512:b92:b0:52e:9b68:d2da with SMTP id 2adb3069b0e04-530bb3928e5mr89798e87.9.1722524334005; Thu, 01 Aug 2024 07:58:54 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:9:dc84:3622:6733:ff49:ee91]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590592sm10252456a12.25.2024.08.01.07.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 07:58:53 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [PATCH 030/125] gccrs: parser: Add peek(n) method to parser Date: Thu, 1 Aug 2024 16:56:26 +0200 Message-ID: <20240801145809.366388-32-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com> References: <20240801145809.366388-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org gcc/rust/ChangeLog: * parse/rust-parse.h: New method. --- gcc/rust/parse/rust-parse.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 1614d19e4a5..8c8bf96eb8d 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -725,6 +725,7 @@ public: const ManagedTokenSource &get_token_source () const { return lexer; } const_TokenPtr peek_current_token () { return lexer.peek_token (0); } + const_TokenPtr peek (int n) { return lexer.peek_token (n); } private: // The token source (usually lexer) associated with the parser.