Re: Texinfo command nesting and syntax checking: nested @ref

2023-02-09 Thread Gavin Smith
On Tue, Feb 07, 2023 at 10:36:03AM +0100, Patrice Dumas wrote: > > It would of course be much simpler > > to eliminate this separate class of commands and forbid @ref etc. > > inside @section and other commands. Could we consider this again? > > I have not changed my mind, having refs in section

Re: Texinfo command nesting and syntax checking: nested @ref

2023-02-07 Thread Patrice Dumas
On Fri, Feb 03, 2023 at 08:19:16PM +, Gavin Smith wrote: > > %contain_basic_inline_with_refs_commands > > This contains sectioning and heading commands, so that > > @section Changes in @ref{SubModule} > > is allowed. I found this mail in the archives with the rationale > for allowing su

Re: Texinfo command nesting and syntax checking: nested @ref

2023-02-03 Thread Gavin Smith
On Sun, Jan 29, 2023 at 06:57:33PM +, Gavin Smith wrote: > On Tue, Jan 24, 2023 at 07:48:29AM +0100, Patrice Dumas wrote: > > > > However, this appears to be also an issue for all of the commands > > > that are marked "contain_simple_text" in command_data.txt. Would > > > it make sense to rep

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-30 Thread Patrice Dumas
On Sun, Jan 29, 2023 at 06:57:32PM +, Gavin Smith wrote: > > I've started work on this in the patch below. Looks right to me. > When I have time, I will make the corresponding change to the XS code. > Then it should be straightforward to extend this to all commands > that should only contain

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-30 Thread Gavin Smith
On Sun, Jan 29, 2023 at 06:57:33PM +, Gavin Smith wrote: > > > Perhaps we should also keep a stack of which commands incremented this > > > counter so we can report the invalid nesting in an error message? > > > > It is a necessity, in my opinion. > > I've started work on this in the patch b

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-29 Thread Gavin Smith
On Tue, Jan 24, 2023 at 07:48:29AM +0100, Patrice Dumas wrote: > > However, this appears to be also an issue for all of the commands > > that are marked "contain_simple_text" in command_data.txt. Would > > it make sense to replace the nesting_context.xref counter with > > a nesting_context.simple

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-25 Thread Gavin Smith
On Tue, Jan 24, 2023 at 08:21:22PM +, Gavin Smith wrote: > On Mon, Jan 23, 2023 at 08:04:48PM +, Gavin Smith wrote: > > In a recent commit I reduced the number of places from three to two. It > > means that spaces are ignored after @caption as caption was inside > > %command_ignore_space_a

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-24 Thread Gavin Smith
On Mon, Jan 23, 2023 at 08:04:48PM +, Gavin Smith wrote: > In a recent commit I reduced the number of places from three to two. It > means that spaces are ignored after @caption as caption was inside > %command_ignore_space_after although this was not being used in the > removed block of code.

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-23 Thread Patrice Dumas
On Sun, Jan 22, 2023 at 09:19:30PM +, Gavin Smith wrote: > On Sat, Jan 21, 2023 at 03:12:15PM +0100, Patrice Dumas wrote: > > Please commit, I'll change the perl parser afterwards, it looks very > > easy to implement. I have a commit related to source marks ready that I > > can commit before o

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-23 Thread Gavin Smith
On Sat, Jan 21, 2023 at 03:12:15PM +0100, Patrice Dumas wrote: > > I have started work on this, incrementing a counter at the > > @footnote open brace and decrement it at the closing brace (following > > the places in the code where ct_brace_command is popped from the > > context stack), but there

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-22 Thread Gavin Smith
On Sat, Jan 21, 2023 at 03:12:15PM +0100, Patrice Dumas wrote: > Please commit, I'll change the perl parser afterwards, it looks very > easy to implement. I have a commit related to source marks ready that I > can commit before or after changing the perl parser for this change, > actually. Thanks

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-21 Thread Patrice Dumas
On Sat, Jan 21, 2023 at 12:50:37PM +, Gavin Smith wrote: > On Thu, Jan 19, 2023 at 04:52:07AM +0100, Patrice Dumas wrote: > > It is not completly clear to me that the performance cost would be lower > > than looking at the commands stack and checking that the nesting is > > valid, as there is,

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-21 Thread Gavin Smith
On Thu, Jan 19, 2023 at 04:52:07AM +0100, Patrice Dumas wrote: > It is not completly clear to me that the performance cost would be lower > than looking at the commands stack and checking that the nesting is > valid, as there is, in general, no deep nesting, and the performance > penalty will proba

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Patrice Dumas
On Wed, Jan 18, 2023 at 09:30:53PM +, Gavin Smith wrote: > I don't see why it should be a huge performance barrier. Suppose > we want to forbid nested @footnote; then we would have a hash like > $self->{'nesting_context'} equal to {'footnote' => 0}, then when > we enter a @footnote, we increme

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Patrice Dumas
On Wed, Jan 18, 2023 at 08:54:21PM +, Gavin Smith wrote: > On Wed, Jan 18, 2023 at 11:52:33AM +0100, Patrice Dumas wrote: > > Even the recent one? I started having more categories in command_data.txt > > both for the inner commands classes (in_heading_spec) and outer commands > > classes > >

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Gavin Smith
On Wed, Jan 18, 2023 at 11:52:33AM +0100, Patrice Dumas wrote: > On Tue, Jan 17, 2023 at 09:26:54PM +, Gavin Smith wrote: > > Disclaimer: this message is not immediately practical. > > > > One thing I've noticed is that direct nesting of @ref commands is diagnosed, > > but indirect nesting is

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Gavin Smith
On Wed, Jan 18, 2023 at 11:52:33AM +0100, Patrice Dumas wrote: > Even the recent one? I started having more categories in command_data.txt > both for the inner commands classes (in_heading_spec) and outer commands > classes > (contain_simple_text, contain_plain_text), maybe simply adding more > c

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Gavin Smith
On Wed, Jan 18, 2023 at 11:52:33AM +0100, Patrice Dumas wrote: > > Perhaps a similar approach could be used in the > > tp/Texinfo/command_data.txt file, avoiding ad hoc and repetitous code > > in the two parser modules to check for valid nesting? > > The current approach of classes of containing a

Re: Texinfo command nesting and syntax checking: nested @ref

2023-01-18 Thread Patrice Dumas
On Tue, Jan 17, 2023 at 09:26:54PM +, Gavin Smith wrote: > Disclaimer: this message is not immediately practical. > > One thing I've noticed is that direct nesting of @ref commands is diagnosed, > but indirect nesting is not: Indeed, this is a long-standing issue in texi2any, and should be, n

Texinfo command nesting and syntax checking: nested @ref

2023-01-17 Thread Gavin Smith
Disclaimer: this message is not immediately practical. When adding a new command (@useindex) to texi2any, I thought it could be easier to define what is a valid nesting of Texinfo commands. One thing I've noticed is that direct nesting of @ref commands is diagnosed, but indirect nesting is not: