DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦adc477175⟧ TextFile

    Length: 3421 (0xd5d)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Class_Printer;
with Bug_Report;
with Bounded_String;

package body List is

    procedure Parse (Ident : in out Message.Unary;
                     Kwd : in out Message.Unary) is
        use Scanner;
    begin  
        case Scanner.Get_Token is
            when Scanner.Identifier =>
                Message.Put (This_Name => Scanner.Get_Value, Into => Ident);
                Scanner.Next;  
                if Scanner.Get_Token = Scanner.Identifier then
                    Parse_Ident (Ident, Kwd);
                end if;
            when Scanner.Keyword =>
                Message.Put (This_Name => Scanner.Get_Value, Into => Kwd);
                Scanner.Next;
                if Scanner.Get_Token = Scanner.Identifier then
                    Message.Put (This_Name => Scanner.Get_Value, Into => Ident);
                    Scanner.Next;
                    if Scanner.Get_Token = Scanner.Keyword then
                        Parse_Kwd (Ident, Kwd);
                    end if;  
                else
                    raise Bug_Report.Identifier_Is_Missing;
                end if;
            when others =>
                raise Bug_Report.Unexpected_Token;
        end case;
    end Parse;

    procedure Parse_Ident (Ident : in out Message.Unary;
                           Kwd : in out Message.Unary) is
        use Scanner;
    begin
        Message.Put (This_Name => Scanner.Get_Value, Into => Ident);
        Scanner.Next;
        if Scanner.Get_Token = Scanner.Identifier then
            Parse_Ident (Ident, Kwd);
        end if;
    end Parse_Ident;

    procedure Parse_Kwd (Ident : in out Message.Unary;
                         Kwd : in out Message.Unary) is
        use Scanner;
    begin
        Message.Put (This_Name => Scanner.Get_Value, Into => Kwd);
        Scanner.Next;
        if Scanner.Get_Token = Scanner.Identifier then
            Message.Put (This_Name => Scanner.Get_Value, Into => Ident);
            Scanner.Next;
            if Scanner.Get_Token = Scanner.Keyword then
                Parse_Kwd (Ident, Kwd);
            end if;
        else
            raise Bug_Report.Identifier_Is_Missing;
        end if;
    end Parse_Kwd;

    function Is_First (T : Scanner.Token) return Boolean is
        use Scanner;
    begin
        return T = Identifier or else T = Keyword;
    end Is_First;

    procedure Unparse (Ident : Message.Unary; Kwd : Message.Unary) is

        Ident_Mess : Message.Unary := Ident;
        Kwd_Mess : Message.Unary := Kwd;

    begin
        Message.Init (This => Ident_Mess);
        Message.Init (This => Kwd_Mess);
        if Message.Is_Done (Kwd_Mess) then
            while not Message.Is_Done (Ident_Mess) loop
                Class_Printer.Put (" " &
                                   Bounded_String.Image
                                      (Message.Get (Name_From => Ident_Mess)));
                Message.Next (Ident_Mess);
            end loop;
        else
            while not Message.Is_Done (Kwd_Mess) loop
                Class_Printer.Put
                   (" " & Bounded_String.Image
                             (Message.Get (Name_From => Kwd_Mess)) &
                    ": " & Bounded_String.Image
                              (Message.Get (Name_From => Ident_Mess)));
                Message.Next (Ident_Mess);
                Message.Next (Kwd_Mess);
            end loop;
        end if;
    end Unparse;

end List;