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