From 29ff7820491210bd02f42508d993ad1a2d24e993 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 16 Jun 2019 12:34:40 +1000 Subject: [PATCH] oceani-tests: add tests with lots of blank lines. This found some problems with the grammer, which I fixed. Signed-off-by: NeilBrown --- csrc/oceani-tests.mdc | 7 +++++++ csrc/oceani.mdc | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/csrc/oceani-tests.mdc b/csrc/oceani-tests.mdc index 8a5e747..8e4ddad 100644 --- a/csrc/oceani-tests.mdc +++ b/csrc/oceani-tests.mdc @@ -57,6 +57,13 @@ arguments separated from the name by commas. For each test, there is a section ./oceani --noexec --print .tmp.code1 >> .tmp.code2 ;\ if ! cmp -s .tmp.code1 .tmp.code2; then \ echo " Failed"; diff -u .tmp.code1 .tmp.code2; exit 1 ; fi ; \ + echo -n "extra-newlines.. "; \ + sed -e 'i\ + ' .tmp.code1 > .tmp.code1a; \ + echo '``````' > .tmp.code2a ;\ + ./oceani --noexec --print .tmp.code1a >> .tmp.code2a;\ + if ! cmp -s .tmp.code1 .tmp.code2a; then \ + echo " Failed"; diff -u .tmp.code1 .tmp.code2a; exit 1; fi ; \ echo -n "exec-after-print.. "; \ ./oceani .tmp.code1 $${1+"$$@"} > .tmp.have ; \ if ! cmp -s .tmp.want .tmp.have; then \ diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index d3a4caf..d234968 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -2031,14 +2031,17 @@ function will be needed. | Open SimpleFieldList } ${ $0 = $<2; }$ | : FieldList $$NEWLINE ${ $0 = $<2; }$ - FieldList -> SimpleFieldListLine ${ $0 = $<1; }$ - | FieldList SimpleFieldListLine ${ + FieldList -> FieldLines ${ $0 = $<1; }$ + | NEWLINE FieldLines ${ $0 = $<2; }$ + FieldLines -> SimpleFieldListLine ${ $0 = $<1; }$ + | FieldLines SimpleFieldListLine ${ $2->prev = $<1; $0 = $<2; }$ SimpleFieldListLine -> SimpleFieldList NEWLINE ${ $0 = $<1; }$ | SimpleFieldListLine NEWLINE ${ $0 = $<1; }$ + | ERROR NEWLINE ${ tok_err(c, "Syntax error in struct field", &$1); }$ SimpleFieldList -> Field ${ $0 = $<1; }$ | SimpleFieldList ; Field ${ @@ -2071,7 +2074,6 @@ function will be needed. $0->f.type = $<3; $0->f.init = val_init($3); }$ - | ERROR ${ tok_err(c, "Syntax error in struct field", &$1); }$ ###### forward decls static void structure_print_type(struct type *t, FILE *f); -- 2.43.0