[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6830] parsetexi update
From: |
Gavin D. Smith |
Subject: |
[6830] parsetexi update |
Date: |
Thu, 03 Dec 2015 14:53:41 +0000 |
Revision: 6830
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6830
Author: gavin
Date: 2015-12-03 14:53:38 +0000 (Thu, 03 Dec 2015)
Log Message:
-----------
parsetexi update
Modified Paths:
--------------
trunk/parsetexi/api.c
trunk/parsetexi/handle_commands.c
trunk/parsetexi/main.c
trunk/parsetexi/parser.c
trunk/parsetexi/separator.c
Modified: trunk/parsetexi/api.c
===================================================================
--- trunk/parsetexi/api.c 2015-12-03 10:06:14 UTC (rev 6829)
+++ trunk/parsetexi/api.c 2015-12-03 14:53:38 UTC (rev 6830)
@@ -175,7 +175,9 @@
e->hv = newHV ();
}
- if (e->parent) // && e->parent_type != route_not_in_tree)
+ if (e->parent //) // && e->parent_type != route_not_in_tree)
+ && e->type != ET_empty_spaces_before_argument) //FIXME :Set parent in
+ // perl code
{
if (!e->parent->hv)
e->parent->hv = newHV ();
@@ -216,6 +218,7 @@
if (e->contents.number > 0
|| e->type == ET_text_root // FIXME special case
+ || e->cmd == CM_image // why image?
|| e->cmd == CM_node) // FIXME special case
{
AV *av;
Modified: trunk/parsetexi/handle_commands.c
===================================================================
--- trunk/parsetexi/handle_commands.c 2015-12-03 10:06:14 UTC (rev 6829)
+++ trunk/parsetexi/handle_commands.c 2015-12-03 14:53:38 UTC (rev 6830)
@@ -634,6 +634,15 @@
e = new_element (ET_NONE);
e->cmd = cmd;
+
+ // 4841
+ // 258 keep_line_nr_brace_commands
+ if (e->cmd == CM_titlefont || e->cmd == CM_anchor
+ || command_data(e->cmd).data > 0)
+ {
+ e->line_nr = line_nr;
+ }
+
add_to_element_contents (current, e);
current = e;
Modified: trunk/parsetexi/main.c
===================================================================
--- trunk/parsetexi/main.c 2015-12-03 10:06:14 UTC (rev 6829)
+++ trunk/parsetexi/main.c 2015-12-03 14:53:38 UTC (rev 6830)
@@ -21,10 +21,12 @@
#include "indices.h"
#include "api.h"
+int debug_output;
int
main (int argc, char **argv)
{
//extern int element_counter;
+ debug_output = 1;
if (argc <= 1)
{
Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c 2015-12-03 10:06:14 UTC (rev 6829)
+++ trunk/parsetexi/parser.c 2015-12-03 14:53:38 UTC (rev 6830)
@@ -311,18 +311,22 @@
current = begin_paragraph (current);
}
- if (last_contents_child (current)
+ last_child = last_contents_child (current);
+ if (last_child
/* There is a difference between the text being defined and empty,
and not defined at all. The latter is true for 'brace_command_arg'
- elements. We need to make sure that we initialize all elements with
- text_append (&e->text, "") where we want merging with following
- text. */
- && last_contents_child (current)->text.space > 0
- && !strchr (last_contents_child (current)->text.text, '\n')
+ elements. We need either to make sure that we initialize all
elements
+ with text_append (&e->text, "") where we want merging with following
+ text, or treat as a special case here.
+ Unfortunately we can't make a special case for
+ ET_empty_spaces_before_argument, because abort_empty_line above
+ produces such an element that shouldn't be merged with. */
+ && (last_child->text.space > 0
+ && !strchr (last_child->text.text, '\n')
+ ) //|| last_child->type == ET_empty_spaces_before_argument)
&& !no_merge_with_following_text)
{
/* Append text to contents */
- ELEMENT *last_child = last_contents_child (current);
text_append (&last_child->text, text);
debug ("MERGED TEXT: %s|||", text);
}
@@ -361,23 +365,28 @@
last_child->text.text);
text_append (&last_child->text, additional_text);
- // FIXME: How and when is this condition exactly met?
+ /* Remove element altogether if it's empty. */
if (last_child->text.end == 0) //2121
{
- KEY_PAIR *k = 0;
+ KEY_PAIR *k = 0; ELEMENT *e;
/* FIXME: does extra key get removed from current or
current->parent? */
- if (current->parent)
- k = lookup_extra_key (current->parent, "spaces_before_argument");
- if (k) // && k->value == last_contents_child (current))
+ if (current)
+ k = lookup_extra_key (current, "spaces_before_argument");
+ if (k && k->value == last_contents_child (current))
{
k->key = "";
k->value = 0;
k->type = extra_deleted;
}
- destroy_element (pop_element_from_contents (current));
+ /* FIXME: We can't destroy it, because it may still be
+ referred to by current->parent->extra. This is an oversight
+ in the Perl implementation. */
+ e = pop_element_from_contents (current);
+ e->parent = 0; e->parent_type = route_not_in_tree;
+ //destroy_element (e);
/* TODO: Maybe we could avoid adding it in the first place? */
}
else if (last_child->type == ET_empty_line) //2132
Modified: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c 2015-12-03 10:06:14 UTC (rev 6829)
+++ trunk/parsetexi/separator.c 2015-12-03 14:53:38 UTC (rev 6830)
@@ -115,6 +115,8 @@
e = new_element (ET_empty_spaces_before_argument);
text_append_n (&e->text, line, n);
add_to_element_contents (current, e);
+ add_extra_key_element (current->parent,
+ "spaces_before_argument", e);
line += n;
}
current->type = ET_brace_command_context;
@@ -133,6 +135,8 @@
{
ELEMENT *e;
e = new_element (ET_empty_spaces_before_argument);
+ /* See comment in parser.c:merge_text */
+ text_append (&e->text, "");
add_to_element_contents (current, e);
add_extra_key_element (current->parent,
"spaces_before_argument", e);
@@ -156,6 +160,7 @@
/* TODO: Record the line number if we are in a def_line in case @
protects the end of the line. */
e = new_element (ET_empty_spaces_before_argument);
+ text_append (&e->text, ""); /* See comment in parser.c:merge_text */
add_to_element_contents (current, e);
debug ("BRACKETED in def/multitable");
@@ -333,7 +338,7 @@
{
char *line = *line_inout;
enum element_type type;
- ELEMENT *new_arg;
+ ELEMENT *new_arg, *e;
abort_empty_line (¤t, NULL);
@@ -370,8 +375,9 @@
new_arg = new_element (type);
add_to_element_args (current, new_arg);
current = new_arg;
- add_to_element_contents (current,
- new_element (ET_empty_spaces_before_argument));
+ e = new_element (ET_empty_spaces_before_argument);
+ text_append (&e->text, ""); /* See comment in parser.c:merge_text */
+ add_to_element_contents (current, e);
*line_inout = line;
return current;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6830] parsetexi update,
Gavin D. Smith <=