From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 20C603857C48 for ; Sun, 4 Jul 2021 22:10:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 20C603857C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x01.wildebeest.org [172.31.17.131]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 88235302FBA6 for ; Mon, 5 Jul 2021 00:10:09 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 1198E2E80FB4; Mon, 5 Jul 2021 00:10:09 +0200 (CEST) From: Mark Wielaard To: gcc-rust@gcc.gnu.org Subject: shebang handling Date: Mon, 5 Jul 2021 00:09:57 +0200 Message-Id: <20210704220959.85580-1-mark@klomp.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jul 2021 22:10:14 -0000 Hi, Shebang handling, the first line starting with #! was not done fully correct and it isn't necessary to keep track of the shebang line in the AST or HIR Crate classes. Because an inner attribute also starts with #! the first line isn't regarded as a shebang line if the #! is followed by (optional) whitespace and comments and a [. In that case the #! is seen as the start of an inner attribute. I added various testcases that hopefully show the funny things you can get when the first line starts with #!. [PATCH 1/2] Handle shebang line, plus any whitespace and comment [PATCH 2/2] Remove has_shebang flag from AST and HIR Crate classes Patches can also be found here: https://code.wildebeest.org/git/user/mjw/gccrs/log/?h=shebang Cheers, Mark