# Perl about each letter from 0-128 and write down
# its answer.
-@posixclasses = (
+use strict;
+use warnings;
+
+my @posixclasses = (
"[:alnum:]",
"[:alpha:]",
"[:ascii:]",
"[:xdigit:]",
);
-@perlclasses = (
+my @perlclasses = (
"\\d",
"\\s",
"\\w",
);
-%overrides = (
+my %overrides = (
# Prior to Perl 5.18, \s did not match vertical tab.
# RE2 preserves that original behaviour.
"\\s:11" => 0,
}
print "}\n\n";
my $n = @ranges;
- $negname = $name;
+ my $negname = $name;
if ($negname =~ /:/) {
$negname =~ s/:/:^/;
} else {
my $count = @entries;
}
+# Prepare gofmt command
+my $gofmt;
+
+if (@ARGV > 0 && $ARGV[0] =~ /\.go$/) {
+ # Send the output of gofmt to the given file
+ open($gofmt, '|-', 'gofmt >'.$ARGV[0]) or die;
+} else {
+ open($gofmt, '|-', 'gofmt') or die;
+}
+
+# Redirect STDOUT to gofmt input
+select $gofmt;
+
print <<EOF;
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// GENERATED BY make_perl_groups.pl; DO NOT EDIT.
-// make_perl_groups.pl >perl_groups.go
+// Code generated by make_perl_groups.pl; DO NOT EDIT.
package syntax
class []rune
}
+//go:generate perl make_perl_groups.pl perl_groups.go
+
// parsePerlClassEscape parses a leading Perl character class escape like \d
// from the beginning of s. If one is present, it appends the characters to r
// and returns the new slice r and the remainder of the string.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// GENERATED BY make_perl_groups.pl; DO NOT EDIT.
-// make_perl_groups.pl >perl_groups.go
+// Code generated by make_perl_groups.pl; DO NOT EDIT.
package syntax