On Sat, Jan 21, 2023 at 12:50:37PM +0000, 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, in general, no deep nesting, and the performance > > penalty will probably be more important for your option when there are a > > lot of non-nested commands. Your proposal, however, avoids a performance > > penalty increasing with nesting, as it would be simply proportional to > > the number of commands, I believe. I do not think that we can know > > in advance which one is better, though, as it depends on the manual. > > > > In any case, your proposal looks good to me, I can follow-up with > > changes in the pure perl parser if you want me to. > > 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 are three different places in the code where > the context is popped at the closing brace. It would be clearer if this > code could be unified. > > I expect that this new code could take over the existing use of the > context brace context (for @caption, @shortcaption and @footnote), > so I suggest that we could add this new code first, then try to simplify > afterwards.
Ok. > I have not committed the change below yet as this leads to a change in the > test results. I believe it should be straightforward to implement this > in the pure Perl parser. I would be happy to write this myself but I > may not have any more time to do this this weekend. 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. -- Pat