summaryrefslogtreecommitdiff
path: root/lib-src/etags.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2012-12-01 09:22:28 +0800
committerChong Yidong <cyd@gnu.org>2012-12-01 09:22:28 +0800
commit00054d2199d929eb224ae62dec2e55608ff1c07f (patch)
treecbd9761c40dddbc55d54d3a02476300714728951 /lib-src/etags.c
parentf64898abf40b09990c4974c921ddc2ebc698609a (diff)
downloademacs-00054d2199d929eb224ae62dec2e55608ff1c07f.tar.gz
* 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/etags.c')
-rw-r--r--lib-src/etags.c21
1 files changed, 18 insertions, 3 deletions
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)
/*
* Perl support
* Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/
+ * /^use constant[ \t\n]+[^ \t\n{=,;]+/
* Perl variable names: /^(my|local).../
* Original code by Bart Robinson <lomew@cs.utah.edu> (1995)
* Additions by Michael Ernst <mernst@alum.mit.edu> (1997)
@@ -4291,9 +4292,10 @@ Perl_functions (FILE *inf)
}
else if (LOOKING_AT (cp, "sub"))
{
- char *pos;
- char *sp = cp;
+ char *pos, *sp;
+ subr:
+ sp = cp;
while (!notinname (*cp))
cp++;
if (cp == sp)
@@ -4316,8 +4318,21 @@ Perl_functions (FILE *inf)
lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
free (name);
}
+ }
+ else if (LOOKING_AT (cp, "use constant")
+ || LOOKING_AT (cp, "use constant::defer"))
+ {
+ /* For hash style multi-constant like
+ use constant { FOO => 123,
+ BAR => 456 };
+ only the first FOO is picked up. Parsing across the value
+ expressions would be difficult in general, due to possible nested
+ hashes, here-documents, etc. */
+ if (*cp == '{')
+ cp = skip_spaces (cp+1);
+ goto subr;
}
- else if (globals) /* only if we are tagging global vars */
+ else if (globals) /* only if we are tagging global vars */
{
/* Skip a qualifier, if any. */
bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local");