aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-09-13 20:33:29 +0000
committerKaroly Lorentey2004-09-13 20:33:29 +0000
commit267eea215b322b02bc4bce13cae61813c50f4b5f (patch)
tree2dec815aa97a75c7d1589e72aa814bba68d4ade9 /lib-src
parent5cd432338667788c6739f43e4aa37fb53cc2a125 (diff)
parentef3b7aae581ae555a11aa38f13e0eb55ad93a8c7 (diff)
downloademacs-267eea215b322b02bc4bce13cae61813c50f4b5f.tar.gz
emacs-267eea215b322b02bc4bce13cae61813c50f4b5f.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-537 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-538 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-540 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-541 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-542 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-543 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-544 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-545 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-546 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-21 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-22 Update from CVS: lisp/nndb.el (require): Remove tcp and duplicate cl. * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-23 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-24 lisp/nnimap.el (nnimap-open-connection): Remove extraneous end-paren * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-25 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-26 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-244
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog19
-rw-r--r--lib-src/etags.c1211
2 files changed, 654 insertions, 576 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 909a5717bcc..b0960f9a98b 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,22 @@
12004-09-13 Francesco Potort,Al(B <pot@gnu.org>
2
3 * etags.c [EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
4 <stdlib.h> is available.
5 (enum sym_type): New st_C_attribute value for parsing
6 gcc's __attribute__. Deleted st_C_typespec value.
7 (gperf, in_word_set): Use gperf 3, options changed. Added the
8 __attribute__ keyword, removed all the st_C_typespec keywords,
9 changed attribute for Java to (C_JAVA & !C_PLPL).
10 (inattribute): New global bool, part of the C state machine.
11 (cblev): Identifier renamed to bracelev throughout.
12 (consider_token, C_entries): Numerous changes for making the
13 parser more robust and adding support for __attribute__.
14
152004-09-13 David A. Capello <dacap@users.sourceforge.net> (tiny change)
16
17 * etags.c: (Lua_suffixes, Lua_help, lang_names, Lua_functions):
18 Support the Lua scripting language <http://www.lua.org>.
19
12004-09-08 Francesco Potort,Al(B <pot@gnu.org> 202004-09-08 Francesco Potort,Al(B <pot@gnu.org>
2 21
3 * etags.c: [LONG_OPTIONS]: make it TRUE (ifdef) or FALSE (ifndef) 22 * etags.c: [LONG_OPTIONS]: make it TRUE (ifdef) or FALSE (ifndef)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 094c81e91a0..f68c2e2bb95 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -32,10 +32,15 @@
32 * 2002 #line directives by Francesco Potort́. 32 * 2002 #line directives by Francesco Potort́.
33 * 33 *
34 * Francesco Potort́ <pot@gnu.org> has maintained and improved it since 1993. 34 * Francesco Potort́ <pot@gnu.org> has maintained and improved it since 1993.
35 *
36 */ 35 */
37 36
38char pot_etags_version[] = "@(#) pot revision number is 16.58"; 37/*
38 * If you want to add support for a new language, start by looking at the LUA
39 * language, which is the simplest. Alternatively, consider shipping a
40 * configuration file containing regexp definitions for etags.
41 */
42
43char pot_etags_version[] = "@(#) pot revision number is 17.4";
39 44
40#define TRUE 1 45#define TRUE 1
41#define FALSE 0 46#define FALSE 0
@@ -61,11 +66,11 @@ char pot_etags_version[] = "@(#) pot revision number is 16.58";
61# ifndef __P /* for Xemacs */ 66# ifndef __P /* for Xemacs */
62# define __P(args) args 67# define __P(args) args
63# endif 68# endif
64#else 69#else /* no config.h */
65# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) 70# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
66# define __P(args) args /* use prototypes */ 71# define __P(args) args /* use prototypes */
67# define PTR void * /* for generic pointers */ 72# define PTR void * /* for generic pointers */
68# else 73# else /* not standard C */
69# define __P(args) () /* no prototypes */ 74# define __P(args) () /* no prototypes */
70# define const /* remove const for old compilers' sake */ 75# define const /* remove const for old compilers' sake */
71# define PTR long * /* don't use void* */ 76# define PTR long * /* don't use void* */
@@ -118,12 +123,19 @@ char pot_etags_version[] = "@(#) pot revision number is 16.58";
118# ifndef HAVE_GETCWD 123# ifndef HAVE_GETCWD
119# define HAVE_GETCWD 124# define HAVE_GETCWD
120# endif /* undef HAVE_GETCWD */ 125# endif /* undef HAVE_GETCWD */
121#else /* !WINDOWSNT */ 126#else /* not WINDOWSNT */
122# ifdef STDC_HEADERS 127# ifdef STDC_HEADERS
123# include <stdlib.h> 128# include <stdlib.h>
124# include <string.h> 129# include <string.h>
125# else 130# else /* no standard C headers */
126 extern char *getenv (); 131 extern char *getenv ();
132# ifdef VMS
133# define EXIT_SUCCESS 1
134# define EXIT_FAILURE 0
135# else /* no VMS */
136# define EXIT_SUCCESS 0
137# define EXIT_FAILURE 1
138# endif
127# endif 139# endif
128#endif /* !WINDOWSNT */ 140#endif /* !WINDOWSNT */
129 141
@@ -333,6 +345,7 @@ static void Erlang_functions __P((FILE *));
333static void Fortran_functions __P((FILE *)); 345static void Fortran_functions __P((FILE *));
334static void HTML_labels __P((FILE *)); 346static void HTML_labels __P((FILE *));
335static void Lisp_functions __P((FILE *)); 347static void Lisp_functions __P((FILE *));
348static void Lua_functions __P((FILE *));
336static void Makefile_targets __P((FILE *)); 349static void Makefile_targets __P((FILE *));
337static void Pascal_functions __P((FILE *)); 350static void Pascal_functions __P((FILE *));
338static void Perl_functions __P((FILE *)); 351static void Perl_functions __P((FILE *));
@@ -637,6 +650,11 @@ defined with `defvar' or `defconst', and in general the first\n\
637argument of any expression that starts with `(def' in column zero\n\ 650argument of any expression that starts with `(def' in column zero\n\
638is a tag."; 651is a tag.";
639 652
653static char *Lua_suffixes [] =
654 { "lua", "LUA", NULL };
655static char Lua_help [] =
656"In Lua scripts, all functions are tags.";
657
640static char *Makefile_filenames [] = 658static char *Makefile_filenames [] =
641 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; 659 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
642static char Makefile_help [] = 660static char Makefile_help [] =
@@ -763,6 +781,7 @@ static language lang_names [] =
763 { "html", HTML_help, HTML_labels, HTML_suffixes }, 781 { "html", HTML_help, HTML_labels, HTML_suffixes },
764 { "java", Cjava_help, Cjava_entries, Cjava_suffixes }, 782 { "java", Cjava_help, Cjava_entries, Cjava_suffixes },
765 { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes }, 783 { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes },
784 { "lua", Lua_help, Lua_functions, Lua_suffixes },
766 { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames}, 785 { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames},
767 { "objc", Objc_help, plain_C_entries, Objc_suffixes }, 786 { "objc", Objc_help, plain_C_entries, Objc_suffixes },
768 { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes }, 787 { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes },
@@ -2373,11 +2392,11 @@ enum sym_type
2373 st_none, 2392 st_none,
2374 st_C_objprot, st_C_objimpl, st_C_objend, 2393 st_C_objprot, st_C_objimpl, st_C_objend,
2375 st_C_gnumacro, 2394 st_C_gnumacro,
2376 st_C_ignore, 2395 st_C_ignore, st_C_attribute,
2377 st_C_javastruct, 2396 st_C_javastruct,
2378 st_C_operator, 2397 st_C_operator,
2379 st_C_class, st_C_template, 2398 st_C_class, st_C_template,
2380 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec 2399 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
2381}; 2400};
2382 2401
2383static unsigned int hash __P((const char *, unsigned int)); 2402static unsigned int hash __P((const char *, unsigned int));
@@ -2385,79 +2404,67 @@ static struct C_stab_entry * in_word_set __P((const char *, unsigned int));
2385static enum sym_type C_symtype __P((char *, int, int)); 2404static enum sym_type C_symtype __P((char *, int, int));
2386 2405
2387/* Feed stuff between (but not including) %[ and %] lines to: 2406/* Feed stuff between (but not including) %[ and %] lines to:
2388 gperf -c -k 1,3 -o -p -r -t 2407 gperf -m 5
2389%[ 2408%[
2409%compare-strncmp
2410%enum
2411%struct-type
2390struct C_stab_entry { char *name; int c_ext; enum sym_type type; } 2412struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
2391%% 2413%%
2392if, 0, st_C_ignore 2414if, 0, st_C_ignore
2393for, 0, st_C_ignore 2415for, 0, st_C_ignore
2394while, 0, st_C_ignore 2416while, 0, st_C_ignore
2395switch, 0, st_C_ignore 2417switch, 0, st_C_ignore
2396return, 0, st_C_ignore 2418return, 0, st_C_ignore
2397@interface, 0, st_C_objprot 2419__attribute__, 0, st_C_attribute
2398@protocol, 0, st_C_objprot 2420@interface, 0, st_C_objprot
2399@implementation,0, st_C_objimpl 2421@protocol, 0, st_C_objprot
2400@end, 0, st_C_objend 2422@implementation,0, st_C_objimpl
2401import, C_JAVA, st_C_ignore 2423@end, 0, st_C_objend
2402package, C_JAVA, st_C_ignore 2424import, (C_JAVA & !C_PLPL), st_C_ignore
2403friend, C_PLPL, st_C_ignore 2425package, (C_JAVA & !C_PLPL), st_C_ignore
2404extends, C_JAVA, st_C_javastruct 2426friend, C_PLPL, st_C_ignore
2405implements, C_JAVA, st_C_javastruct 2427extends, (C_JAVA & !C_PLPL), st_C_javastruct
2406interface, C_JAVA, st_C_struct 2428implements, (C_JAVA & !C_PLPL), st_C_javastruct
2407class, 0, st_C_class 2429interface, (C_JAVA & !C_PLPL), st_C_struct
2408namespace, C_PLPL, st_C_struct 2430class, 0, st_C_class
2409domain, C_STAR, st_C_struct 2431namespace, C_PLPL, st_C_struct
2410union, 0, st_C_struct 2432domain, C_STAR, st_C_struct
2411struct, 0, st_C_struct 2433union, 0, st_C_struct
2412extern, 0, st_C_extern 2434struct, 0, st_C_struct
2413enum, 0, st_C_enum 2435extern, 0, st_C_extern
2414typedef, 0, st_C_typedef 2436enum, 0, st_C_enum
2415define, 0, st_C_define 2437typedef, 0, st_C_typedef
2416operator, C_PLPL, st_C_operator 2438define, 0, st_C_define
2417template, 0, st_C_template 2439operator, C_PLPL, st_C_operator
2418bool, C_PLPL, st_C_typespec 2440template, 0, st_C_template
2419long, 0, st_C_typespec
2420short, 0, st_C_typespec
2421int, 0, st_C_typespec
2422char, 0, st_C_typespec
2423float, 0, st_C_typespec
2424double, 0, st_C_typespec
2425signed, 0, st_C_typespec
2426unsigned, 0, st_C_typespec
2427auto, 0, st_C_typespec
2428void, 0, st_C_typespec
2429static, 0, st_C_typespec
2430const, 0, st_C_typespec
2431volatile, 0, st_C_typespec
2432explicit, C_PLPL, st_C_typespec
2433mutable, C_PLPL, st_C_typespec
2434typename, C_PLPL, st_C_typespec
2435# DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach). 2441# DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach).
2436DEFUN, 0, st_C_gnumacro 2442DEFUN, 0, st_C_gnumacro
2437SYSCALL, 0, st_C_gnumacro 2443SYSCALL, 0, st_C_gnumacro
2438ENTRY, 0, st_C_gnumacro 2444ENTRY, 0, st_C_gnumacro
2439PSEUDO, 0, st_C_gnumacro 2445PSEUDO, 0, st_C_gnumacro
2440# These are defined inside C functions, so currently they are not met. 2446# These are defined inside C functions, so currently they are not met.
2441# EXFUN used in glibc, DEFVAR_* in emacs. 2447# EXFUN used in glibc, DEFVAR_* in emacs.
2442#EXFUN, 0, st_C_gnumacro 2448#EXFUN, 0, st_C_gnumacro
2443#DEFVAR_, 0, st_C_gnumacro 2449#DEFVAR_, 0, st_C_gnumacro
2444%] 2450%]
2445and replace lines between %< and %> with its output, 2451and replace lines between %< and %> with its output, then:
2446then make in_word_set and C_stab_entry static. */ 2452 - remove the #if characterset check
2453 - make in_word_set static and not inline. */
2447/*%<*/ 2454/*%<*/
2448/* C code produced by gperf version 2.7.1 (19981006 egcs) */ 2455/* C code produced by gperf version 3.0.1 */
2449/* Command-line: gperf -c -k 1,3 -o -p -r -t */ 2456/* Command-line: gperf -m 5 */
2450struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; 2457/* Computed positions: -k'1-2' */
2451 2458
2452#define TOTAL_KEYWORDS 47 2459struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
2453#define MIN_WORD_LENGTH 2 2460/* maximum key range = 31, duplicates = 0 */
2454#define MAX_WORD_LENGTH 15
2455#define MIN_HASH_VALUE 18
2456#define MAX_HASH_VALUE 138
2457/* maximum key range = 121, duplicates = 0 */
2458 2461
2459#ifdef __GNUC__ 2462#ifdef __GNUC__
2460__inline 2463__inline
2464#else
2465#ifdef __cplusplus
2466inline
2467#endif
2461#endif 2468#endif
2462static unsigned int 2469static unsigned int
2463hash (str, len) 2470hash (str, len)
@@ -2466,132 +2473,84 @@ hash (str, len)
2466{ 2473{
2467 static unsigned char asso_values[] = 2474 static unsigned char asso_values[] =
2468 { 2475 {
2469 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2476 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2470 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2477 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2471 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2478 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2472 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2479 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2473 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2480 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2474 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2481 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2475 139, 139, 139, 139, 63, 139, 139, 139, 33, 44, 2482 34, 34, 34, 34, 1, 34, 34, 34, 14, 14,
2476 62, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2483 34, 34, 34, 34, 34, 34, 34, 34, 13, 34,
2477 42, 139, 139, 12, 32, 139, 139, 139, 139, 139, 2484 13, 34, 34, 12, 34, 34, 34, 34, 34, 11,
2478 139, 139, 139, 139, 139, 139, 139, 34, 59, 37, 2485 34, 34, 34, 34, 34, 8, 34, 11, 34, 12,
2479 24, 58, 33, 3, 139, 16, 139, 139, 42, 60, 2486 11, 0, 1, 34, 7, 0, 34, 34, 11, 9,
2480 18, 11, 39, 139, 23, 57, 4, 63, 6, 20, 2487 0, 4, 0, 34, 7, 4, 14, 21, 34, 15,
2481 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2488 0, 2, 34, 34, 34, 34, 34, 34, 34, 34,
2482 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2489 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2483 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2490 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2484 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2491 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2485 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2492 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2486 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2493 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2487 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2494 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2488 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2495 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2489 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2496 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2490 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2497 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2491 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2498 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2492 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2499 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2493 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2500 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2494 139, 139, 139, 139, 139, 139 2501 34, 34, 34, 34, 34, 34
2495 }; 2502 };
2496 register int hval = len; 2503 return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
2497
2498 switch (hval)
2499 {
2500 default:
2501 case 3:
2502 hval += asso_values[(unsigned char)str[2]];
2503 case 2:
2504 case 1:
2505 hval += asso_values[(unsigned char)str[0]];
2506 break;
2507 }
2508 return hval;
2509} 2504}
2510 2505
2511#ifdef __GNUC__
2512__inline
2513#endif
2514static struct C_stab_entry * 2506static struct C_stab_entry *
2515in_word_set (str, len) 2507in_word_set (str, len)
2516 register const char *str; 2508 register const char *str;
2517 register unsigned int len; 2509 register unsigned int len;
2518{ 2510{
2511 enum
2512 {
2513 TOTAL_KEYWORDS = 31,
2514 MIN_WORD_LENGTH = 2,
2515 MAX_WORD_LENGTH = 15,
2516 MIN_HASH_VALUE = 3,
2517 MAX_HASH_VALUE = 33
2518 };
2519
2519 static struct C_stab_entry wordlist[] = 2520 static struct C_stab_entry wordlist[] =
2520 { 2521 {
2521 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2522 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2523 {"if", 0, st_C_ignore},
2524 {""}, {""}, {""}, {""},
2525 {"int", 0, st_C_typespec},
2526 {""}, {""},
2527 {"void", 0, st_C_typespec},
2528 {""}, {""},
2529 {"interface", C_JAVA, st_C_struct},
2530 {""},
2531 {"SYSCALL", 0, st_C_gnumacro},
2532 {""},
2533 {"return", 0, st_C_ignore},
2534 {""}, {""}, {""}, {""}, {""}, {""}, {""},
2535 {"while", 0, st_C_ignore},
2536 {"auto", 0, st_C_typespec},
2537 {""}, {""}, {""}, {""}, {""}, {""},
2538 {"float", 0, st_C_typespec},
2539 {"typedef", 0, st_C_typedef},
2540 {"typename", C_PLPL, st_C_typespec},
2541 {""}, {""}, {""}, 2522 {""}, {""}, {""},
2542 {"friend", C_PLPL, st_C_ignore}, 2523 {"if", 0, st_C_ignore},
2543 {"volatile", 0, st_C_typespec}, 2524 {"enum", 0, st_C_enum},
2544 {""}, {""}, 2525 {"@end", 0, st_C_objend},
2545 {"for", 0, st_C_ignore}, 2526 {"extern", 0, st_C_extern},
2546 {"const", 0, st_C_typespec}, 2527 {"extends", (C_JAVA & !C_PLPL), st_C_javastruct},
2547 {"import", C_JAVA, st_C_ignore}, 2528 {"for", 0, st_C_ignore},
2548 {""}, 2529 {"interface", (C_JAVA & !C_PLPL), st_C_struct},
2549 {"define", 0, st_C_define}, 2530 {"@protocol", 0, st_C_objprot},
2550 {"long", 0, st_C_typespec}, 2531 {"@interface", 0, st_C_objprot},
2551 {"implements", C_JAVA, st_C_javastruct}, 2532 {"operator", C_PLPL, st_C_operator},
2552 {"signed", 0, st_C_typespec}, 2533 {"return", 0, st_C_ignore},
2553 {""}, 2534 {"friend", C_PLPL, st_C_ignore},
2554 {"extern", 0, st_C_extern}, 2535 {"import", (C_JAVA & !C_PLPL), st_C_ignore},
2555 {"extends", C_JAVA, st_C_javastruct}, 2536 {"@implementation",0, st_C_objimpl},
2556 {""}, 2537 {"define", 0, st_C_define},
2557 {"mutable", C_PLPL, st_C_typespec}, 2538 {"package", (C_JAVA & !C_PLPL), st_C_ignore},
2558 {"template", 0, st_C_template}, 2539 {"implements", (C_JAVA & !C_PLPL), st_C_javastruct},
2559 {"short", 0, st_C_typespec}, 2540 {"namespace", C_PLPL, st_C_struct},
2560 {"bool", C_PLPL, st_C_typespec}, 2541 {"domain", C_STAR, st_C_struct},
2561 {"char", 0, st_C_typespec}, 2542 {"template", 0, st_C_template},
2562 {"class", 0, st_C_class}, 2543 {"typedef", 0, st_C_typedef},
2563 {"operator", C_PLPL, st_C_operator}, 2544 {"struct", 0, st_C_struct},
2564 {""}, 2545 {"switch", 0, st_C_ignore},
2565 {"switch", 0, st_C_ignore}, 2546 {"union", 0, st_C_struct},
2566 {""}, 2547 {"while", 0, st_C_ignore},
2567 {"ENTRY", 0, st_C_gnumacro}, 2548 {"class", 0, st_C_class},
2568 {""}, 2549 {"__attribute__", 0, st_C_attribute},
2569 {"package", C_JAVA, st_C_ignore}, 2550 {"SYSCALL", 0, st_C_gnumacro},
2570 {"union", 0, st_C_struct}, 2551 {"PSEUDO", 0, st_C_gnumacro},
2571 {"@end", 0, st_C_objend}, 2552 {"ENTRY", 0, st_C_gnumacro},
2572 {"struct", 0, st_C_struct}, 2553 {"DEFUN", 0, st_C_gnumacro}
2573 {"namespace", C_PLPL, st_C_struct},
2574 {""}, {""},
2575 {"domain", C_STAR, st_C_struct},
2576 {"@interface", 0, st_C_objprot},
2577 {"PSEUDO", 0, st_C_gnumacro},
2578 {"double", 0, st_C_typespec},
2579 {""},
2580 {"@protocol", 0, st_C_objprot},
2581 {""},
2582 {"static", 0, st_C_typespec},
2583 {""}, {""},
2584 {"DEFUN", 0, st_C_gnumacro},
2585 {""}, {""}, {""}, {""},
2586 {"explicit", C_PLPL, st_C_typespec},
2587 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2588 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2589 {""},
2590 {"enum", 0, st_C_enum},
2591 {""}, {""},
2592 {"unsigned", 0, st_C_typespec},
2593 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2594 {"@implementation",0, st_C_objimpl}
2595 }; 2554 };
2596 2555
2597 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2556 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2602,7 +2561,7 @@ in_word_set (str, len)
2602 { 2561 {
2603 register const char *s = wordlist[key].name; 2562 register const char *s = wordlist[key].name;
2604 2563
2605 if (*str == *s && !strncmp (str + 1, s + 1, len - 1)) 2564 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
2606 return &wordlist[key]; 2565 return &wordlist[key];
2607 } 2566 }
2608 } 2567 }
@@ -2625,6 +2584,11 @@ C_symtype (str, len, c_ext)
2625 2584
2626 2585
2627/* 2586/*
2587 * Ignoring __attribute__ ((list))
2588 */
2589static bool inattribute; /* looking at an __attribute__ construct */
2590
2591/*
2628 * C functions and variables are recognized using a simple 2592 * C functions and variables are recognized using a simple
2629 * finite automaton. fvdef is its state variable. 2593 * finite automaton. fvdef is its state variable.
2630 */ 2594 */
@@ -2666,10 +2630,9 @@ static enum
2666static enum 2630static enum
2667{ 2631{
2668 snone, /* nothing seen yet, 2632 snone, /* nothing seen yet,
2669 or in struct body if cblev > 0 */ 2633 or in struct body if bracelev > 0 */
2670 skeyseen, /* struct-like keyword seen */ 2634 skeyseen, /* struct-like keyword seen */
2671 stagseen, /* struct-like tag seen */ 2635 stagseen, /* struct-like tag seen */
2672 sintemplate, /* inside template (ignore) */
2673 scolonseen /* colon seen after struct-like tag */ 2636 scolonseen /* colon seen after struct-like tag */
2674} structdef; 2637} structdef;
2675 2638
@@ -2743,7 +2706,7 @@ static void write_classname __P((linebuffer *, char *qualifier));
2743 2706
2744static struct { 2707static struct {
2745 char **cname; /* nested class names */ 2708 char **cname; /* nested class names */
2746 int *cblev; /* nested class curly brace level */ 2709 int *bracelev; /* nested class brace level */
2747 int nl; /* class nesting level (elements used) */ 2710 int nl; /* class nesting level (elements used) */
2748 int size; /* length of the array */ 2711 int size; /* length of the array */
2749} cstack; /* stack for nested declaration tags */ 2712} cstack; /* stack for nested declaration tags */
@@ -2751,38 +2714,38 @@ static struct {
2751#define nestlev (cstack.nl) 2714#define nestlev (cstack.nl)
2752/* After struct keyword or in struct body, not inside a nested function. */ 2715/* After struct keyword or in struct body, not inside a nested function. */
2753#define instruct (structdef == snone && nestlev > 0 \ 2716#define instruct (structdef == snone && nestlev > 0 \
2754 && cblev == cstack.cblev[nestlev-1] + 1) 2717 && bracelev == cstack.bracelev[nestlev-1] + 1)
2755 2718
2756static void 2719static void
2757pushclass_above (cblev, str, len) 2720pushclass_above (bracelev, str, len)
2758 int cblev; 2721 int bracelev;
2759 char *str; 2722 char *str;
2760 int len; 2723 int len;
2761{ 2724{
2762 int nl; 2725 int nl;
2763 2726
2764 popclass_above (cblev); 2727 popclass_above (bracelev);
2765 nl = cstack.nl; 2728 nl = cstack.nl;
2766 if (nl >= cstack.size) 2729 if (nl >= cstack.size)
2767 { 2730 {
2768 int size = cstack.size *= 2; 2731 int size = cstack.size *= 2;
2769 xrnew (cstack.cname, size, char *); 2732 xrnew (cstack.cname, size, char *);
2770 xrnew (cstack.cblev, size, int); 2733 xrnew (cstack.bracelev, size, int);
2771 } 2734 }
2772 assert (nl == 0 || cstack.cblev[nl-1] < cblev); 2735 assert (nl == 0 || cstack.bracelev[nl-1] < bracelev);
2773 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len); 2736 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
2774 cstack.cblev[nl] = cblev; 2737 cstack.bracelev[nl] = bracelev;
2775 cstack.nl = nl + 1; 2738 cstack.nl = nl + 1;
2776} 2739}
2777 2740
2778static void 2741static void
2779popclass_above (cblev) 2742popclass_above (bracelev)
2780 int cblev; 2743 int bracelev;
2781{ 2744{
2782 int nl; 2745 int nl;
2783 2746
2784 for (nl = cstack.nl - 1; 2747 for (nl = cstack.nl - 1;
2785 nl >= 0 && cstack.cblev[nl] >= cblev; 2748 nl >= 0 && cstack.bracelev[nl] >= bracelev;
2786 nl--) 2749 nl--)
2787 { 2750 {
2788 if (cstack.cname[nl] != NULL) 2751 if (cstack.cname[nl] != NULL)
@@ -2849,269 +2812,286 @@ static void make_C_tag __P((bool));
2849 */ 2812 */
2850 2813
2851static bool 2814static bool
2852consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var) 2815consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2853 register char *str; /* IN: token pointer */ 2816 register char *str; /* IN: token pointer */
2854 register int len; /* IN: token length */ 2817 register int len; /* IN: token length */
2855 register int c; /* IN: first char after the token */ 2818 register int c; /* IN: first char after the token */
2856 int *c_extp; /* IN, OUT: C extensions mask */ 2819 int *c_extp; /* IN, OUT: C extensions mask */
2857 int cblev; /* IN: curly brace level */ 2820 int bracelev; /* IN: brace level */
2858 int parlev; /* IN: parenthesis level */ 2821 int parlev; /* IN: parenthesis level */
2859 bool *is_func_or_var; /* OUT: function or variable found */ 2822 bool *is_func_or_var; /* OUT: function or variable found */
2860{ 2823{
2861 /* When structdef is stagseen, scolonseen, or snone with cblev > 0, 2824 /* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
2862 structtype is the type of the preceding struct-like keyword, and 2825 structtype is the type of the preceding struct-like keyword, and
2863 structcblev is the curly brace level where it has been seen. */ 2826 structbracelev is the brace level where it has been seen. */
2864 static enum sym_type structtype; 2827 static enum sym_type structtype;
2865 static int structcblev; 2828 static int structbracelev;
2866 static enum sym_type toktype; 2829 static enum sym_type toktype;
2867 2830
2868 2831
2869 toktype = C_symtype (str, len, *c_extp); 2832 toktype = C_symtype (str, len, *c_extp);
2870 2833
2871 /* 2834 /*
2872 * Advance the definedef state machine. 2835 * Skip __attribute__
2873 */
2874 switch (definedef)
2875 {
2876 case dnone:
2877 /* We're not on a preprocessor line. */
2878 if (toktype == st_C_gnumacro)
2879 {
2880 fvdef = fdefunkey;
2881 return FALSE;
2882 }
2883 break;
2884 case dsharpseen:
2885 if (toktype == st_C_define)
2886 {
2887 definedef = ddefineseen;
2888 }
2889 else
2890 {
2891 definedef = dignorerest;
2892 }
2893 return FALSE;
2894 case ddefineseen:
2895 /*
2896 * Make a tag for any macro, unless it is a constant
2897 * and constantypedefs is FALSE.
2898 */
2899 definedef = dignorerest;
2900 *is_func_or_var = (c == '(');
2901 if (!*is_func_or_var && !constantypedefs)
2902 return FALSE;
2903 else
2904 return TRUE;
2905 case dignorerest:
2906 return FALSE;
2907 default:
2908 error ("internal error: definedef value.", (char *)NULL);
2909 }
2910
2911 /*
2912 * Now typedefs
2913 */
2914 switch (typdef)
2915 {
2916 case tnone:
2917 if (toktype == st_C_typedef)
2918 {
2919 if (typedefs)
2920 typdef = tkeyseen;
2921 fvextern = FALSE;
2922 fvdef = fvnone;
2923 return FALSE;
2924 }
2925 break;
2926 case tkeyseen:
2927 switch (toktype)
2928 {
2929 case st_none:
2930 case st_C_typespec:
2931 case st_C_class:
2932 case st_C_struct:
2933 case st_C_enum:
2934 typdef = ttypeseen;
2935 break;
2936 }
2937 break;
2938 case ttypeseen:
2939 if (structdef == snone && fvdef == fvnone)
2940 {
2941 fvdef = fvnameseen;
2942 return TRUE;
2943 }
2944 break;
2945 case tend:
2946 switch (toktype)
2947 {
2948 case st_C_typespec:
2949 case st_C_class:
2950 case st_C_struct:
2951 case st_C_enum:
2952 return FALSE;
2953 }
2954 return TRUE;
2955 }
2956
2957 /*
2958 * This structdef business is NOT invoked when we are ctags and the
2959 * file is plain C. This is because a struct tag may have the same
2960 * name as another tag, and this loses with ctags.
2961 */ 2836 */
2962 switch (toktype) 2837 if (toktype == st_C_attribute)
2963 {
2964 case st_C_javastruct:
2965 if (structdef == stagseen)
2966 structdef = scolonseen;
2967 return FALSE;
2968 case st_C_template:
2969 case st_C_class:
2970 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
2971 && cblev == 0
2972 && definedef == dnone && structdef == snone
2973 && typdef == tnone && fvdef == fvnone)
2974 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2975 if (toktype == st_C_template)
2976 break;
2977 /* FALLTHRU */
2978 case st_C_struct:
2979 case st_C_enum:
2980 if (parlev == 0
2981 && fvdef != vignore
2982 && (typdef == tkeyseen
2983 || (typedefs_or_cplusplus && structdef == snone)))
2984 {
2985 structdef = skeyseen;
2986 structtype = toktype;
2987 structcblev = cblev;
2988 }
2989 return FALSE;
2990 }
2991
2992 if (structdef == skeyseen)
2993 { 2838 {
2994 structdef = stagseen; 2839 inattribute = TRUE;
2995 return TRUE;
2996 }
2997
2998 if (typdef != tnone)
2999 definedef = dnone;
3000
3001 /* Detect Objective C constructs. */
3002 switch (objdef)
3003 {
3004 case onone:
3005 switch (toktype)
3006 {
3007 case st_C_objprot:
3008 objdef = oprotocol;
3009 return FALSE;
3010 case st_C_objimpl:
3011 objdef = oimplementation;
3012 return FALSE;
3013 }
3014 break;
3015 case oimplementation:
3016 /* Save the class tag for functions or variables defined inside. */
3017 objtag = savenstr (str, len);
3018 objdef = oinbody;
3019 return FALSE; 2840 return FALSE;
3020 case oprotocol: 2841 }
3021 /* Save the class tag for categories. */ 2842
3022 objtag = savenstr (str, len); 2843 /*
3023 objdef = otagseen; 2844 * Advance the definedef state machine.
3024 *is_func_or_var = TRUE; 2845 */
3025 return TRUE; 2846 switch (definedef)
3026 case oparenseen: 2847 {
3027 objdef = ocatseen; 2848 case dnone:
3028 *is_func_or_var = TRUE; 2849 /* We're not on a preprocessor line. */
3029 return TRUE; 2850 if (toktype == st_C_gnumacro)
3030 case oinbody: 2851 {
3031 break; 2852 fvdef = fdefunkey;
3032 case omethodsign: 2853 return FALSE;
3033 if (parlev == 0) 2854 }
3034 { 2855 break;
3035 objdef = omethodtag; 2856 case dsharpseen:
3036 linebuffer_setlen (&token_name, len); 2857 if (toktype == st_C_define)
3037 strncpy (token_name.buffer, str, len); 2858 {
3038 token_name.buffer[len] = '\0'; 2859 definedef = ddefineseen;
3039 return TRUE; 2860 }
3040 } 2861 else
3041 return FALSE; 2862 {
3042 case omethodcolon: 2863 definedef = dignorerest;
3043 if (parlev == 0) 2864 }
3044 objdef = omethodparm; 2865 return FALSE;
3045 return FALSE; 2866 case ddefineseen:
3046 case omethodparm: 2867 /*
3047 if (parlev == 0) 2868 * Make a tag for any macro, unless it is a constant
3048 { 2869 * and constantypedefs is FALSE.
3049 objdef = omethodtag; 2870 */
3050 linebuffer_setlen (&token_name, token_name.len + len); 2871 definedef = dignorerest;
3051 strncat (token_name.buffer, str, len); 2872 *is_func_or_var = (c == '(');
3052 return TRUE; 2873 if (!*is_func_or_var && !constantypedefs)
3053 } 2874 return FALSE;
3054 return FALSE; 2875 else
3055 case oignore: 2876 return TRUE;
3056 if (toktype == st_C_objend) 2877 case dignorerest:
3057 { 2878 return FALSE;
3058 /* Memory leakage here: the string pointed by objtag is 2879 default:
3059 never released, because many tests would be needed to 2880 error ("internal error: definedef value.", (char *)NULL);
3060 avoid breaking on incorrect input code. The amount of 2881 }
3061 memory leaked here is the sum of the lengths of the 2882
3062 class tags. 2883 /*
3063 free (objtag); */ 2884 * Now typedefs
3064 objdef = onone; 2885 */
3065 } 2886 switch (typdef)
3066 return FALSE; 2887 {
3067 } 2888 case tnone:
3068 2889 if (toktype == st_C_typedef)
3069 /* A function, variable or enum constant? */ 2890 {
3070 switch (toktype) 2891 if (typedefs)
3071 { 2892 typdef = tkeyseen;
3072 case st_C_extern: 2893 fvextern = FALSE;
3073 fvextern = TRUE; 2894 fvdef = fvnone;
3074 /* FALLTHRU */ 2895 return FALSE;
3075 case st_C_typespec: 2896 }
3076 switch (fvdef) 2897 break;
3077 { 2898 case tkeyseen:
3078 case finlist: 2899 switch (toktype)
3079 case flistseen: 2900 {
3080 case fignore: 2901 case st_none:
3081 case vignore: 2902 case st_C_class:
3082 break; 2903 case st_C_struct:
3083 default: 2904 case st_C_enum:
3084 fvdef = fvnone; 2905 typdef = ttypeseen;
3085 } 2906 }
3086 return FALSE; 2907 break;
3087 case st_C_ignore: 2908 case ttypeseen:
3088 fvextern = FALSE; 2909 if (structdef == snone && fvdef == fvnone)
3089 fvdef = vignore; 2910 {
3090 return FALSE; 2911 fvdef = fvnameseen;
3091 case st_C_operator: 2912 return TRUE;
3092 fvdef = foperator; 2913 }
3093 *is_func_or_var = TRUE; 2914 break;
3094 return TRUE; 2915 case tend:
3095 case st_none: 2916 switch (toktype)
3096 if (constantypedefs 2917 {
3097 && structdef == snone 2918 case st_C_class:
3098 && structtype == st_C_enum && cblev > structcblev) 2919 case st_C_struct:
3099 return TRUE; /* enum constant */ 2920 case st_C_enum:
3100 switch (fvdef) 2921 return FALSE;
3101 { 2922 }
3102 case fdefunkey: 2923 return TRUE;
3103 if (cblev > 0) 2924 }
3104 break; 2925
3105 fvdef = fdefunname; /* GNU macro */ 2926 /*
3106 *is_func_or_var = TRUE; 2927 * This structdef business is NOT invoked when we are ctags and the
3107 return TRUE; 2928 * file is plain C. This is because a struct tag may have the same
3108 case fvnone: 2929 * name as another tag, and this loses with ctags.
3109 if ((strneq (str, "asm", 3) && endtoken (str[3])) 2930 */
3110 || (strneq (str, "__asm__", 7) && endtoken (str[7]))) 2931 switch (toktype)
3111 { 2932 {
3112 fvdef = vignore; 2933 case st_C_javastruct:
3113 return FALSE; 2934 if (structdef == stagseen)
3114 } 2935 structdef = scolonseen;
2936 return FALSE;
2937 case st_C_template:
2938 case st_C_class:
2939 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
2940 && bracelev == 0
2941 && definedef == dnone && structdef == snone
2942 && typdef == tnone && fvdef == fvnone)
2943 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2944 if (toktype == st_C_template)
2945 break;
2946 /* FALLTHRU */
2947 case st_C_struct:
2948 case st_C_enum:
2949 if (parlev == 0
2950 && fvdef != vignore
2951 && (typdef == tkeyseen
2952 || (typedefs_or_cplusplus && structdef == snone)))
2953 {
2954 structdef = skeyseen;
2955 structtype = toktype;
2956 structbracelev = bracelev;
2957 if (fvdef == fvnameseen)
2958 fvdef = fvnone;
2959 }
2960 return FALSE;
2961 }
2962
2963 if (structdef == skeyseen)
2964 {
2965 structdef = stagseen;
2966 return TRUE;
2967 }
2968
2969 if (typdef != tnone)
2970 definedef = dnone;
2971
2972 /* Detect Objective C constructs. */
2973 switch (objdef)
2974 {
2975 case onone:
2976 switch (toktype)
2977 {
2978 case st_C_objprot:
2979 objdef = oprotocol;
2980 return FALSE;
2981 case st_C_objimpl:
2982 objdef = oimplementation;
2983 return FALSE;
2984 }
2985 break;
2986 case oimplementation:
2987 /* Save the class tag for functions or variables defined inside. */
2988 objtag = savenstr (str, len);
2989 objdef = oinbody;
2990 return FALSE;
2991 case oprotocol:
2992 /* Save the class tag for categories. */
2993 objtag = savenstr (str, len);
2994 objdef = otagseen;
2995 *is_func_or_var = TRUE;
2996 return TRUE;
2997 case oparenseen:
2998 objdef = ocatseen;
2999 *is_func_or_var = TRUE;
3000 return TRUE;
3001 case oinbody:
3002 break;
3003 case omethodsign:
3004 if (parlev == 0)
3005 {
3006 fvdef = fvnone;
3007 objdef = omethodtag;
3008 linebuffer_setlen (&token_name, len);
3009 strncpy (token_name.buffer, str, len);
3010 token_name.buffer[len] = '\0';
3011 return TRUE;
3012 }
3013 return FALSE;
3014 case omethodcolon:
3015 if (parlev == 0)
3016 objdef = omethodparm;
3017 return FALSE;
3018 case omethodparm:
3019 if (parlev == 0)
3020 {
3021 fvdef = fvnone;
3022 objdef = omethodtag;
3023 linebuffer_setlen (&token_name, token_name.len + len);
3024 strncat (token_name.buffer, str, len);
3025 return TRUE;
3026 }
3027 return FALSE;
3028 case oignore:
3029 if (toktype == st_C_objend)
3030 {
3031 /* Memory leakage here: the string pointed by objtag is
3032 never released, because many tests would be needed to
3033 avoid breaking on incorrect input code. The amount of
3034 memory leaked here is the sum of the lengths of the
3035 class tags.
3036 free (objtag); */
3037 objdef = onone;
3038 }
3039 return FALSE;
3040 }
3041
3042 /* A function, variable or enum constant? */
3043 switch (toktype)
3044 {
3045 case st_C_extern:
3046 fvextern = TRUE;
3047 switch (fvdef)
3048 {
3049 case finlist:
3050 case flistseen:
3051 case fignore:
3052 case vignore:
3053 break;
3054 default:
3055 fvdef = fvnone;
3056 }
3057 return FALSE;
3058 case st_C_ignore:
3059 fvextern = FALSE;
3060 fvdef = vignore;
3061 return FALSE;
3062 case st_C_operator:
3063 fvdef = foperator;
3064 *is_func_or_var = TRUE;
3065 return TRUE;
3066 case st_none:
3067 if (constantypedefs
3068 && structdef == snone
3069 && structtype == st_C_enum && bracelev > structbracelev)
3070 return TRUE; /* enum constant */
3071 switch (fvdef)
3072 {
3073 case fdefunkey:
3074 if (bracelev > 0)
3075 break;
3076 fvdef = fdefunname; /* GNU macro */
3077 *is_func_or_var = TRUE;
3078 return TRUE;
3079 case fvnone:
3080 switch (typdef)
3081 {
3082 case ttypeseen:
3083 return FALSE;
3084 case tnone:
3085 if ((strneq (str, "asm", 3) && endtoken (str[3]))
3086 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
3087 {
3088 fvdef = vignore;
3089 return FALSE;
3090 }
3091 break;
3092 }
3093 /* FALLTHRU */
3094 case fvnameseen:
3115 if (len >= 10 && strneq (str+len-10, "::operator", 10)) 3095 if (len >= 10 && strneq (str+len-10, "::operator", 10))
3116 { 3096 {
3117 if (*c_extp & C_AUTO) /* automatic detection of C++ */ 3097 if (*c_extp & C_AUTO) /* automatic detection of C++ */
@@ -3120,7 +3100,7 @@ consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
3120 *is_func_or_var = TRUE; 3100 *is_func_or_var = TRUE;
3121 return TRUE; 3101 return TRUE;
3122 } 3102 }
3123 if (cblev > 0 && !instruct) 3103 if (bracelev > 0 && !instruct)
3124 break; 3104 break;
3125 fvdef = fvnameseen; /* function or variable */ 3105 fvdef = fvnameseen; /* function or variable */
3126 *is_func_or_var = TRUE; 3106 *is_func_or_var = TRUE;
@@ -3216,9 +3196,12 @@ C_entries (c_ext, inf)
3216 register int toklen; /* length of current token */ 3196 register int toklen; /* length of current token */
3217 char *qualifier; /* string used to qualify names */ 3197 char *qualifier; /* string used to qualify names */
3218 int qlen; /* length of qualifier */ 3198 int qlen; /* length of qualifier */
3219 int cblev; /* current curly brace level */ 3199 int bracelev; /* current brace level */
3200 int bracketlev; /* current bracket level */
3220 int parlev; /* current parenthesis level */ 3201 int parlev; /* current parenthesis level */
3221 int typdefcblev; /* cblev where a typedef struct body begun */ 3202 int attrparlev; /* __attribute__ parenthesis level */
3203 int templatelev; /* current template level */
3204 int typdefbracelev; /* bracelev where a typedef struct body begun */
3222 bool incomm, inquote, inchar, quotednl, midtoken; 3205 bool incomm, inquote, inchar, quotednl, midtoken;
3223 bool yacc_rules; /* in the rules part of a yacc file */ 3206 bool yacc_rules; /* in the rules part of a yacc file */
3224 struct tok savetoken; /* token saved during preprocessor handling */ 3207 struct tok savetoken; /* token saved during preprocessor handling */
@@ -3231,10 +3214,10 @@ C_entries (c_ext, inf)
3231 cstack.size = (DEBUG) ? 1 : 4; 3214 cstack.size = (DEBUG) ? 1 : 4;
3232 cstack.nl = 0; 3215 cstack.nl = 0;
3233 cstack.cname = xnew (cstack.size, char *); 3216 cstack.cname = xnew (cstack.size, char *);
3234 cstack.cblev = xnew (cstack.size, int); 3217 cstack.bracelev = xnew (cstack.size, int);
3235 } 3218 }
3236 3219
3237 tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */ 3220 tokoff = toklen = typdefbracelev = 0; /* keep compiler quiet */
3238 curndx = newndx = 0; 3221 curndx = newndx = 0;
3239 lp = curlb.buffer; 3222 lp = curlb.buffer;
3240 *lp = 0; 3223 *lp = 0;
@@ -3244,8 +3227,7 @@ C_entries (c_ext, inf)
3244 yacc_rules = FALSE; 3227 yacc_rules = FALSE;
3245 midtoken = inquote = inchar = incomm = quotednl = FALSE; 3228 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3246 token.valid = savetoken.valid = FALSE; 3229 token.valid = savetoken.valid = FALSE;
3247 cblev = 0; 3230 bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
3248 parlev = 0;
3249 if (cjava) 3231 if (cjava)
3250 { qualifier = "."; qlen = 1; } 3232 { qualifier = "."; qlen = 1; }
3251 else 3233 else
@@ -3257,8 +3239,8 @@ C_entries (c_ext, inf)
3257 c = *lp++; 3239 c = *lp++;
3258 if (c == '\\') 3240 if (c == '\\')
3259 { 3241 {
3260 /* If we're at the end of the line, the next character is a 3242 /* If we are at the end of the line, the next character is a
3261 '\0'; don't skip it, because it's the thing that tells us 3243 '\0'; do not skip it, because it is what tells us
3262 to read the next line. */ 3244 to read the next line. */
3263 if (*lp == '\0') 3245 if (*lp == '\0')
3264 { 3246 {
@@ -3317,95 +3299,115 @@ C_entries (c_ext, inf)
3317 } 3299 }
3318 continue; 3300 continue;
3319 } 3301 }
3320 else 3302 else if (bracketlev > 0)
3321 switch (c) 3303 {
3322 { 3304 switch (c)
3323 case '"': 3305 {
3324 inquote = TRUE; 3306 case ']':
3325 switch (fvdef) 3307 if (--bracketlev > 0)
3326 {
3327 case fdefunkey:
3328 case fstartlist:
3329 case finlist:
3330 case fignore:
3331 case vignore:
3332 break;
3333 default:
3334 fvextern = FALSE;
3335 fvdef = fvnone;
3336 }
3337 continue;
3338 case '\'':
3339 inchar = TRUE;
3340 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3341 {
3342 fvextern = FALSE;
3343 fvdef = fvnone;
3344 }
3345 continue;
3346 case '/':
3347 if (*lp == '*')
3348 {
3349 lp++;
3350 incomm = TRUE;
3351 continue; 3308 continue;
3352 }
3353 else if (/* cplpl && */ *lp == '/')
3354 {
3355 c = '\0';
3356 break;
3357 }
3358 else
3359 break; 3309 break;
3360 case '%': 3310 case '\0':
3361 if ((c_ext & YACC) && *lp == '%') 3311 CNL_SAVE_DEFINEDEF ();
3362 {
3363 /* Entering or exiting rules section in yacc file. */
3364 lp++;
3365 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3366 typdef = tnone; structdef = snone;
3367 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3368 cblev = 0;
3369 yacc_rules = !yacc_rules;
3370 continue;
3371 }
3372 else
3373 break; 3312 break;
3374 case '#': 3313 }
3375 if (definedef == dnone) 3314 continue;
3376 { 3315 }
3377 char *cp; 3316 else switch (c)
3378 bool cpptoken = TRUE; 3317 {
3379 3318 case '"':
3380 /* Look back on this line. If all blanks, or nonblanks 3319 inquote = TRUE;
3381 followed by an end of comment, this is a preprocessor 3320 if (inattribute)
3382 token. */ 3321 break;
3383 for (cp = newlb.buffer; cp < lp-1; cp++) 3322 switch (fvdef)
3384 if (!iswhite (*cp)) 3323 {
3385 { 3324 case fdefunkey:
3386 if (*cp == '*' && *(cp+1) == '/') 3325 case fstartlist:
3387 { 3326 case finlist:
3388 cp++; 3327 case fignore:
3389 cpptoken = TRUE; 3328 case vignore:
3390 } 3329 break;
3391 else 3330 default:
3392 cpptoken = FALSE; 3331 fvextern = FALSE;
3393 } 3332 fvdef = fvnone;
3394 if (cpptoken) 3333 }
3395 definedef = dsharpseen; 3334 continue;
3396 } /* if (definedef == dnone) */ 3335 case '\'':
3397 3336 inchar = TRUE;
3337 if (inattribute)
3338 break;
3339 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3340 {
3341 fvextern = FALSE;
3342 fvdef = fvnone;
3343 }
3344 continue;
3345 case '/':
3346 if (*lp == '*')
3347 {
3348 lp++;
3349 incomm = TRUE;
3350 continue;
3351 }
3352 else if (/* cplpl && */ *lp == '/')
3353 {
3354 c = '\0';
3355 break;
3356 }
3357 else
3358 break;
3359 case '%':
3360 if ((c_ext & YACC) && *lp == '%')
3361 {
3362 /* Entering or exiting rules section in yacc file. */
3363 lp++;
3364 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3365 typdef = tnone; structdef = snone;
3366 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3367 bracelev = 0;
3368 yacc_rules = !yacc_rules;
3369 continue;
3370 }
3371 else
3372 break;
3373 case '#':
3374 if (definedef == dnone)
3375 {
3376 char *cp;
3377 bool cpptoken = TRUE;
3378
3379 /* Look back on this line. If all blanks, or nonblanks
3380 followed by an end of comment, this is a preprocessor
3381 token. */
3382 for (cp = newlb.buffer; cp < lp-1; cp++)
3383 if (!iswhite (*cp))
3384 {
3385 if (*cp == '*' && *(cp+1) == '/')
3386 {
3387 cp++;
3388 cpptoken = TRUE;
3389 }
3390 else
3391 cpptoken = FALSE;
3392 }
3393 if (cpptoken)
3394 definedef = dsharpseen;
3395 } /* if (definedef == dnone) */
3396 continue;
3397 case '[':
3398 bracketlev++;
3398 continue; 3399 continue;
3399 } /* switch (c) */ 3400 } /* switch (c) */
3400 3401
3401 3402
3402 /* Consider token only if some involved conditions are satisfied. */ 3403 /* Consider token only if some involved conditions are satisfied. */
3403 if (typdef != tignore 3404 if (typdef != tignore
3404 && definedef != dignorerest 3405 && definedef != dignorerest
3405 && fvdef != finlist 3406 && fvdef != finlist
3406 && structdef != sintemplate 3407 && templatelev == 0
3407 && (definedef != dnone 3408 && (definedef != dnone
3408 || structdef != scolonseen)) 3409 || structdef != scolonseen)
3410 && !inattribute)
3409 { 3411 {
3410 if (midtoken) 3412 if (midtoken)
3411 { 3413 {
@@ -3429,7 +3431,8 @@ C_entries (c_ext, inf)
3429 3431
3430 if (yacc_rules 3432 if (yacc_rules
3431 || consider_token (newlb.buffer + tokoff, toklen, c, 3433 || consider_token (newlb.buffer + tokoff, toklen, c,
3432 &c_ext, cblev, parlev, &funorvar)) 3434 &c_ext, bracelev, parlev,
3435 &funorvar))
3433 { 3436 {
3434 if (fvdef == foperator) 3437 if (fvdef == foperator)
3435 { 3438 {
@@ -3514,7 +3517,7 @@ C_entries (c_ext, inf)
3514 || (funorvar 3517 || (funorvar
3515 && definedef == dnone 3518 && definedef == dnone
3516 && structdef == snone 3519 && structdef == snone
3517 && cblev > 0)); 3520 && bracelev > 0));
3518 } 3521 }
3519 token.lineno = lineno; 3522 token.lineno = lineno;
3520 token.offset = tokoff; 3523 token.offset = tokoff;
@@ -3539,6 +3542,16 @@ C_entries (c_ext, inf)
3539 || instruct) 3542 || instruct)
3540 make_C_tag (funorvar); 3543 make_C_tag (funorvar);
3541 } 3544 }
3545 else /* not yacc and consider_token failed */
3546 {
3547 if (inattribute && fvdef == fignore)
3548 {
3549 /* We have just met __attribute__ after a
3550 function parameter list: do not tag the
3551 function again. */
3552 fvdef = fvnone;
3553 }
3554 }
3542 midtoken = FALSE; 3555 midtoken = FALSE;
3543 } 3556 }
3544 } /* if (endtoken (c)) */ 3557 } /* if (endtoken (c)) */
@@ -3557,6 +3570,9 @@ C_entries (c_ext, inf)
3557 switch (fvdef) 3570 switch (fvdef)
3558 { 3571 {
3559 case fstartlist: 3572 case fstartlist:
3573 /* This prevents tagging fb in
3574 void (__attribute__((noreturn)) *fb) (void);
3575 Fixing this is not easy and not very important. */
3560 fvdef = finlist; 3576 fvdef = finlist;
3561 continue; 3577 continue;
3562 case flistseen: 3578 case flistseen:
@@ -3566,13 +3582,10 @@ C_entries (c_ext, inf)
3566 fvdef = fignore; 3582 fvdef = fignore;
3567 } 3583 }
3568 break; 3584 break;
3569 case fvnameseen:
3570 fvdef = fvnone;
3571 break;
3572 } 3585 }
3573 if (structdef == stagseen && !cjava) 3586 if (structdef == stagseen && !cjava)
3574 { 3587 {
3575 popclass_above (cblev); 3588 popclass_above (bracelev);
3576 structdef = snone; 3589 structdef = snone;
3577 } 3590 }
3578 break; 3591 break;
@@ -3596,6 +3609,8 @@ C_entries (c_ext, inf)
3596 switch (c) 3609 switch (c)
3597 { 3610 {
3598 case ':': 3611 case ':':
3612 if (inattribute)
3613 break;
3599 if (yacc_rules && token.offset == 0 && token.valid) 3614 if (yacc_rules && token.offset == 0 && token.valid)
3600 { 3615 {
3601 make_C_tag (FALSE); /* a yacc function */ 3616 make_C_tag (FALSE); /* a yacc function */
@@ -3630,7 +3645,7 @@ C_entries (c_ext, inf)
3630 } 3645 }
3631 break; 3646 break;
3632 case ';': 3647 case ';':
3633 if (definedef != dnone) 3648 if (definedef != dnone || inattribute)
3634 break; 3649 break;
3635 switch (typdef) 3650 switch (typdef)
3636 { 3651 {
@@ -3650,7 +3665,7 @@ C_entries (c_ext, inf)
3650 fvdef = fvnone; 3665 fvdef = fvnone;
3651 break; 3666 break;
3652 case fvnameseen: 3667 case fvnameseen:
3653 if ((globals && cblev == 0 && (!fvextern || declarations)) 3668 if ((globals && bracelev == 0 && (!fvextern || declarations))
3654 || (members && instruct)) 3669 || (members && instruct))
3655 make_C_tag (FALSE); /* a variable */ 3670 make_C_tag (FALSE); /* a variable */
3656 fvextern = FALSE; 3671 fvextern = FALSE;
@@ -3658,9 +3673,12 @@ C_entries (c_ext, inf)
3658 token.valid = FALSE; 3673 token.valid = FALSE;
3659 break; 3674 break;
3660 case flistseen: 3675 case flistseen:
3661 if (declarations 3676 if ((declarations
3662 && (typdef == tnone || (typdef != tignore && instruct))) 3677 && (cplpl || !instruct)
3663 make_C_tag (TRUE); /* a function declaration */ 3678 && (typdef == tnone || (typdef != tignore && instruct)))
3679 || (members
3680 && plainc && instruct))
3681 make_C_tag (TRUE); /* a function */
3664 /* FALLTHRU */ 3682 /* FALLTHRU */
3665 default: 3683 default:
3666 fvextern = FALSE; 3684 fvextern = FALSE;
@@ -3680,7 +3698,7 @@ C_entries (c_ext, inf)
3680 structdef = snone; 3698 structdef = snone;
3681 break; 3699 break;
3682 case ',': 3700 case ',':
3683 if (definedef != dnone) 3701 if (definedef != dnone || inattribute)
3684 break; 3702 break;
3685 switch (objdef) 3703 switch (objdef)
3686 { 3704 {
@@ -3702,16 +3720,20 @@ C_entries (c_ext, inf)
3702 case fdefunname: 3720 case fdefunname:
3703 fvdef = fignore; 3721 fvdef = fignore;
3704 break; 3722 break;
3705 case fvnameseen: /* a variable */ 3723 case fvnameseen:
3706 if ((globals && cblev == 0 && (!fvextern || declarations)) 3724 if (parlev == 0
3707 || (members && instruct)) 3725 && ((globals
3708 make_C_tag (FALSE); 3726 && bracelev == 0
3727 && templatelev == 0
3728 && (!fvextern || declarations))
3729 || (members && instruct)))
3730 make_C_tag (FALSE); /* a variable */
3709 break; 3731 break;
3710 case flistseen: /* a function */ 3732 case flistseen:
3711 if ((declarations && typdef == tnone && !instruct) 3733 if ((declarations && typdef == tnone && !instruct)
3712 || (members && typdef != tignore && instruct)) 3734 || (members && typdef != tignore && instruct))
3713 { 3735 {
3714 make_C_tag (TRUE); /* a function declaration */ 3736 make_C_tag (TRUE); /* a function */
3715 fvdef = fvnameseen; 3737 fvdef = fvnameseen;
3716 } 3738 }
3717 else if (!declarations) 3739 else if (!declarations)
@@ -3724,8 +3746,8 @@ C_entries (c_ext, inf)
3724 if (structdef == stagseen) 3746 if (structdef == stagseen)
3725 structdef = snone; 3747 structdef = snone;
3726 break; 3748 break;
3727 case '[': 3749 case ']':
3728 if (definedef != dnone) 3750 if (definedef != dnone || inattribute)
3729 break; 3751 break;
3730 if (structdef == stagseen) 3752 if (structdef == stagseen)
3731 structdef = snone; 3753 structdef = snone;
@@ -3746,8 +3768,8 @@ C_entries (c_ext, inf)
3746 case vignore: 3768 case vignore:
3747 break; 3769 break;
3748 case fvnameseen: 3770 case fvnameseen:
3749 if ((members && cblev == 1) 3771 if ((members && bracelev == 1)
3750 || (globals && cblev == 0 3772 || (globals && bracelev == 0
3751 && (!fvextern || declarations))) 3773 && (!fvextern || declarations)))
3752 make_C_tag (FALSE); /* a variable */ 3774 make_C_tag (FALSE); /* a variable */
3753 /* FALLTHRU */ 3775 /* FALLTHRU */
@@ -3758,6 +3780,11 @@ C_entries (c_ext, inf)
3758 } 3780 }
3759 break; 3781 break;
3760 case '(': 3782 case '(':
3783 if (inattribute)
3784 {
3785 attrparlev++;
3786 break;
3787 }
3761 if (definedef != dnone) 3788 if (definedef != dnone)
3762 break; 3789 break;
3763 if (objdef == otagseen && parlev == 0) 3790 if (objdef == otagseen && parlev == 0)
@@ -3787,6 +3814,12 @@ C_entries (c_ext, inf)
3787 parlev++; 3814 parlev++;
3788 break; 3815 break;
3789 case ')': 3816 case ')':
3817 if (inattribute)
3818 {
3819 if (--attrparlev == 0)
3820 inattribute = FALSE;
3821 break;
3822 }
3790 if (definedef != dnone) 3823 if (definedef != dnone)
3791 break; 3824 break;
3792 if (objdef == ocatseen && parlev == 1) 3825 if (objdef == ocatseen && parlev == 1)
@@ -3820,9 +3853,9 @@ C_entries (c_ext, inf)
3820 if (typdef == ttypeseen) 3853 if (typdef == ttypeseen)
3821 { 3854 {
3822 /* Whenever typdef is set to tinbody (currently only 3855 /* Whenever typdef is set to tinbody (currently only
3823 here), typdefcblev should be set to cblev. */ 3856 here), typdefbracelev should be set to bracelev. */
3824 typdef = tinbody; 3857 typdef = tinbody;
3825 typdefcblev = cblev; 3858 typdefbracelev = bracelev;
3826 } 3859 }
3827 switch (fvdef) 3860 switch (fvdef)
3828 { 3861 {
@@ -3846,26 +3879,26 @@ C_entries (c_ext, inf)
3846 break; 3879 break;
3847 default: 3880 default:
3848 /* Neutralize `extern "C" {' grot. */ 3881 /* Neutralize `extern "C" {' grot. */
3849 if (cblev == 0 && structdef == snone && nestlev == 0 3882 if (bracelev == 0 && structdef == snone && nestlev == 0
3850 && typdef == tnone) 3883 && typdef == tnone)
3851 cblev = -1; 3884 bracelev = -1;
3852 } 3885 }
3853 break; 3886 break;
3854 } 3887 }
3855 switch (structdef) 3888 switch (structdef)
3856 { 3889 {
3857 case skeyseen: /* unnamed struct */ 3890 case skeyseen: /* unnamed struct */
3858 pushclass_above (cblev, NULL, 0); 3891 pushclass_above (bracelev, NULL, 0);
3859 structdef = snone; 3892 structdef = snone;
3860 break; 3893 break;
3861 case stagseen: /* named struct or enum */ 3894 case stagseen: /* named struct or enum */
3862 case scolonseen: /* a class */ 3895 case scolonseen: /* a class */
3863 pushclass_above (cblev, token.line+token.offset, token.length); 3896 pushclass_above (bracelev,token.line+token.offset, token.length);
3864 structdef = snone; 3897 structdef = snone;
3865 make_C_tag (FALSE); /* a struct or enum */ 3898 make_C_tag (FALSE); /* a struct or enum */
3866 break; 3899 break;
3867 } 3900 }
3868 cblev++; 3901 bracelev++;
3869 break; 3902 break;
3870 case '*': 3903 case '*':
3871 if (definedef != dnone) 3904 if (definedef != dnone)
@@ -3881,21 +3914,21 @@ C_entries (c_ext, inf)
3881 break; 3914 break;
3882 if (!ignoreindent && lp == newlb.buffer + 1) 3915 if (!ignoreindent && lp == newlb.buffer + 1)
3883 { 3916 {
3884 if (cblev != 0) 3917 if (bracelev != 0)
3885 token.valid = FALSE; 3918 token.valid = FALSE;
3886 cblev = 0; /* reset curly brace level if first column */ 3919 bracelev = 0; /* reset brace level if first column */
3887 parlev = 0; /* also reset paren level, just in case... */ 3920 parlev = 0; /* also reset paren level, just in case... */
3888 } 3921 }
3889 else if (cblev > 0) 3922 else if (bracelev > 0)
3890 cblev--; 3923 bracelev--;
3891 else 3924 else
3892 token.valid = FALSE; /* something gone amiss, token unreliable */ 3925 token.valid = FALSE; /* something gone amiss, token unreliable */
3893 popclass_above (cblev); 3926 popclass_above (bracelev);
3894 structdef = snone; 3927 structdef = snone;
3895 /* Only if typdef == tinbody is typdefcblev significant. */ 3928 /* Only if typdef == tinbody is typdefbracelev significant. */
3896 if (typdef == tinbody && cblev <= typdefcblev) 3929 if (typdef == tinbody && bracelev <= typdefbracelev)
3897 { 3930 {
3898 assert (cblev == typdefcblev); 3931 assert (bracelev == typdefbracelev);
3899 typdef = tend; 3932 typdef = tend;
3900 } 3933 }
3901 break; 3934 break;
@@ -3910,8 +3943,8 @@ C_entries (c_ext, inf)
3910 case vignore: 3943 case vignore:
3911 break; 3944 break;
3912 case fvnameseen: 3945 case fvnameseen:
3913 if ((members && cblev == 1) 3946 if ((members && bracelev == 1)
3914 || (globals && cblev == 0 && (!fvextern || declarations))) 3947 || (globals && bracelev == 0 && (!fvextern || declarations)))
3915 make_C_tag (FALSE); /* a variable */ 3948 make_C_tag (FALSE); /* a variable */
3916 /* FALLTHRU */ 3949 /* FALLTHRU */
3917 default: 3950 default:
@@ -3919,30 +3952,31 @@ C_entries (c_ext, inf)
3919 } 3952 }
3920 break; 3953 break;
3921 case '<': 3954 case '<':
3922 if (cplpl && structdef == stagseen) 3955 if (cplpl
3956 && (structdef == stagseen || fvdef == fvnameseen))
3923 { 3957 {
3924 structdef = sintemplate; 3958 templatelev++;
3925 break; 3959 break;
3926 } 3960 }
3927 goto resetfvdef; 3961 goto resetfvdef;
3928 case '>': 3962 case '>':
3929 if (structdef == sintemplate) 3963 if (templatelev > 0)
3930 { 3964 {
3931 structdef = stagseen; 3965 templatelev--;
3932 break; 3966 break;
3933 } 3967 }
3934 goto resetfvdef; 3968 goto resetfvdef;
3935 case '+': 3969 case '+':
3936 case '-': 3970 case '-':
3937 if (objdef == oinbody && cblev == 0) 3971 if (objdef == oinbody && bracelev == 0)
3938 { 3972 {
3939 objdef = omethodsign; 3973 objdef = omethodsign;
3940 break; 3974 break;
3941 } 3975 }
3942 /* FALLTHRU */ 3976 /* FALLTHRU */
3943 resetfvdef: 3977 resetfvdef:
3944 case '#': case '~': case '&': case '%': case '/': case '|': 3978 case '#': case '~': case '&': case '%': case '/':
3945 case '^': case '!': case '.': case '?': case ']': 3979 case '|': case '^': case '!': case '.': case '?':
3946 if (definedef != dnone) 3980 if (definedef != dnone)
3947 break; 3981 break;
3948 /* These surely cannot follow a function tag in C. */ 3982 /* These surely cannot follow a function tag in C. */
@@ -4894,6 +4928,31 @@ Lisp_functions (inf)
4894 4928
4895 4929
4896/* 4930/*
4931 * Lua script language parsing
4932 * Original code by David A. Capello <dacap@users.sourceforge.net> (2004)
4933 *
4934 * "function" and "local function" are tags if they start at column 1.
4935 */
4936static void
4937Lua_functions (inf)
4938 FILE *inf;
4939{
4940 register char *bp;
4941
4942 LOOP_ON_INPUT_LINES (inf, lb, bp)
4943 {
4944 if (bp[0] != 'f' && bp[0] != 'l')
4945 continue;
4946
4947 LOOKING_AT (bp, "local"); /* skip possible "local" */
4948
4949 if (LOOKING_AT (bp, "function"))
4950 get_tag (bp, NULL);
4951 }
4952}
4953
4954
4955/*
4897 * Postscript tag functions 4956 * Postscript tag functions
4898 * Just look for lines where the first character is '/' 4957 * Just look for lines where the first character is '/'
4899 * Also look at "defineps" for PSWrap 4958 * Also look at "defineps" for PSWrap