Skip to content

Commit e5386e8

Browse files
committed
Wrong global variables declaration
1 parent bc6cb0e commit e5386e8

23 files changed

+161
-156
lines changed

source/hunt/sql/ast/SQLSetQuantifier.d

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ module hunt.sql.ast.SQLSetQuantifier;
44
public interface SQLSetQuantifier {
55

66
// SQL 92
7-
public static int ALL = 1;
8-
public static int DISTINCT = 2;
7+
enum int ALL = 1;
8+
enum int DISTINCT = 2;
99

10-
public static int UNIQUE = 3;
11-
public static int DISTINCTROW = 4;
10+
enum int UNIQUE = 3;
11+
enum int DISTINCTROW = 4;
1212

1313
// !SetQuantifier
1414
}

source/hunt/sql/ast/expr/SQLAggregateExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import hunt.collection;
1313

1414
public class SQLAggregateExpr : SQLExprImpl , SQLReplaceable {
1515

16-
private static long serialVersionUID = 1L;
17-
1816
protected string methodName;
1917
protected long _methodNameHashCod64;
2018

source/hunt/sql/ast/expr/SQLBetweenExpr.d

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import hunt.sql.ast.expr.SQLBooleanExpr;
2424
public class SQLBetweenExpr : SQLExprImpl , SQLReplaceable //Serializable,
2525
{
2626

27-
private static long serialVersionUID = 1L;
2827
public SQLExpr testExpr;
2928
private bool not;
3029
public SQLExpr beginExpr;

source/hunt/sql/ast/expr/SQLBinaryOpExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import hunt.util.StringBuilder;
3737

3838
public class SQLBinaryOpExpr : SQLExprImpl , SQLReplaceable//, Serializable
3939
{
40-
41-
private static long serialVersionUID = 1L;
4240
public SQLExpr left;
4341
public SQLExpr right;
4442
public SQLBinaryOperator operator;

source/hunt/sql/ast/expr/SQLCaseExpr.d

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import hunt.util.StringBuilder;
2626
public class SQLCaseExpr : SQLExprImpl , SQLReplaceable//, Serializable
2727
{
2828

29-
private static long serialVersionUID = 1L;
3029
private List!Item items;
3130
private SQLExpr valueExpr;
3231
private SQLExpr elseExpr;
@@ -107,8 +106,6 @@ public class SQLCaseExpr : SQLExprImpl , SQLReplaceable//, Serializable
107106

108107
public static class Item : SQLObjectImpl , SQLReplaceable//, Serializable
109108
{
110-
111-
private static long serialVersionUID = 1L;
112109
private SQLExpr conditionExpr;
113110
private SQLExpr valueExpr;
114111

source/hunt/sql/ast/expr/SQLCaseStatement.d

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public class SQLCaseStatement : SQLStatementImpl //, Serializable
7979
public static class Item : SQLObjectImpl //, Serializable
8080
{
8181

82-
private static long serialVersionUID = 1L;
8382
private SQLExpr conditionExpr;
8483
private SQLStatement statement;
8584

source/hunt/sql/ast/expr/SQLContainsExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import hunt.sql.ast.expr.SQLBooleanExpr;
2323

2424
public class SQLContainsExpr : SQLExprImpl , SQLReplaceable//, Serializable
2525
{
26-
27-
private static long serialVersionUID = 1L;
2826
private bool not = false;
2927
private SQLExpr expr;
3028
private List!SQLExpr targetList;

source/hunt/sql/ast/expr/SQLExistsExpr.d

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import hunt.sql.ast.SQLObject;
2828
public class SQLExistsExpr : SQLExprImpl //, Serializable
2929
{
3030

31-
private static long serialVersionUID = 1L;
3231
public bool not = false;
3332
public SQLSelect subQuery;
3433

source/hunt/sql/ast/expr/SQLInListExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import hunt.sql.ast.expr.SQLBooleanExpr;
2626

2727
public class SQLInListExpr : SQLExprImpl //, Serializable
2828
{
29-
30-
private static long serialVersionUID = 1L;
3129
private bool not = false;
3230
private SQLExpr expr;
3331
private List!SQLExpr targetList;

source/hunt/sql/ast/expr/SQLInSubQueryExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import hunt.util.StringBuilder;
2929

3030
public class SQLInSubQueryExpr : SQLExprImpl //, Serializable
3131
{
32-
33-
private static long serialVersionUID = 1L;
3432
private bool not = false;
3533
private SQLExpr expr;
3634

source/hunt/sql/ast/expr/SQLMethodInvokeExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import hunt.util.StringBuilder;
2929

3030
public class SQLMethodInvokeExpr : SQLExprImpl , SQLReplaceable//, Serializable
3131
{
32-
33-
private static long serialVersionUID = 1L;
3432
private string name;
3533
private SQLExpr owner;
3634
private List!SQLExpr parameters;

source/hunt/sql/ast/expr/SQLNotExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import hunt.util.StringBuilder;
1010

1111
public class SQLNotExpr : SQLExprImpl //, Serializable
1212
{
13-
14-
private static long serialVersionUID = 1L;
1513
public SQLExpr expr;
1614

1715
public this(){

source/hunt/sql/ast/expr/SQLQueryExpr.d

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import hunt.util.StringBuilder;
1212

1313
public class SQLQueryExpr : SQLExprImpl //, Serializable
1414
{
15-
16-
private static long serialVersionUID = 1L;
1715
public SQLSelect subQuery;
1816

1917
public this(){

source/hunt/sql/ast/expr/SQLUnaryExpr.d

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import hunt.sql.ast.SQLObject;
1010
public class SQLUnaryExpr : SQLExprImpl // Serializable
1111
{
1212

13-
private static long serialVersionUID = 1L;
1413
private SQLExpr expr;
1514
private SQLUnaryOperator operator;
1615

source/hunt/sql/dialect/mysql/parser/MySqlStatementParser.d

+24-24
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,30 @@ import hunt.sql.dialect.mysql.parser.MySqlSelectIntoParser;
5656

5757
public class MySqlStatementParser : SQLStatementParser {
5858

59-
private static string AUTO_INCREMENT = "AUTO_INCREMENT";
60-
private static string COLLATE2 = "COLLATE";
61-
private static string CHAIN = "CHAIN";
62-
private static string ENGINES = "ENGINES";
63-
private static string ENGINE = "ENGINE";
64-
private static string BINLOG = "BINLOG";
65-
private static string EVENTS = "EVENTS";
66-
private static string SESSION = "SESSION";
67-
private static string GLOBAL = "GLOBAL";
68-
private static string VARIABLES = "VARIABLES";
69-
private static string STATUS = "STATUS";
70-
private static string RESET = "RESET";
71-
private static string DESCRIBE = "DESCRIBE";
72-
private static string WRITE = "WRITE";
73-
private static string READ = "READ";
74-
private static string LOCAL = "LOCAL";
75-
private static string TABLES = "TABLES";
76-
private static string TEMPORARY = "TEMPORARY";
77-
private static string SPATIAL = "SPATIAL";
78-
private static string LOW_PRIORITY = "LOW_PRIORITY";
79-
private static string CONNECTION = "CONNECTION";
80-
private static string EXTENDED = "EXTENDED";
81-
private static string PARTITIONS = "PARTITIONS";
82-
private static string FORMAT = "FORMAT";
59+
private enum string AUTO_INCREMENT = "AUTO_INCREMENT";
60+
private enum string COLLATE2 = "COLLATE";
61+
private enum string CHAIN = "CHAIN";
62+
private enum string ENGINES = "ENGINES";
63+
private enum string ENGINE = "ENGINE";
64+
private enum string BINLOG = "BINLOG";
65+
private enum string EVENTS = "EVENTS";
66+
private enum string SESSION = "SESSION";
67+
private enum string GLOBAL = "GLOBAL";
68+
private enum string VARIABLES = "VARIABLES";
69+
private enum string STATUS = "STATUS";
70+
private enum string RESET = "RESET";
71+
private enum string DESCRIBE = "DESCRIBE";
72+
private enum string WRITE = "WRITE";
73+
private enum string READ = "READ";
74+
private enum string LOCAL = "LOCAL";
75+
private enum string TABLES = "TABLES";
76+
private enum string TEMPORARY = "TEMPORARY";
77+
private enum string SPATIAL = "SPATIAL";
78+
private enum string LOW_PRIORITY = "LOW_PRIORITY";
79+
private enum string CONNECTION = "CONNECTION";
80+
private enum string EXTENDED = "EXTENDED";
81+
private enum string PARTITIONS = "PARTITIONS";
82+
private enum string FORMAT = "FORMAT";
8383

8484
private int maxIntoClause = -1;
8585

source/hunt/sql/dialect/postgresql/parser/PGSQLStatementParser.d

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ import hunt.text;
4343
import std.uni;
4444

4545
public class PGSQLStatementParser : SQLStatementParser {
46-
public static string TIME_ZONE = "TIME ZONE";
47-
public static string TIME = "TIME";
48-
public static string LOCAL = "LOCAL";
46+
enum string TIME_ZONE = "TIME ZONE";
47+
enum string TIME = "TIME";
48+
enum string LOCAL = "LOCAL";
4949

5050
public this(PGExprParser parser) {
5151
super(parser);

source/hunt/sql/parser/CharTypes.d

+59-55
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,26 @@
11
module hunt.sql.parser.CharTypes;
22

33
//import hunt.sql.parser.LayoutCharacters.EOI;
4-
import std.conv;
54
import hunt.sql.parser.LayoutCharacters;
65

7-
public class CharTypes {
8-
9-
private static bool[] hexFlags = new bool[256];
10-
11-
12-
public static bool isHex(char c) {
13-
return c < 256 && hexFlags[c];
14-
}
15-
16-
public static bool isDigit(char c) {
17-
return c >= '0' && c <= '9';
18-
}
19-
20-
private static bool[] firstIdentifierFlags = new bool[256];
21-
22-
23-
public static bool isFirstIdentifierChar(char c) {
24-
if (c <= firstIdentifierFlags.length) {
25-
return firstIdentifierFlags[c];
26-
}
27-
return c != ' ' && c != '';
28-
}
29-
30-
private static string[] stringCache = new string[256];
31-
private static bool[] identifierFlags = new bool[256];
32-
33-
34-
public static bool isIdentifierChar(char c) {
35-
if (c <= identifierFlags.length) {
36-
return identifierFlags[c];
37-
}
38-
return c != ' ' && c != '' && c != '';
39-
}
6+
import std.conv;
7+
import std.stdio;
408

41-
public static string valueOf(char ch) {
42-
if (ch < stringCache.length) {
43-
return stringCache[ch];
44-
}
45-
return null;
46-
}
9+
public class CharTypes {
4710

48-
private static bool[] whitespaceFlags = new bool[256];
11+
private __gshared bool[] hexFlags;
12+
private __gshared bool[] firstIdentifierFlags;
13+
private __gshared string[] stringCache;
14+
private __gshared bool[] identifierFlags;
15+
private __gshared bool[] whitespaceFlags;
4916

50-
/**
51-
* @return false if {@link LayoutCharacters#EOI}
52-
*/
53-
public static bool isWhitespace(char c) {
54-
return (c <= whitespaceFlags.length && whitespaceFlags[c]) //
55-
|| c == ' '; // Chinese space
56-
}
17+
shared static this() {
18+
hexFlags = new bool[256];
19+
firstIdentifierFlags = new bool[256];
20+
stringCache = new string[256];
21+
identifierFlags = new bool[256];
22+
whitespaceFlags = new bool[256];
5723

58-
}
59-
60-
static this()
61-
{
62-
import std.stdio;
6324
for (dchar c = 0; c < CharTypes.hexFlags.length; ++c) {
6425
if (c >= 'A' && c <= 'F') {
6526
CharTypes.hexFlags[c] = true;
@@ -111,6 +72,49 @@ static this()
11172
CharTypes.whitespaceFlags[i] = true;
11273
}
11374

114-
CharTypes.whitespaceFlags[160] = true; // 特别处理
75+
CharTypes.whitespaceFlags[160] = true;
76+
}
77+
78+
79+
public static bool isHex(char c) {
80+
return c < 256 && hexFlags[c];
81+
}
82+
83+
public static bool isDigit(char c) {
84+
return c >= '0' && c <= '9';
85+
}
86+
11587

116-
}
88+
public static bool isFirstIdentifierChar(char c) {
89+
if (c <= firstIdentifierFlags.length) {
90+
return firstIdentifierFlags[c];
91+
}
92+
return c != ' ' && c != '';
93+
}
94+
95+
96+
97+
public static bool isIdentifierChar(char c) {
98+
if (c <= identifierFlags.length) {
99+
return identifierFlags[c];
100+
}
101+
return c != ' ' && c != '' && c != '';
102+
}
103+
104+
public static string valueOf(char ch) {
105+
if (ch < stringCache.length) {
106+
return stringCache[ch];
107+
}
108+
return null;
109+
}
110+
111+
112+
/**
113+
* @return false if {@link LayoutCharacters#EOI}
114+
*/
115+
public static bool isWhitespace(char c) {
116+
return (c <= whitespaceFlags.length && whitespaceFlags[c]) //
117+
|| c == ' '; // Chinese space
118+
}
119+
120+
}

source/hunt/sql/parser/NotAllowCommentException.d

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import hunt.sql.parser.ParserException;
1818

1919
public class NotAllowCommentException : ParserException {
2020

21-
private static long serialVersionUID = 1L;
2221

2322
public this(){
2423
this("comment not allow");

source/hunt/sql/parser/SymbolTable.d

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11

22
module hunt.sql.parser.SymbolTable;
33

4+
import std.concurrency:initOnce;
5+
46
/**
57
*/
68
public class SymbolTable {
79
// private enum UTF8 = "UTF-8";
810
// private static bool JVM_16;
9-
static this()
10-
{
11-
global = new SymbolTable(32768);
11+
// static this()
12+
// {
13+
// global = new SymbolTable(32768);
14+
// }
15+
16+
static SymbolTable global() {
17+
__gshared SymbolTable inst;
18+
return initOnce!inst(new SymbolTable(32768));
1219
}
1320

14-
public static SymbolTable global;
15-
1621
private Entry[] entries;
1722
private int indexMask;
1823

0 commit comments

Comments
 (0)