From: Chris West (Faux) Date: Wed, 5 Aug 2015 20:21:31 +0000 (+0100) Subject: generate parser enums stably: additionally sort on name X-Git-Tag: 4.11~54^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F1833%2Fhead;p=i3%2Fi3 generate parser enums stably: additionally sort on name --- diff --git a/generate-command-parser.pl b/generate-command-parser.pl index f40bb390..c0a9a4d4 100755 --- a/generate-command-parser.pl +++ b/generate-command-parser.pl @@ -112,7 +112,7 @@ for my $line (@lines) { # We sort descendingly by length to be able to replace occurences of the state # name even when one state’s name is included in another one’s (like FOR_WINDOW # is in FOR_WINDOW_COMMAND). -my @keys = sort { length($b) <=> length($a) } keys %states; +my @keys = sort { (length($b) <=> length($a)) or ($a cmp $b) } keys %states; open(my $enumfh, '>', "GENERATED_${prefix}_enums.h");