[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6827] parsetexi update
From: |
Gavin D. Smith |
Subject: |
[6827] parsetexi update |
Date: |
Wed, 02 Dec 2015 17:03:33 +0000 |
Revision: 6827
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6827
Author: gavin
Date: 2015-12-02 17:03:31 +0000 (Wed, 02 Dec 2015)
Log Message:
-----------
parsetexi update
Modified Paths:
--------------
trunk/parsetexi/Parsetexi/Parsetexi.xs
trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
trunk/parsetexi/api.c
trunk/parsetexi/command_data.txt
trunk/parsetexi/command_ids.h
trunk/parsetexi/dump_perl.c
trunk/parsetexi/errors.c
trunk/parsetexi/errors.h
Modified: trunk/parsetexi/Parsetexi/Parsetexi.xs
===================================================================
--- trunk/parsetexi/Parsetexi/Parsetexi.xs 2015-12-02 15:27:14 UTC (rev
6826)
+++ trunk/parsetexi/Parsetexi/Parsetexi.xs 2015-12-02 17:03:31 UTC (rev
6827)
@@ -44,6 +44,9 @@
dump_errors ()
void
+wipe_errors ()
+
+void
parse_file(filename)
char * filename
Modified: trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
===================================================================
--- trunk/parsetexi/Parsetexi/lib/Parsetexi.pm 2015-12-02 15:27:14 UTC (rev
6826)
+++ trunk/parsetexi/Parsetexi/lib/Parsetexi.pm 2015-12-02 17:03:31 UTC (rev
6827)
@@ -354,15 +354,7 @@
# Copy the errors into the error list in Texinfo::Report.
# TODO: Could we just access the error list directly instead of going
# through Texinfo::Report line_error?
- $tree_stream = dump_errors();
- eval $tree_stream;
- for my $error (@{$ERRORS}) {
- if ($error->{'type'} eq 'error') {
- $self->line_error ($error->{'message'}, $error->{'line_nr'});
- } else {
- $self->line_warn ($error->{'message'}, $error->{'line_nr'});
- }
- }
+ _get_errors ($self);
#$Data::Dumper::Purity = 1;
@@ -373,6 +365,21 @@
return $TREE;
}
+sub _get_errors($)
+{
+ my $self = shift;
+ my $ERRORS;
+ my $tree_stream = dump_errors();
+ eval $tree_stream;
+ for my $error (@{$ERRORS}) {
+ if ($error->{'type'} eq 'error') {
+ $self->line_error ($error->{'message'}, $error->{'line_nr'});
+ } else {
+ $self->line_warn ($error->{'message'}, $error->{'line_nr'});
+ }
+ }
+}
+
# Replacement for Texinfo::Parser::parse_texi_text (line 757)
#
# Used in tests under tp/t.
@@ -388,9 +395,11 @@
return undef if (!defined($text));
$self = parser() if (!defined($self));
+ wipe_errors ();
parse_text($text);
my $tree = build_texinfo_tree ();
$self->{'index_names'} = build_index_data ();
+ _get_errors ($self);
_add_parents ($tree);
return $tree;
}
Modified: trunk/parsetexi/api.c
===================================================================
--- trunk/parsetexi/api.c 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/api.c 2015-12-02 17:03:31 UTC (rev 6827)
@@ -32,6 +32,7 @@
#include "labels.h"
#include "indices.h"
#include "api.h"
+#include "errors.h"
ELEMENT *Root;
@@ -41,6 +42,7 @@
{
debug_output = 0;
init_index_commands ();
+ wipe_errors ();
parse_texi_file (filename);
}
@@ -57,6 +59,7 @@
{
ELEMENT *root;
init_index_commands (); /* FIXME - probably not necessary */
+ wipe_errors ();
root = new_element (ET_root_line);
input_push_text (strdup (string));
Root = parse_texi (root);
@@ -68,6 +71,7 @@
{
ELEMENT *root;
init_index_commands (); /* FIXME - probably not necessary */
+ wipe_errors ();
root = new_element (ET_text_root);
input_push_text_with_line_nos (strdup (string));
Root = parse_texi (root);
Modified: trunk/parsetexi/command_data.txt
===================================================================
--- trunk/parsetexi/command_data.txt 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/command_data.txt 2015-12-02 17:03:31 UTC (rev 6827)
@@ -277,6 +277,8 @@
option brace BRACE_style
samp brace BRACE_style
strong brace BRACE_style
+sub brace BRACE_style
+sup brace BRACE_style
# Regular font style commands 595
r brace BRACE_style
Modified: trunk/parsetexi/command_ids.h
===================================================================
--- trunk/parsetexi/command_ids.h 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/command_ids.h 2015-12-02 17:03:31 UTC (rev 6827)
@@ -324,12 +324,14 @@
CM_sp,
CM_ss,
CM_strong,
+CM_sub,
CM_subheading,
CM_subsection,
CM_subsubheading,
CM_subsubsection,
CM_subtitle,
CM_summarycontents,
+CM_sup,
CM_syncodeindex,
CM_synindex,
CM_t,
Modified: trunk/parsetexi/dump_perl.c
===================================================================
--- trunk/parsetexi/dump_perl.c 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/dump_perl.c 2015-12-02 17:03:31 UTC (rev 6827)
@@ -428,11 +428,10 @@
text_append_n (text, "{\n", 2);
indent += 2;
- if (line_nr->file_name)
- {
- dump_indent (text);
- text_printf (text, "'file_name' => '%s',\n", line_nr->file_name);
- }
+ dump_indent (text);
+ text_printf (text, "'file_name' => '%s',\n",
+ line_nr->file_name ?
+ line_nr->file_name : "");
if (line_nr->line_nr)
{
Modified: trunk/parsetexi/errors.c
===================================================================
--- trunk/parsetexi/errors.c 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/errors.c 2015-12-02 17:03:31 UTC (rev 6827)
@@ -87,6 +87,12 @@
line_warn (message);
}
+void
+wipe_errors (void)
+{
+ error_number = 0;
+}
+
char *
dump_errors (void)
{
Modified: trunk/parsetexi/errors.h
===================================================================
--- trunk/parsetexi/errors.h 2015-12-02 15:27:14 UTC (rev 6826)
+++ trunk/parsetexi/errors.h 2015-12-02 17:03:31 UTC (rev 6827)
@@ -2,6 +2,7 @@
void line_errorf (char *format, ...);
void line_warn (char *message);
void line_warnf (char *format, ...);
+void wipe_errors (void);
/* TODO: Proper implementations */
#define command_error line_error
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6827] parsetexi update,
Gavin D. Smith <=