[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 29 Sep 2024 08:34:57 -0400 (EDT) |
branch: master
commit 7924bb32437a56527890cac6f9d9eaeb39eeaac8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jun 25 00:40:36 2024 +0200
* tp/Texinfo/ParserNonXS.pm (_close_brace_command)
(_handle_close_brace), tp/Texinfo/XS/parsetexi/close.c
(close_brace_command), tp/Texinfo/XS/parsetexi/separator.c
(handle_close_brace): pop ct_inlineraw context in close_brace_command
instead of handle_close_brace, such that it is done when the command
is closed although there is no closing brace.
* tp/Makefile.tres, tp/t/16raw.t (inlineraw_not_closed): add test of
@inlineraw not closed.
* tp/Texinfo/XS/parsetexi/api.c, tp/Texinfo/XS/parsetexi/macro.c:
change in FIXMEs.
---
ChangeLog | 15 ++++
tp/Makefile.tres | 1 +
tp/Texinfo/ParserNonXS.pm | 9 +--
tp/Texinfo/XS/parsetexi/api.c | 1 -
tp/Texinfo/XS/parsetexi/close.c | 5 ++
tp/Texinfo/XS/parsetexi/end_line.c | 5 +-
tp/Texinfo/XS/parsetexi/macro.c | 5 +-
tp/Texinfo/XS/parsetexi/separator.c | 5 --
tp/t/16raw.t | 4 +
tp/t/results/raw/inlineraw_not_closed.pl | 129 +++++++++++++++++++++++++++++++
10 files changed, 161 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9b2610d81..82c83c600d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-06-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_close_brace_command)
+ (_handle_close_brace), tp/Texinfo/XS/parsetexi/close.c
+ (close_brace_command), tp/Texinfo/XS/parsetexi/separator.c
+ (handle_close_brace): pop ct_inlineraw context in close_brace_command
+ instead of handle_close_brace, such that it is done when the command
+ is closed although there is no closing brace.
+
+ * tp/Makefile.tres, tp/t/16raw.t (inlineraw_not_closed): add test of
+ @inlineraw not closed.
+
+ * tp/Texinfo/XS/parsetexi/api.c, tp/Texinfo/XS/parsetexi/macro.c:
+ change in FIXMEs.
+
2024-06-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/build_perl_info.c (build_perl_directions): rename
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 411782348e..b0cfe62ba1 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1872,6 +1872,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/raw/inlinefmt.pl \
t/results/raw/inlinefmt_with_empty_line.pl \
t/results/raw/inlineraw.pl \
+ t/results/raw/inlineraw_not_closed.pl \
t/results/raw/inlineraw_with_empty_line.pl \
t/results/raw/lone_braces_in_html.pl \
t/results/raw/misc_raw.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 099b0865ad..1d5b9a0490 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1495,6 +1495,9 @@ sub _close_brace_command($$$;$$$)
$self->{'nesting_context'}->{'caption'} -= 1
if ($current->{'cmdname'} eq 'caption'
or $current->{'cmdname'} eq 'shortcaption');
+ } elsif ($current->{'cmdname'} eq 'inlineraw') {
+ _pop_context($self, ['ct_inlineraw'], $source_info, $current,
+ ' inlineraw');
}
# args are always set
@@ -6528,12 +6531,6 @@ sub _handle_close_brace($$$)
or ($brace_commands{$current->{'parent'}->{'cmdname'}}
and $brace_commands{$current->{'parent'}->{'cmdname'}} eq
'inline')) {
my $current_command = $current->{'parent'};
- if ($brace_commands{$current_command->{'cmdname'}} eq 'inline') {
- if ($current_command->{'cmdname'} eq 'inlineraw') {
- _pop_context($self, ['ct_inlineraw'], $source_info, $current,
- ' inlineraw');
- }
- }
if (!$current_command->{'args'}
or !$current_command->{'args'}->[0]->{'contents'}) {
$self->_line_warn(
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index c2a7a1051c..0e6d133dc7 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -148,7 +148,6 @@ parse_file_path (const char *input_file_path, char **result)
else
{
result[0] = strdup (input_file_path);
- /* FIXME or strdup ("") */
result[1] = 0;
}
}
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index d29479d885..e4c42d0735 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -66,6 +66,11 @@ close_brace_command (ELEMENT *current,
|| current->e.c->cmd == CM_shortcaption)
nesting_context.caption--;
}
+ else if (current->e.c->cmd == CM_inlineraw)
+ {
+ if (pop_context () != ct_inlineraw)
+ fatal ("inlineraw context expected");
+ }
if (command_flags(current) & CF_contain_basic_inline)
(void) pop_command (&nesting_context.basic_inline_stack);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 48c4659385..3a73b9bc89 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1905,10 +1905,7 @@ end_line (ELEMENT *current)
current = end_paragraph (current, 0, 0);
}
/* FIXME not sure about this one, could be better to close
- brace commands in more contexts. Should make sure that
- it is ok before, for instance, it is not sure that CM_inlineraw
- should be closed that way, as it does not seems that the
- ct_inlineraw context is popped.
+ brace commands in more contexts.
*/
else if (current_context () == ct_base)
{ /* closes no_paragraph brace commands that are not context brace
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 55704611e1..390bde12bb 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -135,8 +135,9 @@ parse_macro_command_line (enum command_id cmd, const char
**line_inout,
const char *args_ptr;
int index;
- /* FIXME not sure about that. Could be the best, as there is arg_line.
- Otherwise block_command */
+ /* TODO not sure about using lineraw_command. There is an arg_line info,
+ which is consistent with lineraw_command, but the *macro are block
+ commands. block_command could be used instead */
macro = new_command_element (ET_lineraw_command, cmd);
macro->e.c->source_info = current_source_info;
diff --git a/tp/Texinfo/XS/parsetexi/separator.c
b/tp/Texinfo/XS/parsetexi/separator.c
index 2b6fb367cd..411de2b013 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -464,11 +464,6 @@ handle_close_brace (ELEMENT *current, const char
**line_inout)
|| closed_command == CM_abbr
|| closed_command == CM_acronym)
{
- if (current->parent->e.c->cmd == CM_inlineraw)
- {
- if (ct_inlineraw != pop_context ())
- fatal ("inlineraw context expected");
- }
if (current->parent->e.c->args.number == 0
|| current->parent->e.c->args.list[0]->e.c->contents.number == 0)
{
diff --git a/tp/t/16raw.t b/tp/t/16raw.t
index b9fe11a14e..c3dd43ef0c 100644
--- a/tp/t/16raw.t
+++ b/tp/t/16raw.t
@@ -490,6 +490,10 @@ in displaymath
<i>@acronym{HTML}</i>}.
'],
+['inlineraw_not_closed',
+'@inlineraw{html, aa
+@section sec
+'],
['inline_missing_first_arg',
'@inlinefmt{ , aaa}. @inlineraw{, bbb}.
'],
diff --git a/tp/t/results/raw/inlineraw_not_closed.pl
b/tp/t/results/raw/inlineraw_not_closed.pl
new file mode 100644
index 0000000000..0562c09633
--- /dev/null
+++ b/tp/t/results/raw/inlineraw_not_closed.pl
@@ -0,0 +1,129 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'inlineraw_not_closed'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'html'
+ }
+ ],
+ 'type' => 'brace_arg'
+ },
+ {
+ 'contents' => [
+ {
+ 'text' => 'aa
+'
+ }
+ ],
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'type' => 'brace_arg'
+ }
+ ],
+ 'cmdname' => 'inlineraw',
+ 'extra' => {
+ 'expand_index' => 1,
+ 'format' => 'html'
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'sec'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'section',
+ 'extra' => {
+ 'section_number' => '1'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'inlineraw_not_closed'} = '@inlineraw{html, aa
+}@section sec
+';
+
+
+$result_texts{'inlineraw_not_closed'} = 'aa
+1 sec
+=====
+';
+
+$result_sectioning{'inlineraw_not_closed'} = {
+ 'extra' => {
+ 'section_childs' => [
+ {
+ 'cmdname' => 'section',
+ 'extra' => {
+ 'section_level' => 2,
+ 'section_number' => '1',
+ 'sectioning_root' => {}
+ }
+ }
+ ],
+ 'section_level' => 1
+ }
+};
+$result_sectioning{'inlineraw_not_closed'}{'extra'}{'section_childs'}[0]{'extra'}{'sectioning_root'}
= $result_sectioning{'inlineraw_not_closed'};
+
+$result_errors{'inlineraw_not_closed'} = [
+ {
+ 'error_line' => '@section seen before @inlineraw closing brace
+',
+ 'line_nr' => 1,
+ 'text' => '@section seen before @inlineraw closing brace',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'inlineraw_not_closed'} = {};
+
+
+1;