|
@@ -273,7 +273,7 @@ procedure TSQLParser.Expect(aToken: TSQLToken);
|
|
begin
|
|
begin
|
|
{$ifdef debugparser} Writeln('Expecting : ',GetEnumName(TypeInfo(TSQLToken),Ord(AToken)), ' As string: ',TokenInfos[AToken]);{$endif debugparser}
|
|
{$ifdef debugparser} Writeln('Expecting : ',GetEnumName(TypeInfo(TSQLToken),Ord(AToken)), ' As string: ',TokenInfos[AToken]);{$endif debugparser}
|
|
If (CurrentToken<>aToken) then
|
|
If (CurrentToken<>aToken) then
|
|
- Error(SerrTokenMismatch,[CurrenttokenString,TokenInfos[aToken]]);
|
|
|
|
|
|
+ Error(SerrTokenMismatch,[CurrentTokenString,TokenInfos[aToken]]);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TSQLParser.Expect(aTokens: TSQLTokens);
|
|
procedure TSQLParser.Expect(aTokens: TSQLTokens);
|
|
@@ -380,7 +380,7 @@ begin
|
|
GetNextToken;
|
|
GetNextToken;
|
|
end;
|
|
end;
|
|
// Table aliases with and without AS keyword
|
|
// Table aliases with and without AS keyword
|
|
- if (CurrentToken in [tsqlIdentifier,tsqlAs]) then
|
|
|
|
|
|
+ if (CurrentToken in [tsqlIdentifier,tsqlAs,tsqlText]) then
|
|
begin
|
|
begin
|
|
if CurrentToken=tsqlAs then
|
|
if CurrentToken=tsqlAs then
|
|
begin
|
|
begin
|
|
@@ -398,13 +398,13 @@ begin
|
|
J.Left:=Result;
|
|
J.Left:=Result;
|
|
Result:=J;
|
|
Result:=J;
|
|
Case CurrentToken of
|
|
Case CurrentToken of
|
|
- tsqlInner : J.JoinType:=jtInner;
|
|
|
|
- tsqlJoin : J.JoinType:=jtNone;
|
|
|
|
- tsqlFull : J.JoinType:=jtFullOuter;
|
|
|
|
- tsqlLeft : J.JoinType:=jtLeft;
|
|
|
|
- tsqlRight : J.JoinType:=jtRight;
|
|
|
|
|
|
+ tsqlInner : J.JoinType:=jtInner;
|
|
|
|
+ tsqlJoin : J.JoinType:=jtNone;
|
|
|
|
+ tsqlFull : J.JoinType:=jtFullOuter;
|
|
|
|
+ tsqlLeft : J.JoinType:=jtLeft;
|
|
|
|
+ tsqlRight : J.JoinType:=jtRight;
|
|
else
|
|
else
|
|
- expect([tsqlInner,tsqlFull,tsqlJoin,tsqlOuter,tsqlLeft,tsqlRight]);
|
|
|
|
|
|
+ Expect([tsqlInner,tsqlFull,tsqlJoin,tsqlOuter,tsqlLeft,tsqlRight]);
|
|
end;
|
|
end;
|
|
if CurrentToken<>tsqlJoin then
|
|
if CurrentToken<>tsqlJoin then
|
|
GetNextToken;
|
|
GetNextToken;
|
|
@@ -753,7 +753,7 @@ begin
|
|
tsqlSort : E.JoinType:=pjtSort;
|
|
tsqlSort : E.JoinType:=pjtSort;
|
|
tsqlMerge : E.JoinType:=pjtMerge;
|
|
tsqlMerge : E.JoinType:=pjtMerge;
|
|
else
|
|
else
|
|
- expect([tsqlJoin,tsqlmerge,tsqlSort,tsqlBraceOpen]);
|
|
|
|
|
|
+ Expect([tsqlJoin,tsqlmerge,tsqlSort,tsqlBraceOpen]);
|
|
end;
|
|
end;
|
|
If (CurrentToken<>tsqlBraceOpen) then
|
|
If (CurrentToken<>tsqlBraceOpen) then
|
|
GetNextToken;
|
|
GetNextToken;
|
|
@@ -1097,7 +1097,7 @@ begin
|
|
else
|
|
else
|
|
UnexpectedToken([tsqlIdentifier,tsqlCheck, tsqlConstraint,tsqlForeign,tsqlPrimary,tsqlUnique]);
|
|
UnexpectedToken([tsqlIdentifier,tsqlCheck, tsqlConstraint,tsqlForeign,tsqlPrimary,tsqlUnique]);
|
|
end;
|
|
end;
|
|
- expect([tsqlBraceClose,tsqlComma]);
|
|
|
|
|
|
+ Expect([tsqlBraceClose,tsqlComma]);
|
|
until (CurrentToken=tsqlBraceClose);
|
|
until (CurrentToken=tsqlBraceClose);
|
|
GetNextToken;
|
|
GetNextToken;
|
|
Result:=C;
|
|
Result:=C;
|
|
@@ -1819,7 +1819,7 @@ begin
|
|
begin
|
|
begin
|
|
dt:=sdtNChar;
|
|
dt:=sdtNChar;
|
|
GetNextToken;
|
|
GetNextToken;
|
|
- expect([tsqlCharacter,tsqlChar]);
|
|
|
|
|
|
+ Expect([tsqlCharacter,tsqlChar]);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
Expect([tsqlNCHAR,tsqlVarChar,tsqlCharacter,tsqlChar, tsqlCString, tsqlNational]);
|
|
Expect([tsqlNCHAR,tsqlVarChar,tsqlCharacter,tsqlChar, tsqlCString, tsqlNational]);
|
|
@@ -2592,7 +2592,7 @@ begin
|
|
tsqlMinus : B.Operation:=boSubtract;
|
|
tsqlMinus : B.Operation:=boSubtract;
|
|
tsqlConcatenate : B.Operation:=boConcat;
|
|
tsqlConcatenate : B.Operation:=boConcat;
|
|
else
|
|
else
|
|
- expect([tsqlPlus,tsqlMinus,tsqlConcatenate]);
|
|
|
|
|
|
+ Expect([tsqlPlus,tsqlMinus,tsqlConcatenate]);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
Except
|
|
Except
|
|
@@ -2887,7 +2887,7 @@ begin
|
|
tsqlSome : C:=TSQLSomeExpression;
|
|
tsqlSome : C:=TSQLSomeExpression;
|
|
tsqlSingular : C:=TSQLSingularExpression;
|
|
tsqlSingular : C:=TSQLSingularExpression;
|
|
else
|
|
else
|
|
- expect([tsqlExists, tsqlAll,tsqlAny,tsqlSome,tsqlSingular]);
|
|
|
|
|
|
+ Expect([tsqlExists, tsqlAll,tsqlAny,tsqlSome,tsqlSingular]);
|
|
end;
|
|
end;
|
|
GetNextToken;
|
|
GetNextToken;
|
|
Consume(tsqlBraceOpen);
|
|
Consume(tsqlBraceOpen);
|
|
@@ -2937,11 +2937,12 @@ begin
|
|
if (([eoCheckConstraint,eoTableConstraint,eoComputedBy] * EO)<>[]) then
|
|
if (([eoCheckConstraint,eoTableConstraint,eoComputedBy] * EO)<>[]) then
|
|
Error(SErrUnexpectedToken,[CurrentTokenString]);
|
|
Error(SErrUnexpectedToken,[CurrentTokenString]);
|
|
GetNextToken;
|
|
GetNextToken;
|
|
- expect(tsqlIdentifier);
|
|
|
|
N:=CurrentTokenString;
|
|
N:=CurrentTokenString;
|
|
|
|
+ If (N='') or not (N[1] in ['a'..'z','A'..'Z']) then
|
|
|
|
+ Error(SerrTokenMismatch,[N,TokenInfos[tsqlIdentifier]]);
|
|
Result:=TSQLParameterExpression(CreateElement(TSQLParameterExpression,AParent));
|
|
Result:=TSQLParameterExpression(CreateElement(TSQLParameterExpression,AParent));
|
|
TSQLParameterExpression(Result).Identifier:=CreateIdentifier(Result,N);
|
|
TSQLParameterExpression(Result).Identifier:=CreateIdentifier(Result,N);
|
|
- Consume(tsqlIdentifier);
|
|
|
|
|
|
+ GetNextToken;
|
|
end;
|
|
end;
|
|
tsqlMUL:
|
|
tsqlMUL:
|
|
begin
|
|
begin
|
|
@@ -3261,7 +3262,7 @@ begin
|
|
tsqlSymbolString,
|
|
tsqlSymbolString,
|
|
tsqlIdentifier : Result.NewValue:=CurrentTokenString;
|
|
tsqlIdentifier : Result.NewValue:=CurrentTokenString;
|
|
else
|
|
else
|
|
- expect([tsqlSemiColon,tsqlTerminator,tsqlunknown, tsqlSymbolString]);
|
|
|
|
|
|
+ Expect([tsqlSemiColon,tsqlTerminator,tsqlunknown, tsqlSymbolString]);
|
|
end;
|
|
end;
|
|
GetNextToken;
|
|
GetNextToken;
|
|
// Next token depends on whether an alternative token is in effect...
|
|
// Next token depends on whether an alternative token is in effect...
|