texinfo-commits
[Top][All Lists]
Advanced

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

[6825] parsetexi update


From: Gavin D. Smith
Subject: [6825] parsetexi update
Date: Wed, 02 Dec 2015 14:41:58 +0000

Revision: 6825
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6825
Author:   gavin
Date:     2015-12-02 14:41:57 +0000 (Wed, 02 Dec 2015)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
    trunk/parsetexi/api.c
    trunk/parsetexi/end_line.c
    trunk/parsetexi/indices.c
    trunk/parsetexi/tree_types.h

Modified: trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
===================================================================
--- trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-12-02 10:14:28 UTC (rev 
6824)
+++ trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-12-02 14:41:57 UTC (rev 
6825)
@@ -390,6 +390,7 @@
     $self = parser() if (!defined($self));
     parse_text($text);
     my $tree = build_texinfo_tree ();
+    $self->{'index_names'} = build_index_data ();
     _add_parents ($tree);
     return $tree;
 }

Modified: trunk/parsetexi/api.c
===================================================================
--- trunk/parsetexi/api.c       2015-12-02 10:14:28 UTC (rev 6824)
+++ trunk/parsetexi/api.c       2015-12-02 14:41:57 UTC (rev 6825)
@@ -398,8 +398,8 @@
             /* A "index_entry" extra key on a command defining an index
                entry.  Unlike the other keys, the value is not in the
                main parse tree, but in the indices_information.  It would
-               be much nicer if we could get rid of the need for this key. */
-            /* Could we set this afterwards in build_index_data? */
+               be much nicer if we could get rid of the need for this key.
+               We set this afterwards in build_index_data. */
               break;
             case extra_def_args:
               {

Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c  2015-12-02 10:14:28 UTC (rev 6824)
+++ trunk/parsetexi/end_line.c  2015-12-02 14:41:57 UTC (rev 6825)
@@ -1139,8 +1139,30 @@
       misc_content = trim_spaces_comment_from_content 
         (last_args_child(current));
 
-      add_extra_key_contents (current, "misc_content", misc_content);
+      if (current->cmd != CM_top && misc_content->contents.number == 0)
+        {
+          command_warnf ("@%s missing argument", command_name(current->cmd));
+          add_extra_string (current, "missing_argument", "1");
+        }
+      else
+        {
+          // 3266
+          add_extra_key_contents (current, "misc_content", misc_content);
+          if ((current->parent->cmd == CM_ftable
+               || current->parent->cmd == CM_vtable)
+              && (current->cmd == CM_item || current->cmd == CM_itemx))
+            {
+              enter_index_entry (current->parent->cmd,
+                                 current->cmd,
+                                 current, misc_content);
+            }
+          else
+            {
+              // 3273 possibly check for @def... command
+            }
 
+        }
+
       /* All the other "line" commands" */
       // 3273 - warning about missing argument
 

Modified: trunk/parsetexi/indices.c
===================================================================
--- trunk/parsetexi/indices.c   2015-12-02 10:14:28 UTC (rev 6824)
+++ trunk/parsetexi/indices.c   2015-12-02 14:41:57 UTC (rev 6825)
@@ -84,6 +84,7 @@
   memset (idx, 0, sizeof *idx);
   idx->name = name;
   idx->prefix = name;
+  idx->in_code = in_code;
   if (number_of_indices == space_for_indices)
     {
       space_for_indices += 5;
@@ -129,15 +130,16 @@
 init_index_commands (void)
 {
   INDEX *idx;
-  char **p;
-  char *default_indices[] = {
-    "cp", /* concepts */
-    "fn", /* functions */
-    "vr", /* variables */
-    "ky", /* keystrokes */
-    "pg", /* programs */
-    "tp", /* types */
-    0,
+
+  struct def { char *name; int in_code; }
+  *p, default_indices[] = {
+    "cp", 0, /* concepts */
+    "fn", 1, /* functions */
+    "vr", 1, /* variables */
+    "ky", 1, /* keystrokes */
+    "pg", 1, /* programs */
+    "tp", 1, /* types */
+    0, 0
   };
   int i, j;
 
@@ -182,19 +184,22 @@
     };
 #undef X
 
-  for (p = default_indices; *p; p++)
+  for (p = default_indices; p->name; p++)
     {
       /* Both @cindex and @cpindex are added. */
-      idx = add_index_internal (*p, 0);
+      idx = add_index_internal (p->name, p->in_code);
 
-      *name = **p;
+      *name = p->name[0];
       add_index_command (name, idx); /* @cindex */
 
-      name2[0] = (*p)[0];
-      name2[1] = (*p)[1];
+      name2[0] = p->name[0];
+      name2[1] = p->name[1];
       add_index_command (name2, idx); /* @cpindex */
     }
 
+  associate_command_to_index (CM_vtable, index_by_name ("vr"));
+  associate_command_to_index (CM_ftable, index_by_name ("fn"));
+
   for (i = 0;
        i < sizeof (def_command_indices) / sizeof (def_command_indices[0]);
        i++)
@@ -216,7 +221,8 @@
 
 
 // 2530
-/* INDEX_AT_COMMAND is the Texinfo @-command defining the index entry.
+/* INDEX_TYPE_COMMAND is used to determine which index to enter the entry in.
+   INDEX_AT_COMMAND is the Texinfo @-command defining the index entry.
    CONTENT is an element whose contents represent the text of the
    index entry.  CURRENT is the element in the main body of the manual that
    the index entry refers to. */

Modified: trunk/parsetexi/tree_types.h
===================================================================
--- trunk/parsetexi/tree_types.h        2015-12-02 10:14:28 UTC (rev 6824)
+++ trunk/parsetexi/tree_types.h        2015-12-02 14:41:57 UTC (rev 6825)
@@ -123,7 +123,7 @@
 typedef struct INDEX {
     char *name;
     char *prefix;
-    // int in_code;
+    int in_code;
 
     struct INDEX *merged_in; /* Index this index is merged into, if any. */
 




reply via email to

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