aboutsummaryrefslogtreecommitdiffstats
path: root/man/programs.texi
diff options
context:
space:
mode:
authorFrancesco Potortì1999-11-01 16:40:40 +0000
committerFrancesco Potortì1999-11-01 16:40:40 +0000
commitaca0be23e8c4c73bb810ca3aa72962c7e6d921d5 (patch)
tree33cfc4faafc8b51a1b45bb5bffa038293962d379 /man/programs.texi
parent79ddc9c971569b56505443c338639350ba0a5a5f (diff)
downloademacs-aca0be23e8c4c73bb810ca3aa72962c7e6d921d5.tar.gz
emacs-aca0be23e8c4c73bb810ca3aa72962c7e6d921d5.zip
Document regexp changes in etags.
Diffstat (limited to 'man/programs.texi')
-rw-r--r--man/programs.texi108
1 files changed, 69 insertions, 39 deletions
diff --git a/man/programs.texi b/man/programs.texi
index 56e2ff8718f..68057d81a25 100644
--- a/man/programs.texi
+++ b/man/programs.texi
@@ -1604,7 +1604,7 @@ recorded is called a @dfn{tag}.
1604@menu 1604@menu
1605* Tag Syntax:: Tag syntax for various types of code and text files. 1605* Tag Syntax:: Tag syntax for various types of code and text files.
1606* Create Tags Table:: Creating a tags table with @code{etags}. 1606* Create Tags Table:: Creating a tags table with @code{etags}.
1607* Using Regexps:: Create arbitrary tags using regular expressions. 1607* Etags Regexps:: Create arbitrary tags using regular expressions.
1608* Select Tags Table:: How to visit a tags table. 1608* Select Tags Table:: How to visit a tags table.
1609* Find Tag:: Commands to find the definition of a specific tag. 1609* Find Tag:: Commands to find the definition of a specific tag.
1610* Tags Search:: Using a tags table for searching and replacing. 1610* Tags Search:: Using a tags table for searching and replacing.
@@ -1804,9 +1804,9 @@ have a limit on its length. The simplest way to circumvent this limit
1804is to tell @code{etags} to read the file names from its standard input, 1804is to tell @code{etags} to read the file names from its standard input,
1805by typing a dash in place of the file names, like this: 1805by typing a dash in place of the file names, like this:
1806 1806
1807@example 1807@smallexample
1808find . -name "*.[chCH]" -print | etags - 1808find . -name "*.[chCH]" -print | etags -
1809@end example 1809@end smallexample
1810 1810
1811 Use the option @samp{--language=@var{name}} to specify the language 1811 Use the option @samp{--language=@var{name}} to specify the language
1812explicitly. You can intermix these options with file names; each one 1812explicitly. You can intermix these options with file names; each one
@@ -1815,38 +1815,33 @@ applies to the file names that follow it. Specify
1815language from the file names and file contents. Specify 1815language from the file names and file contents. Specify
1816@samp{--language=none} to turn off language-specific processing 1816@samp{--language=none} to turn off language-specific processing
1817entirely; then @code{etags} recognizes tags by regexp matching alone 1817entirely; then @code{etags} recognizes tags by regexp matching alone
1818(@pxref{Using Regexps}). @samp{etags --help} prints the list of the 1818(@pxref{Etags Regexps}).
1819languages @code{etags} knows, and the file name rules for guessing the 1819
1820language. 1820 @samp{etags --help} prints the list of the languages @code{etags}
1821knows, and the file name rules for guessing the language. It also prints
1822a list of all the available @code{etags} options, together with a short
1823explanation.
1821 1824
1822@node Using Regexps 1825@node Etags Regexps
1823@subsection Using Regexps 1826@subsection Etags Regexps
1824 1827
1825 The @samp{--regex} option provides a general way of recognizing tags 1828 The @samp{--regex} option provides a general way of recognizing tags
1826based on regexp matching. You can freely intermix it with file names. 1829based on regexp matching. You can freely intermix it with file names.
1827Each @samp{--regex} option adds to the preceding ones, and applies only 1830Each @samp{--regex} option adds to the preceding ones, and applies only
1828to the following files. The syntax is: 1831to the following files. The syntax is:
1829 1832
1830@example 1833@smallexample
1831--regex=/@var{tagregexp}[/@var{nameregexp}]/ 1834--regex=/@var{tagregexp}[/@var{nameregexp}]/
1832@end example 1835@end smallexample
1833
1834or
1835
1836@example
1837--ignore-case-regex=/@var{tagregexp}[/@var{nameregexp}]/
1838@end example
1839 1836
1840@noindent 1837@noindent
1841where @var{tagregexp} is used to match the lines to tag. The second 1838where @var{tagregexp} is used to match the lines to tag. It is always
1842form for the option syntax ignores the case when searching a match for 1839anchored, that is, it behaves as if preceded by @samp{^}. If you want
1843the regular expression. @var{tagregexp} is always anchored, that is, it 1840to account for indentation, just match any initial number of blanks by
1844behaves as if preceded by @samp{^}. If you want to account for 1841beginning your regular expression with @samp{[ \t]*}. In the regular
1845indentation, just match any initial number of blanks by beginning your 1842expressions, @samp{\} quotes the next character, and @samp{\t} stands
1846regular expression with @samp{[ \t]*}. In the regular expressions, 1843for the tab character. Note that @code{etags} does not handle the other
1847@samp{\} quotes the next character, and @samp{\t} stands for the tab 1844C escape sequences for special characters.
1848character. Note that @code{etags} does not handle the other C escape
1849sequences for special characters.
1850 1845
1851@cindex interval operator (in regexps) 1846@cindex interval operator (in regexps)
1852 The syntax of regular expressions in @code{etags} is the same as in 1847 The syntax of regular expressions in @code{etags} is the same as in
@@ -1863,19 +1858,19 @@ pick out just the tag. This will enable Emacs to find tags more
1863accurately and to do completion on tag names more reliably. You can 1858accurately and to do completion on tag names more reliably. You can
1864find some examples below. 1859find some examples below.
1865 1860
1866 The option @samp{--case-folded-regexp} (or @samp{-c}) si like 1861 The option @samp{--ignore-case-regex} (or @samp{-c}) is like
1867@samp{--regex}, except that the regular expression provided will be 1862@samp{--regex}, except that the regular expression provided will be
1868matched with case folded, i.e. case-insensitively, which is appropriate 1863matched without regard to case, which is appropriate for various
1869for various programming languages. 1864programming languages.
1870 1865
1871 The @samp{-R} option deletes all the regexps defined with 1866 The @samp{-R} option deletes all the regexps defined with
1872@samp{--regex} options. It applies to the file names following it, as 1867@samp{--regex} options. It applies to the file names following it, as
1873you can see from the following example: 1868you can see from the following example:
1874 1869
1875@example 1870@smallexample
1876etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \ 1871etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \
1877 bar.ber -R --lang=lisp los.er 1872 bar.ber -R --lang=lisp los.er
1878@end example 1873@end smallexample
1879 1874
1880@noindent 1875@noindent
1881Here @code{etags} chooses the parsing language for @file{voo.doo} and 1876Here @code{etags} chooses the parsing language for @file{voo.doo} and
@@ -1885,17 +1880,55 @@ Here @code{etags} chooses the parsing language for @file{voo.doo} and
1885@file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp 1880@file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp
1886matching, to recognize tags in @file{los.er}. 1881matching, to recognize tags in @file{los.er}.
1887 1882
1888 Here are some more examples. The regexps are quoted to protect them 1883 A regular expression can be bound to a given language, by prepending
1889from shell interpretation. 1884it with @samp{@{lang@}}. When you do this, @code{etags} will use the
1885regular expression only for files of that language. @samp{etags --help}
1886prints the list of languages recognised by @code{etags}. The following
1887example tags the @code{DEFVAR} macros in the Emacs source files.
1888@code{etags} applies this regular expression to C files only:
1890 1889
1891@itemize @bullet 1890@smallexample
1892@item 1891--regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/'
1893Tag the @code{DEFVAR} macros in the emacs source files: 1892@end smallexample
1893
1894@noindent
1895This feature is particularly useful when storing a list of regular
1896expressions in a file. The following option syntax instructs
1897@code{etags} to read two files of regular expressions. The regular
1898expressions contained in the second file are matched without regard to
1899case.
1900
1901@smallexample
1902--regex=@@first-file --ignore-case-regex=@@second-file
1903@end smallexample
1904
1905@noindent
1906A regex file contains one regular expressions per line. Empty lines,
1907and lines beginning with space or tab are ignored. When the first
1908character in a line is @samp{@@}, @code{etags} assumes that the rest of
1909the line is the name of a file of regular expressions. This means that
1910such files can be nested. All the other lines are taken to be regular
1911expressions. For example, one can create a file called
1912@samp{emacs.tags} with the following contents (the first line in the
1913file is a comment):
1914
1915@smallexample
1916 -- This is for GNU Emacs source files
1917@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/
1918@end smallexample
1919
1920@noindent
1921and then use it like this:
1894 1922
1895@smallexample 1923@smallexample
1896--regex='/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' 1924etags --regex=@@emacs.tags *.[ch] */*.[ch]
1897@end smallexample 1925@end smallexample
1898 1926
1927 Here are some more examples. The regexps are quoted to protect them
1928from shell interpretation.
1929
1930@itemize @bullet
1931
1899@item 1932@item
1900Tag VHDL files (this example is a single long line, broken here for 1933Tag VHDL files (this example is a single long line, broken here for
1901formatting reasons): 1934formatting reasons):
@@ -1915,9 +1948,6 @@ Tag Tcl files (this last example shows the usage of a @var{nameregexp}):
1915@end smallexample 1948@end smallexample
1916@end itemize 1949@end itemize
1917 1950
1918 For a list of the other available @code{etags} options, execute
1919@code{etags --help}.
1920
1921@node Select Tags Table 1951@node Select Tags Table
1922@subsection Selecting a Tags Table 1952@subsection Selecting a Tags Table
1923 1953