-- $Source: /commtar/monoBANK/RTS/int_tab.dat,v $ -- $Revision: 1.4 $ -- $Date: 87/11/10 11:50:00 $ -- $Author: fitch $ ------------------------------------------------------------- -- RTS_INTEGER_STATE_TABLES ------------------------------------------------------------- with RTS_LEXER; use RTS_LEXER; -- uses type decls package RTS_INTEGER_STATE_TABLES --| mapping and transitions for integer is Mapping: Char_To_Token_Mapping := Char_To_Token_Mapping' ('0'..'9' => Digit, 'e' | 'E' => Exp, -- exponent; could also be extended digit 'A'..'D' | 'F'..'Z' | 'a'..'d' | 'f'..'z' => ExDigit, '_' => UnderScore, '#' => Sharp, ':' => Colon, '+' | '-' => Sign, ' ' | Ascii.ht => Blank, others => Delim); -- Further state definitions for integer: Sign_or_Underscore : constant state := 3; After_Digit : constant state := 4; Exponent : constant state := 5; -- Have seen 'e' signaling exponent Digit_After_Exponent : constant state := 6; Exponent_sign_or_underscore : constant state := 7; Base_Or_Underscore_Sharp : constant state := 8; -- misnamed state??? Based_Number_Sharp : constant state := 9; Base_Or_Underscore_Colon : constant state := 10; -- misnamed state??? Based_Number_Colon : constant state := 11; Complete_Base : constant state := 12; -- finished non-decimal part -- subtypes needed to define transitions constant: subtype ST2 is State_transitions (Start..Complete_Base); -- ST2'last MUST be largest state defined for integer IO -- The following state transitions are what drive the -- Finite State Automaton (FSA). Transitions: constant ST2 := ST2'( Start => ( Blank => Start, -- Skip_Blanks() should prevent this Digit => After_Digit, Sign => Sign_or_Underscore, others => Error), Sign_or_Underscore => ( Digit => After_Digit, others => Error), After_Digit => ( Underscore => Sign_or_Underscore, Digit => After_Digit, Exp => Exponent, Sharp => Base_or_Underscore_Sharp, Colon => Base_or_Underscore_Colon, others => Accepted), Base_or_Underscore_Sharp => ( Digit | ExDigit | Exp => Based_Number_Sharp, others => Error), Based_Number_Sharp => ( Digit | ExDigit | Exp => Based_Number_Sharp, Underscore => Base_or_Underscore_Sharp, Sharp => Complete_Base, others => Error), Base_or_Underscore_Colon => ( Digit | ExDigit | Exp => Based_Number_Colon, others => Error), Based_Number_Colon => ( Digit | ExDigit | Exp => Based_Number_Colon, Underscore => Base_or_Underscore_Colon, Colon => Complete_Base, others => Error), Complete_Base => ( Exp => Exponent, others => Accepted), Exponent => ( Sign => Exponent_Sign_or_Underscore, Digit => Digit_After_Exponent, others => Error), Digit_After_Exponent => ( Digit => Digit_After_Exponent, Underscore => Exponent_Sign_or_Underscore, others => Accepted), Exponent_Sign_or_Underscore => ( Digit => Digit_After_Exponent, others => Error), others => ( others => Error)); end RTS_INTEGER_STATE_TABLES; -- $Cprt start$ -- -- Copyright (C) 1988 by Intermetrics, Inc. -- -- This material may be used duplicated or disclosed by or for the -- U.S. Government pursuant to the copyright license under DAR clause -- 7-104.9(a) (May 1981). -- -- This project was spnsored by the STARS Foundation -- Naval Research Laboratory, Washington DC -- -- $Cprt end$