aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKevin Ryde2012-12-01 09:22:28 +0800
committerChong Yidong2012-12-01 09:22:28 +0800
commit00054d2199d929eb224ae62dec2e55608ff1c07f (patch)
treecbd9761c40dddbc55d54d3a02476300714728951 /lib-src
parentf64898abf40b09990c4974c921ddc2ebc698609a (diff)
downloademacs-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
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog4
-rw-r--r--lib-src/etags.c21
2 files changed, 22 insertions, 3 deletions
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 @@
12012-12-01 Kevin Ryde <user42@zip.com.au>
2
3 * etags.c (Perl_functions): Support "use constant" (Bug#5055).
4
12012-11-27 Paul Eggert <eggert@cs.ucla.edu> 52012-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");