/[emacs]/emacs/lib-src/etags.c
ViewVC logotype

Diff of /emacs/lib-src/etags.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3.24 by pot, Thu Jun 20 08:43:57 2002 UTC revision 3.25 by pot, Thu Jun 20 11:48:31 2002 UTC
# Line 27  Line 27 
27   * 1989 Sam Kendall added C++.   * 1989 Sam Kendall added C++.
28   * 1992 Joseph B. Wells improved C and C++ parsing.   * 1992 Joseph B. Wells improved C and C++ parsing.
29   * 1993 Francesco Potort́ reorganised C and C++.   * 1993 Francesco Potort́ reorganised C and C++.
30   * 1994 Regexp tags by Tom Tromey.   * 1994 Line-by-line regexp tags by Tom Tromey.
31   * 2001 Nested classes by Francesco Potort́ (concept by Mykola Dzyuba).   * 2001 Nested classes by Francesco Potort́ (concept by Mykola Dzyuba).
32   * 2002 #line directives by Francesco Potort́.   * 2002 #line directives by Francesco Potort́.
33   *   *
# Line 35  Line 35 
35   *   *
36   */   */
37    
38  char pot_etags_version[] = "@(#) pot revision number is 16.27";  char pot_etags_version[] = "@(#) pot revision number is 16.29";
39    
40  #define TRUE    1  #define TRUE    1
41  #define FALSE   0  #define FALSE   0
# Line 374  static void find_entries __P((FILE *)); Line 374  static void find_entries __P((FILE *));
374  static void free_tree __P((node *));  static void free_tree __P((node *));
375  static void free_fdesc __P((fdesc *));  static void free_fdesc __P((fdesc *));
376  static void pfnote __P((char *, bool, char *, int, int, long));  static void pfnote __P((char *, bool, char *, int, int, long));
377  static void new_pfnote __P((char *, int, bool, char *, int, int, long));  static void make_tag __P((char *, int, bool, char *, int, int, long));
378  static void invalidate_nodes __P((fdesc *, node **));  static void invalidate_nodes __P((fdesc *, node **));
379  static void put_entries __P((node *));  static void put_entries __P((node *));
380    
# Line 426  static char Line 426  static char
426    /* white chars */    /* white chars */
427    *white = " \f\t\n\r\v",    *white = " \f\t\n\r\v",
428    /* not in a name */    /* not in a name */
429    *nonam = " \f\t\n\r()=,;",    *nonam = " \f\t\n\r()=,;",    /* look at make_tag before modifying! */
430    /* token ending chars */    /* token ending chars */
431    *endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?",    *endtk = " \t\n\r\"'#()[]{}=-+%*/&|^~!<>;,.:?",
432    /* token starting chars */    /* token starting chars */
# Line 1833  pfnote (name, is_func, linestart, linele Line 1833  pfnote (name, is_func, linestart, linele
1833  }  }
1834    
1835  /*  /*
1836     * Check whether an implicitly named tag should be created,
1837     * then call `pfnote'.
1838     * NAME is a string that is internally copied by this function.
1839     *
1840   * TAGS format specification   * TAGS format specification
1841   * Idea by Sam Kendall <kendall@mv.mv.com> (1997)   * Idea by Sam Kendall <kendall@mv.mv.com> (1997)
1842   *   *
1843   * pfnote should emit the optimized form [unnamed tag] only if:   * make_tag creates tags with "implicit tag names" (unnamed tags)
1844   *  1. name does not contain any of the characters " \t\r\n(),;";   * if the following are all true, assuming NONAM=" \f\t\n\r()=,;":
1845   *  2. linestart contains name as either a rightmost, or rightmost but   *  1. NAME does not contain any of the characters in NONAM;
1846     *  2. LINESTART contains name as either a rightmost, or rightmost but
1847   *     one character, substring;   *     one character, substring;
1848   *  3. the character, if any, immediately before name in linestart must   *  3. the character, if any, immediately before NAME in LINESTART must
1849   *     be one of the characters " \t(),;";   *     be a character in NONAM;
1850   *  4. the character, if any, immediately after name in linestart must   *  4. the character, if any, immediately after NAME in LINESTART must
1851   *     also be one of the characters " \t(),;".   *     also be a character in NONAM.
1852   *   *
1853   * The real implementation uses the notinname() macro, which recognises   * The implementation uses the notinname() macro, which recognises the
1854   * characters slightly different from " \t\r\n(),;".  See the variable   * characters stored in the string `nonam'.
1855   * `nonam'.   * etags.el needs to use the same characters that are in NONAM.
1856   */   */
 #define traditional_tag_style TRUE  
1857  static void  static void
1858  new_pfnote (name, namelen, is_func, linestart, linelen, lno, cno)  make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
1859       char *name;                /* tag name, or NULL if unnamed */       char *name;                /* tag name, or NULL if unnamed */
1860       int namelen;               /* tag length */       int namelen;               /* tag length */
1861       bool is_func;              /* tag is a function */       bool is_func;              /* tag is a function */
# Line 1877  new_pfnote (name, namelen, is_func, line Line 1881  new_pfnote (name, namelen, is_func, line
1881                && (cp == linestart                && (cp == linestart
1882                    || notinname (cp[-1]))        /* rule #3 */                    || notinname (cp[-1]))        /* rule #3 */
1883                && strneq (name, cp, namelen))    /* rule #2 */                && strneq (name, cp, namelen))    /* rule #2 */
1884              named = FALSE;      /* use unnamed tag */              named = FALSE;      /* use implicit tag name */
1885          }          }
1886      }      }
1887    
# Line 2981  make_C_tag (isfun) Line 2985  make_C_tag (isfun)
2985  {  {
2986    /* This function should never be called when token.valid is FALSE, but    /* This function should never be called when token.valid is FALSE, but
2987       we must protect against invalid input or internal errors. */       we must protect against invalid input or internal errors. */
2988    if (DEBUG || token.valid)    if (!DEBUG && !token.valid)
2989      {      return;
       if (traditional_tag_style)  
         {  
           /* This was the original code.  Now we call new_pfnote instead,  
              which uses the new method for naming tags (see new_pfnote). */  
           char *name = NULL;  
2990    
2991            if (CTAGS || token.named)    if (!token.valid)             /* this case is optimised away if !DEBUG */
2992              name = savestr (token_name.buffer);      make_tag (concat (token_name.buffer, "##invalid token##", ""),
2993            if (DEBUG && !token.valid)                token_name.len + 17, isfun, token.line,
2994              {                token.offset+token.length+1, token.lineno, token.linepos);
2995                if (token.named)    else
2996                  name = concat (name, "##invalid##", "");      make_tag (token_name.buffer, token_name.len, isfun, token.line,
2997                else                token.offset+token.length+1, token.lineno, token.linepos);
2998                  name = savestr ("##invalid##");  
2999              }    token.valid = FALSE;
           pfnote (name, isfun, token.line,  
                   token.offset+token.length+1, token.lineno, token.linepos);  
         }  
       else  
         new_pfnote (token_name.buffer, token_name.len, isfun, token.line,  
                     token.offset+token.length+1, token.lineno, token.linepos);  
       token.valid = FALSE;  
     }  
3000  }  }
3001    
3002    

Legend:
Removed from v.3.24  
changed lines
  Added in v.3.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26