diff options
| author | Kevin Ryde | 2012-12-01 09:22:28 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-12-01 09:22:28 +0800 |
| commit | 00054d2199d929eb224ae62dec2e55608ff1c07f (patch) | |
| tree | cbd9761c40dddbc55d54d3a02476300714728951 | |
| parent | f64898abf40b09990c4974c921ddc2ebc698609a (diff) | |
| download | emacs-00054d2199d929eb224ae62dec2e55608ff1c07f.tar.gz emacs-00054d2199d929eb224ae62dec2e55608ff1c07f.zip | |
* lib-src/etags.c (Perl_functions): Support "use constant".
* doc/emacs/maintaining.texi (Tag Syntax): Mention Perl's "use constant".
Fixes: debbugs:5055
| -rw-r--r-- | doc/emacs/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/emacs/maintaining.texi | 10 | ||||
| -rw-r--r-- | lib-src/ChangeLog | 4 | ||||
| -rw-r--r-- | lib-src/etags.c | 21 |
4 files changed, 31 insertions, 8 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 5c4ae2e1ee0..fd543789751 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-01 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * maintaining.texi (Tag Syntax): Mention Perl's "use constant". | ||
| 4 | |||
| 1 | 2012-11-24 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2012-11-24 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | * doclicense.texi, gpl.texi: Update to latest version from FSF. | 7 | * doclicense.texi, gpl.texi: Update to latest version from FSF. |
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 67214bde22c..06680a6b4e3 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -1766,11 +1766,11 @@ the file. | |||
| 1766 | 1766 | ||
| 1767 | @item | 1767 | @item |
| 1768 | In Perl code, the tags are the packages, subroutines and variables | 1768 | In Perl code, the tags are the packages, subroutines and variables |
| 1769 | defined by the @code{package}, @code{sub}, @code{my} and @code{local} | 1769 | defined by the @code{package}, @code{sub}, @code{use constant}, |
| 1770 | keywords. Use @samp{--globals} if you want to tag global variables. | 1770 | @code{my}, and @code{local} keywords. Use @samp{--globals} if you |
| 1771 | Tags for subroutines are named @samp{@var{package}::@var{sub}}. The | 1771 | want to tag global variables. Tags for subroutines are named |
| 1772 | name for subroutines defined in the default package is | 1772 | @samp{@var{package}::@var{sub}}. The name for subroutines defined in |
| 1773 | @samp{main::@var{sub}}. | 1773 | the default package is @samp{main::@var{sub}}. |
| 1774 | 1774 | ||
| 1775 | @item | 1775 | @item |
| 1776 | In PHP code, tags are functions, classes and defines. Vars are tags | 1776 | In PHP code, tags are functions, classes and defines. Vars are tags |
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index a74d4b90b9f..294661a6cb3 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-12-01 Kevin Ryde <user42@zip.com.au> | ||
| 2 | |||
| 3 | * etags.c (Perl_functions): Support "use constant" (Bug#5055). | ||
| 4 | |||
| 1 | 2012-11-27 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2012-11-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968). | 7 | Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968). |
diff --git a/lib-src/etags.c b/lib-src/etags.c index b6af17b8edf..ec185c9819f 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -4269,6 +4269,7 @@ Asm_labels (FILE *inf) | |||
| 4269 | /* | 4269 | /* |
| 4270 | * Perl support | 4270 | * Perl support |
| 4271 | * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ | 4271 | * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ |
| 4272 | * /^use constant[ \t\n]+[^ \t\n{=,;]+/ | ||
| 4272 | * Perl variable names: /^(my|local).../ | 4273 | * Perl variable names: /^(my|local).../ |
| 4273 | * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) | 4274 | * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) |
| 4274 | * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) | 4275 | * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) |
| @@ -4291,9 +4292,10 @@ Perl_functions (FILE *inf) | |||
| 4291 | } | 4292 | } |
| 4292 | else if (LOOKING_AT (cp, "sub")) | 4293 | else if (LOOKING_AT (cp, "sub")) |
| 4293 | { | 4294 | { |
| 4294 | char *pos; | 4295 | char *pos, *sp; |
| 4295 | char *sp = cp; | ||
| 4296 | 4296 | ||
| 4297 | subr: | ||
| 4298 | sp = cp; | ||
| 4297 | while (!notinname (*cp)) | 4299 | while (!notinname (*cp)) |
| 4298 | cp++; | 4300 | cp++; |
| 4299 | if (cp == sp) | 4301 | if (cp == sp) |
| @@ -4316,8 +4318,21 @@ Perl_functions (FILE *inf) | |||
| 4316 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); | 4318 | lb.buffer, cp - lb.buffer + 1, lineno, linecharno); |
| 4317 | free (name); | 4319 | free (name); |
| 4318 | } | 4320 | } |
| 4321 | } | ||
| 4322 | else if (LOOKING_AT (cp, "use constant") | ||
| 4323 | || LOOKING_AT (cp, "use constant::defer")) | ||
| 4324 | { | ||
| 4325 | /* For hash style multi-constant like | ||
| 4326 | use constant { FOO => 123, | ||
| 4327 | BAR => 456 }; | ||
| 4328 | only the first FOO is picked up. Parsing across the value | ||
| 4329 | expressions would be difficult in general, due to possible nested | ||
| 4330 | hashes, here-documents, etc. */ | ||
| 4331 | if (*cp == '{') | ||
| 4332 | cp = skip_spaces (cp+1); | ||
| 4333 | goto subr; | ||
| 4319 | } | 4334 | } |
| 4320 | else if (globals) /* only if we are tagging global vars */ | 4335 | else if (globals) /* only if we are tagging global vars */ |
| 4321 | { | 4336 | { |
| 4322 | /* Skip a qualifier, if any. */ | 4337 | /* Skip a qualifier, if any. */ |
| 4323 | bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); | 4338 | bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); |