texinfo-commits
[Top][All Lists]
Advanced

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

[6218] parsetexi command with command as argument


From: Gavin D. Smith
Subject: [6218] parsetexi command with command as argument
Date: Fri, 10 Apr 2015 15:24:40 +0000

Revision: 6218
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6218
Author:   gavin
Date:     2015-04-10 15:24:39 +0000 (Fri, 10 Apr 2015)
Log Message:
-----------
parsetexi command with command as argument

Modified Paths:
--------------
    trunk/parsetexi/ChangeLog
    trunk/parsetexi/Makefile.am
    trunk/parsetexi/Parsetexi/Parsetexi.xs
    trunk/parsetexi/TODO
    trunk/parsetexi/end_line.c
    trunk/parsetexi/parser.c
    trunk/parsetexi/parser.h
    trunk/parsetexi/separator.c

Modified: trunk/parsetexi/ChangeLog
===================================================================
--- trunk/parsetexi/ChangeLog   2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/ChangeLog   2015-04-10 15:24:39 UTC (rev 6218)
@@ -1,5 +1,13 @@
 2015-04-10  Gavin Smith  <address@hidden>
 
+       * end_line.c (end_line_starting_block): Call 
+       register_command_arg.
+       * parser.c (process_remaining_on_line) <command with command as 
+       argument, like @itemize @bullet>: Set command_as_argument extra 
+       value.
+
+2015-04-10  Gavin Smith  <address@hidden>
+
        * Parsetexi/lib/Parsetexi.pm (parser): Add code to receive 
        "values" configuration value.
        (parse_texi_line): First implementation.

Modified: trunk/parsetexi/Makefile.am
===================================================================
--- trunk/parsetexi/Makefile.am 2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/Makefile.am 2015-04-10 15:24:39 UTC (rev 6218)
@@ -29,7 +29,7 @@
                  separator.c \
                  multitable.c \
                  indices.c \
-                 macro.c \
+                 macro.c macro.h \
                  handle_commands.c handle_commands.h \
                  def.c def.h \
                  dump_perl.c dump_perl.h \

Modified: trunk/parsetexi/Parsetexi/Parsetexi.xs
===================================================================
--- trunk/parsetexi/Parsetexi/Parsetexi.xs      2015-04-10 11:27:51 UTC (rev 
6217)
+++ trunk/parsetexi/Parsetexi/Parsetexi.xs      2015-04-10 15:24:39 UTC (rev 
6218)
@@ -1,19 +1,15 @@
-#define context perl_context
-
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
 
-#undef context
-
 #include "ppport.h"
 
-#include "../parser.h"
-
+#include "../tree_types.h"
 #include "../tree.h"
 #include "../api.h"
 #include "../errors.h"
+#include "../macro.h"
 
 
 HV *build_texinfo_tree (void);

Modified: trunk/parsetexi/TODO
===================================================================
--- trunk/parsetexi/TODO        2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/TODO        2015-04-10 15:24:39 UTC (rev 6218)
@@ -1,5 +1,6 @@
 * conditionals on @set/@value, output format
 * implement command_warn properly
+* floats
 * Check everywhere we store values, we check properly what to do if the
   values are already defined.
 * check valid nestings
@@ -47,7 +48,7 @@
 the overall structure of the makeinfo program and might not lose much 
 flexibility in return.  Most of the strings in texinfo_document.pot 
 don't use any Texinfo commands, and the others could be expressed 
-directly in the output format, e.g.  instead of
+directly in the output format, e.g. instead of
 
 msgid "{category} on {class}: @strong{{name}}
 

Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c  2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/end_line.c  2015-04-10 15:24:39 UTC (rev 6218)
@@ -806,6 +806,11 @@
 
       add_extra_key_contents (current->parent, "prototypes", prototypes);
     }
