Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polishing #478

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/io/r2dbc/postgresql/PostgresqlSqlLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ private static boolean isSpecialOrOperatorChar(char c) {
private static TokenizedSql.Token getBlockCommentToken(String sql, int beginIndex) {
int depth = 1;
for (int i = beginIndex + 2; i < (sql.length() - 1); i++) {
String biGraph = sql.substring(i, i + 2);

if (biGraph.equals("/*")) {
char c1 = sql.charAt(i);
char c2 = sql.charAt(i + 1);
if (c1 == '/' && c2 == '*') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies but to me current version seems more readable biGraph.equals("/*") i.e. start of the comment block.

Or am I missing something here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sql.substring(i, i + 2).
Using char instead can avoid generating redundant string objects.

depth++;
i++;
} else if (biGraph.equals("*/")) {
} else if (c1 == '*' && c2 == '/') {
depth--;
i++;
}
Expand Down