texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/command_data.awk, tp/Te


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h (command_struct): separate the information on the number of arguments from the information on the type of command.
Date: Sun, 25 Sep 2022 12:00:43 -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 c8f18816c2 * tp/Texinfo/XS/parsetexi/command_data.awk, 
tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h 
(command_struct): separate the information on the number of arguments from the 
information on the type of command.
c8f18816c2 is described below

commit c8f18816c2af3ea077d8083f0fb36d1c68150b88
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 25 18:00:31 2022 +0200

    * tp/Texinfo/XS/parsetexi/command_data.awk,
    tp/Texinfo/XS/parsetexi/command_data.txt,
    tp/Texinfo/XS/parsetexi/commands.h (command_struct): separate the
    information on the number of arguments from the information on
    the type of command.
---
 ChangeLog                                |   8 ++
 tp/Texinfo/XS/parsetexi/command_data.awk |  28 ++++++-
 tp/Texinfo/XS/parsetexi/command_data.txt | 122 +++++++++++++++----------------
 tp/Texinfo/XS/parsetexi/commands.h       |   4 +-
 4 files changed, 98 insertions(+), 64 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ac98fb84de..2a80eca9b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-09-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/command_data.awk,
+       tp/Texinfo/XS/parsetexi/command_data.txt,
+       tp/Texinfo/XS/parsetexi/commands.h (command_struct): separate the
+       information on the number of arguments from the information on
+       the type of command.
+
 2022-09-25  Patrice Dumas  <pertusus@free.fr>
 
        microtype in texi2any parsers
diff --git a/tp/Texinfo/XS/parsetexi/command_data.awk 
b/tp/Texinfo/XS/parsetexi/command_data.awk
index 9974d1aefb..133a1c044e 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.awk
+++ b/tp/Texinfo/XS/parsetexi/command_data.awk
@@ -118,12 +118,13 @@ BEGIN {
     }
     commands[c] = $2
     data[c] = $3
+    args_nr[c] = $4
 }
 
 END {
     print "COMMAND builtin_command_data[] = {" > CD
 
-    print "0, 0, 0," > CD
+    print "0, 0, 0, 0," > CD
 
     # We want the output sorted so we can use bsearch
     PROCINFO["sorted_in"]="@ind_str_asc"
@@ -152,7 +153,30 @@ END {
         } else {
             command_data = "0"
         }
-        print "\"" c2 "\", " flags ", " command_data "," > CD
+
+        if (args_nr[c] != "") {
+            args_nr_data = args_nr[c]
+        } else {
+            # backward compatibility, remove when updated
+            where_digit = match(data[c], /^[0-9]$/)
+            if (where_digit != 0) {
+              args_nr_data = data[c]
+            } else {
+              where = 0
+              if (commands[c] != "") {
+                where = match(commands[c], /block/)
+                if (where == 0) {
+                  where = match(commands[c], /^nobrace$/)
+                }
+              }
+              if (where != 0 || command_data == "BRACE_noarg") {
+                args_nr_data = "0"
+              } else {
+                args_nr_data = "1"
+              }
+            }
+        }
+        print "\"" c2 "\", " flags ", " command_data ", " args_nr_data "," > CD
     }
     print "};" > CD
     print "};" > CI
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt 
b/tp/Texinfo/XS/parsetexi/command_data.txt
index d8ca8f0e03..3284e88789 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -185,69 +185,69 @@ refill                  other,deprecated                
OTHER_noarg
 ##########################################################
 
 # letter_no_arg_commands
-aa                      brace                           0
-AA                      brace                           0
-ae                      brace                           0
-oe                      brace                           0
-AE                      brace                           0
-OE                      brace                           0
-o                       brace                           0
-O                       brace                           0
-ss                      brace                           0
-l                       brace                           0
-L                       brace                           0
-DH                      brace                           0
-dh                      brace                           0
-TH                      brace                           0
-th                      brace                           0
+aa                      brace                           BRACE_noarg
+AA                      brace                           BRACE_noarg
+ae                      brace                           BRACE_noarg
+oe                      brace                           BRACE_noarg
+AE                      brace                           BRACE_noarg
+OE                      brace                           BRACE_noarg
+o                       brace                           BRACE_noarg
+O                       brace                           BRACE_noarg
+ss                      brace                           BRACE_noarg
+l                       brace                           BRACE_noarg
+L                       brace                           BRACE_noarg
+DH                      brace                           BRACE_noarg
+dh                      brace                           BRACE_noarg
+TH                      brace                           BRACE_noarg
+th                      brace                           BRACE_noarg
 
 # no arg commands
