Tutorialaa-grep




Prev | Up | Next | Back | Forward | Online Documentation Home Page

SYNOPSIS

       aa-grep [options] pattern phylumlist filelist ...


DESCRIPTION

       aa-grep  uses  Ada-ASSURED batch mode to search the speci-
       fied Ada source code files according to the Ada  structure
       of  the code.  aa-grep is similar to the UNIX utility grep
       with the addition of a phylumlist parameter.  aa-grep will
       only  find  matches where the pattern corresponds with the
       source code and the structure corresponds with a phylum in
       the  phylumlist.  Each line that contains a match is writ-
       ten to standard output.

       The pattern is a regular expression, as defined by the STk
       reference manual.

       The  phylumlist is a comma-separated list of phylum names.
       These phyla correspond to Ada structures such as a package
       body or a statement.  See the section PHYLA below for some
       common phyla names.

       By default, if there is  more  than  one  file  listed  in
       filelist, then each matched line is preceded with the name
       of the file in which  it  was  found.   This  behavior  is
       changed by the -h flag.


OPTIONS

       -c     Displays  only a count of the matching phyla.  Note
              that this count does not correspond to  the  number
              of  matching  lines  as  there may be more than one
              matching phlyum per line, or more than one matching
              line per phlyum.

       -h     Suppresses  reporting  of  filenames  when multiple
              files are processed.  That is, it prevents the name
              of the file containing the matching line from being
              appended to that line.

       -i     Ignores the case of letters in pattern matching.

       -l     Lists only the name of each file containing matched
              lines.   Each  filename  is listed only once; file-
              names are separated by newlines.

       -n     Precedes each line with its relative line number in
              the file.

       -v     Displays  all  lines  except  those  that match the
              specified pattern.

       -w     Search for the pattern as  a  whole  phylum.   This
              will only work for patterns without special charac-

       aa-grep -c "" "subprogram_body" test.a
              This  returns  the number of procedure and function
              bodies in test.a.

       aa-grep -w -i "i" "identifier,identifier2" test.a
              This returns all lines in test.a containing identi-
              fiers named "i" or "I".

       aa-grep "[aeiou]*[0-9]+.z" "identifier,identifier2" test.a
              This returns all lines in test.a containing identi-
              fiers with names that have:
              zero or more vowels, followed by
              one or more digits, followed by
              any single character, followed by
              the character z.


PHYLA

       The following are some common phylum names.   For  a  com-
       plete list, see the on-line Ada-ASSURED grammar. Note that
       phlya dealing with comments cannot be used with aa-grep.

       Phylum names:
              compilation_unit
              enumeration_literal_specification
              expanded_name
              expanded_name2
              expression
              identifier
              identifier2
              label
              name
              name2
              number
              package_body
              package_specification
              pragma_choice
              program_unit_body
              program_unit_declaration
              record_definition
              renaming_declaration
              statement
              subprogram_body
              subprogram_declaration
              task_body
              task_declaration
              type_definition
              use_clause
              with_clause


RETURN VALUES

       aa-grep returns 0 on success (regardless  of  whether  any


COPYRIGHT

       Copyright  1997--2002,  by GrammaTech, Inc., 317 N. Aurora
       St., Ithaca, NY 14850.



Ada-ASSURED        Release 3.5, July 2004         AA-GREP(l)


Forward