Mercurial > emacs
annotate etc/ETAGS.EBNF @ 46097:f6567777cef8
*** empty log message ***
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Sat, 29 Jun 2002 19:52:14 +0000 |
parents | c5474d1cf831 |
children | 1d83bbd2ceec |
rev | line source |
---|---|
45946
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
1 This file contains two sections: |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
2 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
3 1) An EBNF (Extended Backus Normal Form) description of the format of |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
4 the tags file created by etags.c and interpreted by etags.el |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
5 2) A discussion of tag names and implicit tag names |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
6 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
7 ======================= EBNF tag file description ======================= |
45799 | 8 |
9 Productions created from current behaviour to aid extensions | |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
10 Francesco Potorti` <pot@gnu.org> 2002 |
45946
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
11 ---------------- |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
12 |
45799 | 13 FF ::= #x0c /* tag section starter */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
14 |
45799 | 15 LF ::= #x0a /* line terminator */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
16 |
43857
1e419a707ae1
*** empty log message ***
Francesco Potortì <pot@gnu.org>
parents:
43850
diff
changeset
|
17 DEL ::= #x7f /* pattern terminator */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
18 |
43857
1e419a707ae1
*** empty log message ***
Francesco Potortì <pot@gnu.org>
parents:
43850
diff
changeset
|
19 SOH ::= #x01 /* name terminator */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
20 |
43858
8d0430162d52
*** empty log message ***
Francesco Potortì <pot@gnu.org>
parents:
43857
diff
changeset
|
21 regchar ::= [^#x0a#x0c#x7f] /* regular character */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
22 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
23 regstring ::= { regchar } /* regular string */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
24 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
25 unsint ::= [0-9] { [0-9] } /* non-negative integer */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
26 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
27 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
28 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
29 tagfile ::= { tagsection } /* a tags file */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
30 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
31 tagsection ::= FF LF ( includesec | regularsec ) LF |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
32 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
33 includesec ::= filename ",include" [ LF fileprop ] |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
34 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
35 regularsec ::= filename "," [ unsint ] [ LF fileprop ] { LF tag } |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
36 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
37 filename ::= regchar regstring /* a file name */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
38 |
45799 | 39 fileprop ::= "(" regstring ")" /* an elisp alist */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
40 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
41 tag ::= directtag | patterntag |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
42 |
45799 | 43 directtag ::= DEL realposition /* no pattern */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
44 |
43857
1e419a707ae1
*** empty log message ***
Francesco Potortì <pot@gnu.org>
parents:
43850
diff
changeset
|
45 patterntag ::= pattern DEL [ tagname SOH ] position |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
46 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
47 pattern ::= regstring /* a tag pattern */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
48 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
49 tagname ::= regchar regstring /* a tag name */ |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
50 |
45799 | 51 position ::= realposition | "," /* charpos,linepos */ |
43850
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
52 |
4c55c058ad72
Description of the tags file format.
Francesco Potortì <pot@gnu.org>
parents:
diff
changeset
|
53 realposition ::= "," unsint | unsint "," | unsint "," unsint |
45946
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
54 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
55 ==================== end of EBNF tag file description ==================== |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
56 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
57 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
58 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
59 ======================== discussion on tag names ========================= |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
60 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
61 - What are tag names |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
62 Tag lines in a tags file are usually made from the above defined pattern |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
63 and by an optional tag name. The pattern is a string that is searched |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
64 in the source file to find the tagged line. |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
65 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
66 - Why tag names are good |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
67 When a user looks for a tag, Emacs first compares the tag with the tag |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
68 names contained in the tags file. If no match is found, Emacs compares |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
69 the tag with the patterns. The tag name is then the preferred way to |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
70 look for tags in the tags file, because when the tag name is present |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
71 Emacs can find a tag faster and more accurately. These tag names are |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
72 part of tag lines in the tags file, so we call them "explicit". |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
73 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
74 - Why implicit tag names are even better |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
75 The purpose of implicit tag names is to reduce the number of tag names |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
76 in a tags file, thus reducing the size of the tags file. When the user |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
77 looks for a tag, and Emacs founds no explicit tag names that match it, |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
78 Emacs then tries to match the tag with an implicit tag name. Such a |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
79 match occurs when the tag matches a pattern, subject to the satisfaction |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
80 of all the following four rules: |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
81 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
82 NONAM=" \f\t\n\r()=,;"; |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
83 1. the tag does not contain any of the characters in NONAM; |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
84 2. the pattern contains the tag as either a rightmost, or rightmost |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
85 but one character, substring; |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
86 3. the character, if any, immediately before the tag in the pattern |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
87 must be a character in NONAM; |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
88 4. the character, if any, immediately after the tag in the pattern |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
89 must also be a character in NONAM. |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
90 |
c5474d1cf831
Added discussion on tag names.
Francesco Potortì <pot@gnu.org>
parents:
45799
diff
changeset
|
91 ===================== end of discussion on tag names ===================== |