texinfo-commits
[Top][All Lists]
Advanced

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

[6119] parsetexi add brace command argument types


From: Gavin D. Smith
Subject: [6119] parsetexi add brace command argument types
Date: Thu, 12 Feb 2015 19:29:29 +0000

Revision: 6119
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6119
Author:   gavin
Date:     2015-02-12 19:29:28 +0000 (Thu, 12 Feb 2015)
Log Message:
-----------
parsetexi add brace command argument types

Modified Paths:
--------------
    trunk/parsetexi/ChangeLog
    trunk/parsetexi/command_data.txt
    trunk/parsetexi/commands.h
    trunk/parsetexi/separator.c

Modified: trunk/parsetexi/ChangeLog
===================================================================
--- trunk/parsetexi/ChangeLog   2015-02-11 17:53:36 UTC (rev 6118)
+++ trunk/parsetexi/ChangeLog   2015-02-12 19:29:28 UTC (rev 6119)
@@ -1,3 +1,8 @@
+2015-02-12  Gavin Smith  <address@hidden>
+
+       * command_data.txt <brace commands>: Add arg types for all 
+       commands (some of these could change).
+
 2015-02-03  Gavin Smith  <address@hidden>
 
        * parser.c (process_remaining_on_line): Handle @verb.

Modified: trunk/parsetexi/command_data.txt
===================================================================
--- trunk/parsetexi/command_data.txt    2015-02-11 17:53:36 UTC (rev 6118)
+++ trunk/parsetexi/command_data.txt    2015-02-12 19:29:28 UTC (rev 6119)
@@ -241,91 +241,96 @@
 # accent commands - can be called with or without braces
 # do we need both "brace" and "accent"?
 # there is special casing on line 3998
-\"             brace,accent
-~              brace,accent
-^              brace,accent
-`              brace,accent
-'              brace,accent
-,              brace,accent
-=              brace,accent
-ringaccent     brace,accent
-H              brace,accent
-dotaccent      brace,accent
-u              brace,accent
-ubaraccent     brace,accent
-udotaccent     brace,accent
-v              brace,accent
-ogonek         brace,accent
-tieaccent      brace,accent
-dotless                brace,accent
+\"             brace,accent    BRACE_accent
+~              brace,accent    BRACE_accent
+^              brace,accent    BRACE_accent
+`              brace,accent    BRACE_accent
+'              brace,accent    BRACE_accent
+,              brace,accent    BRACE_accent
+=              brace,accent    BRACE_accent
+ringaccent     brace,accent    BRACE_accent
+H              brace,accent    BRACE_accent
+dotaccent      brace,accent    BRACE_accent
+u              brace,accent    BRACE_accent
+ubaraccent     brace,accent    BRACE_accent
+udotaccent     brace,accent    BRACE_accent
+v              brace,accent    BRACE_accent
+ogonek         brace,accent    BRACE_accent
+tieaccent      brace,accent    BRACE_accent
+dotless                brace,accent    BRACE_accent
 
 # Style commands
-asis           brace
-cite           brace
-clicksequence  brace
-dfn            brace
-emph           brace
-sc             brace
-t              brace
-var            brace
-headitemfont   brace
-code           brace
-command                brace
-env            brace
-file           brace
-kbd            brace
-option         brace
-samp           brace
-strong         brace
+asis           brace   BRACE_style
+cite           brace   BRACE_style
+clicksequence  brace   BRACE_style
+dfn            brace   BRACE_style
+emph           brace   BRACE_style
+sc             brace   BRACE_style
+t              brace   BRACE_style
+var            brace   BRACE_style
+headitemfont   brace   BRACE_style
+code           brace   BRACE_style
+command                brace   BRACE_style
+env            brace   BRACE_style
+file           brace   BRACE_style
+kbd            brace   BRACE_style
+option         brace   BRACE_style
+samp           brace   BRACE_style
+strong         brace   BRACE_style
 
 # Regular font style commands 595
-r              brace
-i              brace
-b              brace
-sansserif      brace
-slanted                brace
+r              brace   BRACE_style
+i              brace   BRACE_style
+b              brace   BRACE_style
+sansserif      brace   BRACE_style
+slanted                brace   BRACE_style
 
-# One arg commands
+# One arg, "simple text" argument commands
+# I intend to use "1" for these commands only, and
+# use a different value for the other commands which
+# are said to take 1 argument in Common.pm.
 ctrl           brace   1
 dmn            brace   1
-w              brace   1
-key            brace   1
 titlefont      brace   1
