From 6f040ad79e8aecbf6ee14ea9a7e6adfe373d6c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Sat, 4 Nov 2017 10:48:52 +0100 Subject: [PATCH 1/3] Add `// fall through` in emitter Reenable FallThorugh error-prone check --- jflex-unicode-maven-plugin/pom.xml | 2 +- jflex/src/main/java/jflex/Emitter.java | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/jflex-unicode-maven-plugin/pom.xml b/jflex-unicode-maven-plugin/pom.xml index 34f355d2f..915dba197 100644 --- a/jflex-unicode-maven-plugin/pom.xml +++ b/jflex-unicode-maven-plugin/pom.xml @@ -37,7 +37,7 @@ de.jflex jflex-maven-plugin - 1.6.1 + 1.7.0-SNAPSHOT diff --git a/jflex/src/main/java/jflex/Emitter.java b/jflex/src/main/java/jflex/Emitter.java index 0c1bc40fb..3ea5c0586 100644 --- a/jflex/src/main/java/jflex/Emitter.java +++ b/jflex/src/main/java/jflex/Emitter.java @@ -920,10 +920,10 @@ private void emitLexFunctHeader() { println(" zzCh = Character.codePointAt(zzBufferL, zzCurrentPosL, zzMarkedPosL);"); println(" zzCharCount = Character.charCount(zzCh);"); println(" switch (zzCh) {"); - println(" case '\\u000B':"); - println(" case '\\u000C':"); - println(" case '\\u0085':"); - println(" case '\\u2028':"); + println(" case '\\u000B': // fall though"); + println(" case '\\u000C': // fall though"); + println(" case '\\u0085': // fall though"); + println(" case '\\u2028': // fall though"); println(" case '\\u2029':"); if (scanner.lineCount) println(" yyline++;"); if (scanner.columnCount) println(" yycolumn = 0;"); @@ -980,11 +980,11 @@ private void emitLexFunctHeader() { println(" if (zzMarkedPosL > zzStartRead) {"); println(" switch (zzBufferL[zzMarkedPosL-1]) {"); println(" case '\\n':"); - println(" case '\\u000B':"); - println(" case '\\u000C':"); - println(" case '\\u0085':"); - println(" case '\\u2028':"); - println(" case '\\u2029':"); + println(" case '\\u000B': // fall though"); + println(" case '\\u000C': // fall though"); + println(" case '\\u0085': // fall though"); + println(" case '\\u2028': // fall though"); + println(" case '\\u2029': // fall though"); println(" zzAtBOL = true;"); println(" break;"); println(" case '\\r': "); @@ -1199,7 +1199,8 @@ private void emitActions() { } println(" { " + action.content); - println(" }"); + println(" } "); + println(" // fall through"); println(" case " + (i++) + ": break;"); } } @@ -1232,7 +1233,7 @@ private void emitEOFVal() { println(" }\");"); } println(" " + action.content); - println(" }"); + println(" } // fall though"); println(" case " + (++last) + ": break;"); } } From c6a6bfc7f9e3bebe07b0faca7b0b77172d7ad75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Sat, 4 Nov 2017 11:16:16 +0100 Subject: [PATCH 2/3] Use the project version rather than hardcoded valie --- jflex-unicode-maven-plugin/pom.xml | 2 +- testsuite/jflex-testsuite-maven-plugin/pom.xml | 2 +- testsuite/testcases/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jflex-unicode-maven-plugin/pom.xml b/jflex-unicode-maven-plugin/pom.xml index 915dba197..4ebda9af6 100644 --- a/jflex-unicode-maven-plugin/pom.xml +++ b/jflex-unicode-maven-plugin/pom.xml @@ -37,7 +37,7 @@ de.jflex jflex-maven-plugin - 1.7.0-SNAPSHOT + ${project.parent.version} diff --git a/testsuite/jflex-testsuite-maven-plugin/pom.xml b/testsuite/jflex-testsuite-maven-plugin/pom.xml index 82865f72e..01acea05f 100644 --- a/testsuite/jflex-testsuite-maven-plugin/pom.xml +++ b/testsuite/jflex-testsuite-maven-plugin/pom.xml @@ -109,7 +109,7 @@ de.jflex jflex - 1.7.0-SNAPSHOT + ${project.parent.version} diff --git a/testsuite/testcases/pom.xml b/testsuite/testcases/pom.xml index da8dd2a69..91030583f 100644 --- a/testsuite/testcases/pom.xml +++ b/testsuite/testcases/pom.xml @@ -26,7 +26,7 @@ de.jflex jflex - 1.7.0-SNAPSHOT + ${project.parent.version} test From 001b25958259fcfe0a4f69f109e981e9d87b9de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20D=C3=A9camps?= Date: Sat, 4 Nov 2017 11:29:30 +0100 Subject: [PATCH 3/3] Revert urelated changes. --- testsuite/jflex-testsuite-maven-plugin/pom.xml | 2 +- testsuite/testcases/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/jflex-testsuite-maven-plugin/pom.xml b/testsuite/jflex-testsuite-maven-plugin/pom.xml index 01acea05f..82865f72e 100644 --- a/testsuite/jflex-testsuite-maven-plugin/pom.xml +++ b/testsuite/jflex-testsuite-maven-plugin/pom.xml @@ -109,7 +109,7 @@ de.jflex jflex - ${project.parent.version} + 1.7.0-SNAPSHOT diff --git a/testsuite/testcases/pom.xml b/testsuite/testcases/pom.xml index 91030583f..da8dd2a69 100644 --- a/testsuite/testcases/pom.xml +++ b/testsuite/testcases/pom.xml @@ -26,7 +26,7 @@ de.jflex jflex - ${project.parent.version} + 1.7.0-SNAPSHOT test