[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7524] avoid apparent range in regex
From: |
gavinsmith0123 |
Subject: |
[7524] avoid apparent range in regex |
Date: |
Sun, 20 Nov 2016 20:22:03 +0000 (UTC) |
Revision: 7524
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7524
Author: gavin
Date: 2016-11-20 20:22:02 +0000 (Sun, 20 Nov 2016)
Log Message:
-----------
avoid apparent range in regex
Modified Paths:
--------------
trunk/tp/Texinfo/Parser.pm
trunk/tp/parsetexi/convert.c
trunk/tp/parsetexi/macro.c
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2016-11-20 18:20:26 UTC (rev 7523)
+++ trunk/tp/Texinfo/Parser.pm 2016-11-20 20:22:02 UTC (rev 7524)
@@ -1158,7 +1158,7 @@
my $macro = { 'cmdname' => $command, 'parent' => $parent, 'contents' => [],
'extra' => {'arg_line' => $line}, 'line_nr' => $line_nr };
# REMACRO
- if ($line =~ /^\s+([[:alnum:]][[:alnum:]-_]*)\s*(.*)/) {
+ if ($line =~ /^\s+([[:alnum:]][[:alnum:]_-]*)\s*(.*)/) {
my $macro_name = $1;
my $args_def = $2;
my @args;
Modified: trunk/tp/parsetexi/convert.c
===================================================================
--- trunk/tp/parsetexi/convert.c 2016-11-20 18:20:26 UTC (rev 7523)
+++ trunk/tp/parsetexi/convert.c 2016-11-20 20:22:02 UTC (rev 7524)
@@ -68,7 +68,19 @@
// TODO multitable or block command
- // TODO macro
+ if (cmd == CM_macro || cmd == CM_rmacro)
+ {
+ KEY_PAIR *k;
+ char *s = 0;
+ k = lookup_extra_key (e, "arg_line");
+ if (k)
+ s = (char *)k->value;
+ if (s)
+ {
+ ADD(s);
+ return;
+ }
+ }
// TODO node
@@ -139,6 +151,13 @@
ADD("}");
// TODO: "fix" arg or raw block command
+ if (command_flags (e) & CF_block)
+ {
+ ADD("@end ");
+ ADD(command_name(e->cmd));
+ if (command_data(e->cmd).data != BLOCK_raw)
+ ADD("\n");
+ }
}
return;
Modified: trunk/tp/parsetexi/macro.c
===================================================================
--- trunk/tp/parsetexi/macro.c 2016-11-20 18:20:26 UTC (rev 7523)
+++ trunk/tp/parsetexi/macro.c 2016-11-20 20:22:02 UTC (rev 7524)
@@ -24,6 +24,7 @@
#include "text.h"
#include "input.h"
#include "errors.h"
+#include "convert.h"
static MACRO *macro_list;
static size_t macro_number;
@@ -280,7 +281,7 @@
switch (*sep)
{
case '\\':
- if (!strchr ("\\{}", sep[1]))
+ if (!strchr ("\\{},", sep[1]))
text_append_n (&arg, sep, 1);
if (sep[1])
{
@@ -368,26 +369,23 @@
char *arg;
int pos; /* Index into arguments. */
int i; /* Index into macro contents. */
- ELEMENT **body;
+ char *macrobody;
+ ELEMENT tmp;
+
+ memset (&tmp, 0, sizeof (ELEMENT));
+ tmp.contents = macro->contents;
+ macrobody = convert_to_texinfo (&tmp);
/* Initialize TEXT object. */
expanded->end = 0;
- body = macro->contents.list;
- for (i = 0; i < macro->contents.number; i++)
+ if (!macrobody)
+ return;
+
{
char *ptext;
- if (body[i]->type != ET_raw)
- continue; /* Could be an ET_last_raw_newline. */
-
- /* There should be at least a newline. */
- if (body[i]->text.end == 0)
- continue;
-
- ptext = body[i]->text.text;
- if (i == macro->contents.number - 1)
- ; // TODO: strip newline
+ ptext = macrobody;
while (1)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7524] avoid apparent range in regex,
gavinsmith0123 <=