text stringlengths 0 234 |
|---|
return Node.Child (1, Reference); |
else |
return Node.Next_Subtree (Reference); |
end if; |
end Left_Breakdown; |
--------------- |
-- On_Reduce -- |
--------------- |
procedure On_Reduce (Parts : Production_Index) is |
Count : constant Natural := Counts (Parts); |
subtype First_Nodes is Nodes.Node_Array (1 .. Count); |
Kind : Nodes.Node_Kind; |
begin |
Stack.Top := Stack.Top - Count + 1; |
Factory.Create_Node |
(Parts, |
First_Nodes (Stack.Node (Stack.Top .. Stack.Top + Count - 1)), |
Stack.Node (Stack.Top), |
Kind); |
if Count = 0 then |
Stack.State (Stack.Top) := State; |
end if; |
State := Next_State (Stack.State (Stack.Top), Kind); |
end On_Reduce; |
-------------- |
-- On_Shift -- |
-------------- |
procedure On_Shift |
(State : in out Parser_State; |
New_State : Parser_State; |
Node : access Nodes.Node'Class) is |
begin |
Push (Stack, State, Nodes.Node_Access (Node)); |
State := New_State; |
end On_Shift; |
--------- |
-- Pop -- |
--------- |
procedure Pop |
(Self : in out Parser_Stack; |
State : out Parser_State; |
Node : out Nodes.Node_Access) is |
begin |
State := Self.State (Self.Top); |
Node := Self.Node (Self.Top); |
Self.Top := Self.Top - 1; |
end Pop; |
---------- |
-- Push -- |
---------- |
procedure Push |
(Self : in out Parser_Stack; |
State : Parser_State; |
Node : Nodes.Node_Access) is |
begin |
Self.Top := Self.Top + 1; |
Self.State (Self.Top) := State; |
Self.Node (Self.Top) := Node; |
Node.Set_Local_Errors (False); |
end Push; |
------------- |
-- Recover -- |
------------- |
procedure Recover (LA : out Nodes.Node_Access) is |
begin |
if Stack.Top > 1 then |
-- Remove any default reductions from the parse stack |
Right_Breakdown; |
end if; |
Recover_2 (LA); |
end Recover; |
--------------- |
-- Recover_2 -- |
--------------- |
procedure Recover_2 (LA : out Nodes.Node_Access) is |
type Offset_Array is array (Positive range <>) of Natural; |
function Is_Valid_Isolation |
(Node : Nodes.Node_Access; |
Offset : Natural; |
State : Parser_State) return Boolean; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.