]> git.sur5r.net Git - i3/i3/blobdiff - generate-command-parser.pl
Merge branch 'next' into master
[i3/i3] / generate-command-parser.pl
index 9b5ef562941779da30ff5e6386f178bd36c9650d..6208945dc87558f0ee88cd5cfdbfcd9a9bd68e69 100755 (executable)
@@ -2,7 +2,7 @@
 # vim:ts=4:sw=4:expandtab
 #
 # i3 - an improved dynamic tiling window manager
-# © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
+# © 2009 Michael Stapelberg and contributors (see also: LICENSE)
 #
 # generate-command-parser.pl: script to generate parts of the command parser
 # from its specification file parser-specs/commands.spec.
@@ -109,10 +109,10 @@ for my $line (@lines) {
 # Second step: Generate the enum values for all states.
 
 # It is important to keep the order the same, so we store the keys once.
-# We sort descendingly by length to be able to replace occurences of the state
+# We sort descendingly by length to be able to replace occurrences 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");