> --- 1029,1043 ----
>   
>         if (brace < 0 ||
>             (brace == 0 && strncmp (input_text + i, match, match_len) == 0))
> !     {
> !       /* If the character to search for is found, but it turns out
> !          that this character is special (is actually a command
> !          character in this context), then skip it. */
> !       if ((match_len == 1) && (i > 0) && (input_text[i - 1] == '@'))
> !         continue;
> !       else
> !         break;
> !     }

Err...  This doesn't seem right to me: it fails for the following
weirdo:

        @email{foobar@@baz@@, The Foobar}

In other words, the @ in "@x" may by itself be preceeded by a @, in
which case x should NOT be skipped.

The following change seems to fix these problems (and a couple of
others, which it seems were lurking there for ages ;-).

Anthony, could you please see if this solves your problems and doesn't
introduce new ones?  Thanks.

Karl, I attach below a small test file I used to test this issue.  It
probably makes sense to add it to the test suite.


1999-11-14  Eli Zaretskii  <[EMAIL PROTECTED]>

        * makeinfo/makeinfo.c (get_until_in_braces): Skip matches that are
        escaped by a @.  Don't count braces escaped by a @.  Don't stop
        too early when looking for a brace.

--- makeinfo/makeinfo.c~1       Sat Oct 16 09:28:40 1999
+++ makeinfo/makeinfo.c Sun Nov 14 19:20:50 1999
@@ -1020,10 +1020,21 @@ get_until_in_braces (match, string)
 
   for (i = input_text_offset; i < input_text_length; i++)
     {
-      if (input_text[i] == '{')
+      if (i < input_text_length - 1 && input_text[i] == '@')
+        {
+          i++;                 /* skip commands like @, and @{ */
+          continue;
+        }
+      else if (input_text[i] == '{')
         brace++;
       else if (input_text[i] == '}')
-        brace--;
+        {
+          brace--;
+          /* If looking for a brace, don't stop at the interior brace,
+             like after "baz" in "@foo{something @bar{baz} more}".  */
+          if (brace == 0)
+            continue;
+        }
       else if (input_text[i] == '\n')
         line_number++;
 

\input texinfo @c -*- texinfo -*-
@setfilename commas.info
@settitle AUTHORS -- who did what on GNU LilyPond

@macro foo
foo-expansion
@end macro

@macro bar
bar-expansion
@end macro

@node Top, , AUTHORS -- who did what on GNU LilyPond, (dir)
@top
@menu
* AUTHORS -- who did what on GNU LilyPond:: AUTHORS -- who did what.
@end menu

@node AUTHORS -- who did what on GNU LilyPond, Top, , Top
@chapter AUTHORS -- who did what on GNU LilyPond?

This file lists authors of GNU LilyPond, and what they wrote.
It also uses foobar@{.

@itemize @bullet
@item @email{pinard@@iro.montreal.ca, Fran@,{c}ois Pinard},
  parts of Documentation.
@item @email{foobar@@baz@@, The Foobar},
  the usual foobarical thing.
@item @email{another@@foobar@{, Buzzer},
  buzzed all the way.
@item @email{@foo{}@@@bar{}},
  also helped.
@item @email{tomcato@@xoommail.com, Tom Cato Amundsen},
  cembalo-partita in mundela.
@end itemize

@bye

Reply via email to