texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5216] * tp/Texinfo/Parser.pm: put the first line in 'pending' instead o


From: Patrice Dumas
Subject: [5216] * tp/Texinfo/Parser.pm: put the first line in 'pending' instead of
Date: Sat, 02 Mar 2013 00:18:20 +0000

Revision: 5216
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5216
Author:   pertusus
Date:     2013-03-02 00:18:19 +0000 (Sat, 02 Mar 2013)
Log Message:
-----------
        * tp/Texinfo/Parser.pm: put the first line in 'pending' instead of 
        seeking back in the input stream.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/MANIFEST
    trunk/tp/Texinfo/Parser.pm
    trunk/tp/tests/formatting/Makefile.am
    trunk/tp/tests/formatting/tests-parser.txt
    trunk/tp/tests/run_parser_all.sh

Added Paths:
-----------
    trunk/tp/tests/formatting/empty.texi
    trunk/tp/tests/formatting/one_line.texi
    trunk/tp/tests/formatting/one_line_no_content.texi
    trunk/tp/tests/formatting/res_parser/empty/
    trunk/tp/tests/formatting/res_parser/empty/empty.1
    trunk/tp/tests/formatting/res_parser/empty/empty.2
    trunk/tp/tests/formatting/res_parser/empty/empty.html
    trunk/tp/tests/formatting/res_parser/one_line/
    trunk/tp/tests/formatting/res_parser/one_line/one_line.1
    trunk/tp/tests/formatting/res_parser/one_line/one_line.2
    trunk/tp/tests/formatting/res_parser/one_line/one_line.html
    trunk/tp/tests/formatting/res_parser/one_line_no_content/
    
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.1
    
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.2
    
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.html
    trunk/tp/tests/test_scripts/formatting_empty.sh
    trunk/tp/tests/test_scripts/formatting_one_line.sh
    trunk/tp/tests/test_scripts/formatting_one_line_no_content.sh

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2013-02-28 08:53:45 UTC (rev 5215)
+++ trunk/ChangeLog     2013-03-02 00:18:19 UTC (rev 5216)
@@ -1,3 +1,8 @@
+2013-03-02  Patrice Dumas  <address@hidden>
+
+       * tp/Texinfo/Parser.pm: put the first line in 'pending' instead of 
+       seeking back in the input stream.
+
 2013-02-28  Patrice Dumas  <address@hidden>
 
        * tp/t/test_utils.pl: close generated files before doing the comparison.

Modified: trunk/tp/MANIFEST
===================================================================
--- trunk/tp/MANIFEST   2013-02-28 08:53:45 UTC (rev 5215)
+++ trunk/tp/MANIFEST   2013-03-02 00:18:19 UTC (rev 5216)
@@ -1277,6 +1277,8 @@
 t/results/value/empty_set.pl
 t/results/value/empty_value_in_line.pl
 t/results/value/set_flag_command_equivalent.pl
+t/results/value/set_in_item_missing_line.pl
+t/results/value/set_on_item_line.pl
 t/results/value/simple.pl
 t/results/value/spaces_before_value.pl
 t/results/value/value_after_accent.pl

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2013-02-28 08:53:45 UTC (rev 5215)
+++ trunk/tp/Texinfo/Parser.pm  2013-03-02 00:18:19 UTC (rev 5216)
@@ -844,17 +844,17 @@
   my $line_nr = 0;
   my $line;
   my @first_lines;
-  # FIXME this won't work on pipes
-  my $line_beginning_position = tell $filehandle;
+
+  my $pending_first_texi_line;
+  # the first line not empty and not with \input is kept in 
+  # $pending_first_texi_line and put in the pending lines just below
   while ($line = <$filehandle>) {
+    $line_nr++;
     if ($line =~ /^ *\\input/ or $line =~ /^\s*$/) {
       $line =~ s/\x{7F}.*\s*//;
       push @first_lines, $line;
-      $line_nr++;
-      $line_beginning_position = tell $filehandle;
     } else {
-      # go back to the beginning of the line
-      seek($filehandle, $line_beginning_position, 0);
+      $pending_first_texi_line = $line;
       last;
     }
   }
