Skip to content

Commit

Permalink
Checkstyle issues and code cleanup.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Kraus <[email protected]>
  • Loading branch information
Tomas-Kraus committed Oct 6, 2021
1 parent 012db14 commit 7203804
Showing 1 changed file with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ private interface Action extends Consumer<Parser> {}
*/
private enum CharClass {
IDENTIFIER_START, // Any character for which the method Character.isJavaIdentifierStart returns true
// or '_'
IDENTIFIER_PART, // Any character for which the method Character.isJavaIdentifierPart returns true
LF, // Line feed / new line (\n), terminates line alone or in CR LF sequence
CR, // Carriage return (\r), terminates line in CR LF sequence
Expand All @@ -234,8 +235,9 @@ private static CharClass charClass(char c) {
case '-': return DASH;
case '/': return SLASH;
case ':': return COLON;
case '_': return IDENTIFIER_START;
default:
return Character.isJavaIdentifierStart(c) || c == '_'
return Character.isJavaIdentifierStart(c)
? IDENTIFIER_START
: (Character.isJavaIdentifierPart(c) ? IDENTIFIER_PART : OTHER);
}
Expand Down Expand Up @@ -291,8 +293,10 @@ private enum State {
},
// Transitions from COLON state
{
PARAMETER, // IDENTIFIER_START: first character of named parameter, switch to PARAMETER state
STATEMENT, // IDENTIFIER_PART: can't be first character of named parameter, go back to STATEMENT state
PARAMETER, // IDENTIFIER_START: first character of named parameter,
// switch to PARAMETER state
STATEMENT, // IDENTIFIER_PART: can't be first character of named parameter,
// go back to STATEMENT state
STATEMENT, // LF: can't be first character of named parameter, go back to STATEMENT state
STATEMENT, // CR: can't be first character of named parameter, go back to STATEMENT state
STRING, // APOSTROPHE: not a named parameter but beginning of SQL string processing,
Expand Down Expand Up @@ -325,8 +329,10 @@ private enum State {
},
// Transitions from MULTILN_COMMENT_BG state
{
STATEMENT, // IDENTIFIER_START: not starting sequence of multi line comment, go back to STATEMENT state
STATEMENT, // IDENTIFIER_PART: not starting sequence of multi line comment, go back to STATEMENT state
STATEMENT, // IDENTIFIER_START: not starting sequence of multi line comment,
// go back to STATEMENT state
STATEMENT, // IDENTIFIER_PART: not starting sequence of multi line comment,
// go back to STATEMENT state
STATEMENT, // LF: not starting sequence of multi line comment, go back to STATEMENT state
STATEMENT, // CR: not starting sequence of multi line comment, go back to STATEMENT state
STRING, // APOSTROPHE: not starting sequence of multi line comment but beginning of SQL
Expand All @@ -343,8 +349,10 @@ private enum State {
},
// Transitions from MULTILN_COMMENT_END state
{
MULTILN_COMMENT, // IDENTIFIER_START: not ending sequence of multi line comment, go back to MULTILN_COMMENT state
MULTILN_COMMENT, // IDENTIFIER_PART: not ending sequence of multi line comment, go back to MULTILN_COMMENT state
MULTILN_COMMENT, // IDENTIFIER_START: not ending sequence of multi line comment,
// go back to MULTILN_COMMENT state
MULTILN_COMMENT, // IDENTIFIER_PART: not ending sequence of multi line comment,
// go back to MULTILN_COMMENT state
MULTILN_COMMENT, // LF: not ending sequence of multi line comment, go back to MULTILN_COMMENT state
MULTILN_COMMENT, // CR: not ending sequence of multi line comment, go back to MULTILN_COMMENT state
MULTILN_COMMENT, // APOSTROPHE: not ending sequence of multi line comment,
Expand Down Expand Up @@ -373,8 +381,10 @@ private enum State {
},
// Transitions from SINGLELN_COMMENT_BG state
{
STATEMENT, // IDENTIFIER_START: not starting sequence of single line comment, go back to STATEMENT state
STATEMENT, // IDENTIFIER_PART: not starting sequence of single line comment, go back to STATEMENT state
STATEMENT, // IDENTIFIER_START: not starting sequence of single line comment,
// go back to STATEMENT state
STATEMENT, // IDENTIFIER_PART: not starting sequence of single line comment,
// go back to STATEMENT state
STATEMENT, // LF: not starting sequence of single line comment, go back to STATEMENT state
STATEMENT, // CR: not starting sequence of single line comment, go back to STATEMENT state
STRING, // APOSTROPHE: not starting sequence of single line comment but beginning of SQL
Expand All @@ -390,8 +400,10 @@ private enum State {
},
// Transitions from SINGLELN_COMMENT_END state
{
SINGLELN_COMMENT, // IDENTIFIER_START: not ending sequence of single line comment, go back to SINGLELN_COMMENT state
SINGLELN_COMMENT, // IDENTIFIER_PART: not ending sequence of single line comment, go back to SINGLELN_COMMENT state
SINGLELN_COMMENT, // IDENTIFIER_START: not ending sequence of single line comment,
// go back to SINGLELN_COMMENT state
SINGLELN_COMMENT, // IDENTIFIER_PART: not ending sequence of single line comment,
// go back to SINGLELN_COMMENT state
STATEMENT, // LF: end of single line comment, switch to STATEMENT state
SINGLELN_COMMENT_END, // CR: not ending sequence of single line comment but possible ending sequence
// of next single line comment, retry end of single line comment processing
Expand Down Expand Up @@ -453,8 +465,8 @@ private enum State {
// Actions performed on transitions from COLON state
{
Parser::setFirstParamChar, // IDENTIFIER_START: set first parameter character
Parser::addColonAndCopyChar, // IDENTIFIER_PART: not a parameter, add delayed colon and copy current statement character
// to output
Parser::addColonAndCopyChar, // IDENTIFIER_PART: not a parameter, add delayed colon and copy current
// statement character to output
Parser::addColonAndCopyChar, // LF: not a parameter, add delayed colon and copy current statement character
// to output
Parser::addColonAndCopyChar, // CR: not a parameter, add delayed colon and copy current statement character
Expand Down

0 comments on commit 7203804

Please sign in to comment.