fix typo:

aggrete -> aggregate
keywod -> keyword
Localtion -> location
This commit is contained in:
bytesmithing
2020-12-16 22:58:30 +08:00
parent fa57d18724
commit cb053fd844
16 changed files with 54 additions and 54 deletions
@@ -82,7 +82,7 @@ public class Lexer {
protected Token token;
protected Keywords keywods = Keywords.DEFAULT_KEYWORDS;
protected Keywords keywords = Keywords.DEFAULT_KEYWORDS;
protected String stringVal;
protected long hash_lower; // fnv1a_64
@@ -106,7 +106,7 @@ public class Lexer {
protected DbType dbType;
protected boolean optimizedForParameterized = false;
protected boolean keepSourceLocaltion = false;
protected boolean keepSourceLocation = false;
protected int startPos;
protected int posLine;
@@ -131,9 +131,9 @@ public class Lexer {
this.dbType = dbType;
if (DbType.sqlite == dbType) {
this.keywods = Keywords.SQLITE_KEYWORDS;
this.keywords = Keywords.SQLITE_KEYWORDS;
} else if (DbType.dm == dbType) {
this.keywods = Keywords.DM_KEYWORDS;
this.keywords = Keywords.DM_KEYWORDS;
}
}
@@ -214,8 +214,8 @@ public class Lexer {
String stringVal;
}
public Keywords getKeywods() {
return keywods;
public Keywords getKeywords() {
return keywords;
}
public SavePoint mark() {
@@ -2337,7 +2337,7 @@ public class Lexer {
return;
}
Token tok = keywods.getKeyword(hash_lower);
Token tok = keywords.getKeyword(hash_lower);
if (tok != null) {
token = tok;
if (token == Token.IDENTIFIER) {
@@ -2858,7 +2858,7 @@ public class Lexer {
} else if (feature == KeepComments) {
this.keepComments = state;
} else if (feature == KeepSourceLocation) {
this.keepSourceLocaltion = state;
this.keepSourceLocation = state;
} else if (feature == SkipComments) {
this.skipComment = state;
}
@@ -365,7 +365,7 @@ public class SQLExprParser extends SQLParser {
long hash_lower = lexer.hash_lower();
int sourceLine = -1, sourceColumn = -1;
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
sourceLine = lexer.posLine;
sourceColumn = lexer.posColumn;
@@ -1539,20 +1539,20 @@ public class SQLExprParser extends SQLParser {
if (distinct) {
aggMethodName = methodName;
} else {
aggMethodName = getAggreateFunction(hash_lower);
aggMethodName = getAggregateFunction(hash_lower);
}
} else if (expr instanceof SQLPropertyExpr) {
methodName = ((SQLPropertyExpr) expr).getSimpleName();
aggMethodName = SQLUtils.normalize(methodName);
hash_lower = FnvHash.fnv1a_64_lower(aggMethodName);
aggMethodName = getAggreateFunction(hash_lower);
aggMethodName = getAggregateFunction(hash_lower);
owner = ((SQLPropertyExpr) expr).getOwner();
} else if (expr instanceof SQLDefaultExpr) {
methodName = "DEFAULT";
} else if (expr instanceof SQLCharExpr) {
methodName = ((SQLCharExpr) expr).getText();
if (isAggreateFunction(methodName)) {
if (isAggregateFunction(methodName)) {
aggMethodName = methodName;
}
} else if (expr instanceof SQLDbLinkExpr) {
@@ -1731,7 +1731,7 @@ public class SQLExprParser extends SQLParser {
|| lexer.token == Token.LITERAL_ALIAS) {
name = lexer.stringVal();
lexer.nextToken();
} else if (lexer.getKeywods().containsValue(lexer.token)) {
} else if (lexer.getKeywords().containsValue(lexer.token)) {
name = lexer.stringVal();
lexer.nextToken();
} else if (lexer.token == Token.VARIANT && lexer.stringVal().startsWith("$")) {
@@ -2040,7 +2040,7 @@ public class SQLExprParser extends SQLParser {
}
SQLIdentifierExpr identifierExpr = new SQLIdentifierExpr(identName, hash);
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
identifierExpr.setSourceLine(lexer.posLine);
identifierExpr.setSourceColumn(lexer.posColumn);
@@ -2064,7 +2064,7 @@ public class SQLExprParser extends SQLParser {
}
if (lexer.token != Token.LITERAL_ALIAS && lexer.token != Token.IDENTIFIER
&& (!lexer.getKeywods().containsValue(lexer.token))) {
&& (!lexer.getKeywords().containsValue(lexer.token))) {
throw new ParserException("error, " + lexer.info());
}
@@ -2081,16 +2081,16 @@ public class SQLExprParser extends SQLParser {
return name;
}
public boolean isAggreateFunction(String word) {
public boolean isAggregateFunction(String word) {
long hash_lower = FnvHash.fnv1a_64_lower(word);
return isAggreateFunction(hash_lower);
return isAggregateFunction(hash_lower);
}
protected boolean isAggreateFunction(long hash_lower) {
protected boolean isAggregateFunction(long hash_lower) {
return Arrays.binarySearch(aggregateFunctionHashCodes, hash_lower) >= 0;
}
protected String getAggreateFunction(long hash_lower) {
protected String getAggregateFunction(long hash_lower) {
int index = Arrays.binarySearch(aggregateFunctionHashCodes, hash_lower);
if (index < 0) {
return null;
@@ -5049,9 +5049,9 @@ public class SQLExprParser extends SQLParser {
if (strVal.startsWith("--")) {
strVal = strVal.substring(2);
}
SQLIntegerExpr intergerExpr = SQLIntegerExpr.ofIntOrLong(Long.parseLong(strVal));
intergerExpr.setType("INTEGER");
expr = intergerExpr;
SQLIntegerExpr integerExpr = SQLIntegerExpr.ofIntOrLong(Long.parseLong(strVal));
integerExpr.setType("INTEGER");
expr = integerExpr;
lexer.nextToken();
} else if (hash_lower == FnvHash.Constants.SMALLINT
&& lexer.token == Token.LITERAL_CHARS) {
@@ -5294,7 +5294,7 @@ public class SQLExprParser extends SQLParser {
hash_lower = FnvHash.hashCode64(ident);
}
SQLIdentifierExpr identifierExpr = new SQLIdentifierExpr(ident, hash_lower);
if (lexer.keepSourceLocaltion) {
if (lexer.keepSourceLocation) {
lexer.computeRowAndColumn();
identifierExpr.setSourceLine(lexer.posLine);
identifierExpr.setSourceColumn(lexer.posColumn);