texinfo-commits
[Top][All Lists]
Advanced

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

[6341] parsetexi handle unexpanded @value


From: Gavin D. Smith
Subject: [6341] parsetexi handle unexpanded @value
Date: Thu, 18 Jun 2015 00:40:20 +0000

Revision: 6341
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6341
Author:   gavin
Date:     2015-06-18 00:40:17 +0000 (Thu, 18 Jun 2015)
Log Message:
-----------
parsetexi handle unexpanded @value

Modified Paths:
--------------
    trunk/parsetexi/ChangeLog
    trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
    trunk/parsetexi/api.c
    trunk/parsetexi/parser.c

Modified: trunk/parsetexi/ChangeLog
===================================================================
--- trunk/parsetexi/ChangeLog   2015-06-16 23:12:03 UTC (rev 6340)
+++ trunk/parsetexi/ChangeLog   2015-06-18 00:40:17 UTC (rev 6341)
@@ -1,3 +1,10 @@
+2015-06-18  Gavin Smith  <address@hidden>
+
+       * parser.c (process_remaining_on_line) <@value> Add element to 
+       tree for unexpanded value.
+       * api.c (element_to_perl_hash): Output 'type' as name for 
+       unexpanded @value.
+
 2015-06-15  Gavin Smith  <address@hidden>
 
        * Parsetexi/Parsetexi.xs,

Modified: trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
===================================================================
--- trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-06-16 23:12:03 UTC (rev 
6340)
+++ trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-06-18 00:40:17 UTC (rev 
6341)
@@ -127,16 +127,13 @@
           add_include_directory ($d);
         }
       } elsif ($key eq 'values') {
-       # This is used by Texinfo::Structuring::gdt for substituted values
+       # This is used by Texinfo::Report::gdt for substituted values
        for my $v (keys %{$conf->{'values'}}) {
-         if (ref($conf->{'values'}->{$v}) eq 'HASH') {
-           if (defined ($conf->{'values'}->{$v}->{'text'})) {
-             store_value ($v, $conf->{'values'}->{$v}->{'text'});
-           } else {
-             store_value ($v, "<<HASH WITH NO TEXT>>");
-           }
-         } elsif (ref($conf->{'values'}->{$v}) eq 'SCALAR') {
+         if (!ref($conf->{'values'}->{$v})) {
+           warn "v is $v", "\n";
            store_value ($v, $conf->{'values'}->{$v});
+          } elsif (ref($conf->{'values'}->{$v}) eq 'HASH') {
+            store_value ($v, "<<HASH VALUE>>");
          } elsif (ref($conf->{'values'}->{$v}) eq 'ARRAY') {
            store_value ($v, "<<ARRAY VALUE>>");
          } else {

Modified: trunk/parsetexi/api.c
===================================================================
--- trunk/parsetexi/api.c       2015-06-16 23:12:03 UTC (rev 6340)
+++ trunk/parsetexi/api.c       2015-06-18 00:40:17 UTC (rev 6341)
@@ -222,7 +222,10 @@
   if (e->text.space > 0)
     {
       sv = newSVpv (e->text.text, e->text.end);
-      hv_store (e->hv, "text", strlen ("text"), sv, 0);
+      if (e->cmd != CM_value)
+        hv_store (e->hv, "text", strlen ("text"), sv, 0);
+      else
+        hv_store (e->hv, "type", strlen ("type"), sv, 0);
       SvUTF8_on (sv);
     }
 

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-06-16 23:12:03 UTC (rev 6340)
+++ trunk/parsetexi/parser.c    2015-06-18 00:40:17 UTC (rev 6341)
@@ -902,8 +902,27 @@
               value = fetch_value (arg_start, line - arg_start);
               if (!value)
                 {
+                  /* Add element for unexpanded @value.
+                     This is not necessarily an error - in
+                     Texinfo::Report::gdt we deliberately pass
+                     in undefined values. */
+                  ELEMENT *value_elt;
                   line_errorf ("undefined flag: %.*s", line - arg_start, 
                                arg_start);
+                  value_elt = new_element (ET_NONE);
+                  value_elt->cmd = CM_value;
+                  text_append_n (&value_elt->text, arg_start,
+                                 line - arg_start);
+                  /* In the Perl code, the name of the flag is stored in
+                     the "type" field.  We need to store in 'text' instead
+                     and then output it as the type in
+                     dump_perl.c / api.c. */
+
+                  add_to_element_contents (current, value_elt);
+
+                  /* Prevent merging with following.  TODO: Check why
+                     this happens in the first place. */
+                  add_to_element_contents (current, new_element (ET_NONE));
                 }
               else
                 {
@@ -916,9 +935,9 @@
                   input_push_text (strdup (line));
                   input_push_text (strdup (value));
                   line = new_line ();
-                  retval = 1;
-                  goto funexit;
                 }
+              retval = 1;
+              goto funexit;
             }
           else
             {




reply via email to

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