# If formula '[1]' is true, it executes the next commands if\((.*)\)\ *\{ #\!\/usr\/bin\/perl ####################################################### #\!\/usr\/bin\/perl # Code commented by the script 'comenta' # #!/usr/bin/perl # by Fernando Correa de Oliveira # #!/usr/bin/perl ####################################################### #!/usr/bin/perl #!/usr/bin/perl # If formula '[1]' is true, it executes the next commands ^\s*if\s?\((.*)\)\s*\{? # If formula '[2]' is true, it executes command '[1]' ^\s*(.*)\ if\ ?\(?(.*)\)?\s?; # Unless formula '[1]' is true, it executes the next commands ^\s*unless\ ?\(?(.*)\)?\ *\{ # Unless formula '[2]' is true, it executes command '[1]' ^\s*(.*)\ unless\ ?\(?(.*)\)?\ *; # While expression '[1]' is true... while\s?\((.*)\)\s?\{? # For expression '[1]' for\s?\((.*)\)\s?\{ # '[1]' => the same as: '[2] = [2] + [3]' ((\$\w)+\+=(\d+)) # Opens file '[2]' with the handle '[1]' open\((.*)\ ?\,\ ?(.*)\) # Removes '\n' from the end of variable [1] chomp\((\$.*)\) # Closes file with the handle '[1]' close\(?\ ?(.*)\)?\ ?; # User [1] with UID [3] and home [6] (.*):(x?):(.*):(.*):(.*):(.*):(.*) # For each of the arguments of '[1]' do foreach\ *\((.*)\)\ *{ # For [1] being the same as each one of the arguments in '[2]' do foreach\ *($.*)\ \((.*)\)\ ?{ # '[1]' => from [2] to [3] (([0-9]+)\ ?\.\.\ ?([0-9]+)) # '[1]' receives parameter passed on function call \((\$.*)\)=\@_ # [1] => '[2]' receives the first parameter passed on program call, deleting it. ((\$.*)=shift) # Declaration of local variable '[1]' my\s*(\$\w*); # Declaration of global variable '[1]' our\s*(\$\w*); # [1] => Declaration of local variable '[2]' containing '[3]' (my\s*(\$\w+)=(.*)); # [1] => Declaration of global variable '[2]' containing '[3]' (our\s*(\$\w+)=(.*)); # Declaration of local hash '[1]' my\s*(\%\w+); # Declaration of global hash '[1]' our\s*(\%\w+); # [1] => Value of position '[3]' in hash %[2] (\$(\w+)\{(.+)\}) # return() => Leaves the function return\ ?\(?\ ?\)? # return([1]) => Leaves the function with '[1]' as return value return\ ?\(?\ (.*)\ ?\)? # As the function already says: Uses module '[1]' ^use\s+(.+); ############################### Function '[1]' ####################### ^\s*sub (\w*\(?\)?)\ *\{?$ # [1] => Tests regular expression '[3]' in variable '[2]' \s?((\$\w+)\s?=~\s?(\/.+\/)) # [1] => Recognises any type of space, as whitespace, tab or line break \s?\$\w+\s?=~\s?\/.*(\\s).*\/ # [1] => Recognises any letter \s?\$\w+\s?=~\s?\/.*(\\w).*\/ # [1] => Recognises any word \s?\$\w+\s?=~\s?\/.*(\\W).*\/ # [1] => Recognises any number \s?\$\w+\s?=~\s?\/.*(\\d).*\/ # [1] => Recognises anything between '[2]' and '[3]' \s?\$\w+\s?=~\s?\/.*(\[(\w|\d)\-(\w|\d)\]).*\/ # [1] => The expression '[2]' must appear between [3] and [4] times \s?\$\w+\s?=~\s?\/.*(([\[|\(].+[\]|\)])\{(\d),(\d)\}).*\/ # [1] => The expression '[2]' must appear between [3] and [4] times \s?\$\w+\s?=~\s?\/.*((\\.)\{(\d),(\d)\}).*\/