diff options
Diffstat (limited to '')
-rw-r--r-- | src/syntactic-sugar/refex-expr | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/syntactic-sugar/refex-expr b/src/syntactic-sugar/refex-expr new file mode 100644 index 0000000..f9e7706 --- /dev/null +++ b/src/syntactic-sugar/refex-expr @@ -0,0 +1,35 @@ +# vim: syn=perl: + +# "sugar script" (syntactic sugar helper) for gitolite3 +# ---------------------------------------------------------------------- +# see src/VREF/refex-expr for instructions and WARNINGS! + +my $perm = qr(-|R|RW\+?C?D?M?); + +my $seq = 1; + +sub sugar_script { + my $lines = shift; + + # my @out = (); + for my $l (@$lines) { + push @out, $l; + + # quick check + next unless $l =~ /^($perm) /; + # more detailed check + next unless $l =~ /^($perm) (\S.*) = (\S.*)$/; + my ( $perm, $refexes, $users ) = ( $1, $2, $3 ); + next unless $refexes =~ / (and|not|or|xor|\+|-|==|-lt|-gt|-eq|-le|-ge|-ne) /; + + print STDERR ">>>> $l\n"; + pop @out; # we need to replace that last line + + push @out, "option refex-expr.sugar$seq = $refexes"; + push @out, "$perm VREF/refex-expr/sugar$seq = $users"; + + $seq++; + } + + return \@out; +} |