Re: [PATCH 02/18] chainlint.pl: add POSIX shell lexical analyzer
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-09-01 12:35:55
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2022-09-01 12:35:55
On Thu, Sep 01 2022, Eric Sunshine via GitGitGadget wrote:
From: Eric Sunshine <redacted>
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.