Pino Toscano
2014-Jan-21 16:18 UTC
[Libguestfs] [PATCH] builder: allow more empty lines in index files
Improve the index grammar tp allow more than one empty line between sections, and to allow any number of empty lines at the end of the file (after the last section). --- builder/index-parse.y | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/builder/index-parse.y b/builder/index-parse.y index f5e551b..a8d2f62 100644 --- a/builder/index-parse.y +++ b/builder/index-parse.y @@ -80,10 +80,10 @@ index: { parsed_index = $2; } sections: - section + section emptylines { $$ = $1; } - | section EMPTY_LINE sections - { $$ = $1; $$->next = $3; } + | section EMPTY_LINE emptylines sections + { $$ = $1; $$->next = $4; } section: SECTION_HEADER fields @@ -113,6 +113,12 @@ continuations: free ($1); free ($2); } +emptylines: + /* empty */ + {} + | EMPTY_LINE emptylines + {} + %% void -- 1.8.3.1
Richard W.M. Jones
2014-Jan-21 16:44 UTC
Re: [Libguestfs] [PATCH] builder: allow more empty lines in index files
On Tue, Jan 21, 2014 at 05:18:28PM +0100, Pino Toscano wrote:> Improve the index grammar tp allow more than one empty line between > sections, and to allow any number of empty lines at the end of the file > (after the last section). > --- > builder/index-parse.y | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/builder/index-parse.y b/builder/index-parse.y > index f5e551b..a8d2f62 100644 > --- a/builder/index-parse.y > +++ b/builder/index-parse.y > @@ -80,10 +80,10 @@ index: > { parsed_index = $2; } > > sections: > - section > + section emptylines > { $$ = $1; } > - | section EMPTY_LINE sections > - { $$ = $1; $$->next = $3; } > + | section EMPTY_LINE emptylines sections > + { $$ = $1; $$->next = $4; } > > section: > SECTION_HEADER fields > @@ -113,6 +113,12 @@ continuations: > free ($1); > free ($2); } > > +emptylines: > + /* empty */ > + {} > + | EMPTY_LINE emptylines > + {} > + > %% > > void > -- > 1.8.3.1Looks fine, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
Seemingly Similar Threads
- [PATCH 1/2] builder: allow the index parser to parse files with no sections
- [PATCH 1/3] builder: make the C index parser reentrant
- [PATCH 0/6] RFC: basic subscription-manager support in virt-customize
- [PATCH] builder: handle empty lines in indexes before first section (RHBZ#1201526)
- [PATCH] builder: ignore spaces after repo identifiers (RHBZ#1506511)