[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7521] parsetexi more on macros
From: |
gavinsmith0123 |
Subject: |
[7521] parsetexi more on macros |
Date: |
Sun, 20 Nov 2016 16:36:27 +0000 (UTC) |
Revision: 7521
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7521
Author: gavin
Date: 2016-11-20 16:36:27 +0000 (Sun, 20 Nov 2016)
Log Message:
-----------
parsetexi more on macros
Modified Paths:
--------------
trunk/tp/parsetexi/macro.c
Modified: trunk/tp/parsetexi/macro.c
===================================================================
--- trunk/tp/parsetexi/macro.c 2016-11-20 15:46:50 UTC (rev 7520)
+++ trunk/tp/parsetexi/macro.c 2016-11-20 16:36:27 UTC (rev 7521)
@@ -1,4 +1,4 @@
-/* Copyright 2010, 2011, 2012, 2013, 2014, 2015
+/* Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -94,8 +94,15 @@
line += strspn (line, whitespace_chars);
name = read_command_name (&line);
- if (!name)
+
+ if (*line && *line != '{' && !strchr (whitespace_chars, *line))
{
+ line_error ("bad name for @%s", command_name (cmd));
+ add_extra_string (macro, "invalid_syntax", "1");
+ return macro;
+ }
+ else if (!name)
+ {
line_error ("@%s requires a name", command_name (cmd));
add_extra_string (macro, "invalid_syntax", "1");
return macro;
@@ -112,8 +119,7 @@
if (*args_ptr != '{')
{
/* Either error or no args. */
- line = args_ptr;
- goto funexit;
+ goto check_trailing;
}
args_ptr++;
@@ -147,13 +153,9 @@
if (q2 == args_ptr)
{
// 1126 - argument is completely whitespace
- if (index == 0)
- {
- args_ptr = q + 1;
- break; /* Empty arg list, like "@macro m { }". */
- }
- line_error ("bad or empty @%s formal argument:",
- command_name(cmd));
+ if (*q == ',')
+ line_error ("bad or empty @%s formal argument:",
+ command_name(cmd));
}
else
{
@@ -186,13 +188,15 @@
index++;
}
+
+check_trailing:
line = args_ptr;
-
line += strspn (line, whitespace_chars);
if (*line && *line != '@')
{
line_error ("bad syntax for @%s argument: %s",
command_name(cmd), line);
+ add_extra_string (macro, "invalid_syntax", "1");
}
//line += strlen (line); /* Discard rest of line. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7521] parsetexi more on macros,
gavinsmith0123 <=