texinfo-commits
[Top][All Lists]
Advanced

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

[6846] parsetexi update (accents)


From: Gavin D. Smith
Subject: [6846] parsetexi update (accents)
Date: Thu, 10 Dec 2015 20:25:57 +0000

Revision: 6846
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6846
Author:   gavin
Date:     2015-12-10 20:25:56 +0000 (Thu, 10 Dec 2015)
Log Message:
-----------
parsetexi update (accents)

Modified Paths:
--------------
    trunk/parsetexi/api.c
    trunk/parsetexi/end_line.c
    trunk/parsetexi/parser.c

Modified: trunk/parsetexi/api.c
===================================================================
--- trunk/parsetexi/api.c       2015-12-09 20:05:49 UTC (rev 6845)
+++ trunk/parsetexi/api.c       2015-12-10 20:25:56 UTC (rev 6846)
@@ -231,6 +231,8 @@
       || e->cmd == CM_image // why image?
       || e->cmd == CM_anchor
       || e->type == ET_menu_entry_name
+      || e->type == ET_brace_command_arg
+      || e->cmd == CM_TeX
       || e->cmd == CM_node) // FIXME special case
     {
       AV *av;

Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c  2015-12-09 20:05:49 UTC (rev 6845)
+++ trunk/parsetexi/end_line.c  2015-12-10 20:25:56 UTC (rev 6846)
@@ -1106,6 +1106,12 @@
                         }
                       add_extra_string (current, "command_argument",
                                         strdup (end_command));
+                      if (line[strspn (line, whitespace_chars)] != '\0')
+                        {
+                          command_errorf (current,
+                                          "superfluous argument to @end %s: "
+                                          "%s", end_command, line);
+                        }
                     }
                 }
               else

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-12-09 20:05:49 UTC (rev 6845)
+++ trunk/parsetexi/parser.c    2015-12-10 20:25:56 UTC (rev 6846)
@@ -891,7 +891,62 @@
         }
       else if (command_flags (current) & CF_accent) // 3996 - accent commands
         {
-          // do accent stuff here
+          if (strchr (whitespace_chars_except_newline, *line))
+            {
+              if (isalpha (command_name(current->cmd)[0]))
+              /* e.g. @dotaccent */
+                {
+                  char *p; char *s;
+                  KEY_PAIR *k;
+                  p = line + strspn (line, whitespace_chars_except_newline);
+                  k = lookup_extra_key (current, "spaces");
+                  if (!k)
+                    {
+                      asprintf (&s, "%.*s", (int) (p - line), p);
+                      add_extra_string (current, "spaces", s);
+                    }
+                  else
+                    {
+                      asprintf (&s, "%s%.*s",
+                                (char *) k->value,
+                                (int) (p - line), p);
+                      free (k->value);
+                      k->value = (ELEMENT *) s;
+                    }
+                  line = p;
+                }
+              else if (*line == '@')
+                {
+                  line_errorf ("use braces to give a command as an argument "
+                               "to @%s", command_name(current->cmd));
+                  current = current->parent;
+                }
+              else if (*line != '\0' && *line != '\n' && *line != '\r')
+                {
+                  ELEMENT *e;
+                  debug ("ACCENT");
+                  e = new_element (ET_following_arg);
+                  add_to_element_args (current, e);
+                  text_append_n (&e->text, line, 1);
+                  if (current->cmd == CM_dotless
+                      && *line != 'i' && *line != 'j')
+                    {
+                      line_errorf ("@%s expects `i' or `j' as argument, "
+                                   "not `%c'", *line++);
+                    }
+                  if (isalpha (command_name(current->cmd)[0]))
+                    e->type = ET_space_command_arg;
+                  while (current->contents.number > 0)
+                    destroy_element (pop_element_from_contents (current));
+                  current = current->parent;
+                }
+              else // 4032
+                {
+                  debug ("STRANGE ACC");
+                  line_warnf ("accent command address@hidden' must not be 
followed by "
+                              "a new line", command_name(current->cmd));
+                }
+            }
           current = current->parent;
           goto funexit;
         }




reply via email to

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