+  else
+    {
+      isolate_last_space (current, ET_space_at_end_block_command); // 2939
+      register_command_arg (current, "block_command_line_contents");
+    }
 
   if (current->parent->cmd == CM_float) // 2943
     {

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/parser.c    2015-04-10 15:24:39 UTC (rev 6218)
@@ -396,7 +396,7 @@
 
 /* 2149 */
 /* Split any trailing whitespace on the last contents child of CURRENT into
-   own element, ET_spaces_at_end by default.
+   its own element, ET_spaces_at_end by default.
   
    This is used for the argument to a line command, and for the arguments to a 
    brace command taking a given number of arguments.
@@ -494,16 +494,22 @@
   trimmed->parent_type = route_not_in_tree;
   for (i = 0; i < original->contents.number; i++)
     {
-      if (original->contents.list[i]->type != ET_empty_spaces_after_command
-        && original->contents.list[i]->type != ET_spaces_at_end
-        && original->contents.list[i]->type != ET_empty_spaces_before_argument)
+      enum element_type t = original->contents.list[i]->type;
+      if (t != ET_empty_line_after_command
+          && t != ET_empty_spaces_after_command
+          && t != ET_empty_spaces_before_argument
+          && t != ET_empty_space_at_end_def_bracketed
+          && t != ET_empty_spaces_after_close_brace
+          && t != ET_spaces_at_end
+          && t != ET_space_at_end_block_command
+          && original->contents.list[i]->cmd != CM_c
+          && original->contents.list[i]->cmd != CM_comment)
         {
           /* FIXME: Is this safe to serialize? */
           /* For example, if there are extra keys in the elements under each 
              argument?  They may not be set in a copy.
              Hopefully there aren't many extra keys set on commands in 
              node names. */
-          //add_to_element_contents (trimmed, original->contents.list[i]);
           add_to_contents_as_array (trimmed, original->contents.list[i]);
         }
     }
@@ -827,8 +833,13 @@
     {
       if (command_with_command_as_argument (current->parent)) // 3988
         {
-          debug ("FOR PARENT");
-          current->type = ET_command_as_argument;
+          debug ("FOR PARENT @%s command_as_argument @%s",
+                 command_name(current->parent->parent->cmd),
+                 command_name(current->cmd));
+          if (!current->type)
+            current->type = ET_command_as_argument;
+          add_extra_key_element (current->parent->parent, 
+                                 "command_as_argument", current);
           current = current->parent;
         }
       else if (command_flags (current) & CF_accent) // 3996 - accent commands

Modified: trunk/parsetexi/parser.h
===================================================================
--- trunk/parsetexi/parser.h    2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/parser.h    2015-04-10 15:24:39 UTC (rev 6218)
@@ -26,6 +26,7 @@
 extern int debug_output;
 
 /* In separator.c */
+void register_command_arg (ELEMENT *current, char *key);
 ELEMENT *handle_separator (ELEMENT *current, char separator,
                            char **line_inout);
 
@@ -52,14 +53,7 @@
 extern ELEMENT *current_node;
 extern ELEMENT *current_section;
 
-/* In macro.c */
-void new_macro (char *name, ELEMENT *macro);
-ELEMENT *parse_macro_command_line (enum command_id, char **line_inout,
-                                   ELEMENT *parent);
-ELEMENT *handle_macro (ELEMENT *current, char **line_inout,
-                       enum command_id cmd_id);
-void store_value (char *name, char *value);
-char *fetch_value (char *name, int len);
+#include "macro.h"
 
 /* In multitable.c */
 ELEMENT *item_line_parent (ELEMENT *current);

Modified: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c 2015-04-10 11:27:51 UTC (rev 6217)
+++ trunk/parsetexi/separator.c 2015-04-10 15:24:39 UTC (rev 6218)
@@ -30,8 +30,7 @@
 
    For a brace command $element, $element->{'args'} has pretty much the same 
    information as $element->{'extra'}->{'brace_command_contents'}. */
-
-static void
+void
 register_command_arg (ELEMENT *current, char *key)
 {
   ELEMENT *value;




reply via email to

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