From f004de29a6fe14e1da67f5b32cb75f504267a681 Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sun, 3 Apr 2016 08:31:25 +0100 Subject: [PATCH] Omit some useless newlines in the generated code. --- re2c/bootstrap/src/parse/lex.cc | 6 ++-- re2c/src/parse/lex.re | 4 +-- re2c/test/condition_06.cs.c | 48 ++++++++++++-------------- re2c/test/condition_07.cbi.c | 2 -- re2c/test/condition_08.cbi.c | 2 -- re2c/test/condition_08.cbif.c | 2 -- re2c/test/condition_09.cbif.c | 2 -- re2c/test/condition_09.cgif.c | 2 -- re2c/test/condition_10.cgif.c | 2 -- re2c/test/condition_12.cgif.c | 2 -- re2c/test/condition_14.cbif.c | 2 -- re2c/test/condition_14.cgif.c | 2 -- re2c/test/condition_14.cif.c | 2 -- re2c/test/condition_14.csif.c | 2 -- re2c/test/condition_15.csif.c | 2 -- re2c/test/condtype_decl.c.c | 8 ++--- re2c/test/condtype_decl.cg.c | 8 ++--- re2c/test/condtype_decl.cs.c | 8 ++--- re2c/test/condtype_forwdecl.cg.c | 2 -- re2c/test/condtype_forwdecl.cs.c | 2 -- re2c/test/repeat-01.cgir.c | 2 -- re2c/test/repeat-02.cgir.c | 2 -- re2c/test/repeat-03.cgir.c | 2 -- re2c/test/reuse_conds_default_1.cgir.c | 2 -- re2c/test/yyaccept_missing.bci.c | 2 -- 25 files changed, 37 insertions(+), 83 deletions(-) diff --git a/re2c/bootstrap/src/parse/lex.cc b/re2c/bootstrap/src/parse/lex.cc index 2f2006e1..ff7ff99f 100644 --- a/re2c/bootstrap/src/parse/lex.cc +++ b/re2c/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Sat Apr 2 22:03:43 2016 */ +/* Generated by re2c 0.16 on Sun Apr 3 08:30:42 2016 */ #line 1 "../src/parse/lex.re" #include "src/util/c99_stdint.h" #include @@ -612,8 +612,8 @@ yy107: { if (opts->target == opt_t::CODE) { out.wraw(tok, start) - .wdelay_line_info().ws("\n") - .wdelay_types().ws("\n") + .wdelay_line_info() + .wdelay_types() .wline_info(cline, get_fname().c_str()); } lex_end_of_comment(); diff --git a/re2c/src/parse/lex.re b/re2c/src/parse/lex.re index 2ce931a0..006c0b5a 100644 --- a/re2c/src/parse/lex.re +++ b/re2c/src/parse/lex.re @@ -134,8 +134,8 @@ echo: "/*!types:re2c" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) - .wdelay_line_info().ws("\n") - .wdelay_types().ws("\n") + .wdelay_line_info() + .wdelay_types() .wline_info(cline, get_fname().c_str()); } lex_end_of_comment(); diff --git a/re2c/test/condition_06.cs.c b/re2c/test/condition_06.cs.c index 7a2096e1..c90abde6 100644 --- a/re2c/test/condition_06.cs.c +++ b/re2c/test/condition_06.cs.c @@ -54,14 +54,12 @@ void fputl(const char *s, size_t len, FILE *stream) } #line 57 "condition_06.cs.c" - enum YYCONDTYPE { EStateNormal, EStateComment, EStateSkiptoeol, EStateString, }; - #line 54 "condition_06.cs.re" @@ -75,7 +73,7 @@ void scan(Scanner *s) { s->tok = s->cur; -#line 79 "condition_06.cs.c" +#line 77 "condition_06.cs.c" { unsigned char yych; if (cond < 2) { @@ -102,7 +100,7 @@ yy4: { goto yyc_Comment; } -#line 106 "condition_06.cs.c" +#line 104 "condition_06.cs.c" yy5: yych = *++s->cur; if (yych != '/') goto yy4; @@ -111,7 +109,7 @@ yy5: { continue; } -#line 115 "condition_06.cs.c" +#line 113 "condition_06.cs.c" /* *********************************** */ yyc_Normal: if ((s->lim - s->cur) < 3) { if(fill(s, 3) >= 0) break; } @@ -129,7 +127,7 @@ yy11: fputc(*s->tok, stdout); continue; } -#line 133 "condition_06.cs.c" +#line 131 "condition_06.cs.c" yy12: ++s->cur; #line 134 "condition_06.cs.re" @@ -138,7 +136,7 @@ yy12: state = EStateString; continue; } -#line 142 "condition_06.cs.c" +#line 140 "condition_06.cs.c" yy14: yych = *++s->cur; if (yych == '*') goto yy16; @@ -154,14 +152,14 @@ yy16: { goto yyc_Comment; } -#line 158 "condition_06.cs.c" +#line 156 "condition_06.cs.c" yy18: ++s->cur; #line 130 "condition_06.cs.re" { goto yyc_Skiptoeol; } -#line 165 "condition_06.cs.c" +#line 163 "condition_06.cs.c" yy20: yych = *++s->cur; switch (yych) { @@ -186,7 +184,7 @@ yy22: fputc('|', stdout); continue; } -#line 190 "condition_06.cs.c" +#line 188 "condition_06.cs.c" yy24: ++s->cur; #line 111 "condition_06.cs.re" @@ -194,7 +192,7 @@ yy24: fputc('^', stdout); continue; } -#line 198 "condition_06.cs.c" +#line 196 "condition_06.cs.c" yy26: ++s->cur; #line 81 "condition_06.cs.re" @@ -202,7 +200,7 @@ yy26: fputc('[', stdout); continue; } -#line 206 "condition_06.cs.c" +#line 204 "condition_06.cs.c" yy28: ++s->cur; #line 86 "condition_06.cs.re" @@ -210,7 +208,7 @@ yy28: fputc(']', stdout); continue; } -#line 214 "condition_06.cs.c" +#line 212 "condition_06.cs.c" yy30: ++s->cur; #line 121 "condition_06.cs.re" @@ -218,7 +216,7 @@ yy30: fputc('~', stdout); continue; } -#line 222 "condition_06.cs.c" +#line 220 "condition_06.cs.c" yy32: ++s->cur; #line 106 "condition_06.cs.re" @@ -226,7 +224,7 @@ yy32: fputc('\\', stdout); continue; } -#line 230 "condition_06.cs.c" +#line 228 "condition_06.cs.c" yy34: ++s->cur; #line 91 "condition_06.cs.re" @@ -234,7 +232,7 @@ yy34: fputc('{', stdout); continue; } -#line 238 "condition_06.cs.c" +#line 236 "condition_06.cs.c" yy36: ++s->cur; #line 101 "condition_06.cs.re" @@ -242,7 +240,7 @@ yy36: fputc('#', stdout); continue; } -#line 246 "condition_06.cs.c" +#line 244 "condition_06.cs.c" yy38: ++s->cur; #line 96 "condition_06.cs.re" @@ -250,7 +248,7 @@ yy38: fputc('}', stdout); continue; } -#line 254 "condition_06.cs.c" +#line 252 "condition_06.cs.c" /* *********************************** */ yyc_Skiptoeol: if ((s->lim - s->cur) < 5) { if(fill(s, 5) >= 0) break; } @@ -267,14 +265,14 @@ yy43: { goto yyc_Skiptoeol; } -#line 271 "condition_06.cs.c" +#line 269 "condition_06.cs.c" yy44: ++s->cur; #line 161 "condition_06.cs.re" { continue; } -#line 278 "condition_06.cs.c" +#line 276 "condition_06.cs.c" yy46: yych = *(s->tok = ++s->cur); if (yych == '?') goto yy48; @@ -296,7 +294,7 @@ yy50: { goto yyc_Skiptoeol; } -#line 300 "condition_06.cs.c" +#line 298 "condition_06.cs.c" yy52: yych = *++s->cur; if (yych == '\n') goto yy50; @@ -312,7 +310,7 @@ yy54: { goto yyc_Skiptoeol; } -#line 316 "condition_06.cs.c" +#line 314 "condition_06.cs.c" yy56: ++s->cur; if ((yych = *s->cur) == '\n') goto yy54; @@ -330,7 +328,7 @@ yy60: fputc(*s->tok, stdout); continue; } -#line 334 "condition_06.cs.c" +#line 332 "condition_06.cs.c" yy61: ++s->cur; #line 174 "condition_06.cs.re" @@ -338,7 +336,7 @@ yy61: fputc(*s->tok, stdout); continue; } -#line 342 "condition_06.cs.c" +#line 340 "condition_06.cs.c" yy63: yych = *++s->cur; if (yych == '\n') goto yy60; @@ -348,7 +346,7 @@ yy63: fputl((const char*)s->tok, 2, stdout); continue; } -#line 352 "condition_06.cs.c" +#line 350 "condition_06.cs.c" } #line 183 "condition_06.cs.re" diff --git a/re2c/test/condition_07.cbi.c b/re2c/test/condition_07.cbi.c index ada83c2a..283b56f2 100644 --- a/re2c/test/condition_07.cbi.c +++ b/re2c/test/condition_07.cbi.c @@ -52,14 +52,12 @@ void fputl(const char *s, size_t len, FILE *stream) } } - enum YYCONDTYPE { EStateR1, EStateR2, }; - void scan(Scanner *s) { int cond = EStateR1; diff --git a/re2c/test/condition_08.cbi.c b/re2c/test/condition_08.cbi.c index f4265f86..ec6a4469 100644 --- a/re2c/test/condition_08.cbi.c +++ b/re2c/test/condition_08.cbi.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_08.cbif.c b/re2c/test/condition_08.cbif.c index 6c8aa6f9..017009b6 100644 --- a/re2c/test/condition_08.cbif.c +++ b/re2c/test/condition_08.cbif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_09.cbif.c b/re2c/test/condition_09.cbif.c index eb4ee4d3..ceafc6a8 100644 --- a/re2c/test/condition_09.cbif.c +++ b/re2c/test/condition_09.cbif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_09.cgif.c b/re2c/test/condition_09.cgif.c index 731afa5c..a312343c 100644 --- a/re2c/test/condition_09.cgif.c +++ b/re2c/test/condition_09.cgif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_10.cgif.c b/re2c/test/condition_10.cgif.c index 1d92fbe2..42a78b45 100644 --- a/re2c/test/condition_10.cgif.c +++ b/re2c/test/condition_10.cgif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_12.cgif.c b/re2c/test/condition_12.cgif.c index 058f0b24..64158b25 100644 --- a/re2c/test/condition_12.cgif.c +++ b/re2c/test/condition_12.cgif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_14.cbif.c b/re2c/test/condition_14.cbif.c index 4cd54dda..cc49f47d 100644 --- a/re2c/test/condition_14.cbif.c +++ b/re2c/test/condition_14.cbif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_14.cgif.c b/re2c/test/condition_14.cgif.c index 10aaab10..bb5b33fe 100644 --- a/re2c/test/condition_14.cgif.c +++ b/re2c/test/condition_14.cgif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_14.cif.c b/re2c/test/condition_14.cif.c index 64b5024b..d2e7c8d9 100644 --- a/re2c/test/condition_14.cif.c +++ b/re2c/test/condition_14.cif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_14.csif.c b/re2c/test/condition_14.csif.c index 4cd54dda..cc49f47d 100644 --- a/re2c/test/condition_14.csif.c +++ b/re2c/test/condition_14.csif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condition_15.csif.c b/re2c/test/condition_15.csif.c index ea6e13c0..7002913f 100644 --- a/re2c/test/condition_15.csif.c +++ b/re2c/test/condition_15.csif.c @@ -5,7 +5,6 @@ #define BSIZE 8192 - enum ScanContition { EStateNormal, EStateComment, @@ -14,7 +13,6 @@ enum ScanContition { }; - typedef struct Scanner { FILE *fp; diff --git a/re2c/test/condtype_decl.c.c b/re2c/test/condtype_decl.c.c index a198c542..a6fd66d1 100644 --- a/re2c/test/condtype_decl.c.c +++ b/re2c/test/condtype_decl.c.c @@ -1,12 +1,10 @@ /* Generated by re2c */ #line 1 "condtype_decl.c.re" #line 4 "condtype_decl.c.c" - enum YYCONDTYPE { yyca, yycb, }; - #line 1 "condtype_decl.c.re" @@ -16,7 +14,7 @@ int main () char * YYCURSOR; #define YYGETCONDITION() cond -#line 20 "condtype_decl.c.c" +#line 18 "condtype_decl.c.c" { unsigned char yych; switch (YYGETCONDITION()) { @@ -35,7 +33,7 @@ yy4: ++YYCURSOR; #line 11 "condtype_decl.c.re" {} -#line 39 "condtype_decl.c.c" +#line 37 "condtype_decl.c.c" /* *********************************** */ yyc_b: yych = *YYCURSOR; @@ -48,7 +46,7 @@ yy9: ++YYCURSOR; #line 12 "condtype_decl.c.re" {} -#line 52 "condtype_decl.c.c" +#line 50 "condtype_decl.c.c" } #line 13 "condtype_decl.c.re" diff --git a/re2c/test/condtype_decl.cg.c b/re2c/test/condtype_decl.cg.c index 82d5a521..58634842 100644 --- a/re2c/test/condtype_decl.cg.c +++ b/re2c/test/condtype_decl.cg.c @@ -1,12 +1,10 @@ /* Generated by re2c */ #line 1 "condtype_decl.cg.re" #line 4 "condtype_decl.cg.c" - enum YYCONDTYPE { yyca, yycb, }; - #line 1 "condtype_decl.cg.re" @@ -16,7 +14,7 @@ int main () char * YYCURSOR; #define YYGETCONDITION() cond -#line 20 "condtype_decl.cg.c" +#line 18 "condtype_decl.cg.c" { unsigned char yych; static void *yyctable[2] = { @@ -32,7 +30,7 @@ yy4: ++YYCURSOR; #line 11 "condtype_decl.cg.re" {} -#line 36 "condtype_decl.cg.c" +#line 34 "condtype_decl.cg.c" /* *********************************** */ yyc_b: yych = *YYCURSOR; @@ -41,7 +39,7 @@ yy9: ++YYCURSOR; #line 12 "condtype_decl.cg.re" {} -#line 45 "condtype_decl.cg.c" +#line 43 "condtype_decl.cg.c" } #line 13 "condtype_decl.cg.re" diff --git a/re2c/test/condtype_decl.cs.c b/re2c/test/condtype_decl.cs.c index 0ec9e9b9..14b18738 100644 --- a/re2c/test/condtype_decl.cs.c +++ b/re2c/test/condtype_decl.cs.c @@ -1,12 +1,10 @@ /* Generated by re2c */ #line 1 "condtype_decl.cs.re" #line 4 "condtype_decl.cs.c" - enum YYCONDTYPE { yyca, yycb, }; - #line 1 "condtype_decl.cs.re" @@ -16,7 +14,7 @@ int main () char * YYCURSOR; #define YYGETCONDITION() cond -#line 20 "condtype_decl.cs.c" +#line 18 "condtype_decl.cs.c" { unsigned char yych; if (YYGETCONDITION() < 1) { @@ -32,7 +30,7 @@ yy4: ++YYCURSOR; #line 11 "condtype_decl.cs.re" {} -#line 36 "condtype_decl.cs.c" +#line 34 "condtype_decl.cs.c" /* *********************************** */ yyc_b: yych = *YYCURSOR; @@ -41,7 +39,7 @@ yy9: ++YYCURSOR; #line 12 "condtype_decl.cs.re" {} -#line 45 "condtype_decl.cs.c" +#line 43 "condtype_decl.cs.c" } #line 13 "condtype_decl.cs.re" diff --git a/re2c/test/condtype_forwdecl.cg.c b/re2c/test/condtype_forwdecl.cg.c index 5253dd4e..ae1f36bd 100644 --- a/re2c/test/condtype_forwdecl.cg.c +++ b/re2c/test/condtype_forwdecl.cg.c @@ -41,12 +41,10 @@ yy9: } #line 44 "condtype_forwdecl.cg.c" - enum cond_t : int { yyca, yycb, }; - #line 18 "condtype_forwdecl.cg.re" re2c: warning: line 14: control flow in condition 'a' is undefined for strings that match '[\x0-\x60\x62-\xFF]', use default rule '*' [-Wundefined-control-flow] diff --git a/re2c/test/condtype_forwdecl.cs.c b/re2c/test/condtype_forwdecl.cs.c index 6419423c..b408b869 100644 --- a/re2c/test/condtype_forwdecl.cs.c +++ b/re2c/test/condtype_forwdecl.cs.c @@ -41,12 +41,10 @@ yy9: } #line 44 "condtype_forwdecl.cs.c" - enum cond_t : int { yyca, yycb, }; - #line 18 "condtype_forwdecl.cs.re" re2c: warning: line 14: control flow in condition 'a' is undefined for strings that match '[\x0-\x60\x62-\xFF]', use default rule '*' [-Wundefined-control-flow] diff --git a/re2c/test/repeat-01.cgir.c b/re2c/test/repeat-01.cgir.c index f23bac4b..1a809001 100644 --- a/re2c/test/repeat-01.cgir.c +++ b/re2c/test/repeat-01.cgir.c @@ -1,14 +1,12 @@ /* Generated by re2c */ // multiple scanners - enum YYCONDTYPE { yycr1, yycr2, }; - void scan(unsigned char* in) { diff --git a/re2c/test/repeat-02.cgir.c b/re2c/test/repeat-02.cgir.c index d6fc40ee..62379b0d 100644 --- a/re2c/test/repeat-02.cgir.c +++ b/re2c/test/repeat-02.cgir.c @@ -1,14 +1,12 @@ /* Generated by re2c */ // multiple scanners - enum YYCONDTYPE { yycr1, yycr2, }; - void scan(unsigned char* in) { diff --git a/re2c/test/repeat-03.cgir.c b/re2c/test/repeat-03.cgir.c index 78f176b1..15730381 100644 --- a/re2c/test/repeat-03.cgir.c +++ b/re2c/test/repeat-03.cgir.c @@ -1,14 +1,12 @@ /* Generated by re2c */ // multiple scanners - enum YYCONDTYPE { yycr1, yycr2, }; - void scan(unsigned char* in) { diff --git a/re2c/test/reuse_conds_default_1.cgir.c b/re2c/test/reuse_conds_default_1.cgir.c index fcf8302f..500f734b 100644 --- a/re2c/test/reuse_conds_default_1.cgir.c +++ b/re2c/test/reuse_conds_default_1.cgir.c @@ -3,13 +3,11 @@ // 're2c: error: line 11, column 9: code to default rule 'r1' is already defined' // This must be fixed later - enum YYCONDTYPE { yycr2, }; - void scan(unsigned char* in) { diff --git a/re2c/test/yyaccept_missing.bci.c b/re2c/test/yyaccept_missing.bci.c index 46ccebe2..fe4aa299 100644 --- a/re2c/test/yyaccept_missing.bci.c +++ b/re2c/test/yyaccept_missing.bci.c @@ -15,14 +15,12 @@ static enum YYCONDTYPE yy_state; - enum YYCONDTYPE { yycINITIAL, yycST_VALUE, }; - int scan(char *s, int l) { char *p = s; -- 2.40.0