3 # Extract permission names from the output of the dump_idl utility.
5 # The logic necessarily makes assumptions about the format of
6 # dump_idl's output. If that format changes, the logic may no longer work.
8 # In the output: each permission name appears on a separate line,
9 # flush left. Normally the output should be piped into sort -u in
10 # order to eliminate duplicates.
17 # Return the number of leading white space characters.
18 # We do not distinguish between tabs and spaces.
21 return 0 unless (defined( $str ));
22 $str =~ s/\S.*//; # Remove everything after the leading white space
23 return length $str; # Take the length of what's left
29 # Check the indentation to see if we're still
30 # inside the list of permissions.
32 if ( indent_level( $_ ) > $perm_indent ) {
34 # This line contains a permission name.
35 # Strip off the leading white space and write it.
41 # We're no longer inside the list of permissions.
45 } elsif (/\s+permission [(]string array[)]$/) {
47 # We are entering a list of permissions, each of which is
48 # indented further than this line. When we see a line that
49 # is *not* further indented, that will end the list.
51 # The indentation is defined as the number of leading white
52 # space characters, be they tabs or spaces. If the format of
53 # the dump_idl output is changed to involve some bizarre and
54 # perverse mixture of tabs and spaces, this logic may not work.
57 $perm_indent = indent_level( $_ );