Subject: Re: [PATCH 02/18] chainlint.pl: add POSIX shell lexical analyzer

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 01 Sep 2022 14:32:49 +0200

On Thu, Sep 01 2022, Eric Sunshine via GitGitGadget wrote:

> From: Eric Sunshine <[email-masked]>

Just generally on this series:

> +	$tag =~ s/['"\\]//g;

I think this would be a *lot* easier to read if all of these little
regex decls could be split out into some "grammar" class, or other
helper module/namespace. So e.g.:

	my $SCRIPT_QUOTE_RX = qr/['"\\]/;

Then:

> +	return $cc if $cc =~ /^(?:&&|\|\||>>|;;|<&|>&|<>|>\|)$/;

	my $SCRIPT_WHATEVER_RX = qr/
		^(?:
		&&
		|
		\|\|
		[...]
	/x;

etc., i.e. we could then make use of /x to add inline comments to these.