-hyphenation    brace   1
+
+w              brace   BRACE_other
+key            brace   BRACE_other
+
+hyphenation    brace   BRACE_other
 anchor         brace   1
 errormsg       brace   1
 
 # code style commands
-code           brace
-command                brace
-env            brace
-file           brace
-kbd            brace
-key            brace
-option         brace
-samp           brace
-indicateurl    brace
-verb           brace
-t              brace
+code           brace   BRACE_other
+command                brace   BRACE_other
+env            brace   BRACE_other
+file           brace   BRACE_other
+kbd            brace   BRACE_other
+key            brace   BRACE_other
+option         brace   BRACE_other
+samp           brace   BRACE_other
+indicateurl    brace   1
+verb           brace   BRACE_other
+t              brace   BRACE_other
 
 # context brace commands - commands that enclose full texts
-footnote       brace,context_brace
-caption                brace,context_brace
-shortcaption   brace,context_brace
-math           brace,context_brace
+footnote       brace   BRACE_context
+caption                brace   BRACE_context
+shortcaption   brace   BRACE_context
+math           brace   BRACE_context
 
 # explained commands 624
-abbr           brace
-acronym                brace
+abbr           brace   1
+acronym                brace   1
 
 # inline format command
-inlineraw              brace,inline
-inlinefmt              brace,inline
-inlinefmtifelse                brace,inline
+inlineraw              brace,inline    BRACE_inline
+inlinefmt              brace,inline    BRACE_inline
+inlinefmtifelse                brace,inline    BRACE_inline
 
 # inline conditional commands
-inlineifclear          brace,inline
-inlineifset            brace,inline
+inlineifclear          brace,inline    BRACE_inline
+inlineifset            brace,inline    BRACE_inline
 
 email                  brace   2
 

Modified: trunk/parsetexi/commands.h
===================================================================
--- trunk/parsetexi/commands.h  2015-02-11 17:53:36 UTC (rev 6118)
+++ trunk/parsetexi/commands.h  2015-02-12 19:29:28 UTC (rev 6119)
@@ -50,9 +50,10 @@
 #define CF_letter_no_arg               0x0020
 #define CF_accent                      0x0040
 #define CF_style                       0x0080
+/* CF_code_style is set for brace commands only. */
 #define CF_code_style                  0x0100
 #define CF_regular_font_style          0x0200
-#define CF_context_brace               0x0400
+// #define free                        0x0400
 #define CF_ref                         0x0800
 #define CF_explained                   0x1000
 #define CF_block                       0x2000
@@ -90,12 +91,9 @@
 #define BLOCK_raw -2
 #define BLOCK_multitable -3
 
-#if 0
-/* Types of brace command could go in 'flags', although then we risk running 
-   out of space for flags.  If it does then we have the 'data' field free to 
-   store a number of args in. */
-
 /* Types of brace command (CF_brace). */
-#define BRACE_context_brace -1
-
-#endif
+#define BRACE_context -1 /* Can enclose paragraph breaks. */
+#define BRACE_accent -2
+#define BRACE_style -3
+#define BRACE_inline -4
+#define BRACE_other -5

Modified: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c 2015-02-11 17:53:36 UTC (rev 6118)
+++ trunk/parsetexi/separator.c 2015-02-12 19:29:28 UTC (rev 6119)
@@ -45,7 +45,7 @@
       current = arg;
 
       /* 4903 */
-      if (command_data(command).flags & CF_context_brace)
+      if (command_data(command).data == BRACE_context)
         {
           if (command == CM_caption || command == CM_shortcaption)
             {
@@ -159,14 +159,15 @@
       goto funexit;
     }
   else if (command_flags(current->parent) & CF_brace)
-    // || definfoenclose
     {
       enum command_id closed_command;
       // 5019
-      if (command_flags(current->parent) & CF_context_brace)
+      if (command_data(current->parent->cmd).data == BRACE_context)
         {
           enum context c;
           c = pop_context ();
+          /* The Perl code here checks that the popped context and the
+             parent command match as strings. */
         }
       closed_command = current->parent->cmd;
       debug ("CLOSING(brace) %s", command_data(closed_command).cmdname);
@@ -295,7 +296,9 @@
     {
       current = handle_close_brace (current, &line);
     }
-  else if (separator == ',' && current->remaining_args > 0) // 5228
+  /* If a comma is seen after all the arguments for the command have been
+     read, it is included in the last argument. */
+  else if (separator == ',' && current->parent->remaining_args > 0) // 5228
     {
       current = handle_comma (current, &line);
     }




reply via email to

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