texinfo-commits
[Top][All Lists]
Advanced

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

[5697] define search strings


From: Gavin D. Smith
Subject: [5697] define search strings
Date: Thu, 03 Jul 2014 15:05:34 +0000

Revision: 5697
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5697
Author:   gavin
Date:     2014-07-03 15:05:31 +0000 (Thu, 03 Jul 2014)
Log Message:
-----------
define search strings

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c
    trunk/info/nodes.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-02 13:42:52 UTC (rev 5696)
+++ trunk/ChangeLog     2014-07-03 15:05:31 UTC (rev 5697)
@@ -1,3 +1,10 @@
+2014-07-03  Gavin Smith  <address@hidden>
+
+       * info/nodes.h (INFO_MENU_REGEXP, INFO_MENU_ENTRY_REGEXP)
+       (INFO_XREF_REGEXP): New symbols.
+       * info/info-utils.c (scan_node_contents): Use them instead of literal
+       strings.
+
 2014-07-02  Gavin Smith  <address@hidden>
 
        * info/terminal.c (term_Km): New variable.

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2014-07-02 13:42:52 UTC (rev 5696)
+++ trunk/info/info-utils.c     2014-07-03 15:05:31 UTC (rev 5697)
@@ -1570,11 +1570,7 @@
 
   parse_top_node_line (node);
 
-  /* Search for menu items or cross references in buffer.  This is
-     INFO_MENU_LABEL "|" INFO_XREF_LABEL, but with '*' characters escaped.
-     Only match "*Note" if it is followed by a whitespace character so that it
-     will not be recognized if, e.g., it is surrounded in inverted commas. */
-  search_string = "\n\\* Menu:|(\\*Note[ \\t\\n])";
+  search_string = INFO_MENU_REGEXP "|" INFO_XREF_REGEXP;
 
   s.buffer = node->contents;
   s.start = inptr - node->contents;
@@ -1599,9 +1595,7 @@
           if (*inptr == '\n')
             skip_input (strspn (inptr, "\n") - 1); /* Keep one newline. */
 
-          /* This is INFO_MENU_ENTRY_LABEL "|" INFO_XREF_LABEL, but
-             with '*' characters escaped. */
-          search_string = "\n\\* |\\*Note";
+          search_string = INFO_MENU_ENTRY_REGEXP "|" INFO_XREF_REGEXP;
           s.start = inptr - s.buffer;
           continue;
         }

Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h  2014-07-02 13:42:52 UTC (rev 5696)
+++ trunk/info/nodes.h  2014-07-03 15:05:31 UTC (rev 5697)
@@ -89,8 +89,13 @@
 #define INFO_NEXT_LABEL                 "Next:"
 #define INFO_UP_LABEL                   "Up:"
 #define INFO_MENU_LABEL                 "\n* Menu:"
+#define INFO_MENU_REGEXP                "\n\\* Menu:"
 #define INFO_MENU_ENTRY_LABEL           "\n* "
+#define INFO_MENU_ENTRY_REGEXP          "\n\\* "
 #define INFO_XREF_LABEL                 "*Note"
+/* Only match "*Note" if it is followed by a whitespace character so that it
+   will not be recognized if, e.g., it is surrounded in inverted commas. */
+#define INFO_XREF_REGEXP                "\\*Note[ \\t\\n]";
 #define TAGS_TABLE_END_LABEL            "\nEnd Tag Table"
 #define TAGS_TABLE_BEG_LABEL            "Tag Table:\n"
 #define INDIRECT_TAGS_TABLE_LABEL       "Indirect:\n"




reply via email to

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