-TeX                     brace                           0
-LaTeX                   brace                           0
-bullet                  brace                           0
-copyright               brace                           0
-registeredsymbol        brace                           0
-dots                    brace                           0
-enddots                 brace                           0
-equiv                   brace                           0
-error                   brace                           0
-expansion               brace                           0
-arrow                   brace                           0
-minus                   brace                           0
-point                   brace                           0
-print                   brace                           0
-result                  brace                           0
-today                   brace                           0
-exclamdown              brace                           0
-questiondown            brace                           0
-pounds                  brace                           0
-ordf                    brace                           0
-ordm                    brace                           0
-atchar                  brace                           0
-ampchar                 brace                           0
-lbracechar              brace                           0
-rbracechar              brace                           0
-backslashchar           brace                           0
-hashchar                brace                           0
-comma                   brace                           0
-euro                    brace                           0
-geq                     brace                           0
-leq                     brace                           0
-tie                     brace                           0
-textdegree              brace                           0
-click                   brace                           0
-quotedblleft            brace                           0
-quotedblright           brace                           0
-quoteleft               brace                           0
-quoteright              brace                           0
-quotedblbase            brace                           0
-quotesinglbase          brace                           0
-guillemetleft           brace                           0
-guillemetright          brace                           0
-guillemotleft           brace                           0
-guillemotright          brace                           0
-guilsinglleft           brace                           0
-guilsinglright          brace                           0
+TeX                     brace                           BRACE_noarg
+LaTeX                   brace                           BRACE_noarg
+bullet                  brace                           BRACE_noarg
+copyright               brace                           BRACE_noarg
+registeredsymbol        brace                           BRACE_noarg
+dots                    brace                           BRACE_noarg
+enddots                 brace                           BRACE_noarg
+equiv                   brace                           BRACE_noarg
+error                   brace                           BRACE_noarg
+expansion               brace                           BRACE_noarg
+arrow                   brace                           BRACE_noarg
+minus                   brace                           BRACE_noarg
+point                   brace                           BRACE_noarg
+print                   brace                           BRACE_noarg
+result                  brace                           BRACE_noarg
+today                   brace                           BRACE_noarg
+exclamdown              brace                           BRACE_noarg
+questiondown            brace                           BRACE_noarg
+pounds                  brace                           BRACE_noarg
+ordf                    brace                           BRACE_noarg
+ordm                    brace                           BRACE_noarg
+atchar                  brace                           BRACE_noarg
+ampchar                 brace                           BRACE_noarg
+lbracechar              brace                           BRACE_noarg
+rbracechar              brace                           BRACE_noarg
+backslashchar           brace                           BRACE_noarg
+hashchar                brace                           BRACE_noarg
+comma                   brace                           BRACE_noarg
+euro                    brace                           BRACE_noarg
+geq                     brace                           BRACE_noarg
+leq                     brace                           BRACE_noarg
+tie                     brace                           BRACE_noarg
+textdegree              brace                           BRACE_noarg
+click                   brace                           BRACE_noarg
+quotedblleft            brace                           BRACE_noarg
+quotedblright           brace                           BRACE_noarg
+quoteleft               brace                           BRACE_noarg
+quoteright              brace                           BRACE_noarg
+quotedblbase            brace                           BRACE_noarg
+quotesinglbase          brace                           BRACE_noarg
+guillemetleft           brace                           BRACE_noarg
+guillemetright          brace                           BRACE_noarg
+guillemotleft           brace                           BRACE_noarg
+guillemotright          brace                           BRACE_noarg
+guilsinglleft           brace                           BRACE_noarg
+guilsinglright          brace                           BRACE_noarg
 
 # accent commands - can be called with or without braces
 \"                      brace,accent                    BRACE_accent
diff --git a/tp/Texinfo/XS/parsetexi/commands.h 
b/tp/Texinfo/XS/parsetexi/commands.h
index 1bea7ccbb2..960253d5d8 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -19,7 +19,8 @@
 typedef struct command_struct {
     char *cmdname;
     unsigned long flags; /* Up to 32 flags */
-    int data; /* Number of arguments for brace or line commands. */
+    int data; /* type of command. */
+    int args_number; /* Number of arguments for brace or line commands. */
 } COMMAND;
 
 extern COMMAND builtin_command_data[];
@@ -114,6 +115,7 @@ void wipe_user_commands (void);
 #define BLOCK_variadic -5
 
 /* Types of brace command (CF_brace). */
+#define BRACE_noarg 0
 #define BRACE_context -1 /* Can enclose paragraph breaks. */
 #define BRACE_accent -2
 #define BRACE_style_other -3



reply via email to

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