DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 7010 (0x1b62) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧
-- table des symboles with Text_Io; with Fichier_Io; with Bounded_String; with Reserved_Word; package body Scanner is procedure Open (Fichier_Source : in out Text_Io.File_Type) is begin Fichier_Io.Open (Fichier_Source); end Open; procedure Close (Fichier_Source : in out Text_Io.File_Type) is begin Fichier_Io.Close (Fichier_Source); end Close; function At_End (Fichier_Source : in Text_Io.File_Type) return Boolean is begin return Fichier_Io.At_End (Fichier_Source); end At_End; function At_Line (Fichier_Source : in Text_Io.File_Type) return Boolean is begin return Fichier_Io.At_Line (Fichier_Source); end At_Line; procedure Next (Fichier_Source : in Text_Io.File_Type) is C : Character; State : Etat; begin Bounded_String.Free (Current_Value); if At_End (Fichier_Source) then Current_Token := Token'(Eof); else State := Etat'(Normal); loop if At_End (Fichier_Source) then C := Ascii.Eot; else C := Fichier_Io.Get (Fichier_Source); end if; case State is when Normal => case C is when Ascii.Eot => Current_Token := Token'(Eof); State := Etat'(Found); when ' ' | Ascii.Cr | Ascii.Ht => null; when '<' => Bounded_String.Append (Current_Value, C); Current_Token := Token'(Less); State := Etat'(Less); when '>' => Bounded_String.Append (Current_Value, C); Current_Token := Token'(Great); State := Etat'(Great); when '=' => Bounded_String.Append (Current_Value, C); Current_Token := Token'(Equal); State := Etat'(Found); when '{' | '}' | '(' | ')' | '.' => Bounded_String.Append (Current_Value, C); Current_Token := Token'(Special); State := Etat'(Found); when '+' | '-' | '*' | '/' => Bounded_String.Append (Current_Value, C); Current_Token := Token'(Operator); State := Etat'(Found); when '"' => Bounded_String.Append (Current_Value, C); State := Etat'(Word); when others => if C in 'a' .. 'z' or else C in 'A' .. 'Z' then Bounded_String.Append (Current_Value, C); State := Etat'(Identifier); elsif C in '0' .. '9' then Bounded_String.Append (Current_Value, C); State := Etat'(Number); else Bounded_String.Append (Current_Value, C); Current_Token := Token'(Unknown); State := Etat'(Found); end if; end case; when Number => if C in '0' .. '9' then Bounded_String.Append (Current_Value, C); else Fichier_Io.Unget (Fichier_Source); Current_Token := Token'(Integer); State := Etat'(Found); end if; when Identifier => if C in 'a' .. 'z' or else C in 'A' .. 'Z' then Bounded_String.Append (Current_Value, C); elsif C = ':' then Current_Token := Token'(Keyword); State := Etat'(Found); else Fichier_Io.Unget (Fichier_Source); Current_Token := Token'(Identifier); Current_Token := Reserved_Word.Reserved_To_Token (Bounded_String.Image (Current_Value)); State := Etat'(Found); end if; when Word => Bounded_String.Append (Current_Value, C); if C /= '"' then Current_Token := Token'(Word); else State := Etat'(Found_Word); end if; when Found_Word => if C /= '"' then Current_Token := Token'(Word); State := Etat'(Found); Fichier_Io.Unget (Fichier_Source); else Current_Token := Token'(Word); State := Etat'(Word); end if; when Great => if C = '=' then Bounded_String.Append (Current_Value, C); Current_Token := Token'(Great_Equal); else Fichier_Io.Unget (Fichier_Source); State := Etat'(Found); end if; when Less => if C = '=' then Bounded_String.Append (Current_Value, C); Current_Token := Token'(Less_Equal); else Fichier_Io.Unget (Fichier_Source); State := Etat'(Found); end if; when Found => null; end case; exit when (State = Found); end loop; end if; end Next; function Get_Value (Fichier_Source : in Text_Io.File_Type) return Bounded_String.Variable_String is begin return Scanner.Current_Value; end Get_Value; function Get_Token (Fichier_Source : in Text_Io.File_Type) return Token is begin Next (Fichier_Source); return Scanner.Current_Token; end Get_Token; end Scanner;