|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 19456 (0x4c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Lex, seg_0462f3, seg_04694f
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧ └─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Nos_Chaines; with File; with Text_Io; with Io_Exceptions; package body Lex is Current_Value : Nos_Chaines.Infinite_String.Variable_String; Current_Token : Token; Thefile : Text_Io.File_Type; End_Lexical_Analysis : Boolean; type Keyword is (Afficher, Ajouter, Creer, Decrire, Deplacer, Detruire, Findujeu, Informer, Inventaire, Joueur, Modifierdescription, Supprimer, Si, Sinon, Finsi, Finjeu, Locales, Generales, Initiales, Et, Ou, Alors, Communication, Compteur, Objet, Lieu, Personnage, Scenario, Contenu, Debutcommunication, Etat, Finlieu, Finobjet, Finpersonnage, Fincompteur, Possession, Position, Description, Definitionpreposition, Definitionvariable, Definitionverbe, Direction, Est, Dans, Positioncourante, Reliea, Sera, Sortie, Valeur, Vers, Existe, Fincommunication, Modulo, Non, Sens1, Sens2); subtype Letter is Character range 'a' .. 'z'; subtype Digit is Character range '0' .. '9'; procedure Open (Nomfichier : in String) is begin End_Lexical_Analysis := False; Text_Io.Open (File => Thefile, Mode => Text_Io.In_File, Name => Nomfichier, Form => ""); File.Open (Thefile); end Open; function Get_Token return Token is begin return Current_Token; end Get_Token; function Next_Token return Token is begin Next; return Get_Token; end Next_Token; function Get_Value return Nos_Chaines.String_Text is begin return (Current_Value); end Get_Value; function Get_Line return Positive is begin return Positive'Val (Text_Io.Line (Thefile)); --File.Get_Line (Thefile); end Get_Line; function At_End return Boolean is begin if Current_Token = L_Eof then Text_Io.Close (Thefile); end if; return (Current_Token = L_Eof); end At_End; function Is_Alpha_Num (Car : Character) return Boolean is begin if Car in Digit then return True; elsif Car in Letter then return True; elsif Car = '_' then return True; else return False; end if; end Is_Alpha_Num; procedure To_Token (Source : Nos_Chaines.String_Text) is begin Current_Token := Token'Val (Keyword'Pos (Keyword'Value (Nos_Chaines.Infinite_String.Image (Source)))); exception when Constraint_Error => Current_Token := L_Id; end To_Token; procedure Next is type State is (St_Start, St_Found, St_Text, St_Begin_Comment, St_Comment, St_End_Comment, St_Number, St_Word); Next_State : State; Current_Char : Character; begin Nos_Chaines.Infinite_String.Free (Current_Value); if not End_Lexical_Analysis then Next_State := St_Start; Find_Lexeme: loop File.Next (Thefile); Current_Char := File.Value (Thefile); case Next_State is when St_Start => case Current_Char is when Letter => Current_Token := L_Id; Next_State := St_Word; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when Digit => Next_State := St_Number; Current_Token := L_Number; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when ' ' => null; when ':' => Current_Token := L_Colon; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '<' => Current_Token := L_Less; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '>' => Current_Token := L_Great; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when ',' => Current_Token := L_Coma; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '(' => Current_Token := L_Left_Bracket; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when ')' => Current_Token := L_Right_Bracket; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '"' => Next_State := St_Text; when '\' => Next_State := St_Begin_Comment; when '=' => Current_Token := L_Equal; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '+' => Current_Token := L_Plus; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '-' => Current_Token := L_Moins; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '*' => Current_Token := L_Multiplication; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when '/' => Current_Token := L_Division; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); when others => Current_Token := L_Unk; Next_State := St_Found; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); end case; when St_Number => if Current_Char not in Digit then Current_Token := L_Number; Next_State := St_Found; File.Unget (Thefile); else Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); end if; when St_Word => if not Is_Alpha_Num (Current_Char) then To_Token (Current_Value); Next_State := St_Found; File.Unget (Thefile); else Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); end if; when St_Text => if Current_Char = '"' then Current_Token := L_Text; Next_State := St_Found; else Current_Token := L_Unk; Nos_Chaines.Infinite_String.Append (Target => Current_Value, Source => Current_Char); end if; when St_Begin_Comment => if Current_Char = '\' then Next_State := St_Comment; Current_Token := L_Unk; else Next_State := St_Found; Current_Token := L_Unk; end if; when St_Comment => if Current_Char = '\' then Next_State := St_End_Comment; end if; when St_End_Comment => if Current_Char = '\' then Next_State := St_Start; else Next_State := St_Comment; end if; when St_Found => exit Find_Lexeme; end case; if (Next_State = St_Found) then exit Find_Lexeme; end if; end loop Find_Lexeme; else Current_Token := L_Eof; end if; exception when File.End_Of_File_Exception => if (Next_State = St_Found or Next_State = St_Start) then Nos_Chaines.Infinite_String.Free (Current_Value); Current_Token := L_Eof; else End_Lexical_Analysis := True; end if; end Next; end Lex;
nblk1=12 nid=7 hdr6=1c [0x00] rec0=19 rec1=00 rec2=01 rec3=08c [0x01] rec0=2b rec1=00 rec2=0e rec3=04a [0x02] rec0=27 rec1=00 rec2=0c rec3=022 [0x03] rec0=1c rec1=00 rec2=06 rec3=00e [0x04] rec0=10 rec1=00 rec2=0b rec3=072 [0x05] rec0=10 rec1=00 rec2=0a rec3=068 [0x06] rec0=11 rec1=00 rec2=09 rec3=00c [0x07] rec0=10 rec1=00 rec2=0f rec3=02a [0x08] rec0=10 rec1=00 rec2=12 rec3=02e [0x09] rec0=15 rec1=00 rec2=11 rec3=070 [0x0a] rec0=17 rec1=00 rec2=10 rec3=030 [0x0b] rec0=02 rec1=00 rec2=05 rec3=02a [0x0c] rec0=1f rec1=00 rec2=0d rec3=00e [0x0d] rec0=17 rec1=00 rec2=04 rec3=000 [0x0e] rec0=17 rec1=00 rec2=04 rec3=001 [0x0f] rec0=00 rec1=00 rec2=00 rec3=000 [0x10] rec0=00 rec1=00 rec2=00 rec3=000 [0x11] rec0=00 rec1=00 rec2=00 rec3=000 tail 0x21542d49286503fb77f73 0x42a00088462060003 Free Block Chain: 0x7: 0000 00 03 00 04 80 01 2e 01 02 03 04 05 06 07 08 09 ┆ . ┆ 0x3: 0000 00 08 00 27 80 24 20 20 20 20 20 20 20 20 20 20 ┆ ' $ ┆ 0x8: 0000 00 02 00 06 80 03 20 20 20 03 20 20 20 20 20 20 ┆ ┆ 0x2: 0000 00 00 03 fc 80 2c 20 20 20 20 20 20 20 20 20 20 ┆ , ┆