[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7168] parsetexi info enclose
From: |
gavinsmith0123 |
Subject: |
[7168] parsetexi info enclose |
Date: |
Sat, 14 May 2016 17:34:52 +0000 (UTC) |
Revision: 7168
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7168
Author: gavin
Date: 2016-05-14 17:34:52 +0000 (Sat, 14 May 2016)
Log Message:
-----------
parsetexi info enclose
Modified Paths:
--------------
trunk/tp/parsetexi/api.c
trunk/tp/parsetexi/end_line.c
trunk/tp/parsetexi/handle_commands.c
trunk/tp/parsetexi/macro.c
trunk/tp/parsetexi/parser.c
trunk/tp/parsetexi/separator.c
trunk/tp/parsetexi/tree_types.h
Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/api.c 2016-05-14 17:34:52 UTC (rev 7168)
@@ -63,7 +63,7 @@
void
parse_file (char *filename)
{
- debug_output = 0;
+ debug_output = 1;
parse_texi_file (filename);
}
@@ -510,7 +510,8 @@
newRV_inc((SV *)extra), 0);
}
- if (e->line_nr.line_nr)
+ if (e->line_nr.line_nr
+ && !(command_flags(e) & CF_INFOENCLOSE))
{
#define STORE(key, sv) hv_store (hv, key, strlen (key), sv, 0)
LINE_NR *line_nr = &e->line_nr;
Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/end_line.c 2016-05-14 17:34:52 UTC (rev 7168)
@@ -379,10 +379,12 @@
/* Remember it. */
new_cmd = add_texinfo_command (new_command);
+ add_infoenclose (new_cmd, start, end);
new_cmd &= ~USER_COMMAND_BIT;
+
user_defined_command_data[new_cmd].flags
|= (CF_INFOENCLOSE | CF_brace);
- /* TODO: Remember the data. */
+ user_defined_command_data[new_cmd].data = BRACE_style;
ADD_ARG(new_command); free (new_command);
ADD_ARG(start); free (start);
Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c 2016-05-14 15:04:01 UTC (rev
7167)
+++ trunk/tp/parsetexi/handle_commands.c 2016-05-14 17:34:52 UTC (rev
7168)
@@ -1034,6 +1034,16 @@
{
add_extra_string (e, "clickstyle", global_clickstyle);
}
+ if (command_data(cmd).flags & CF_INFOENCLOSE)
+ {
+ INFO_ENCLOSE *ie = lookup_infoenclose (cmd);
+ if (ie)
+ {
+ add_extra_string (e, "begin", ie->begin);
+ add_extra_string (e, "end", ie->end);
+ }
+ e->type = ET_definfoenclose_command;
+ }
*line_inout = line;
return current;
Modified: trunk/tp/parsetexi/macro.c
===================================================================
--- trunk/tp/parsetexi/macro.c 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/macro.c 2016-05-14 17:34:52 UTC (rev 7168)
@@ -582,3 +582,55 @@
return "1";
return 0;
}
+
+
+static INFO_ENCLOSE *infoencl_list;
+static size_t infoencl_number;
+static size_t infoencl_space;
+
+INFO_ENCLOSE *
+lookup_infoenclose (enum command_id cmd)
+{
+ int i;
+ for (i = 0; i < infoencl_number; i++)
+ {
+ if (infoencl_list[i].cmd == cmd)
+ return &infoencl_list[i];
+ }
+ return 0;
+}
+
+void
+add_infoenclose (enum command_id cmd, char *begin, char *end)
+{
+ int i;
+ INFO_ENCLOSE *ie = 0;
+
+ /* Check if already defined. */
+ for (i = 0; i < infoencl_number; i++)
+ {
+ if (infoencl_list[i].cmd == cmd)
+ {
+ ie = &infoencl_list[i];
+ free (ie->begin);
+ free (ie->end);
+ break;
+ }
+ }
+
+ if (!ie)
+ {
+ if (infoencl_number == infoencl_space)
+ {
+ infoencl_list = realloc (infoencl_list,
+ (infoencl_space += 5)
+ * sizeof (INFO_ENCLOSE));
+ }
+ ie = &infoencl_list[infoencl_number++];
+ }
+
+ ie->cmd = cmd;
+ ie->begin = strdup (begin);
+ ie->end = strdup (end);
+}
+
Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/parser.c 2016-05-14 17:34:52 UTC (rev 7168)
@@ -927,9 +927,14 @@
{
cmd = lookup_command (command);
if (!cmd)
- line_error ("unknown command `%s'", command); // 4877
+ {
+ line_error ("unknown command `%s'", command); // 4877
+ line = line_after_command;
+ }
}
free (command);
+ if (!cmd)
+ 0;//goto funexit;
}
if (cmd && (command_data(cmd).flags & CF_ALIAS))
cmd = command_data(cmd).data;
@@ -1142,6 +1147,7 @@
/* Prevent merging with following. TODO: Check why
this happens in the first place. */
add_to_element_contents (current, new_element (ET_NONE));
+ line++; /* past '}' */
}
else
{
@@ -1238,7 +1244,6 @@
if (cmd == 0)
{
// 4287 Unknown command
- //line_error ("unknown command address@hidden'",);
retval = 1;
goto funexit;
}
Modified: trunk/tp/parsetexi/separator.c
===================================================================
--- trunk/tp/parsetexi/separator.c 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/separator.c 2016-05-14 17:34:52 UTC (rev 7168)
@@ -552,7 +552,7 @@
char t[2];
t[0] = separator;
t[1] = '\0';
- merge_text (current, t);
+ current = merge_text (current, t);
}
*line_inout = line;
Modified: trunk/tp/parsetexi/tree_types.h
===================================================================
--- trunk/tp/parsetexi/tree_types.h 2016-05-14 15:04:01 UTC (rev 7167)
+++ trunk/tp/parsetexi/tree_types.h 2016-05-14 17:34:52 UTC (rev 7168)
@@ -46,6 +46,12 @@
struct ELEMENT *value;
} KEY_PAIR;
+typedef struct {
+ enum command_id cmd;
+ char *begin;
+ char *end;
+} INFO_ENCLOSE;
+
typedef struct ELEMENT_LIST {
struct ELEMENT **list;
size_t number;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7168] parsetexi info enclose,
gavinsmith0123 <=