[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/command_data.txt, tp/Te
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting) (process_remaining_on_line): merge commands with CF_other flag with commands with CF_nobrace flag. Add NOBRACE_symbol type for symbols without brace. Rename OTHER_skipspace as NOBRACE_skipspace. Rename OTHER_noarg as NOBRACE_other. Handle all the CF_nobrace commands in handle_other_command, which means moving the handling o [...] |
Date: |
Fri, 30 Sep 2022 13:58:07 -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 4145a5d6b3 * tp/Texinfo/XS/parsetexi/command_data.txt,
tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting)
(process_remaining_on_line): merge commands with CF_other flag with commands
with CF_nobrace flag. Add NOBRACE_symbol type for symbols without brace.
Rename OTHER_skipspace as NOBRACE_skipspace. Rename OTHER_noarg as
NOBRACE_other. Handle all the CF_nobrace commands in handle_other_command,
which means [...]
4145a5d6b3 is described below
commit 4145a5d6b35c183714eb21ccec0d01d3c0d6bcb5
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Sep 30 19:57:56 2022 +0200
* tp/Texinfo/XS/parsetexi/command_data.txt,
tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting)
(process_remaining_on_line): merge commands with CF_other flag with
commands with CF_nobrace flag. Add NOBRACE_symbol type for symbols
without brace. Rename OTHER_skipspace as NOBRACE_skipspace. Rename
OTHER_noarg as NOBRACE_other. Handle all the CF_nobrace commands in
handle_other_command, which means moving the handling of
NOBRACE_symbol commands from process_remaining_on_line to
handle_other_command.
* tp/Texinfo/XS/parsetexi/close.c (close_commands),
tp/Texinfo/XS/parsetexi/context_stack.c
(in_preformatted_context_not_menu), tp/Texinfo/XS/parsetexi/parser.c
(check_valid_nesting, parse_texi): check CF_* in addition to .data in
some places to be sure that the value is for the right type of
command.
---
ChangeLog | 20 ++++++++++
tp/TODO | 2 +
tp/Texinfo/XS/parsetexi/close.c | 9 +++--
tp/Texinfo/XS/parsetexi/command_data.txt | 62 +++++++++++++++----------------
tp/Texinfo/XS/parsetexi/commands.h | 8 ++--
tp/Texinfo/XS/parsetexi/context_stack.c | 4 +-
tp/Texinfo/XS/parsetexi/handle_commands.c | 31 ++++++++++++----
tp/Texinfo/XS/parsetexi/parser.c | 54 +++++++++++----------------
8 files changed, 112 insertions(+), 78 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 24f281c1e7..b949944139 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2022-09-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/command_data.txt,
+ tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
+ tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting)
+ (process_remaining_on_line): merge commands with CF_other flag with
+ commands with CF_nobrace flag. Add NOBRACE_symbol type for symbols
+ without brace. Rename OTHER_skipspace as NOBRACE_skipspace. Rename
+ OTHER_noarg as NOBRACE_other. Handle all the CF_nobrace commands in
+ handle_other_command, which means moving the handling of
+ NOBRACE_symbol commands from process_remaining_on_line to
+ handle_other_command.
+
+ * tp/Texinfo/XS/parsetexi/close.c (close_commands),
+ tp/Texinfo/XS/parsetexi/context_stack.c
+ (in_preformatted_context_not_menu), tp/Texinfo/XS/parsetexi/parser.c
+ (check_valid_nesting, parse_texi): check CF_* in addition to .data in
+ some places to be sure that the value is for the right type of
+ command.
+
2022-09-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm,
diff --git a/tp/TODO b/tp/TODO
index 453fd0a938..c47c5f8a1c 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,6 +13,8 @@ Before next release
global_unique document_settable_unique_at_commands
global document_settable_multiple_at_commands
+Add in_math (for /)?
+
Bugs
====
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index aa1d1a76e5..86e27aff14 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -402,12 +402,14 @@ close_commands (ELEMENT *current, enum command_id
closed_command,
if (closed_command && current->cmd == closed_command)
{
if (command_data(current->cmd).flags & CF_preformatted
- || command_data(current->cmd).data == BLOCK_menu)
+ || (command_data(current->cmd).flags & CF_block
+ && command_data(current->cmd).data == BLOCK_menu))
{
if (pop_context () != ct_preformatted)
fatal ("preformatted context expected");
}
- else if (command_data(current->cmd).data == BLOCK_format_raw)
+ else if (command_data(current->cmd).flags & CF_block
+ && command_data(current->cmd).data == BLOCK_format_raw)
{
if (pop_context () != ct_rawpreformatted)
fatal ("rawpreformatted context expected");
@@ -418,7 +420,8 @@ close_commands (ELEMENT *current, enum command_id
closed_command,
fatal ("math context expected");
}
- if (command_data(current->cmd).data == BLOCK_region)
+ if (command_data(current->cmd).flags & CF_block
+ && command_data(current->cmd).data == BLOCK_region)
pop_region ();
*closed_element = current;
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt
b/tp/Texinfo/XS/parsetexi/command_data.txt
index b6d04228e1..e8de4d8225 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -25,23 +25,23 @@ txiinternalvalue brace,internal
INTERNAL_brace
##############################################################
# no brace commands - single letter commands
-* nobrace
+* nobrace NOBRACE_symbol
# space
-\x20 nobrace
-\t nobrace
-\n nobrace
-- nobrace
-| nobrace
-/ nobrace
-: nobrace
-! nobrace
-? nobrace
-. nobrace
-@ nobrace
-& nobrace
-} nobrace
-{ nobrace
-\\ nobrace
+\x20 nobrace NOBRACE_symbol
+\t nobrace NOBRACE_symbol
+\n nobrace NOBRACE_symbol
+- nobrace NOBRACE_symbol
+| nobrace NOBRACE_symbol
+/ nobrace NOBRACE_symbol
+: nobrace NOBRACE_symbol
+! nobrace NOBRACE_symbol
+? nobrace NOBRACE_symbol
+. nobrace NOBRACE_symbol
+@ nobrace NOBRACE_symbol
+& nobrace NOBRACE_symbol
+} nobrace NOBRACE_symbol
+{ nobrace NOBRACE_symbol
+\\ nobrace NOBRACE_symbol
##########################################################
#
@@ -160,23 +160,23 @@ subentry line
LINE_line
##########################################################
# formatting
-noindent other OTHER_skipspace
-indent other OTHER_skipspace
-headitem other OTHER_skipspace
-item other OTHER_skipspace
-tab other OTHER_skipspace
+noindent nobrace NOBRACE_skipspace
+indent nobrace NOBRACE_skipspace
+headitem nobrace NOBRACE_skipspace
+item nobrace NOBRACE_skipspace
+tab nobrace NOBRACE_skipspace
# only valid in heading or footing
-thischapter other,in_heading OTHER_noarg
-thischaptername other,in_heading OTHER_noarg
-thischapternum other,in_heading OTHER_noarg
-thissection other,in_heading OTHER_noarg
-thissectionname other,in_heading OTHER_noarg
-thissectionnum other,in_heading OTHER_noarg
-thisfile other,in_heading OTHER_noarg
-thispage other,in_heading OTHER_noarg
-thistitle other,in_heading OTHER_noarg
+thischapter nobrace,in_heading NOBRACE_other
+thischaptername nobrace,in_heading NOBRACE_other
+thischapternum nobrace,in_heading NOBRACE_other
+thissection nobrace,in_heading NOBRACE_other
+thissectionname nobrace,in_heading NOBRACE_other
+thissectionnum nobrace,in_heading NOBRACE_other
+thisfile nobrace,in_heading NOBRACE_other
+thispage nobrace,in_heading NOBRACE_other
+thistitle nobrace,in_heading NOBRACE_other
# obsolete @-commands.
-refill other,deprecated OTHER_noarg
+refill nobrace,deprecated NOBRACE_other
diff --git a/tp/Texinfo/XS/parsetexi/commands.h
b/tp/Texinfo/XS/parsetexi/commands.h
index d05f86cc3e..11f94da71f 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -75,6 +75,7 @@ void wipe_user_commands (void);
#define CF_menu 0x00080000
/* CF_align is not used, in Common */
#define CF_align 0x00100000
+/* CF_other is not used */
#define CF_other 0x00200000
#define CF_preformatted 0x00400000
#define CF_preformatted_code 0x00800000
@@ -106,9 +107,10 @@ void wipe_user_commands (void);
#define LINE_text -6
#define LINE_line -7
-/* Types of other command (has CF_other flag). */
-#define OTHER_skipspace -1
-#define OTHER_noarg -2
+/* Types of command without brace nor on line (has CF_nobrace flag). */
+#define NOBRACE_symbol 0
+#define NOBRACE_skipspace -1
+#define NOBRACE_other -2
/* Types of block command (CF_block). */
#define BLOCK_conditional -1
diff --git a/tp/Texinfo/XS/parsetexi/context_stack.c
b/tp/Texinfo/XS/parsetexi/context_stack.c
index 9006d6af56..79e31e9e93 100644
--- a/tp/Texinfo/XS/parsetexi/context_stack.c
+++ b/tp/Texinfo/XS/parsetexi/context_stack.c
@@ -157,7 +157,9 @@ in_preformatted_context_not_menu()
if (ct != ct_line && ct != ct_preformatted)
return 0;
cmd = commands_stack[i];
- if (command_data(cmd).data != BLOCK_menu && ct == ct_preformatted)
+ if (command_data(cmd).flags & CF_block
+ && command_data(cmd).data != BLOCK_menu
+ && ct == ct_preformatted)
return 1;
}
return 0;
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index cbff82e6d8..1beaf4c5c9 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -77,7 +77,7 @@ check_no_text (ELEMENT *current)
return after_paragraph;
}
-/* noarg skipspace */
+/* symbol skipspace other */
ELEMENT *
handle_other_command (ELEMENT *current, char **line_inout,
enum command_id cmd, int *status)
@@ -89,8 +89,11 @@ handle_other_command (ELEMENT *current, char **line_inout,
*status = STILL_MORE_TO_PROCESS;
arg_spec = command_data(cmd).data;
- if (arg_spec == OTHER_noarg)
+ if (arg_spec != NOBRACE_skipspace)
{
+ misc = new_element (ET_NONE);
+ misc->cmd = cmd;
+ add_to_element_contents (current, misc);
if (command_data(cmd).flags & CF_in_heading
&& !(command_data(current_context_command()).flags &
CF_heading_spec))
{
@@ -98,12 +101,24 @@ handle_other_command (ELEMENT *current, char **line_inout,
command_name(cmd));
}
- misc = new_element (ET_NONE);
- misc->cmd = cmd;
- add_to_element_contents (current, misc);
- register_global_command (misc);
- if (close_preformatted_command(cmd))
- current = begin_preformatted (current);
+ if (arg_spec == NOBRACE_symbol)
+ {
+ if (cmd == CM_BACKSLASH && current_context () != ct_math)
+ {
+ line_warn ("@\\ should only appear in math context");
+ }
+ if (cmd == CM_NEWLINE)
+ {
+ current = end_line (current);
+ *status = GET_A_NEW_LINE;
+ }
+ }
+ else /* NOBRACE_other */
+ {
+ register_global_command (misc);
+ if (close_preformatted_command(cmd))
+ current = begin_preformatted (current);
+ }
}
else
{
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index e6e119022d..c428376e77 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -951,7 +951,9 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
ok = 1;
else if (outer_flags & CF_accent)
{
- if (cmd_flags & (CF_nobrace | CF_accent))
+ if ((cmd_flags & CF_accent)
+ || (cmd_flags & CF_nobrace
+ && command_data(cmd).data == NOBRACE_symbol))
ok = 1;
else if (cmd_flags & CF_brace
&& command_data(cmd).data == BRACE_noarg)
@@ -979,7 +981,7 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
{
/* Start by checking if the command is allowed inside a "full text
command" - this is the most permissive. */
- if (cmd_flags & CF_nobrace)
+ if (cmd_flags & CF_nobrace && command_data(cmd).data == NOBRACE_symbol)
ok = 1;
if (cmd_flags & CF_brace && !(cmd_flags & CF_INFOENCLOSE))
ok = 1;
@@ -992,7 +994,8 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
|| cmd == CM_clear
|| cmd == CM_end)
ok = 1;
- else if (command_data(cmd).data == BLOCK_format_raw)
+ else if (cmd_flags & CF_block
+ && command_data(cmd).data == BLOCK_format_raw)
ok = 1;
if (cmd == CM_caption || cmd == CM_shortcaption)
ok = 0;
@@ -1334,7 +1337,8 @@ superfluous_arg:
retval = GET_A_NEW_LINE; goto funexit; /* Get next line. */
}
} /* CM_verb */
- else if (command_data(current->cmd).data == BLOCK_format_raw
+ else if (command_flags(current) & CF_block
+ && command_data(current->cmd).data == BLOCK_format_raw
&& !format_expanded_p (command_name(current->cmd)))
{
ELEMENT *e;
@@ -1787,7 +1791,12 @@ value_invalid:
/* check command doesn't start a paragraph */
/* TODO store this in cmd->flags. */
- if (!(command_data(cmd).flags & (CF_line | CF_other | CF_block)
+ if (!((command_data(cmd).flags & (CF_line | CF_block))
+ || (command_data(cmd).flags & CF_nobrace
+ && (command_data(cmd).data == NOBRACE_skipspace
+ /* FIXME NOBRACE_other should probably start a paragraph
+ except for refill */
+ || command_data(cmd).data == NOBRACE_other))
|| cmd == CM_titlefont
|| cmd == CM_caption
|| cmd == CM_shortcaption
@@ -1842,7 +1851,8 @@ value_invalid:
cmd = CM_item_LINE;
/* We could possibly have done this before check_valid_nesting. */
- if (command_data(cmd).flags & CF_other)
+ /* No-brace command */
+ if (command_data(cmd).flags & CF_nobrace)
{
int status;
current = handle_other_command (current, &line, cmd, &status);
@@ -1878,26 +1888,6 @@ value_invalid:
{
current = handle_brace_command (current, &line, cmd);
}
- /* No-brace command */
- else if (command_data(cmd).flags & CF_nobrace)
- {
- ELEMENT *nobrace;
-
- nobrace = new_element (ET_NONE);
- nobrace->cmd = cmd;
- add_to_element_contents (current, nobrace);
-
- if (cmd == CM_BACKSLASH && current_context () != ct_math)
- {
- line_warn ("@\\ should only appear in math context");
- }
- if (cmd == CM_NEWLINE)
- {
- current = end_line (current);
- retval = GET_A_NEW_LINE;
- goto funexit;
- }
- }
}
/* "Separator" character */
else if (*line != '\0' && strchr ("{}@,:\t.\f", *line))
@@ -2053,12 +2043,12 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
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 (!((command_flags(current) & CF_block)
- && (command_data(current->cmd).data == BLOCK_raw
- || command_data(current->cmd).data == BLOCK_conditional)
- || current->parent && current->parent->cmd == CM_verb
- || (command_data(current->cmd).data == BLOCK_format_raw
- && !format_expanded_p (command_name(current->cmd))))
+ if (!(((command_flags(current) & CF_block)
+ && ((command_data(current->cmd).data == BLOCK_raw
+ || command_data(current->cmd).data == BLOCK_conditional)
+ || (command_data(current->cmd).data == BLOCK_format_raw
+ && !format_expanded_p (command_name(current->cmd)))))
+ || current->parent && current->parent->cmd == CM_verb)
&& current_context () != ct_def)
{
ELEMENT *e;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting) (process_remaining_on_line): merge commands with CF_other flag with commands with CF_nobrace flag. Add NOBRACE_symbol type for symbols without brace. Rename OTHER_skipspace as NOBRACE_skipspace. Rename OTHER_noarg as NOBRACE_other. Handle all the CF_nobrace commands in handle_other_command, which means moving the handling o [...],
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h, tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting), tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace, handle_close_brace, handle_comma): rep [...]
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm (%nobrace_symbol_text, %nobrace_commands), tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/NodeNameNormalization.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm: rename former %nobrace_commands as %nobrace_symbol_text. Set %nobrace_co [...]
- Previous by thread:
branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h, tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting), tp/Texinfo/XS/parsetexi/separator.c (handle_open_brace, handle_close_brace, handle_comma): rep [...]
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm (%nobrace_symbol_text, %nobrace_commands), tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line), tp/Texinfo/Convert/Converter.pm, tp/Texinfo/Convert/DocBook.pm, tp/Texinfo/Convert/HTML.pm, tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/NodeNameNormalization.pm, tp/Texinfo/Convert/Plaintext.pm, tp/Texinfo/Convert/TexinfoMarkup.pm, tp/Texinfo/Convert/Text.pm, tp/Texinfo/Convert/TextContent.pm: rename former %nobrace_commands as %nobrace_symbol_text. Set %nobrace_co [...]
- Index(es):