texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/main/tree_types.h (CONTAINER), tp


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/tree_types.h (CONTAINER), tp/Texinfo/XS/main/element_types.awk, tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash), tp/Texinfo/XS/main/convert_to_texinfo.c (expand_cmd_args_to_texi), tp/Texinfo/XS/parsetexi/parser.c (move_last_space_to_element): remove eit_brace_content_spaces_before_argument from enum elt_info_type, use eit_spaces_before_argument instead. Do not overload enum elt_info_type indices, instead allow an unused slot for some elements in elt_info.
Date: Wed, 23 Oct 2024 05:13:47 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 43c4f2c991 * tp/Texinfo/XS/main/tree_types.h (CONTAINER), 
tp/Texinfo/XS/main/element_types.awk, tp/Texinfo/XS/main/build_perl_info.c 
(element_to_perl_hash), tp/Texinfo/XS/main/convert_to_texinfo.c 
(expand_cmd_args_to_texi), tp/Texinfo/XS/parsetexi/parser.c 
(move_last_space_to_element): remove eit_brace_content_spaces_before_argument 
from enum elt_info_type, use eit_spaces_before_argument instead.  Do not 
overload enum elt_info_type indices, instead allow an unused slot for some e 
[...]
43c4f2c991 is described below

commit 43c4f2c99162c5469707041eaffe436720bbe6ce
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Oct 23 11:13:41 2024 +0200

    * tp/Texinfo/XS/main/tree_types.h (CONTAINER),
    tp/Texinfo/XS/main/element_types.awk,
    tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash),
    tp/Texinfo/XS/main/convert_to_texinfo.c (expand_cmd_args_to_texi),
    tp/Texinfo/XS/parsetexi/parser.c (move_last_space_to_element): remove
    eit_brace_content_spaces_before_argument from enum elt_info_type, use
    eit_spaces_before_argument instead.  Do not overload enum
    elt_info_type indices, instead allow an unused slot for some elements
    in elt_info.
---
 ChangeLog                               | 12 ++++++++++++
 tp/Texinfo/XS/main/build_perl_info.c    |  2 +-
 tp/Texinfo/XS/main/convert_to_texinfo.c |  5 +----
 tp/Texinfo/XS/main/element_types.awk    | 20 +++++++++++++-------
 tp/Texinfo/XS/main/element_types.c      | 20 ++++++++++----------
 tp/Texinfo/XS/main/tree_types.h         |  5 ++---
 tp/Texinfo/XS/parsetexi/parser.c        |  5 +----
 7 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 441a80cb0e..cbe17134af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-10-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/tree_types.h (CONTAINER),
+       tp/Texinfo/XS/main/element_types.awk,
+       tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash),
+       tp/Texinfo/XS/main/convert_to_texinfo.c (expand_cmd_args_to_texi),
+       tp/Texinfo/XS/parsetexi/parser.c (move_last_space_to_element): remove
+       eit_brace_content_spaces_before_argument from enum elt_info_type, use
+       eit_spaces_before_argument instead.  Do not overload enum
+       elt_info_type indices, instead allow an unused slot for some elements
+       in elt_info.
+
 2024-10-21  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/XS/main/build_perl_info.c (element_to_perl_hash):
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index cfc3290aaf..f1b6b9d9b0 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -887,7 +887,7 @@ element_to_perl_hash (ELEMENT *e, int avoid_recursion)
           if (e->type == ET_context_brace_command)
             {
               store_info_element (e,
-                  e->elt_info[eit_brace_content_spaces_before_argument],
+                  e->elt_info[eit_spaces_before_argument],
                   "spaces_before_argument",
                   avoid_recursion, &info_hv);
             }
