Next: Examples of gnatxref Usage, Previous: Project Files for gnatxref and gnatfind, Up: The Cross-Referencing Tools gnatxref and gnatfind
As specified in the section about `gnatfind', the pattern can be a regular expression. Two kinds of regular expressions are recognized:
Here is a more formal grammar:
regexp ::= term term ::= elmt -- matches elmt term ::= elmt elmt -- concatenation (elmt then elmt) term ::= * -- any string of 0 or more characters term ::= ? -- matches any character term ::= [char {char}] -- matches any character listed term ::= [char - char] -- matches any character in range
grep
.
The following is the form of a regular expression, expressed in same BNF style as is found in the Ada Reference Manual:
regexp ::= term {| term} -- alternation (term or term ...) term ::= item {item} -- concatenation (item then item) item ::= elmt -- match elmt item ::= elmt * -- zero or more elmt's item ::= elmt + -- one or more elmt's item ::= elmt ? -- matches elmt or nothing elmt ::= nschar -- matches given character elmt ::= [nschar {nschar}] -- matches any character listed elmt ::= [^ nschar {nschar}] -- matches any character not listed elmt ::= [char - char] -- matches chars in given range elmt ::= \\ char -- matches given character elmt ::= . -- matches any single character elmt ::= ( regexp ) -- parens used for grouping char ::= any character, including special characters nschar ::= any character except ()[].*+?^
Here are a few examples:
abcde|fghi
- will match any of the two strings
abcde
andfghi
,abc*d
- will match any string like
abd
,abcd
,abccd
,abcccd
, and so on,[a-z]+
- will match any string which has only lowercase characters in it (and at least one character.