[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_o
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line) (parse_texi): process a definition line continuation right where it is seen. Get the next line immediately too. |
Date: |
Sun, 29 Sep 2024 07:26:33 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 1d8c850a03 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line,
_parse_texi), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line)
(parse_texi): process a definition line continuation right where it is seen.
Get the next line immediately too.
1d8c850a03 is described below
commit 1d8c850a0382bef1d63c1ed9c0dd6002d3b3aaba
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jun 22 10:06:53 2024 +0200
* tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line)
(parse_texi): process a definition line continuation right where it is
seen. Get the next line immediately too.
---
ChangeLog | 7 ++++++
tp/Texinfo/ParserNonXS.pm | 39 +++++++++++++-------------------
tp/Texinfo/XS/parsetexi/parser.c | 48 ++++++++++++++++++----------------------
3 files changed, 44 insertions(+), 50 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2e59207955..c88298ea8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-06-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi),
+ tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line)
+ (parse_texi): process a definition line continuation right where it is
+ seen. Get the next line immediately too.
+
2024-06-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/handle_commands.c (handle_block_command):
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 4c0fe3a1f3..131e4b0cde 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -7355,14 +7355,18 @@ sub _process_remaining_on_line($$$$)
# special case with @ followed by a newline protecting end of lines
# in @def*
- my $def_line_continuation
- = ($self->_top_context() eq 'ct_def' and $command eq "\n");
+ if ($self->_top_context() eq 'ct_def' and $command eq "\n") {
+ my $line_continuation_source_mark
+ = { 'sourcemark_type' => 'defline_continuation' };
+ _register_source_mark($self, $current, $line_continuation_source_mark);
+ ($line, $source_info) = _next_text($self, $current);
+ return ($current, $line, $source_info, $retval);
+ }
# warn on not appearing at line beginning. Need to do before closing
# paragraph as it also closes the empty line
- if (not $def_line_continuation
- and not _abort_empty_line($self, $current)
- and $begin_line_commands{$command}) {
+ if (not _abort_empty_line($self, $current)
+ and $begin_line_commands{$command}) {
$self->_line_warn(
sprintf(__("\@%s should only appear at the beginning of a line"),
$command), $source_info);
@@ -7385,14 +7389,6 @@ sub _process_remaining_on_line($$$$)
_check_valid_nesting ($self, $current, $command, $source_info);
_check_valid_nesting_context ($self, $command, $source_info);
- if ($def_line_continuation) {
- my $line_continuation_source_mark
- = { 'sourcemark_type' => 'defline_continuation' };
- _register_source_mark($self, $current, $line_continuation_source_mark);
- return ($current, $line, $source_info, $GET_A_NEW_LINE);
- # goto funexit; # used in XS code
- }
-
if ($in_index_commands{$command}
and $current->{'contents'}
and $current->{'contents'}->[-1]
@@ -7627,18 +7623,13 @@ sub _parse_texi($$$)
# next;
#}
- if (# not def line
- $self->_top_context() ne 'ct_def') {
- next NEXT_LINE if _check_line_directive ($self, $line, $source_info);
- print STDERR "BEGIN LINE\n" if ($self->{'conf'}->{'DEBUG'});
-
- # based on whitespace_chars_except_newline in XS parser
- $line =~ s/^([ \t\cK\f]*)//;
- push @{$current->{'contents'}}, { 'type' => 'empty_line',
- 'text' => $1,
- 'parent' => $current };
- }
+ next NEXT_LINE if _check_line_directive ($self, $line, $source_info);
+ # based on whitespace_chars_except_newline in XS parser
+ $line =~ s/^([ \t\cK\f]*)//;
+ push @{$current->{'contents'}}, { 'type' => 'empty_line',
+ 'text' => $1,
+ 'parent' => $current };
while (1) {
($current, $line, $source_info, $status)
= _process_remaining_on_line($self, $current, $line, $source_info);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 162d73bac1..5eff2b2984 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2236,7 +2236,6 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
/* Any other @-command. */
else if (cmd)
{
- int def_line_continuation;
/* command used to get command data. Needed for the multicategory
@item command. */
enum command_id data_cmd = cmd;
@@ -2349,13 +2348,20 @@ process_remaining_on_line (ELEMENT **current_inout,
const char **line_inout)
/* special case with @ followed by a newline protecting end of lines
in @def* */
- def_line_continuation = (current_context () == ct_def
- && cmd == CM_NEWLINE);
+ if (current_context () == ct_def && cmd == CM_NEWLINE)
+ {
+ SOURCE_MARK *line_continuation_source_mark
+ = new_source_mark (SM_type_defline_continuation);
+ register_source_mark (current, line_continuation_source_mark);
+
+ free (allocated_text);
+ line = allocated_text = next_text (current);
+ goto funexit;
+ }
/* warn on not appearing at line beginning. Need to do before closing
paragraph as it also closes the empty line */
- if (!def_line_continuation
- && !abort_empty_line (current)
+ if (!abort_empty_line (current)
&& ((cmd == CM_node || cmd == CM_bye)
|| (command_data(cmd).flags & CF_block)
|| ((command_data(cmd).flags & CF_line)
@@ -2391,15 +2397,6 @@ process_remaining_on_line (ELEMENT **current_inout,
const char **line_inout)
check_valid_nesting_context (cmd);
}
- if (def_line_continuation)
- {
- SOURCE_MARK *line_continuation_source_mark
- = new_source_mark (SM_type_defline_continuation);
- register_source_mark (current, line_continuation_source_mark);
- retval = GET_A_NEW_LINE;
- goto funexit;
- }
-
if ((cmd == CM_sortas
|| cmd == CM_seeentry
|| cmd == CM_seealso
@@ -2655,6 +2652,9 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
/* Read input file line-by-line. */
while (1)
{
+ ELEMENT *e;
+ int n;
+
free (allocated_line);
line = allocated_line = next_text (current);
if (!allocated_line)
@@ -2665,22 +2665,18 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
debug_nonl ("NEW LINE %s", line);
+ if (check_line_directive (line))
+ continue;
+
/* collect leading whitespace and save as an "ET_empty_line" element.
This element type can be changed in 'abort_empty_line' when more
text is read. */
- if (current_context () != ct_def)
- {
- ELEMENT *e;
- int n;
- if (check_line_directive (line))
- continue;
-
- debug ("BEGIN LINE");
-
- e = new_text_element (ET_empty_line);
- add_to_element_contents (current, e);
- n = strspn (line, whitespace_chars_except_newline);
+ e = new_text_element (ET_empty_line);
+ add_to_element_contents (current, e);
+ n = strspn (line, whitespace_chars_except_newline);
+ if (n > 0)
+ {
text_append_n (e->e.text, line, n);
line += n;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line) (parse_texi): process a definition line continuation right where it is seen. Get the next line immediately too.,
Patrice Dumas <=