diff --git a/tp/Texinfo/XS/main/convert_to_texinfo.c 
b/tp/Texinfo/XS/main/convert_to_texinfo.c
index db97f09eab..888b0888f5 100644
--- a/tp/Texinfo/XS/main/convert_to_texinfo.c
+++ b/tp/Texinfo/XS/main/convert_to_texinfo.c
@@ -65,10 +65,7 @@ expand_cmd_args_to_texi (const ELEMENT *e, TEXT *result)
 
   if (type_data[e->type].flags & TF_spaces_before)
     {
-      if (e->type != ET_context_brace_command)
-        spc_before_arg = e->elt_info[eit_spaces_before_argument];
-      else
-        spc_before_arg = e->elt_info[eit_brace_content_spaces_before_argument];
+      spc_before_arg = e->elt_info[eit_spaces_before_argument];
     }
 
   /* if there is no arg_line, the end of line is in rawline_arg in args
diff --git a/tp/Texinfo/XS/main/element_types.awk 
b/tp/Texinfo/XS/main/element_types.awk
index dd8b0bfd7c..494533521d 100644
--- a/tp/Texinfo/XS/main/element_types.awk
+++ b/tp/Texinfo/XS/main/element_types.awk
@@ -59,13 +59,6 @@ END {
         t = types[line_idx]
         flags_str = ""
         elt_info_number = 0;
-        # spaces_after_cmd_before_arg
-        if (type_flags[t] != "" && match(type_flags[t], /braces/)) {
-          elt_info_number = 1;
-        }
-        if (type_flags[t] != "" && match(type_flags[t], /spaces_before/)) {
-          elt_info_number += 1;
-        }
         # spaces_after_argument
         if (type_flags[t] != "" && match(type_flags[t], /spaces_after/)) {
           elt_info_number += 1;
@@ -74,6 +67,19 @@ END {
         if (t == "block_line_arg" || t == "line_arg") {
           elt_info_number += 1;
         }
+        # spaces_after_cmd_before_arg
+        if (type_flags[t] != "" && match(type_flags[t], /braces/)) {
+          elt_info_number += 1;
+        } else if (elt_info_number > 0) {
+          # add an empty slot for the unused index in the array
+          elt_info_number += 1;
+        }
+        if (type_flags[t] != "" && match(type_flags[t], /spaces_before/)) {
+          elt_info_number += 1;
+        } else if (elt_info_number > 0) {
+          # add an empty slot for the unused index in the array
+          elt_info_number += 1;
+        }
         if (type_flags[t] != "") {
             split(type_flags[t], flags_array, ",")
             for (flag_idx in flags_array) {
diff --git a/tp/Texinfo/XS/main/element_types.c 
b/tp/Texinfo/XS/main/element_types.c
index 01ad0f93fd..1b9e9e3eb2 100644
--- a/tp/Texinfo/XS/main/element_types.c
+++ b/tp/Texinfo/XS/main/element_types.c
@@ -5,15 +5,15 @@
 TYPE_DATA type_data[] = {
 {0, 0, 0},
 {"index_entry_command", TF_spaces_before | TF_at_command, 1},
-{"definfoenclose_command", TF_braces | TF_at_command, 1},
+{"definfoenclose_command", TF_braces | TF_at_command, 2},
 {"nobrace_command", TF_at_command, 0},
-{"brace_noarg_command", TF_braces | TF_at_command, 1},
+{"brace_noarg_command", TF_braces | TF_at_command, 2},
 {"container_command", TF_at_command, 0},
 {"lineraw_command", TF_at_command, 0},
 {"line_command", TF_spaces_before | TF_at_command, 1},
 {"block_command", TF_spaces_before | TF_at_command, 1},
-{"brace_command", TF_braces | TF_at_command, 1},
-{"brace_args_command", TF_braces | TF_at_command, 1},
+{"brace_command", TF_braces | TF_at_command, 2},
+{"brace_args_command", TF_braces | TF_at_command, 2},
 {"context_brace_command", TF_braces | TF_spaces_before | TF_at_command, 2},
 {"empty_line", TF_text | TF_leading_space, 0},
 {"raw", TF_text, 0},
@@ -40,9 +40,9 @@ TYPE_DATA type_data[] = {
 {"rawpreformatted", 0, 0},
 {"brace_container", 0, 0},
 {"brace_command_context", 0, 0},
-{"brace_arg", TF_spaces_before | TF_spaces_after, 2},
-{"block_line_arg", TF_spaces_before | TF_spaces_after, 3},
-{"line_arg", TF_spaces_before | TF_spaces_after, 3},
+{"brace_arg", TF_spaces_before | TF_spaces_after, 3},
+{"block_line_arg", TF_spaces_before | TF_spaces_after, 4},
+{"line_arg", TF_spaces_before | TF_spaces_after, 4},
 {"following_arg", 0, 0},
 {"rawline_arg", TF_text, 0},
 {"menu_entry", 0, 0},
@@ -73,7 +73,7 @@ TYPE_DATA type_data[] = {
 {"multitable_body", 0, 0},
 {"row", 0, 0},
 {"balanced_braces", 0, 0},
-{"bracketed_arg", TF_spaces_before | TF_spaces_after, 2},
+{"bracketed_arg", TF_spaces_before | TF_spaces_after, 3},
 {"def_line_arg", 0, 0},
 {"untranslated_def_line_arg", 0, 0},
 {"def_category", 0, 0},
@@ -87,8 +87,8 @@ TYPE_DATA type_data[] = {
 {"untranslated", TF_text, 0},
 {"elided_rawpreformatted", 0, 0},
 {"elided_brace_command_arg", 0, 0},
-{"macro_call", TF_braces | TF_macro_call, 1},
-{"rmacro_call", TF_braces | TF_macro_call, 1},
+{"macro_call", TF_braces | TF_macro_call, 2},
+{"rmacro_call", TF_braces | TF_macro_call, 2},
 {"macro_call_line", TF_spaces_before | TF_macro_call, 1},
 {"rmacro_call_line", TF_spaces_before | TF_macro_call, 1},
 {"linemacro_call", TF_spaces_before | TF_macro_call, 1},
diff --git a/tp/Texinfo/XS/main/tree_types.h b/tp/Texinfo/XS/main/tree_types.h
index 9f05ebb241..0160da808b 100644
--- a/tp/Texinfo/XS/main/tree_types.h
+++ b/tp/Texinfo/XS/main/tree_types.h
@@ -240,12 +240,11 @@ typedef struct CONTAINER {
 
 /* indices in ELEMENT elt_info */
 enum elt_info_type {
+   eit_spaces_before_argument, /* diverse types.  Only context_brace_command
+                                  also with braces */
    eit_spaces_after_cmd_before_arg, /* types with braces flag */
    eit_spaces_after_argument,
    eit_comment_at_end, /* block_line_arg line_arg */
-   eit_spaces_before_argument = 0, /* diverse types.  Only 
context_brace_command
-                                     also with braces */
-   eit_brace_content_spaces_before_argument = 1, /* not 0, also brace commands 
*/
 };
 
 /* indices in ELEMENT string_info */
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 352eb1cced..9cc8c845d4 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -728,10 +728,7 @@ move_last_space_to_element (ELEMENT *current)
   ELEMENT *e = pop_element_from_contents (current);
   e->type = ET_other_text;
   e->parent = 0;
-  if (owning_element->type != ET_context_brace_command)
-    owning_element->elt_info[eit_spaces_before_argument] = e;
-  else
-    owning_element->elt_info[eit_brace_content_spaces_before_argument] = e;
+  owning_element->elt_info[eit_spaces_before_argument] = e;
   internal_space_holder = 0;
 }
 



reply via email to

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