[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_initia
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization) (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c (raw_block_stack) (push_raw_block_stack, pop_raw_block_stack, process_remaining_on_line) (parse_texi): use a stack, raw_block_stack for nested raw block commands instead of putting them in the tree. |
Date: |
Sun, 01 Jan 2023 11:08:38 -0500 |
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 ded35d8215 * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization)
(_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c
(raw_block_stack) (push_raw_block_stack, pop_raw_block_stack,
process_remaining_on_line) (parse_texi): use a stack, raw_block_stack for
nested raw block commands instead of putting them in the tree.
ded35d8215 is described below
commit ded35d8215aa266d917df825e8abd01c5f3aea3c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 1 17:08:26 2023 +0100
* tp/Texinfo/ParserNonXS.pm (%parser_state_initialization)
(_process_remaining_on_line, _parse_texi),
tp/Texinfo/XS/parsetexi/parser.c (raw_block_stack)
(push_raw_block_stack, pop_raw_block_stack, process_remaining_on_line)
(parse_texi): use a stack, raw_block_stack for nested raw block
commands instead of putting them in the tree.
---
ChangeLog | 9 +
tp/Texinfo/ParserNonXS.pm | 128 +++---
tp/Texinfo/XS/parsetexi/parser.c | 196 ++++-----
tp/t/results/conditionals/nested_ignore.pl | 184 ++-------
.../conditionals/nested_ignore_comment_no_eol.pl | 29 +-
.../conditionals/nested_ignore_with_comments.pl | 460 ++++-----------------
tp/t/results/formatting/glossary.pl | 256 ++++--------
tp/t/results/macro/arg_body_expansion_order.pl | 51 +--
tp/t/results/macro/bad_formal_arg.pl | 51 +--
tp/t/results/macro/simple_imbricated_macro.pl | 51 +--
tp/t/results/raw/nested_macros.pl | 102 ++---
11 files changed, 414 insertions(+), 1103 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ac38f212ae..7c58b0c235 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-01-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization)
+ (_process_remaining_on_line, _parse_texi),
+ tp/Texinfo/XS/parsetexi/parser.c (raw_block_stack)
+ (push_raw_block_stack, pop_raw_block_stack, process_remaining_on_line)
+ (parse_texi): use a stack, raw_block_stack for nested raw block
+ commands instead of putting them in the tree.
+
2023-01-01 Patrice Dumas <pertusus@free.fr>
* tp/t/09indices.t, tp/Makefile.tres: add test with index_table with
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index b8ed384223..a5d4b335a0 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -137,6 +137,7 @@ my %parser_state_initialization = (
# global @-commands.
'conditionals_stack' => [], # a stack of conditional commands that are
# expanded.
+ 'raw_block_stack' => [], # a stack of raw block commands that are nested.
'floats' => {}, # key is the normalized float type, value is
# an array reference holding all the floats
# of that type.
@@ -4138,89 +4139,61 @@ sub _process_remaining_on_line($$$$)
and $line =~ /^\s*\@(r?macro)\s+/)
or ($current->{'cmdname'} eq 'ignore'
and $line =~ /^\s*\@(ignore)(\@|\s+)/)) {
- push @{$current->{'contents'}}, { 'cmdname' => $1,
- 'parent' => $current,
- 'contents' => [],};
- $current = $current->{'contents'}->[-1];
- if ($current->{'cmdname'} eq 'ignore') {
- $line =~ s/\s*\@ignore(\s*)//;
- if ($1 ne '') {
- $current->{'args'} = [
- {'type' => 'block_line_arg', 'parent' => $current,
- 'info' => {'spaces_after_argument' => $1},}
- ];
- }
- if ($line =~ /\@(c|comment)((\@|\s+).*)?$/) {
- my $comment_command = $1;
- my $comment_text = $2;
- chomp $comment_text;
- my $has_end_of_line = chomp $line;
- $comment_text .= "\n" if ($has_end_of_line);
- if (not exists($current->{'args'})) {
- $current->{'args'} = [
- {'type' => 'block_line_arg', 'parent' => $current,
- 'info' => {}}
- ];
- }
- my $comment_element = {'cmdname' => $comment_command, 'args' => [],
- 'extra' => {'misc_args' => [$comment_text]},
- 'parent' => $current->{'args'}->[-1]};
- push @{$comment_element->{'args'}}, {'type' => 'misc_arg',
- 'parent' => $comment_element, 'text' => $comment_text};
- $current->{'args'}->[-1]->{'info'}->{'comment_at_end'}
- = $comment_element;
- }
- } else {
- $line =~ s/\s*\@r?macro//;
- $current->{'info'} = {'arg_line' => $line };
- }
+ push @{$self->{'raw_block_stack'}}, $1;
print STDERR "RAW SECOND LEVEL \@$current->{'cmdname'}\n"
if ($self->{'DEBUG'});
+ push @{$current->{'contents'}},
+ { 'text' => $line, 'type' => 'raw', 'parent' => $current };
$retval = $GET_A_NEW_LINE;
goto funexit;
} elsif ($line =~ /^(\s*?)\@end\s+([a-zA-Z][\w-]*)/
and ($2 eq $current->{'cmdname'})) {
- if ($line =~ s/^(\s+)//) {
- push @{$current->{'contents'}},
- { 'text' => $1,
- 'type' => 'raw', 'parent' => $current };
- $self->_line_warn(sprintf(
- __("\@end %s should only appear at the beginning of a line"),
- $current->{'cmdname'}), $source_info);
- }
- # store toplevel macro specification
- if (($current->{'cmdname'} eq 'macro' or $current->{'cmdname'} eq
'rmacro')
- and (! $current->{'parent'}
- or !$current->{'parent'}->{'cmdname'}
- or ($current->{'parent'}->{'cmdname'} ne 'macro'
- and $current->{'parent'}->{'cmdname'} ne 'rmacro'))) {
- my $macrobody =
- Texinfo::Convert::Texinfo::convert_to_texinfo(
- { 'contents' => $current->{'contents'} });
- if ($current->{'args'} and $current->{'args'}->[0]) {
- my $name = $current->{'args'}->[0]->{'text'};
- if (exists($self->{'macros'}->{$name})) {
- $self->_line_warn(sprintf(__("macro `%s' previously defined"),
- $name), $current->{'source_info'});
- $self->_line_warn(sprintf(__(
- "here is the previous definition of `%s'"),
- $name), $self->{'macros'}->{$name}->{'element'}->{'source_info'});
- }
- if ($all_commands{$name}
- or ($name eq 'txiinternalvalue'
- and $self->{'accept_internalvalue'})) {
- $self->_line_warn(sprintf(__(
- "redefining Texinfo language command: \@%s"),
- $name), $current->{'source_info'});
- }
- if (!($current->{'extra'}
- and $current->{'extra'}->{'invalid_syntax'})) {
- $self->{'macros'}->{$name} = {
- 'element' => $current,
- 'macrobody' => $macrobody
- };
+ if (scalar(@{$self->{'raw_block_stack'}}) == 0) {
+ if ($line =~ s/^(\s+)//) {
+ push @{$current->{'contents'}},
+ { 'text' => $1,
+ 'type' => 'raw', 'parent' => $current };
+ $self->_line_warn(sprintf(
+ __("\@end %s should only appear at the beginning of a line"),
+ $current->{'cmdname'}), $source_info);
+ }
+ if ($current->{'cmdname'} eq 'macro'
+ or $current->{'cmdname'} eq 'rmacro') {
+ # store toplevel macro specification
+ my $macrobody =
+ Texinfo::Convert::Texinfo::convert_to_texinfo(
+ { 'contents' => $current->{'contents'} });
+ if ($current->{'args'} and $current->{'args'}->[0]) {
+ my $name = $current->{'args'}->[0]->{'text'};
+ if (exists($self->{'macros'}->{$name})) {
+ $self->_line_warn(sprintf(__("macro `%s' previously defined"),
+ $name), $current->{'source_info'});
+ $self->_line_warn(sprintf(__(
+ "here is the previous definition of `%s'"),
+ $name), $self->{'macros'}->{$name}->{'element'}->{'source_info'});
+ }
+ if ($all_commands{$name}
+ or ($name eq 'txiinternalvalue'
+ and $self->{'accept_internalvalue'})) {
+ $self->_line_warn(sprintf(__(
+ "redefining Texinfo language command: \@%s"),
+ $name), $current->{'source_info'});
+ }
+ if (!($current->{'extra'}
+ and $current->{'extra'}->{'invalid_syntax'})) {
+ $self->{'macros'}->{$name} = {
+ 'element' => $current,
+ 'macrobody' => $macrobody
+ };
+ }
}
}
+ } else {
+ my $closed_cmdname = pop @{$self->{'raw_block_stack'}};
+ push @{$current->{'contents'}},
+ { 'text' => $line, 'type' => 'raw', 'parent' => $current };
+ $retval = $GET_A_NEW_LINE;
+ goto funexit;
}
print STDERR "CLOSED raw $current->{'cmdname'}\n" if ($self->{'DEBUG'});
# start a new line for the @end line (without the first spaces on
@@ -6098,6 +6071,11 @@ sub _parse_texi($$$)
$self->_line_error(sprintf(__("expected \@end %s"), $end_conditional),
$source_info);
}
+ while (@{$self->{'raw_block_stack'}}) {
+ my $end_raw_block = pop @{$self->{'raw_block_stack'}};
+ $self->_line_error(sprintf(__("expected \@end %s"), $end_raw_block),
+ $source_info);
+ }
$current = _close_commands($self, $current, $source_info);
my @context_stack = $self->_get_context_stack();
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 14b2f2d20b..4a07c1690e 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -165,6 +165,34 @@ pop_conditional_stack (void)
}
+/* Raw block commands stack. */
+
+enum command_id *raw_block_stack;
+size_t raw_block_number;
+size_t raw_block_space;
+
+void
+push_raw_block_stack (enum command_id raw_block)
+{
+ if (raw_block_number == raw_block_space)
+ {
+ raw_block_stack = realloc (raw_block_stack,
+ (raw_block_space += 5)
+ * sizeof (enum command_id));
+ if (!raw_block_stack)
+ fatal ("realloc failed");
+ }
+ raw_block_stack[raw_block_number++] = raw_block;
+}
+
+enum command_id
+pop_raw_block_stack (void)
+{
+ if (raw_block_number == 0)
+ return CM_NONE;
+ return raw_block_stack[--raw_block_number];
+}
+
/* Counters */
COUNTER count_remaining_args;
COUNTER count_items;
@@ -1154,78 +1182,13 @@ process_remaining_on_line (ELEMENT **current_inout,
char **line_inout)
}
if (cmd)
{
- ELEMENT *e = new_element (ET_NONE);
- e->cmd = cmd;
- line = p;
+ ELEMENT *e;
+ e = new_element (ET_raw);
+ text_append (&e->text, line);
add_to_element_contents (current, e);
- current = e;
- if (cmd == CM_ignore)
- {
- size_t len_spaces = strspn (p, whitespace_chars);
- if (len_spaces)
- {
- ELEMENT *e;
- char *spaces_after_arg = strndup (p, len_spaces);
- p += len_spaces;
+ push_raw_block_stack (cmd);
- e = new_element (ET_block_line_arg);
- add_info_string (e, "spaces_after_argument",
- spaces_after_arg);
- add_to_element_args (current, e);
- }
- while (*p)
- {
- p = strchr (p, '@');
- if (p)
- {
- char *cmd_name;
- char *comment_position = read_comment (p, &cmd_name);
- if (comment_position)
- {
- ELEMENT *args;
- ELEMENT *e;
- ELEMENT *comment_e;
- ELEMENT *misc_arg_e;
- ELEMENT *block_line_arg_e;
-
- if (current->args.number == 0)
- {
- block_line_arg_e
- = new_element (ET_block_line_arg);
- add_to_element_args (current, block_line_arg_e);
- }
- else
- block_line_arg_e
- = args_child_by_index (current, 0);
-
- args = new_element (ET_NONE);
- e = new_element (ET_NONE);
- text_append (&e->text, comment_position);
- add_to_element_contents (args, e);
-
- misc_arg_e = new_element (ET_misc_arg);
- text_append (&misc_arg_e->text, comment_position);
-
- comment_e = new_element (ET_NONE);
- comment_e->cmd = lookup_command (cmd_name);
- add_extra_misc_args (comment_e, "misc_args", args);
- add_to_element_args (comment_e, misc_arg_e);
-
- add_info_element_oot (block_line_arg_e,
- "comment_at_end",
- comment_e);
- }
- p += 1;
- }
- else
- break;
- }
- }
- else
- {
- add_info_string_dup (e, "arg_line", line);
- }
retval = GET_A_NEW_LINE;
goto funexit;
}
@@ -1233,58 +1196,69 @@ process_remaining_on_line (ELEMENT **current_inout,
char **line_inout)
if (is_end_current_command (current, &p, &end_cmd))
{
ELEMENT *e;
-
- if (strchr (whitespace_chars, *line))
+ if (raw_block_number == 0)
{
ELEMENT *e;
- int n = strspn (line, whitespace_chars);
- e = new_element (ET_raw);
- text_append_n (&e->text, line, n);
- add_to_element_contents (current, e);
- line += n;
- line_warn ("@end %s should only appear at the "
- "beginning of a line", command_name(end_cmd));
- }
- /* For macros, define a new macro (unless we are in a nested
- macro definition). */
- if ((end_cmd == CM_macro || end_cmd == CM_rmacro)
- && (!current->parent
- || (current->parent->cmd != CM_macro
- && current->parent->cmd != CM_rmacro)))
- {
- char *name;
- enum command_id existing;
- if (current->args.number > 0)
+ if (strchr (whitespace_chars, *line))
{
- name = element_text (args_child_by_index (current, 0));
+ ELEMENT *e;
+ int n = strspn (line, whitespace_chars);
+ e = new_element (ET_raw);
+ text_append_n (&e->text, line, n);
+ add_to_element_contents (current, e);
+ line += n;
+ line_warn ("@end %s should only appear at the "
+ "beginning of a line", command_name(end_cmd));
+ }
- existing = lookup_command (name);
- if (existing)
+ /* For macros, define a new macro. */
+ if (end_cmd == CM_macro || end_cmd == CM_rmacro)
+ {
+ char *name;
+ enum command_id existing;
+ if (current->args.number > 0)
{
- MACRO *macro;
- macro = lookup_macro (existing);
- if (macro)
+ name = element_text (args_child_by_index (current, 0));
+
+ existing = lookup_command (name);
+ if (existing)
{
- line_error_ext (1, ¤t->source_info,
- "macro `%s' previously defined", name);
- line_error_ext (1, ¯o->element->source_info,
- "here is the previous definition of `%s'", name);
+ MACRO *macro;
+ macro = lookup_macro (existing);
+ if (macro)
+ {
+ line_error_ext (1, ¤t->source_info,
+ "macro `%s' previously defined", name);
+ line_error_ext (1, ¯o->element->source_info,
+ "here is the previous definition of `%s'",
name);
+ }
+ else if (!(existing & USER_COMMAND_BIT))
+ {
+ line_error_ext (1, ¤t->source_info,
+ "redefining Texinfo language command: @%s",
+ name);
+ }
}
- else if (!(existing & USER_COMMAND_BIT))
+ if (!lookup_extra (current, "invalid_syntax"))
{
- line_error_ext (1, ¤t->source_info,
- "redefining Texinfo language command: @%s",
- name);
+ new_macro (name, current);
}
}
- if (!lookup_extra (current, "invalid_syntax"))
- {
- new_macro (name, current);
- }
}
}
+ else
+ {
+ ELEMENT *e;
+ e = new_element (ET_raw);
+ text_append (&e->text, line);
+ add_to_element_contents (current, e);
+
+ pop_raw_block_stack();
+ retval = GET_A_NEW_LINE;
+ goto funexit;
+ }
debug ("CLOSED raw %s", command_name(end_cmd));
/* start a new line for the @end line (without the first spaces on
@@ -2230,6 +2204,14 @@ finished_totally:
conditional_number--;
}
+ /* Check for unclosed raw block commands */
+ while (raw_block_number > 0)
+ {
+ line_error ("expected @end %s",
+ command_name(raw_block_stack[raw_block_number - 1]));
+ raw_block_number--;
+ }
+
{
ELEMENT *dummy;
current = close_commands (current, CM_NONE, &dummy, CM_NONE);
diff --git a/tp/t/results/conditionals/nested_ignore.pl
b/tp/t/results/conditionals/nested_ignore.pl
index 4ad4d4fd57..4f6f2618c7 100644
--- a/tp/t/results/conditionals/nested_ignore.pl
+++ b/tp/t/results/conditionals/nested_ignore.pl
@@ -22,51 +22,9 @@ $result_trees{'nested_ignore'} = {
'cmdname' => 'ignore',
'contents' => [
{
- 'args' => [
- {
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => '
+ 'text' => '@ignore
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 4,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
},
{
'text' => '
@@ -74,56 +32,34 @@ $result_trees{'nested_ignore'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => '@end iftex
+ 'text' => '@end ignore
',
- 'type' => 'raw'
- },
- {
- 'text' => '@ifinfo
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 9,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@ignore
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end iftex
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@ifinfo
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -131,56 +67,24 @@ $result_trees{'nested_ignore'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => '@end ifclear
+ 'text' => '@ignore
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ifclear
',
- 'type' => 'raw'
- },
- {
- 'text' => '@ifclear
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@ifclear
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 14,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
}
],
'source_info' => {
diff --git a/tp/t/results/conditionals/nested_ignore_comment_no_eol.pl
b/tp/t/results/conditionals/nested_ignore_comment_no_eol.pl
index e0a638eed7..b9b5027157 100644
--- a/tp/t/results/conditionals/nested_ignore_comment_no_eol.pl
+++ b/tp/t/results/conditionals/nested_ignore_comment_no_eol.pl
@@ -22,29 +22,8 @@ $result_trees{'nested_ignore_comment_no_eol'} = {
'cmdname' => 'ignore',
'contents' => [
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => ' comment',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- ' comment'
- ]
- }
- },
- 'spaces_after_argument' => ' '
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore'
+ 'text' => '@ignore @c comment',
+ 'type' => 'raw'
}
],
'source_info' => {
@@ -68,12 +47,12 @@ $result_texts{'nested_ignore_comment_no_eol'} = '';
$result_errors{'nested_ignore_comment_no_eol'} = [
{
- 'error_line' => 'no matching `@end ignore\'
+ 'error_line' => 'expected @end ignore
',
'file_name' => '',
'line_nr' => 2,
'macro' => '',
- 'text' => 'no matching `@end ignore\'',
+ 'text' => 'expected @end ignore',
'type' => 'error'
},
{
diff --git a/tp/t/results/conditionals/nested_ignore_with_comments.pl
b/tp/t/results/conditionals/nested_ignore_with_comments.pl
index fe7cec1d42..12cb7beb0a 100644
--- a/tp/t/results/conditionals/nested_ignore_with_comments.pl
+++ b/tp/t/results/conditionals/nested_ignore_with_comments.pl
@@ -22,51 +22,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'cmdname' => 'ignore',
'contents' => [
{
- 'args' => [
- {
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'No space no comment
+ 'text' => '@ignore
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 4,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'No space no comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -74,51 +42,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Spaces no comment
+ 'text' => '@ignore
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 8,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Spaces no comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -126,65 +62,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => ' no space comment
+ 'text' => '@ignore@c no space comment
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- ' no space comment
-'
- ]
- }
- }
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Comment
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Comment
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 12,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -192,66 +82,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => '
+ 'text' => '@ignore @c
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- '
-'
- ]
- }
- },
- 'spaces_after_argument' => ' '
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Comment no argument
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Comment no argument
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 16,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -259,66 +102,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => ' space comment
+ 'text' => '@ignore @c space comment
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- ' space comment
-'
- ]
- }
- },
- 'spaces_after_argument' => ' '
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Space Comment
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Space Comment
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 20,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -326,66 +122,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => ' comment after text
+ 'text' => '@ignore something @comment comment after text
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'comment',
- 'extra' => {
- 'misc_args' => [
- ' comment after text
-'
- ]
- }
- },
- 'spaces_after_argument' => ' '
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Text comment
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Text comment
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 24,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -393,66 +142,19 @@ $result_trees{'nested_ignore_with_comments'} = {
'type' => 'raw'
},
{
- 'args' => [
- {
- 'info' => {
- 'comment_at_end' => {
- 'args' => [
- {
- 'text' => ' comment after command
+ 'text' => '@ignore some @code{variable} @comment comment after
command
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'comment',
- 'extra' => {
- 'misc_args' => [
- ' comment after command
-'
- ]
- }
- },
- 'spaces_after_argument' => ' '
- },
- 'type' => 'block_line_arg'
- }
- ],
- 'cmdname' => 'ignore',
- 'contents' => [
- {
- 'text' => 'Command comment
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'Command comment
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'ignore'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'ignore'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 28,
- 'macro' => ''
- }
- }
- ]
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end ignore
+',
+ 'type' => 'raw'
},
{
'text' => '
@@ -522,11 +224,11 @@ Comment no argument
Space Comment
@end ignore
-@ignore @comment comment after text
+@ignore something @comment comment after text
Text comment
@end ignore
-@ignore @comment comment after command
+@ignore some @code{variable} @comment comment after command
Command comment
@end ignore
diff --git a/tp/t/results/formatting/glossary.pl
b/tp/t/results/formatting/glossary.pl
index 090ee4d0b0..84161fbe01 100644
--- a/tp/t/results/formatting/glossary.pl
+++ b/tp/t/results/formatting/glossary.pl
@@ -247,98 +247,44 @@ $result_trees{'glossary'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => '@unmacro glossarytext
+ 'text' => '@macro expandglossary{glossary}
',
- 'type' => 'raw'
- },
- {
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => '\\\\glossary\\\\
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@unmacro glossarytext
',
- 'type' => 'raw'
- },
- {
- 'text' => '@item \\name\\ @anchor{\\id\\}
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@macro glossarytext
',
- 'type' => 'raw'
- },
- {
- 'text' => '\\text\\
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '\\\\glossary\\\\
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => 'glossary.texi',
- 'line_nr' => 29,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' glossarytext
-'
- }
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => 'glossary.texi',
- 'line_nr' => 30,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' expandglossary{glossary}
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@item \\name\\ @anchor{\\id\\}
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '\\text\\
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'text' => '@expandglossary {@glossarytext}
@@ -642,56 +588,29 @@ $result_trees{'glossary'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => '\\glossary\\
+ 'text' => '@macro glossarytext
',
- 'type' => 'raw'
- },
- {
- 'text' => '@item name1 @anchor{id1}
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '\\glossary\\
',
- 'type' => 'raw'
- },
- {
- 'text' => 'text1, arg1
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@item name1 @anchor{id1}
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => 'glossary.texi',
- 'line_nr' => 42,
- 'macro' => 'gentry'
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' glossarytext
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'text1, arg1
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'args' => [
@@ -916,56 +835,29 @@ $result_trees{'glossary'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => '\\glossary\\
+ 'text' => '@macro glossarytext
',
- 'type' => 'raw'
- },
- {
- 'text' => '@item name2 @anchor{id2}
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '\\glossary\\
',
- 'type' => 'raw'
- },
- {
- 'text' => 'text2
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@item name2 @anchor{id2}
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => 'glossary.texi',
- 'line_nr' => 43,
- 'macro' => 'gentry'
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' glossarytext
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'text2
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'args' => [
diff --git a/tp/t/results/macro/arg_body_expansion_order.pl
b/tp/t/results/macro/arg_body_expansion_order.pl
index 14c36a3eec..f5102f1c60 100644
--- a/tp/t/results/macro/arg_body_expansion_order.pl
+++ b/tp/t/results/macro/arg_body_expansion_order.pl
@@ -91,46 +91,19 @@ $result_trees{'arg_body_expansion_order'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => 'different
+ 'text' => '@macro othermacro
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 10,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' othermacro
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'different
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'text' => '\\arg\\
diff --git a/tp/t/results/macro/bad_formal_arg.pl
b/tp/t/results/macro/bad_formal_arg.pl
index 746d7d640f..fbc7eabd08 100644
--- a/tp/t/results/macro/bad_formal_arg.pl
+++ b/tp/t/results/macro/bad_formal_arg.pl
@@ -171,46 +171,19 @@ $result_trees{'bad_formal_arg'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => 'in macro foo
+ 'text' => '@macro foo {? aaa}
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 14,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' foo {? aaa}
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'in macro foo
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'args' => [
diff --git a/tp/t/results/macro/simple_imbricated_macro.pl
b/tp/t/results/macro/simple_imbricated_macro.pl
index fa8d781617..d5fccd7048 100644
--- a/tp/t/results/macro/simple_imbricated_macro.pl
+++ b/tp/t/results/macro/simple_imbricated_macro.pl
@@ -24,46 +24,19 @@ $result_trees{'simple_imbricated_macro'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => 'bidule.
+ 'text' => '@macro bidule {}
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 5,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' bidule {}
-'
- }
+ 'type' => 'raw'
+ },
+ {
+ 'text' => 'bidule.
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'args' => [
diff --git a/tp/t/results/raw/nested_macros.pl
b/tp/t/results/raw/nested_macros.pl
index ed09ec1d70..a45879734f 100644
--- a/tp/t/results/raw/nested_macros.pl
+++ b/tp/t/results/raw/nested_macros.pl
@@ -32,83 +32,29 @@ $result_trees{'nested_macros'} = {
'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'text' => 'other macro
+ 'text' => '@macro othermacro
',
- 'type' => 'raw'
- },
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 5,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => ' othermacro
-'
- }
+ 'type' => 'raw'
},
{
- 'cmdname' => 'macro',
- 'contents' => [
- {
- 'args' => [
- {
- 'contents' => [
- {
- 'text' => 'macro'
- }
- ],
- 'info' => {
- 'spaces_after_argument' => '
-'
- },
- 'type' => 'line_arg'
- }
- ],
- 'cmdname' => 'end',
- 'extra' => {
- 'text_arg' => 'macro'
- },
- 'info' => {
- 'spaces_before_argument' => ' '
- },
- 'source_info' => {
- 'file_name' => '',
- 'line_nr' => 7,
- 'macro' => ''
- }
- }
- ],
- 'info' => {
- 'arg_line' => '
-'
- }
+ 'text' => 'other macro
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@macro
+',
+ 'type' => 'raw'
+ },
+ {
+ 'text' => '@end macro
+',
+ 'type' => 'raw'
},
{
'args' => [
@@ -181,11 +127,11 @@ $result_converted{'plaintext'}->{'nested_macros'} = '';
$result_converted{'xml'}->{'nested_macros'} = '<macro name="truc" line=" truc
{ arg, ex}" endspaces=" "><formalarg>arg</formalarg><formalarg>ex</formalarg>
in macro \\arg\\
-<macro line=" othermacro " endspaces=" ">
+@macro othermacro
other macro
-</macro>
-<macro endspaces=" ">
-</macro>
+@end macro
+@macro
+@end macro
</macro>
';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization) (_process_remaining_on_line, _parse_texi), tp/Texinfo/XS/parsetexi/parser.c (raw_block_stack) (push_raw_block_stack, pop_raw_block_stack, process_remaining_on_line) (parse_texi): use a stack, raw_block_stack for nested raw block commands instead of putting them in the tree.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/t/09indices.t, tp/Makefile.tres: add test with index_table with default customization, rename former index_table as index_table_chapter_no_node. Add explicit split nodes for Plaintext testing for index_nodes. Split @file_encodings_tests out of @file_tests. In @file_tests, do only testing of Info if it is expected to be different from the base case. Keep spaces at end of line in test text only.
- Next by Date:
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization), (_process_remaining_on_line, _end_line_misc_line, _parse_texi): rename conditionals_stack as conditional_stack to match XS parser.
- Previous by thread:
branch master updated: * tp/t/09indices.t, tp/Makefile.tres: add test with index_table with default customization, rename former index_table as index_table_chapter_no_node. Add explicit split nodes for Plaintext testing for index_nodes. Split @file_encodings_tests out of @file_tests. In @file_tests, do only testing of Info if it is expected to be different from the base case. Keep spaces at end of line in test text only.
- Next by thread:
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_initialization), (_process_remaining_on_line, _end_line_misc_line, _parse_texi): rename conditionals_stack as conditional_stack to match XS parser.
- Index(es):