Skip to content

Commit

Permalink
Add fall-through statements in Emitter (#235)
Browse files Browse the repository at this point in the history
Add `// fall through` in jflex emitter.

Note that the FallThrough test is still a warning.
Only when 1.7.0 has been released can the jflex-unicode-maven-plugin depend on it (it currently depends on 1.6.1 which obviously doesn't produce code with `fall through`).
  • Loading branch information
regisd committed Nov 4, 2017
1 parent 45c98be commit 6d15369
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion jflex-unicode-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<plugin>
<groupId>de.jflex</groupId>
<artifactId>jflex-maven-plugin</artifactId>
<version>1.6.1</version>
<version>${project.parent.version}</version>
<executions>
<execution>
<goals>
Expand Down
23 changes: 12 additions & 11 deletions jflex/src/main/java/jflex/Emitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -921,10 +921,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;");
Expand Down Expand Up @@ -981,11 +981,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': ");
Expand Down Expand Up @@ -1200,7 +1200,8 @@ private void emitActions() {
}

println(" { " + action.content);
println(" }");
println(" } ");
println(" // fall through");
println(" case " + (i++) + ": break;");
}
}
Expand Down Expand Up @@ -1233,7 +1234,7 @@ private void emitEOFVal() {
println(" }\");");
}
println(" " + action.content);
println(" }");
println(" } // fall though");
println(" case " + (++last) + ": break;");
}
}
Expand Down

0 comments on commit 6d15369

Please sign in to comment.