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: 10808 (0x2a38) Types: TextFile Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧
separate (Lex) package body Automate is The_String : Bounded_String.Variable_String (80); function Get return Bounded_String.Variable_String is begin return The_String; end Get; function Double_Point_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '=' => return Token'(Let); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Double_Point_State; function Greater_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '=' => return Token'(Greater_Or_Equal); when others => Look_Ahead.Set (To => C); return Token'(Greater_Than); end case; end Greater_State; function Less_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '>' => return Token'(Not_Equal); when '=' => return Token'(Less_Or_Equal); when others => Look_Ahead.Set (To => C); return Token'(Less_Than); end case; end Less_State; function Comment_State return Token; function End_Of_Comment_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '/' => return Start; when others => return Comment_State; end case; end End_Of_Comment_State; function Comment_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '*' => return End_Of_Comment_State; when others => return Comment_State; end case; end Comment_State; function Start_Comment_State return Token is C : Character; begin C := Get_Next_Character (The_File); case C is when '*' => return Comment_State; when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Start_Comment_State; function Based_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' => return Based_State (C); when others => Look_Ahead.Set (To => C); return Token'(Based); end case; end Based_State; function Based_Number_Value_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' => return Based_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Based_Number_Value_State; function The_Base_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return The_Base_State (C); when '#' => return Based_Number_Value_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end The_Base_State; function Start_Of_Based_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return The_Base_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Start_Of_Based_State; function Hour_With_S_State (In_Character : Character) return Token is begin Bounded_String.Append (Target => The_String, Source => In_Character); return Token'(Hour); end Hour_With_S_State; function Tenth_Of_Second_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when 's' | 'S' => return Hour_With_S_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Tenth_Of_Second_State; function Point_Of_Second_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Tenth_Of_Second_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Point_Of_Second_State; function Second_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Second_State (C); when '.' => return Point_Of_Second_State (C); when 's' | 'S' => return Hour_With_S_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Second_State; function Hour_With_M_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Second_State (C); when others => Look_Ahead.Set (To => C); return Token'(Hour); end case; end Hour_With_M_State; function Minute_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Minute_State (C); when '.' => return Point_Of_Second_State (C); when 'm' | 'M' => return Hour_With_M_State (C); when 's' | 'S' => return Hour_With_S_State (C); when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Minute_State; function Hour_With_H_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Minute_State (C); when others => Look_Ahead.Set (To => C); return Token'(Hour); end case; end Hour_With_H_State; function Int_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when '0' .. '9' => return Int_State (C); when 'h' | 'H' => return Hour_With_H_State (C); when 'm' | 'M' => return Hour_With_M_State (C); when '.' => return Point_Of_Second_State (C); when 's' | 'S' => return Hour_With_S_State (C); when others => Look_Ahead.Set (To => C); return Token'(Int); end case; end Int_State; function Identifier_State (In_Character : Character) return Token is C : Character; begin Bounded_String.Append (Target => The_String, Source => In_Character); C := Get_Next_Character (The_File); case C is when 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' => return Identifier_State (C); when others => Look_Ahead.Set (To => C); return Token'(Identifier); end case; end Identifier_State; function Start return Token is C : Character; begin Current_Line := Natural (Text_Io.Line (The_File)); Current_Column := Natural (Text_Io.Col (The_File)); Bounded_String.Free (The_String); C := Get_Next_Character (The_File); case C is when Ascii.Eot => return Token'(Eof); when ' ' | Ascii.Cr => return Start; when '0' .. '9' => return Int_State (C); when '#' => return Start_Of_Based_State (C); when 'a' .. 'z' | 'A' .. 'Z' => return Identifier_State (C); when '/' => return Start_Comment_State; when '{' => return Token'(Begin_Bracket); when '}' => return Token'(End_Bracket); when '(' => return Token'(Open_Bracket); when ')' => return Token'(Close_Bracket); when '*' => return Token'(Multiply); when '+' => return Token'(Plus); when '-' => return Token'(Minus); when '=' => return Token'(Equal); when ':' => return Double_Point_State; when '<' => return Less_State; when '>' => return Greater_State; when others => Look_Ahead.Set (To => C); return Token'(Unknown); end case; end Start; end Automate;