text
stringlengths 0
234
|
|---|
if Current_Char /= What then
|
raise Parsing_Error
|
with "Expecting '" & What & "' got '" & Current_Char & "'";
|
else
|
Next_Char;
|
end if;
|
end Expect;
|
function Remaining return String is
|
begin
|
return Buffer (Cursor .. Buffer'Last);
|
end Remaining;
|
Level : Natural := 0;
|
function Indent return String is
|
use Ada.Strings.Fixed;
|
begin
|
return (Level * 3) * " ";
|
end Indent;
|
procedure Down_Level is
|
begin
|
Level := Level + 1;
|
end Down_Level;
|
procedure Up_Level is
|
begin
|
Level := Level - 1;
|
end Up_Level;
|
procedure Ecco (X : String) is
|
begin
|
if Verbose then
|
Ada.Text_Io.Put_Line (Indent
|
& "Calling "
|
& X & "[" & Remaining & "]"
|
& "'" & Current_Char & "'");
|
Down_Level;
|
end if;
|
end Ecco;
|
procedure Fine is
|
begin
|
if Verbose then
|
Up_Level;
|
Ada.Text_Io.Put_Line (Indent & "done " & "[" & Remaining & "]"
|
& "'" & Current_Char & "'");
|
end if;
|
end Fine;
|
procedure Advance (N : Positive) is
|
begin
|
Cursor := Cursor + N - 1;
|
Next_Char;
|
end Advance;
|
function Parse_Expr return Node_Access;
|
-- function Parse_Identifier return Bounded_ID is
|
-- use Ada.Strings.Maps;
|
-- use Bounded_IDs;
|
--
|
-- Result : Bounded_ID;
|
-- ID_Chars : constant Character_Set :=
|
-- To_Set (Character_Range'('a', 'z')) or
|
-- To_Set (Character_Range'('A', 'Z')) or
|
-- To_Set (Character_Range'('0', '9')) or
|
-- To_Set ('.') or
|
-- To_Set ('_');
|
-- begin
|
-- Ecco ("ID");
|
--
|
-- while Is_In (Current_Char, ID_Chars) loop
|
-- Result := Result & Current_Char;
|
-- Next_Char (Skip_Spaces => False);
|
-- end loop;
|
--
|
-- if Current_Char = ' ' then
|
-- Next_Char;
|
-- end if;
|
--
|
-- Fine;
|
-- return Result;
|
-- end Parse_Identifier;
|
procedure Parse_Parameter_List (Parameters : out Parameter_Array;
|
N_Params : out Natural)
|
is
|
begin
|
Ecco ("par-list");
|
if Current_Char = ')' then
|
N_Params := 0;
|
else
|
N_Params := 1;
|
Parameters (1) := Parse_Expr;
|
while Current_Char = ',' loop
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.