@@ -872,7 +872,8 @@
             if ($self->{'TEST'});
   $self = parser() if (!defined($self));
   $self->{'input'} = [{
-       'pending' => [],
+       'pending' => [[$pending_first_texi_line, {'line_nr' => $line_nr,
+                                'macro' => '', 'file_name' => $file_name}]],
        'name' => $file_name,
        'line_nr' => $line_nr,
        'fh' => $filehandle

Modified: trunk/tp/tests/formatting/Makefile.am
===================================================================
--- trunk/tp/tests/formatting/Makefile.am       2013-02-28 08:53:45 UTC (rev 
5215)
+++ trunk/tp/tests/formatting/Makefile.am       2013-03-02 00:18:19 UTC (rev 
5216)
@@ -7,6 +7,7 @@
  float_copying.texi         my-bib-macros.texi \
  documentlanguage_set.texi  japanese_long_name.texi \
  simple_with_menu.texi      unknown_nodes_renamed.texi \
+ one_line_no_content.texi one_line.texi empty.texi \
  unknown_nodes_renamed-noderename.cnf-ref \
  file.css tests-parser.txt  res_parser
 

Added: trunk/tp/tests/formatting/empty.texi
===================================================================
Added: trunk/tp/tests/formatting/one_line.texi
===================================================================
--- trunk/tp/tests/formatting/one_line.texi                             (rev 0)
+++ trunk/tp/tests/formatting/one_line.texi     2013-03-02 00:18:19 UTC (rev 
5216)
@@ -0,0 +1 @@
+AB

Added: trunk/tp/tests/formatting/one_line_no_content.texi
===================================================================
--- trunk/tp/tests/formatting/one_line_no_content.texi                          
(rev 0)
+++ trunk/tp/tests/formatting/one_line_no_content.texi  2013-03-02 00:18:19 UTC 
(rev 5216)
@@ -0,0 +1 @@
+\input texinfo.tex

Added: trunk/tp/tests/formatting/res_parser/empty/empty.1
===================================================================
Added: trunk/tp/tests/formatting/res_parser/empty/empty.2
===================================================================
--- trunk/tp/tests/formatting/res_parser/empty/empty.2                          
(rev 0)
+++ trunk/tp/tests/formatting/res_parser/empty/empty.2  2013-03-02 00:18:19 UTC 
(rev 5216)
@@ -0,0 +1 @@
+empty.texi: warning: must specify a title with a title command or @top

Added: trunk/tp/tests/formatting/res_parser/empty/empty.html
===================================================================
--- trunk/tp/tests/formatting/res_parser/empty/empty.html                       
        (rev 0)
+++ trunk/tp/tests/formatting/res_parser/empty/empty.html       2013-03-02 
00:18:19 UTC (rev 5216)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="texi2any">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.indentedblock {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
+div.smalllisp {margin-left: 3.2em}
+kbd {font-style:oblique}
+pre.display {font-family: inherit}
+pre.format {font-family: inherit}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: inherit; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: inherit; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:nowrap}
+span.nolinebreak {white-space:nowrap}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" 
vlink="#800080" alink="#FF0000">
+<hr>
+<p><font size="-1">
+  This document was generated on <em>a sunny day</em> using <a 
href="http://www.gnu.org/software/texinfo/";><em>texi2any</em></a>.
+</font></p>
+
+
+</body>
+</html>

Added: trunk/tp/tests/formatting/res_parser/one_line/one_line.1
===================================================================
Added: trunk/tp/tests/formatting/res_parser/one_line/one_line.2
===================================================================
--- trunk/tp/tests/formatting/res_parser/one_line/one_line.2                    
        (rev 0)
+++ trunk/tp/tests/formatting/res_parser/one_line/one_line.2    2013-03-02 
00:18:19 UTC (rev 5216)
@@ -0,0 +1 @@
+one_line.texi: warning: must specify a title with a title command or @top

Added: trunk/tp/tests/formatting/res_parser/one_line/one_line.html
===================================================================
--- trunk/tp/tests/formatting/res_parser/one_line/one_line.html                 
        (rev 0)
+++ trunk/tp/tests/formatting/res_parser/one_line/one_line.html 2013-03-02 
00:18:19 UTC (rev 5216)
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="texi2any">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.indentedblock {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
+div.smalllisp {margin-left: 3.2em}
+kbd {font-style:oblique}
+pre.display {font-family: inherit}
+pre.format {font-family: inherit}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: inherit; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: inherit; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:nowrap}
+span.nolinebreak {white-space:nowrap}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" 
vlink="#800080" alink="#FF0000">
+<p>AB
+</p><hr>
+<p><font size="-1">
+  This document was generated on <em>a sunny day</em> using <a 
href="http://www.gnu.org/software/texinfo/";><em>texi2any</em></a>.
+</font></p>
+
+
+</body>
+</html>

Added: 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.1
===================================================================
Added: 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.2
===================================================================
--- 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.2  
                            (rev 0)
+++ 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.2  
    2013-03-02 00:18:19 UTC (rev 5216)
@@ -0,0 +1 @@
+one_line_no_content.texi: warning: must specify a title with a title command 
or @top

Added: 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.html
===================================================================
--- 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.html
                           (rev 0)
+++ 
trunk/tp/tests/formatting/res_parser/one_line_no_content/one_line_no_content.html
   2013-03-02 00:18:19 UTC (rev 5216)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="texi2any">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.indentedblock {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
+div.smalllisp {margin-left: 3.2em}
+kbd {font-style:oblique}
+pre.display {font-family: inherit}
+pre.format {font-family: inherit}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: inherit; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: inherit; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:nowrap}
+span.nolinebreak {white-space:nowrap}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" 
vlink="#800080" alink="#FF0000">
+<hr>
+<p><font size="-1">
+  This document was generated on <em>a sunny day</em> using <a 
href="http://www.gnu.org/software/texinfo/";><em>texi2any</em></a>.
+</font></p>
+
+
+</body>
+</html>

Modified: trunk/tp/tests/formatting/tests-parser.txt
===================================================================
--- trunk/tp/tests/formatting/tests-parser.txt  2013-02-28 08:53:45 UTC (rev 
5215)
+++ trunk/tp/tests/formatting/tests-parser.txt  2013-03-02 00:18:19 UTC (rev 
5216)
@@ -23,6 +23,11 @@
 ignore_and_comments_output ignore_and_comments.texi --init 
ignore_and_comments_output.init
 test_redefine_need test_need.texi --init redefine_need.init
 
+# test the first line
+one_line_no_content one_line_no_content.texi
+one_line one_line.texi
+empty empty.texi
+
 # diverse
 direntry_dircategory_info_split direntry_dircategory.texi --info --split-size 1
 split_nocopying split_nocopying.texi --info

Modified: trunk/tp/tests/run_parser_all.sh
===================================================================
--- trunk/tp/tests/run_parser_all.sh    2013-02-28 08:53:45 UTC (rev 5215)
+++ trunk/tp/tests/run_parser_all.sh    2013-03-02 00:18:19 UTC (rev 5216)
@@ -296,6 +296,7 @@
     fi
     if test $ret = 0 ; then
       diff_base="${dir}${dir_suffix}"
+      res_dir_used=
       if [ -d "$results_dir/$dir" ]; then
         res_dir_used="$results_dir/$dir"
       fi

Added: trunk/tp/tests/test_scripts/formatting_empty.sh
===================================================================
--- trunk/tp/tests/test_scripts/formatting_empty.sh                             
(rev 0)
+++ trunk/tp/tests/test_scripts/formatting_empty.sh     2013-03-02 00:18:19 UTC 
(rev 5216)
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+if test z"$srcdir" = "z"; then
+  srcdir=.
+fi
+
+command=run_parser_all.sh
+one_test_logs_dir=test_log
+diffs_dir=diffs
+
+
+
+if test "z$LONG_TESTS" = z"yes"; then
+  echo "Skipping short tests because we are only doing long tests"
+  exit 77
+fi
+dir=formatting
+arg='empty'
+name='empty'
+[ -d "$dir" ] || mkdir $dir
+
+srcdir_test=$dir; export srcdir_test;
+cd "$dir" || exit 99
+../"$srcdir"/"$command" -dir $dir $arg
+exit_status=$?
+cat $one_test_logs_dir/$name.log
+if test -f $diffs_dir/$name.diff; then
+  echo 
+  cat $diffs_dir/$name.diff
+fi
+exit $exit_status
+


Property changes on: trunk/tp/tests/test_scripts/formatting_empty.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tp/tests/test_scripts/formatting_one_line.sh
===================================================================
--- trunk/tp/tests/test_scripts/formatting_one_line.sh                          
(rev 0)
+++ trunk/tp/tests/test_scripts/formatting_one_line.sh  2013-03-02 00:18:19 UTC 
(rev 5216)
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+if test z"$srcdir" = "z"; then
+  srcdir=.
+fi
+
+command=run_parser_all.sh
+one_test_logs_dir=test_log
+diffs_dir=diffs
+
+
+
+if test "z$LONG_TESTS" = z"yes"; then
+  echo "Skipping short tests because we are only doing long tests"
+  exit 77
+fi
+dir=formatting
+arg='one_line'
+name='one_line'
+[ -d "$dir" ] || mkdir $dir
+
+srcdir_test=$dir; export srcdir_test;
+cd "$dir" || exit 99
+../"$srcdir"/"$command" -dir $dir $arg
+exit_status=$?
+cat $one_test_logs_dir/$name.log
+if test -f $diffs_dir/$name.diff; then
+  echo 
+  cat $diffs_dir/$name.diff
+fi
+exit $exit_status
+


Property changes on: trunk/tp/tests/test_scripts/formatting_one_line.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/tp/tests/test_scripts/formatting_one_line_no_content.sh
===================================================================
--- trunk/tp/tests/test_scripts/formatting_one_line_no_content.sh               
                (rev 0)
+++ trunk/tp/tests/test_scripts/formatting_one_line_no_content.sh       
2013-03-02 00:18:19 UTC (rev 5216)
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+if test z"$srcdir" = "z"; then
+  srcdir=.
+fi
+
+command=run_parser_all.sh
+one_test_logs_dir=test_log
+diffs_dir=diffs
+
+
+
+if test "z$LONG_TESTS" = z"yes"; then
+  echo "Skipping short tests because we are only doing long tests"
+  exit 77
+fi
+dir=formatting
+arg='one_line_no_content'
+name='one_line_no_content'
+[ -d "$dir" ] || mkdir $dir
+
+srcdir_test=$dir; export srcdir_test;
+cd "$dir" || exit 99
+../"$srcdir"/"$command" -dir $dir $arg
+exit_status=$?
+cat $one_test_logs_dir/$name.log
+if test -f $diffs_dir/$name.diff; then
+  echo 
+  cat $diffs_dir/$name.diff
+fi
+exit $exit_status
+


Property changes on: 
trunk/tp/tests/test_scripts/formatting_one_line_no_content.sh
___________________________________________________________________
Added: svn:executable
   + *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]