emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111044: * lib-src/etags.c (Perl_func


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111044: * lib-src/etags.c (Perl_functions): Support "use constant".
Date: Sat, 01 Dec 2012 09:22:28 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111044
fixes bug: http://debbugs.gnu.org/5055
author: Kevin Ryde <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-01 09:22:28 +0800
message:
  * lib-src/etags.c (Perl_functions): Support "use constant".
  
  * doc/emacs/maintaining.texi (Tag Syntax): Mention Perl's "use constant".
modified:
  doc/emacs/ChangeLog
  doc/emacs/maintaining.texi
  lib-src/ChangeLog
  lib-src/etags.c
=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog       2012-11-24 21:37:18 +0000
+++ b/doc/emacs/ChangeLog       2012-12-01 01:22:28 +0000
@@ -1,3 +1,7 @@
+2012-12-01  Kevin Ryde  <address@hidden>
+
+       * maintaining.texi (Tag Syntax): Mention Perl's "use constant".
+
 2012-11-24  Paul Eggert  <address@hidden>
 
        * doclicense.texi, gpl.texi: Update to latest version from FSF.

=== modified file 'doc/emacs/maintaining.texi'
--- a/doc/emacs/maintaining.texi        2012-10-16 23:27:40 +0000
+++ b/doc/emacs/maintaining.texi        2012-12-01 01:22:28 +0000
@@ -1766,11 +1766,11 @@
 
 @item
 In Perl code, the tags are the packages, subroutines and variables
-defined by the @code{package}, @code{sub}, @code{my} and @code{local}
-keywords.  Use @samp{--globals} if you want to tag global variables.
-Tags for subroutines are named @address@hidden::@var{sub}}.  The
-name for subroutines defined in the default package is
address@hidden::@var{sub}}.
+defined by the @code{package}, @code{sub}, @code{use constant},
address@hidden, and @code{local} keywords.  Use @samp{--globals} if you
+want to tag global variables.  Tags for subroutines are named
address@hidden@var{package}::@var{sub}}.  The name for subroutines defined in
+the default package is @samp{main::@var{sub}}.
 
 @item
 In PHP code, tags are functions, classes and defines.  Vars are tags

=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2012-11-27 05:17:07 +0000
+++ b/lib-src/ChangeLog 2012-12-01 01:22:28 +0000
@@ -1,3 +1,7 @@
+2012-12-01  Kevin Ryde  <address@hidden>
+
+       * etags.c (Perl_functions): Support "use constant" (Bug#5055).
+
 2012-11-27  Paul Eggert  <address@hidden>
 
        Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968).

=== modified file 'lib-src/etags.c'
--- a/lib-src/etags.c   2012-11-21 21:06:52 +0000
+++ b/lib-src/etags.c   2012-12-01 01:22:28 +0000
@@ -4269,6 +4269,7 @@
 /*
  * 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 <address@hidden> (1995)
  * Additions by Michael Ernst <address@hidden> (1997)
@@ -4291,9 +4292,10 @@
        }
       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 @@
                        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");


reply via email to

[Prev in Thread] Current Thread [Next in Thread]