📄 ezexpryacc.pas
字号:
60 : begin
Val(yyv[yysp-0].yystring, IntVal, Code);
if Code=0 then
FExprList.Add(TIntegerLiteral.Create(StrToInt(yyv[yysp-0].yystring)))
else
FExprList.Add(TFloatLiteral.Create(StrToFloat(yyv[yysp-0].yystring)));
end;
61 : begin
FExprList.Add(TFloatLiteral.Create(StrToFloat(yyv[yysp-0].yystring)));
end;
62 : begin
FExprList.Add(TStringLiteral.Create(GetString( yyv[yysp-0].yystring )));
end;
63 : begin
FExprList.Add(TBooleanLiteral.Create(True));
end;
64 : begin
FExprList.Add(TBooleanLiteral.Create(False));
end;
65 : begin
FExprList.Add(TStringLiteral.Create(''));
end;
66 : begin
FExprList.Add(TStringLiteral.Create(GetString( yyv[yysp-0].yystring ) ));
end;
67 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goIntersects) );
end;
68 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goWithin) );
end;
69 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goEntirelyWithin) );
end;
70 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goContains) );
end;
71 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goContainsEntire) );
end;
72 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goEntirelyWithinNoEdgeTouched) );
end;
73 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goContainsEntireNoEdgeTouched) );
end;
74 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goExtentOverlaps) );
end;
75 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goShareCommonPoint) );
end;
76 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goShareCommonLine) );
end;
77 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goLineCross) );
end;
78 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goCommonPointOrLineCross) );
end;
79 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goEdgeTouch) );
end;
80 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goEdgeTouchOrIntersect) );
end;
81 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goPointInPolygon) );
end;
82 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goCentroidInPolygon) );
end;
83 : begin
AddExpression( TEzGraphicOperatorExpr.Create(nil, goIdentical) );
end;
84 : begin
AddExpression( TEzVectorExpr.Create( Nil, FVector, FVectorType, FBufferWidth ) );
FVector.Clear;
FBufferWidth:= 0;
end;
85 : begin
FVectorType:= vtUndefined;
end;
86 : begin
FVectorType:= vtPolyline;
end;
87 : begin
FVectorType:= vtPolygon;
end;
88 : begin
FVectorType:= vtBuffer;
end;
89 : begin
end;
90 : begin
FBufferWidth := StrToFloat( yyv[yysp-0].yystring );
end;
91 : begin
yyval := yyv[yysp-0];
end;
92 : begin
yyval := yyv[yysp-2];
end;
93 : begin
if FVector.Parts.Count=0 then FVector.Parts.Add(0);
FVector.Parts.Add(FVector.Count);
end;
94 : begin
yyval := yyv[yysp-0];
end;
95 : begin
yyval := yyv[yysp-2];
end;
96 : begin
FVector.AddPoint(StrToFloat(yyv[yysp-3].yystring), StrToFloat(yyv[yysp-1].yystring));
end;
97 : begin
yyval := yyv[yysp-0];
end;
98 : begin
yyval := yyv[yysp-0];
end;
99 : begin
yyval := yyv[yysp-0];
end;
100 : begin
FExprList.Add(TIntegerLiteral.Create(StrToInt(yyv[yysp-0].yystring)));
Inc( FNumRecords );
end;
101 : begin
FExprList.Add(TIntegerLiteral.Create(StrToInt(yyv[yysp-0].yystring)));
Inc( FNumRecords );
end;
102 : begin
AddExpression( TEntExpr.Create(nil, FMainExpr.Gis,
FMainExpr.Gis.Layers.LayerByName( yyv[yysp-2].yystring )) );
end;
103 : begin
AddExpression( TEzQueryVectorExpr.Create(ForceParamList(3), FMainExpr ) );
end;
104 : begin
AddExpression( TEzQueryScopeExpr.Create(ForceParamList(2), FMainExpr ) );
end;
105 : begin
//!!! pendiente de implementar aqui la comparacion registro a registro para JOINs en SQL!!!
end;
106 : begin
AddExpression( TEzQueryLayerExpr.Create(ForceParamList( FNumRecords + 3 ), FMainExpr ) );
FNumRecords:= 0;
end;
107 : begin
AddExpression( TEzQueryLayerExpr.Create(ForceParamList(3), FMainExpr ) );
end;
108 : begin
AddExpression( TEzQueryLayerExpr.Create(ForceParamList(3), FMainExpr ) );
end;
109 : begin
end;
110 : begin
yyval := yyv[yysp-2];
end;
111 : begin
yyval := yyv[yysp-0];
end;
112 : begin
yyval := yyv[yysp-2];
end;
113 : begin
GetOneOperator;
FreeAndNil( Op1 );
FOrderBy.AddObject( yyv[yysp-1].yystring, Pointer( Ord( FDescending ) ) );
FDescending := False;
end;
114 : begin
end;
115 : begin
FDescending := True;
end;
116 : begin
FDescending := True;
end;
end;
end(*yyaction*);
(* parse table: *)
type YYARec = record
sym, act : SmallInt;
end;
YYRRec = record
len, sym : SmallInt;
end;
const
yynacts = 2217;
yyngotos = 309;
yynstates = 221;
yynrules = 116;
var
yya : array [1..yynacts ] of YYARec;
yyg : array [1..yyngotos ] of YYARec;
yyd : array [0..yynstates-1] of SmallInt;
yyal: array [0..yynstates-1] of SmallInt;
yyah: array [0..yynstates-1] of SmallInt;
yygl: array [0..yynstates-1] of SmallInt;
yygh: array [0..yynstates-1] of SmallInt;
yyr : array [1..yynrules ] of YYRRec;
procedure LoadResArrays;
procedure ResLoad(const resname: string; ResourceBuffer: Pointer);
var
ResourceSize: Integer;
ResourcePtr: PChar;
BinResource: THandle;
ResInstance: Longint;
H: THandle;
Buf: array[0..255] of Char;
begin
H := System.FindResourceHInstance(HInstance);
StrPLCopy(Buf, resname, SizeOf(Buf)-1);
ResInstance := FindResource(H, Buf, RT_RCDATA);
if ResInstance = 0 then begin
H := HInstance;
{try to find in main binary}
ResInstance := FindResource(H, Buf, RT_RCDATA);
end;
ResourceSize := SizeofResource(H,ResInstance);
BinResource := LoadResource(H,ResInstance);
ResourcePtr := LockResource(BinResource);
Move(ResourcePtr^, ResourceBuffer^, ResourceSize);
UnlockResource(BinResource);
FreeResource(BinResource);
end;
begin
ResLoad('EzExprYacc_YYA', @yya[1]);
ResLoad('EzExprYacc_YYG', @yyg[1]);
ResLoad('EzExprYacc_YYD', @yyd[0]);
ResLoad('EzExprYacc_YYAL', @yyal[0]);
ResLoad('EzExprYacc_YYAH', @yyah[0]);
ResLoad('EzExprYacc_YYGL', @yygl[0]);
ResLoad('EzExprYacc_YYGH', @yygh[0]);
ResLoad('EzExprYacc_YYR', @yyr[1]);
end;
const _error = 256; (* error token *)
function yyact(state, sym : Integer; var act : SmallInt) : Boolean;
(* search action table *)
var k : Integer;
begin
k := yyal[state];
while (k<=yyah[state]) and (yya[k].sym<>sym) do inc(k);
if k>yyah[state] then
yyact := false
else
begin
act := yya[k].act;
yyact := true;
end;
end(*yyact*);
function yygoto(state, sym : Integer; var nstate : SmallInt) : Boolean;
(* search goto table *)
var k : Integer;
begin
k := yygl[state];
while (k<=yygh[state]) and (yyg[k].sym<>sym) do inc(k);
if k>yygh[state] then
yygoto := false
else
begin
nstate := yyg[k].act;
yygoto := true;
end;
end(*yygoto*);
label parse, next, error, errlab, shift, reduce, accept, abort;
begin(*yyparse*)
(* load arrays from resource *)
LoadResArrays;
yystate := 0; yychar := -1; yynerrs := 0; yyerrflag := 0; yysp := 0;
{$ifdef yydebug}
yydebug := true;
{$else}
yydebug := false;
{$endif}
parse:
(* push state and value: *)
inc(yysp);
if yysp>yymaxdepth then
begin
yyerror('yyparse stack overflow');
goto abort;
end;
yys[yysp] := yystate; yyv[yysp] := yyval;
next:
if (yyd[yystate]=0) and (yychar=-1) then
(* get next symbol *)
begin
repeat
yychar := yyLexer.yylex; if yychar<0 then yychar := 0;
// ignore comments and blanks [ \n\t]
if not( (yychar=_COMMENT) or (yychar=_BLANK) or
(yychar=_TAB) or (yychar=_NEWLINE) ) then break;
until false;
if yychar= _ILLEGAL then goto error;
end;
(*
if yydebug then
writeln( yyLexer.yyOutput, 'state '+intToStr( yystate)+ ', char '+
intToStr( yychar) + ' at line n
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -