[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6833] parsetexi update
From: |
Gavin D. Smith |
Subject: |
[6833] parsetexi update |
Date: |
Sat, 05 Dec 2015 11:31:27 +0000 |
Revision: 6833
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6833
Author: gavin
Date: 2015-12-05 11:31:25 +0000 (Sat, 05 Dec 2015)
Log Message:
-----------
parsetexi update
Modified Paths:
--------------
trunk/parsetexi/ChangeLog
trunk/parsetexi/close.c
trunk/parsetexi/context_stack.c
trunk/parsetexi/end_line.c
trunk/parsetexi/errors.c
trunk/parsetexi/errors.h
Modified: trunk/parsetexi/ChangeLog
===================================================================
--- trunk/parsetexi/ChangeLog 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/ChangeLog 2015-12-05 11:31:25 UTC (rev 6833)
@@ -1,3 +1,7 @@
+2015-12-05 Gavin Smith <address@hidden>
+
+ * errors.c (command_warnf, command_errorf): Implement.
+
2015-12-01 Gavin Smith <address@hidden>
* separator.c (remove_empty_content_arguments): Implement.
Modified: trunk/parsetexi/close.c
===================================================================
--- trunk/parsetexi/close.c 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/close.c 2015-12-05 11:31:25 UTC (rev 6833)
@@ -29,20 +29,24 @@
if (current->cmd != CM_verb || current->type == ET_NONE)
{
if (closed_command)
- command_errorf ("@end %s seen before @%s closing brace",
+ command_errorf (current,
+ "@end %s seen before @%s closing brace",
command_name(closed_command),
command_name(current->cmd));
else if (interrupting_command)
- command_errorf ("%s seen before @%s closing brace",
+ command_errorf (current,
+ "%s seen before @%s closing brace",
command_name(interrupting_command),
command_name(current->cmd));
else
- command_errorf ("@%s missing close brace",
+ command_errorf (current,
+ "@%s missing close brace",
command_name(current->cmd));
}
else
{
- command_errorf ("@%s missing closing delimiter sequence: %s",
+ command_errorf (current,
+ "@%s missing closing delimiter sequence: %s",
command_name(current->cmd),
element_type_names[current->type]);
}
@@ -260,7 +264,7 @@
switch (current->type)
{
case ET_bracketed:
- command_error ("misplaced {");
+ command_error (current, "misplaced {");
current = current->parent;
break;
case ET_menu_comment:
Modified: trunk/parsetexi/context_stack.c
===================================================================
--- trunk/parsetexi/context_stack.c 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/context_stack.c 2015-12-05 11:31:25 UTC (rev 6833)
@@ -30,14 +30,12 @@
stack = realloc (stack, (space += 5) * sizeof (enum context));
}
- /*
- debug (">>>>>>>>>>>>>>>>>.PUSHING STACK AT %d -- %s", top,
+ debug (">>>>>>>>>>>>>>>>>PUSHING STACK AT %d -- %s", top,
c == ct_preformatted ? "preformatted"
: c == ct_line ? "line"
: c == ct_def ? "def"
: c == ct_menu ? "menu"
: "");
- */
stack[top++] = c;
}
@@ -47,7 +45,7 @@
if (top == 0)
abort ();
- /* debug (">>>>>>>>>>>>>POPPING STACK AT %d", top - 1); */
+ debug (">>>>>>>>>>>>>POPPING STACK AT %d", top - 1);
return stack[--top];
}
Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/end_line.c 2015-12-05 11:31:25 UTC (rev 6833)
@@ -166,7 +166,7 @@
cmd = line_command->cmd;
if (arg->contents.number == 0)
{
- /*command_errorf ("@%s missing argument",
+ /*command_errorf (line_command, "@%s missing argument",
command_name (cmd));*/
return 0;
}
@@ -201,7 +201,7 @@
if (!argarg)
{
- command_errorf ("@%s missing argument", command_name(cmd));
+ command_errorf (line_command, "@%s missing argument", command_name(cmd));
add_extra_string (line_command, "missing_argument", "1");
return 0;
}
@@ -812,7 +812,7 @@
// but we got here from t/21multitable.t on 2015.11.30.
if (!e->cmd)
{
- command_warnf ("unexpected argument on @%s line:",
+ command_warnf (current, "unexpected argument on @%s line:",
command_name(current->cmd));
// TODO: Convert argument to Texinfo
}
@@ -1028,7 +1028,7 @@
end_id = lookup_command (end_command);
if (end_id == 0 || !(command_data(end_id).flags & CF_block))
{
- command_warnf ("unknown @end %s", end_command);
+ command_warnf (current, "unknown @end %s", end_command);
free (end_command); end_command = 0;
}
else
@@ -1056,7 +1056,7 @@
if (0)
{
conditional_stack_fail:
- command_error ("unmatched @end");
+ command_error (current, "unmatched @end");
}
}
add_extra_string (current, "command_argument",
@@ -1065,7 +1065,7 @@
}
else
{
- command_errorf ("bad argument to @end: %s", line);
+ command_errorf (current, "bad argument to @end: %s", line);
}
}
else if (current->cmd == CM_include) // 3166
@@ -1143,7 +1143,8 @@
if (current->cmd != CM_top && misc_content->contents.number == 0)
{
- command_warnf ("@%s missing argument", command_name(current->cmd));
+ command_warnf (current, "@%s missing argument",
+ command_name(current->cmd));
add_extra_string (current, "missing_argument", "1");
}
else
@@ -1255,7 +1256,7 @@
/* 3350 */
if (cmd == CM_setfilename && (current_node || current_section))
{
- command_warn ("@setfilename after the first element");
+ command_warn (misc_cmd, "@setfilename after the first element");
}
/* 3355 columnfractions */
else if (cmd == CM_columnfractions)
@@ -1266,13 +1267,13 @@
/* Check if in multitable. */
if (!current->parent || current->parent->cmd != CM_multitable)
{
- command_error
- ("@columnfractions only meaningful on a @multitable line");
+ command_error (current,
+ "@columnfractions only meaningful on a @multitable line");
}
else
{
// pop and check context stack
- //pop_context (); /* ct_line */;
+ pop_context (); /* ct_line */;
current = current->parent;
@@ -1587,13 +1588,13 @@
}
else
{
- command_warnf ("missing name for @%s",
+ command_warnf (current->parent, "missing name for @%s",
command_name (original_def_command));
}
}
else
{
- command_warnf ("missing category for @%s",
+ command_warnf (current->parent, "missing category for @%s",
command_name (original_def_command));
}
Modified: trunk/parsetexi/errors.c
===================================================================
--- trunk/parsetexi/errors.c 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/errors.c 2015-12-05 11:31:25 UTC (rev 6833)
@@ -37,6 +37,32 @@
static size_t error_number = 0;
static size_t error_space = 0;
+static void
+line_error_internal (enum error_type type, LINE_NR *cmd_line_nr,
+ char *format, va_list v)
+{
+ char *message;
+ vasprintf (&message, format, v);
+ if (!message) abort ();
+ if (error_number == error_space)
+ {
+ error_list = realloc (error_list,
+ (error_space += 10) * sizeof (ERROR_MESSAGE));
+ }
+ error_list[error_number].message = message;
+ error_list[error_number].type = type;
+
+ if (cmd_line_nr)
+ {
+ if (cmd_line_nr->line_nr)
+ error_list[error_number++].line_nr = *cmd_line_nr;
+ else
+ error_list[error_number++].line_nr = line_nr;
+ }
+ else
+ error_list[error_number++].line_nr = line_nr;
+}
+
void
line_error (char *message)
{
@@ -55,11 +81,9 @@
line_errorf (char *format, ...)
{
va_list v;
- char *message;
va_start (v, format);
- vasprintf (&message, format, v);
- line_error (message);
+ line_error_internal (error, 0, format, v);
}
void
@@ -80,14 +104,30 @@
line_warnf (char *format, ...)
{
va_list v;
- char *message;
va_start (v, format);
- vasprintf (&message, format, v);
- line_warn (message);
+ line_error_internal (warning, 0, format, v);
}
void
+command_warnf (ELEMENT *e, char *format, ...)
+{
+ va_list v;
+
+ va_start (v, format);
+ line_error_internal (warning, &e->line_nr, format, v);
+}
+
+void
+command_errorf (ELEMENT *e, char *format, ...)
+{
+ va_list v;
+
+ va_start (v, format);
+ line_error_internal (error, &e->line_nr, format, v);
+}
+
+void
wipe_errors (void)
{
error_number = 0;
Modified: trunk/parsetexi/errors.h
===================================================================
--- trunk/parsetexi/errors.h 2015-12-03 18:26:22 UTC (rev 6832)
+++ trunk/parsetexi/errors.h 2015-12-05 11:31:25 UTC (rev 6833)
@@ -2,12 +2,12 @@
void line_errorf (char *format, ...);
void line_warn (char *message);
void line_warnf (char *format, ...);
+void command_errorf (ELEMENT *e, char *format, ...);
+void command_warnf (ELEMENT *e, char *format, ...);
void wipe_errors (void);
-/* TODO: Proper implementations */
-#define command_error line_error
-#define command_errorf line_errorf
-#define command_warn line_warn
-#define command_warnf line_warnf
+/* TODO: remove */
+#define command_error command_errorf
+#define command_warn command_warnf
char *dump_errors (void);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6833] parsetexi update,
Gavin D. Smith <=