[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7085] parsetexi nested macro
From: |
Gavin D. Smith |
Subject: |
[7085] parsetexi nested macro |
Date: |
Thu, 31 Mar 2016 16:42:43 +0000 |
Revision: 7085
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7085
Author: gavin
Date: 2016-03-31 16:42:41 +0000 (Thu, 31 Mar 2016)
Log Message:
-----------
parsetexi nested macro
Modified Paths:
--------------
trunk/tp/parsetexi/ChangeLog
trunk/tp/parsetexi/Parsetexi.pm
trunk/tp/parsetexi/handle_commands.c
trunk/tp/parsetexi/macro.c
trunk/tp/parsetexi/parser.c
Modified: trunk/tp/parsetexi/ChangeLog
===================================================================
--- trunk/tp/parsetexi/ChangeLog 2016-03-29 14:30:37 UTC (rev 7084)
+++ trunk/tp/parsetexi/ChangeLog 2016-03-31 16:42:41 UTC (rev 7085)
@@ -1,3 +1,7 @@
+2016-03-31 Gavin Smith <address@hidden>
+
+ * parser.c (process_remaining_on_line): Handle nested @macro.
+
2016-03-28 Gavin Smith <address@hidden>
* Makefile.am: Disable standalone parsetexi program, as building it
@@ -5,7 +9,6 @@
* command_data.awk: Fix command data for commands given by
backslash escapes.
-
2016-03-27 Gavin Smith <address@hidden>
Replace MakeMaker build system with automake/libtool one, copied
Modified: trunk/tp/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/parsetexi/Parsetexi.pm 2016-03-29 14:30:37 UTC (rev 7084)
+++ trunk/tp/parsetexi/Parsetexi.pm 2016-03-31 16:42:41 UTC (rev 7085)
@@ -25,6 +25,8 @@
require Exporter;
+use Texinfo::Encoding;
+
our @ISA = qw(Exporter DynaLoader Texinfo::Report);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
@@ -153,7 +155,7 @@
# This is used by Texinfo::Report::gdt for substituted values
for my $v (keys %{$conf->{'values'}}) {
if (!ref($conf->{'values'}->{$v})) {
- warn "v is $v", "\n";
+ warn "v is $v", "\n";
store_value ($v, $conf->{'values'}->{$v});
} elsif (ref($conf->{'values'}->{$v}) eq 'HASH') {
store_value ($v, "<<HASH VALUE>>");
Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c 2016-03-29 14:30:37 UTC (rev
7084)
+++ trunk/tp/parsetexi/handle_commands.c 2016-03-31 16:42:41 UTC (rev
7085)
@@ -557,10 +557,8 @@
// mark_and_warn_invalid ();
current = macro;
- /* 4640 FIXME */
+ /* 4640 */
/* A new line should be read immediately after this. */
- /* Alternative is to use longjmp to go where "last;" does in the Perl
- version. */
line = strchr (line, '\0');
*get_new_line = 1;
goto funexit;
Modified: trunk/tp/parsetexi/macro.c
===================================================================
--- trunk/tp/parsetexi/macro.c 2016-03-29 14:30:37 UTC (rev 7084)
+++ trunk/tp/parsetexi/macro.c 2016-03-31 16:42:41 UTC (rev 7085)
@@ -75,6 +75,7 @@
macro = new_element (ET_NONE);
macro->cmd = cmd;
+ macro->line_nr = line_nr;
line += strspn (line, whitespace_chars);
name = read_command_name (&line);
Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-03-29 14:30:37 UTC (rev 7084)
+++ trunk/tp/parsetexi/parser.c 2016-03-31 16:42:41 UTC (rev 7085)
@@ -671,19 +671,37 @@
&& (command_data(current->cmd).data == BLOCK_raw
|| command_data(current->cmd).data == BLOCK_conditional))
{ /* 3730 */
-#if 0
/* Check if we are using a macro within a macro. */
- if (...)
+ if (current->cmd == CM_macro || current->cmd == CM_rmacro)
{
- ELEMENT *e = new_element ();
- /* ... */
-
- current = current->contents.list[number];
- break;
+ enum command_id cmd = 0;
+ char *p = line;
+ p += strspn (p, whitespace_chars);
+ if (!strncmp (p, "@macro", strlen ("@macro")))
+ {
+ p += strlen ("@macro");
+ cmd = CM_macro;
+ }
+ else if (!strncmp (p, "@rmacro", strlen ("@rmacro")))
+ {
+ p += strlen ("@rmacro");
+ cmd = CM_rmacro;
+ }
+ if (cmd)
+ {
+ ELEMENT *e = new_element (ET_NONE);
+ e->cmd = cmd;
+ line = p;
+ add_to_element_contents (current, e);
+ add_extra_string (e, "arg_line", strdup (line));
+ current = e;
+ retval = GET_A_NEW_LINE;
+ goto funexit;
+ }
}
-
+#if 0
/* Else check for nested ifclear */
- else if (...)
+ if (...)
{
/* ... */
current = current->contents.list[number];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7085] parsetexi nested macro,
Gavin D. Smith <=