Update copyright notices for 2013.
[bpt/emacs.git] / etc / ETAGS.EBNF
... / ...
CommitLineData
1-*- indented-text -*-
2
3See the end of this file for copyright information.
4
5This file contains two sections:
6
71) An EBNF (Extended Backus-Naur Form) description of the format of
8 the tags file created by etags.c and interpreted by etags.el;
92) A discussion of tag names and implicit tag names.
10
11====================== 1) EBNF tag file description =====================
12
13Productions created from current behavior to aid extensions
14Francesco Potorti` <pot@gnu.org> 2002
15----------------
16
17FF ::= #x0c /* tag section starter */
18
19LF ::= #x0a /* line terminator */
20
21DEL ::= #x7f /* pattern terminator */
22
23SOH ::= #x01 /* name terminator */
24
25regchar ::= [^#x0a#x0c#x7f] /* regular character */
26
27regstring ::= { regchar } /* regular string */
28
29unsint ::= [0-9] { [0-9] } /* non-negative integer */
30
31
32
33tagfile ::= { tagsection } /* a tags file */
34
35tagsection ::= FF LF ( includesec | regularsec ) LF
36
37includesec ::= filename ",include" [ LF fileprop ]
38
39regularsec ::= filename "," [ unsint ] [ LF fileprop ] { LF tag }
40
41filename ::= regchar regstring /* a file name */
42
43fileprop ::= "(" regstring ")" /* an elisp alist */
44
45tag ::= directtag | patterntag
46
47directtag ::= DEL realposition /* no pattern */
48
49patterntag ::= pattern DEL [ tagname SOH ] position
50
51pattern ::= regstring /* a tag pattern */
52
53tagname ::= regchar regstring /* a tag name */
54
55position ::= realposition | "," /* charpos,linepos */
56
57realposition ::= "," unsint | unsint "," | unsint "," unsint
58
59==================== end of EBNF tag file description ====================
60
61
62
63======================= 2) discussion of tag names =======================
64
65- WHAT ARE TAG NAMES
66Tag lines in a tags file are usually made from the above defined pattern
67and by an optional tag name. The pattern is a string that is searched
68in the source file to find the tagged line.
69
70- WHY TAG NAMES ARE GOOD
71When a user looks for a tag, Emacs first compares the tag with the tag
72names contained in the tags file. If no match is found, Emacs compares
73the tag with the patterns. The tag name is then the preferred way to
74look for tags in the tags file, because when the tag name is present
75Emacs can find a tag faster and more accurately. These tag names are
76part of tag lines in the tags file, so we call them "explicit".
77
78- WHY IMPLICIT TAG NAMES ARE EVEN BETTER
79When a tag line has no name, but a name can be deduced from the pattern,
80we say that the tag line has an implicit tag name. Often tag names are
81redundant; this happens when the name of a tag is an easily guessable
82substring of the tag pattern. We define a set of rules to decide
83whether it is possible to deduce the tag name from the pattern, and make
84an unnamed tag in those cases. The name deduced from the pattern of an
85unnamed tag is the implicit name of that tag.
86 When the user looks for a tag, and Emacs finds no explicit tag names
87that match it, Emacs then looks for an tag whose implicit tag name
88matches the request. etags.c uses implicit tag names when possible, in
89order to reduce the size of the tags file.
90 An implicit tag name is deduced from the pattern by discarding the
91last character if it is one of ` \f\t\n\r()=,;', then taking all the
92rightmost consecutive characters in the pattern which are not one of
93those.
94
95===================== end of discussion of tag names =====================
96
97Copyright (C) 2002-2013 Free Software Foundation, Inc.
98
99COPYING PERMISSIONS:
100
101 This document is free software: you can redistribute it and/or modify
102 it under the terms of the GNU General Public License as published by
103 the Free Software Foundation, either version 3 of the License, or
104 (at your option) any later version.
105
106 This program is distributed in the hope that it will be useful,
107 but WITHOUT ANY WARRANTY; without even the implied warranty of
108 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109 GNU General Public License for more details.
110
111 You should have received a copy of the GNU General Public License
112 along with this program. If not, see <http://www.gnu.org/licenses/>.