ETAGS.EBNF 4.0 KB

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