From ebfe46503f02e68dba8bf14d646c342a4515c3a1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 25 Apr 2018 14:37:59 +0200 Subject: [PATCH] STYLE: improve wmkdepend parse error message - parsing error state only arises from a missing final newline in the file (which the dnl macro does not capture). Report with a warning instead of modifying the dnl macro since we generally wish to know about this anyhow. - add missing newline to YEqn.H file. --- .../solvers/combustion/chemFoam/YEqn.H | 2 +- wmake/src/wmkdepend.cpp | 20 +++++++++---------- wmake/src/wmkdepend.rl | 12 +++-------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/applications/solvers/combustion/chemFoam/YEqn.H b/applications/solvers/combustion/chemFoam/YEqn.H index edb4072b7d..f31ff16496 100644 --- a/applications/solvers/combustion/chemFoam/YEqn.H +++ b/applications/solvers/combustion/chemFoam/YEqn.H @@ -9,4 +9,4 @@ mesh.solver("Yi") ); } -} \ No newline at end of file +} diff --git a/wmake/src/wmkdepend.cpp b/wmake/src/wmkdepend.cpp index 4aa8923991..251ce2d415 100644 --- a/wmake/src/wmkdepend.cpp +++ b/wmake/src/wmkdepend.cpp @@ -43,7 +43,7 @@ Description The FSM can be visualized (eg, in a browser) with the following command - ragel -V wmkdepend.cpp | dot -Tsvg -owmkdepend.svg + ragel -pV wmkdepend.cpp | dot -Tsvg -owmkdepend.svg Usage wmkdepend [-Idir..] [-iheader...] [-eENV...] [-oFile] filename @@ -309,7 +309,7 @@ namespace Files // Can use 'variable p xxx;' etc to change these names -#line 340 "wmkdepend.rl" +#line 334 "wmkdepend.rl" @@ -325,7 +325,7 @@ static const int wmkdep_error = 0; static const int wmkdep_en_main = 21; -#line 348 "wmkdepend.rl" +#line 342 "wmkdepend.rl" /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -356,7 +356,7 @@ void processFile(const std::string& fileName) act = 0; } -#line 369 "wmkdepend.rl" +#line 363 "wmkdepend.rl" /* ^^^ FSM initialization here ^^^ */; // Local token start @@ -420,11 +420,11 @@ tr0: } goto st21; tr2: -#line 337 "wmkdepend.rl" +#line 332 "wmkdepend.rl" {te = p+1;} goto st21; tr17: -#line 337 "wmkdepend.rl" +#line 332 "wmkdepend.rl" {{p = ((te))-1;}} goto st21; tr21: @@ -444,7 +444,7 @@ tr36: {te = p;p--;} goto st21; tr37: -#line 337 "wmkdepend.rl" +#line 332 "wmkdepend.rl" {te = p;p--;} goto st21; tr38: @@ -820,15 +820,15 @@ cs = 0; _out: {} } -#line 412 "wmkdepend.rl" +#line 406 "wmkdepend.rl" /* ^^^ FSM execution here ^^^ */; if (0 == cs) { - // FSM failed before finding a token + // Typically only arises when missing a trailing newline std::cerr << EXENAME ": parse error while scanning '" - << fileName << "'\n"; + << fileName << "' ... perhaps missing a final newline\n"; break; } diff --git a/wmake/src/wmkdepend.rl b/wmake/src/wmkdepend.rl index 729ab472ac..ee80952474 100644 --- a/wmake/src/wmkdepend.rl +++ b/wmake/src/wmkdepend.rl @@ -41,7 +41,7 @@ Description The FSM can be visualized (eg, in a browser) with the following command - ragel -V wmkdepend.cpp | dot -Tsvg -owmkdepend.svg + ragel -pV wmkdepend.cpp | dot -Tsvg -owmkdepend.svg Usage wmkdepend [-Idir..] [-iheader...] [-eENV...] [-oFile] filename @@ -329,13 +329,7 @@ namespace Files '//' dnl; # 1-line comment '/*' any* :>> '*/'; # Multi-line comment - # String handling is currently unused - ### # Single and double quoted strings - ### 'L'? '"' ( /\\./ | [^"\\\n] )* '"'; # ' quoted - discard - ### 'L'? "'" ( /\\./ | [^'\\\n] )* "'"; # " quoted - discard - dnl; # Discard all other lines - *|; }%% @@ -413,10 +407,10 @@ void processFile(const std::string& fileName) if (%%{write error;}%% == cs) { - // FSM failed before finding a token + // Typically only arises when missing a trailing newline std::cerr << EXENAME ": parse error while scanning '" - << fileName << "'\n"; + << fileName << "' ... perhaps missing a final newline\n"; break; }