[Top][All Lists]

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

RE: patches for xsl family enhancing bison output

From: Jannick
Subject: RE: patches for xsl family enhancing bison output
Date: Tue, 30 Oct 2018 16:19:32 +0100

Hi Akim,

Many thanks for the review. Setting things up and struggling with GNU lib, 
gettext version etc.
took me a bit of time. I know that I am late for the 3.2 party, but I hope that 
I am not too late. :) 

Maybe - and if you feel confident about the results - this could go into the 
new 3.2.x release.

Again many thanks for your suggestions which led me to rework the 
implementation and the

1 - reference date is the last modified date of the input grammar file

2 - GNU lib modules stat, fprintftime and year2038 are added

3 - the modified time shows up in all of bison's outputs (txt, dot, xml, html)

4 - the txt output is made fully consistent, i.e. the result file directly 
generated by
bison (--report-file) or by using xml2text.xsl applied to bison's xml output is
consistent (see commit log text). Same for the dot output. The consistency 
enhancements to the xml file (and subsequently to the .xsl files) for items 
added to bison's direct txt report. See 5. below as to how to compare those 
of two bison versions.

On Sat, 27 Oct 2018 16:59:11 +0200, Akim Demaille wrote:
> > Le 27 oct. 2018 à 16:12, Jannick <address@hidden> a écrit :
> Please, have a look at the git log, and use the same conventions.
> In particular, prefer the imperative.  And rework your commits.

I did and I tried to stick to the standards to see there. 

> > From 892ef0986c99779ec821966c2445f8a747d18da3 Mon Sep 17 00:00:00
> 2001
> > From: Jannick <address@hidden>
> > Date: Sat, 27 Oct 2018 13:45:35 +0200
> > Subject: [PATCH 2/6] xml-output: add compilation date stamp
> >
> > The date time stamp is determined one time only during run time.
> > ---
> >  src/print-xml.c |  4 ++++
> >  src/print.c     | 19 +++++++++++++++++++
> >  src/print.h     |  3 ++-
> >  3 files changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/print-xml.c b/src/print-xml.c index 3f4bc5b..8be81fd
> > 100644
> > --- a/src/print-xml.c
> > +++ b/src/print-xml.c
> > @@ -513,6 +513,10 @@ print_xml (void)
> >    xml_printf (out, level + 1, "<filename>%s</filename>",
> >                xml_escape (grammar_file));
> >
> > +  fputc ('\n', out);
> > +  xml_printf (out, level + 1, "<compilation datestamp=\"%s\"/>",
> > +              xml_escape (datetimestamp()) );
> I’m not sure this is really needed.  The time the file was generated does not
> convey a lot of information, does it?  The timestamp of the original file 
> would
> make more sense, but still fragile.

Good point. The updated implementation refers to the modified date of the 
file. The relevant GNU lib modules which are new to bison are added. 

> Could you please send a few examples of outputs, before and after
> your changes?

5 - For testing I attached a makefile (rather quick'n'dirty, but straight 
which compares the txt, dot, xml, html output between two bison versions and 
performs a consistency check for txt and dot (direct vs xml/xsl each) for each 
version. The makefile requires diff, sed, xsltproc and sort.
To start with, define the variables YACC0 and YACC1 with paths to two bison 
versions and
XSLTDIR0 and XSLTDIR1 for the corresponding xslt directories, put the input 
grammar files
into a folder 'grammars' next to the makefile. Run 'make' - or rather 'make -s' 
to shut it up -
and the comparison tests are performed. See the .log file for each input 
grammar (.y)
and the file tests.failed. If all tests for a .y file are passed, then an .OK 
file is created.
If one of YACC0 or YACC1 is not defined (e.g., comment it out), then only the 
checks for the defined YACC version is performed.
Differences are taken in three cumulative stages: first as an ordinary diff, 
then diff with 
ignoring leading white spaces (ignore identation), then diff without 
indentation and ignoring
that lines have only been moved. Sed helps to overcome inconsistencies between 
bison 3.1 and
master in preliminary steps.
All intermediate files are saved in the directory with the makefile and are 
removed if the test passes.
'make clean' does what is says. Best to start in an empty directory to be on 
the safe side.
If you want the intermediate files not to be removed after the tests, then say 
'make -s NOTIDYUP=1'.
This thing has been growing on the fly over the last 2 days and helped me to 
compare versions and to identify
issues. As test grammars I used bison's and flex' grammar files and others. The 
makefile is not
well documented as it is, but it works for me. I thought to share it with you. 
IIRC then there is
a consistency test in the test suite. I am not sure if true and if it is active.

Note in the first section of the makefile (config section) there might be some 
leftovers for Windows
which should be gone when configured for the system used for the tests.

If the makefile does not properly run, then I am happy to send some diffs 


Attachment: 0003-reports-xml-txt-add-type-names-of-terminals-non-term.patch
Description: Binary data

Attachment: 0001-bootstrap-add-GNU-lib-modules-for-printing-a-date-to.patch
Description: Binary data

Attachment: 0002-reports-xml-txt-dot-html-add-modified-date-of-input-.patch
Description: Binary data

Attachment: makefile
Description: Binary data

reply via email to

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