[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Fri, 14 Jul 2023 15:43:21 -0400 (EDT) |
branch: master
commit 192ee2dc4d1111856e6299b722664eab04190f1b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jul 14 21:42:50 2023 +0200
* tp/Texinfo/ParserNonXS.pm (_end_line_misc_line)
(_handle_menu_entry_separators, _handle_line_command)
(_handle_open_brace, _handle_comma),
tp/Texinfo/XS/parsetexi/handle_commands.c (parse_rawline_command)
(handle_line_command), tp/Texinfo/XS/parsetexi/menus.c
(handle_menu_entry_separators), tp/Texinfo/XS/parsetexi/parser.c
(process_remaining_on_line), tp/Texinfo/XS/parsetexi/separator.c
(handle_comma): synchronize debug messages across parsers.
* tp/Texinfo/ParserNonXS.pm (_handle_open_brace),
tp/Texinfo/XS/parsetexi/separator.c (handle_comma): rearrange code
related to inline type.
---
ChangeLog | 15 +++++++++
tp/Texinfo/ParserNonXS.pm | 34 ++++++++++---------
tp/Texinfo/XS/parsetexi/handle_commands.c | 12 +++++--
tp/Texinfo/XS/parsetexi/menus.c | 4 ++-
tp/Texinfo/XS/parsetexi/parser.c | 2 ++
tp/Texinfo/XS/parsetexi/separator.c | 55 ++++++++++++++++---------------
6 files changed, 77 insertions(+), 45 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 88708a26d6..ccc260ed40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,21 @@
* NEWS: remove reverted change about index commands ending
paragraphs.
+2023-07-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line)
+ (_handle_menu_entry_separators, _handle_line_command)
+ (_handle_open_brace, _handle_comma),
+ tp/Texinfo/XS/parsetexi/handle_commands.c (parse_rawline_command)
+ (handle_line_command), tp/Texinfo/XS/parsetexi/menus.c
+ (handle_menu_entry_separators), tp/Texinfo/XS/parsetexi/parser.c
+ (process_remaining_on_line), tp/Texinfo/XS/parsetexi/separator.c
+ (handle_comma): synchronize debug messages across parsers.
+
+ * tp/Texinfo/ParserNonXS.pm (_handle_open_brace),
+ tp/Texinfo/XS/parsetexi/separator.c (handle_comma): rearrange code
+ related to inline type.
+
2023-07-14 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_html_set_pages_files): set up a
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 41c2699595..31eccb4723 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3552,7 +3552,7 @@ sub _end_line_misc_line($$$)
and $block_commands{$closed_command->{'cmdname'}} eq 'menu'
and defined($self->_top_context_command())
and $block_commands{$self->_top_context_command()} eq 'menu') {
- print STDERR "CLOSE MENU but still in menu context\n"
+ print STDERR "CLOSE menu but still in menu context\n"
if ($self->{'DEBUG'});
push @{$current->{'contents'}}, {'type' => 'menu_comment',
'parent' => $current,
@@ -4949,7 +4949,8 @@ sub _handle_menu_entry_separators($$$$$$)
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'internal_menu_star')
{
if ($$line_ref !~ /^\s+/) {
- print STDERR "ABORT MENU STAR ($$line_ref)\n" if ($self->{'DEBUG'});
+ print STDERR "ABORT MENU STAR before: "
+ ._debug_protect_eol($$line_ref)."\n" if ($self->{'DEBUG'});
delete $current->{'contents'}->[-1]->{'type'};
} else {
print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
@@ -5378,8 +5379,8 @@ sub _handle_line_command($$$$$$)
# @item or @itemx in @table
if ($command eq 'item' or $command eq 'itemx') {
my $parent;
- print STDERR "ITEM_LINE\n" if ($self->{'DEBUG'});
if ($parent = _item_line_parent($current)) {
+ print STDERR "ITEM LINE $command\n" if ($self->{'DEBUG'});
$current = $parent;
_gather_previous_item($self, $current, $command, $source_info);
} else {
@@ -5861,10 +5862,10 @@ sub _handle_open_brace($$$$)
# lone braces accepted right in a rawpreformatted
} elsif ($current->{'type'}
and $current->{'type'} eq 'rawpreformatted') {
- # this can happen in an expanded rawpreformatted
- $current = _merge_text($self, $current, '{');
print STDERR "LONE OPEN BRACE in rawpreformatted\n"
if ($self->{'DEBUG'});
+ # this can happen in an expanded rawpreformatted
+ $current = _merge_text($self, $current, '{');
# matching braces accepted in a rawpreformatted, inline raw or
# math. Note that for rawpreformatted, it can only happen
# within an @-command as { is simply added as seen just above.
@@ -6186,21 +6187,24 @@ sub _handle_comma($$$$)
# condition is missing for some reason
print STDERR "INLINE COND MISSING\n"
if ($self->{'DEBUG'});
- } elsif ($inline_format_commands{$current->{'cmdname'}}) {
- if ($self->{'expanded_formats_hash'}->{$inline_type}) {
+ } else {
+ print STDERR "INLINE: $inline_type\n" if ($self->{'DEBUG'});
+ if ($inline_format_commands{$current->{'cmdname'}}) {
+ if ($self->{'expanded_formats_hash'}->{$inline_type}) {
+ $expandp = 1;
+ $current->{'extra'}->{'expand_index'} = 1;
+ } else {
+ $expandp = 0;
+ }
+ } elsif (($current->{'cmdname'} eq 'inlineifset'
+ and exists($self->{'values'}->{$inline_type}))
+ or ($current->{'cmdname'} eq 'inlineifclear'
+ and ! exists($self->{'values'}->{$inline_type}))) {
$expandp = 1;
$current->{'extra'}->{'expand_index'} = 1;
} else {
$expandp = 0;
}
- } elsif (($current->{'cmdname'} eq 'inlineifset'
- and exists($self->{'values'}->{$inline_type}))
- or ($current->{'cmdname'} eq 'inlineifclear'
- and ! exists($self->{'values'}->{$inline_type}))) {
- $expandp = 1;
- $current->{'extra'}->{'expand_index'} = 1;
- } else {
- $expandp = 0;
}
$current->{'extra'}->{'format'} = $inline_type;
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 2cb868b461..3d0ef5eac4 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -285,9 +285,17 @@ parse_rawline_command (char *line, enum command_id cmd,
r = skip_to_comment_if_comment_or_spaces (q, has_comment);
if (!r || r != q)
{
+ char *end_line;
+ char *line_nonl;
q += strspn (q, whitespace_chars);
+ /* remove new line for the message */
+ line_nonl = strdup (q);
+ end_line = strchr (line_nonl, '\n');
+ if (end_line)
+ *end_line = '\0';
line_warn ("remaining argument on @%s line: %s",
- command_name(cmd), q);
+ command_name(cmd), line_nonl);
+ free (line_nonl);
}
break;
clickstyle_invalid:
@@ -713,7 +721,7 @@ handle_line_command (ELEMENT *current, char **line_inout,
ELEMENT *parent;
if ((parent = item_line_parent (current)))
{
- debug ("ITEM_LINE");
+ debug ("ITEM LINE %s", command_name(cmd));
current = parent;
gather_previous_item (current, cmd);
}
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index bb51ec4f5e..f41a43848f 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -184,7 +184,9 @@ handle_menu_entry_separators (ELEMENT **current_inout, char
**line_inout)
else if (current->contents.number > 0
&& last_contents_child(current)->type == ET_internal_menu_star)
{
- debug ("ABORT MENU STAR");
+ debug_nonl ("ABORT MENU STAR before: ");
+ debug_print_protected_string (line); debug ("");
+
last_contents_child(current)->type = ET_NONE;
}
/* After a separator in a menu, end of menu entry node or menu entry name
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 7fe2813849..876ee1432a 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1380,6 +1380,8 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
}
if (cmd)
{
+ debug ("RAW SECOND LEVEL %s in @%s", command_name(cmd),
+ command_name(current->cmd));
push_raw_block_stack (cmd);
}
/* Else check if line is "@end ..." for current command. */
diff --git a/tp/Texinfo/XS/parsetexi/separator.c
b/tp/Texinfo/XS/parsetexi/separator.c
index ab124cf776..64d1d320a7 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -195,6 +195,7 @@ handle_open_brace (ELEMENT *current, char **line_inout)
}
else if (current->type == ET_rawpreformatted)
{
+ debug ("LONE OPEN BRACE in rawpreformatted");
current = merge_text (current, "{", 0);
}
/* matching braces accepted in a rawpreformatted, inline raw or
@@ -581,7 +582,6 @@ handle_comma (ELEMENT *current, char **line_inout)
{
KEY_PAIR *k;
int expandp = 0;
- debug ("THE INLINE PART");
k = lookup_extra (current, "format");
if (!k)
{
@@ -595,42 +595,43 @@ handle_comma (ELEMENT *current, char **line_inout)
inline_type = arg->text.text;
}
- debug ("INLINE <%s>", inline_type);
if (!inline_type)
{
/* Condition is missing */
debug ("INLINE COND MISSING");
+ add_extra_string (current, "format", 0);
}
- else if (current->cmd == CM_inlineraw
- || current->cmd == CM_inlinefmt
- || current->cmd == CM_inlinefmtifelse)
+ else
{
- if (format_expanded_p (inline_type))
+ debug ("INLINE: %s", inline_type);
+ if (current->cmd == CM_inlineraw
+ || current->cmd == CM_inlinefmt
+ || current->cmd == CM_inlinefmtifelse)
+ {
+ if (format_expanded_p (inline_type))
+ {
+ expandp = 1;
+ add_extra_integer (current, "expand_index", 1);
+ }
+ else
+ expandp = 0;
+ }
+ else if (current->cmd == CM_inlineifset
+ || current->cmd == CM_inlineifclear)
{
- expandp = 1;
- add_extra_integer (current, "expand_index", 1);
+ expandp = 0;
+ if (fetch_value (inline_type))
+ expandp = 1;
+ if (current->cmd == CM_inlineifclear)
+ expandp = !expandp;
+ if (expandp)
+ add_extra_integer (current, "expand_index", 1);
}
else
expandp = 0;
- }
- else if (current->cmd == CM_inlineifset
- || current->cmd == CM_inlineifclear)
- {
- expandp = 0;
- if (fetch_value (inline_type))
- expandp = 1;
- if (current->cmd == CM_inlineifclear)
- expandp = !expandp;
- if (expandp)
- add_extra_integer (current, "expand_index", 1);
- }
- else
- expandp = 0;
- if (inline_type)
- add_extra_string_dup (current, "format", inline_type);
- else
- add_extra_string (current, "format", 0);
+ add_extra_string_dup (current, "format", inline_type);
+ }
/* Skip first argument for a false @inlinefmtifelse */
if (!expandp && current->cmd == CM_inlinefmtifelse)
@@ -697,7 +698,7 @@ handle_comma (ELEMENT *current, char **line_inout)
}
else if (current->cmd == CM_inlinefmtifelse)
{
- /* Second art of @inlinefmtifelse when condition is true. Discard
+ /* Second part of @inlinefmtifelse when condition is true. Discard
second argument. */
expandp = 0;
}