text stringlengths 0 234 |
|---|
function Node_Offset |
(Node : Nodes.Node_Access; |
Time : Version_Trees.Version) return Natural; |
-- Compute offset of Node in given Time |
function Get_Cut |
(Node : Nodes.Node_Access; |
Offset : Offset_Array; |
Top : Positive) return Natural; |
-- Compute stack entry corresponding to leading edge of node’s |
-- subtree in the previous version. Returns False if no entry is |
-- so aligned. Top limits stack depth search. |
procedure Isolate (Node : Nodes.Node_Access; Top : Positive); |
-- Resets configuration so parsing can continue. |
procedure Refine (Node : Nodes.Node_Access); |
-- Isolate the argument and recursively recover the subtree that it |
-- roots. |
procedure Discard_Changes_And_Mark_Errors |
(Node : access Nodes.Node'Class); |
Jam_Offset : Natural; |
------------------------------------- |
-- Discard_Changes_And_Mark_Errors -- |
------------------------------------- |
procedure Discard_Changes_And_Mark_Errors |
(Node : access Nodes.Node'Class) is |
begin |
Node.Discard; |
if Node.Local_Changes (Reference, Now) then |
Node.Set_Local_Errors (True); |
end if; |
end Discard_Changes_And_Mark_Errors; |
------------- |
-- Get_Cut -- |
------------- |
function Get_Cut |
(Node : Nodes.Node_Access; |
Offset : Offset_Array; |
Top : Positive) return Natural |
is |
Old_Offset : constant Natural := Node_Offset (Node, Previous); |
begin |
for J in 1 .. Top loop |
if Offset (J) > Old_Offset then |
return 0; |
elsif Offset (J) = Old_Offset then |
for K in J + 1 .. Top loop |
if Offset (K) /= Offset (J) then |
return K - 1; |
end if; |
end loop; |
return J; |
end if; |
end loop; |
return 0; |
end Get_Cut; |
------------------------ |
-- Is_Valid_Isolation -- |
------------------------ |
function Is_Valid_Isolation |
(Node : Nodes.Node_Access; |
Offset : Natural; |
State : Parser_State) return Boolean |
is |
Old_Offset : constant Natural := Node_Offset (Node, Previous); |
begin |
if Offset /= Old_Offset then |
-- The starting offset of the subtree must be the same in both |
-- the previous and current versions. |
-- I have no idea how this could fail??? |
return False; |
elsif Offset > Jam_Offset then |
-- Cannot be to the right of the point where the error was |
-- detected by the parser. |
return False; |
elsif Offset + Node.Span (Nodes.Text_Length, Previous) <= |
Jam_Offset |
then |
-- The ending offset must meet or exceed the detection point. |
return False; |
elsif Node.Span (Nodes.Text_Length, Previous) /= |
Node.Span (Nodes.Text_Length, Now) |
then |
-- The subtree span must the same in current and prev versions. |
return False; |
end if; |
declare |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.