-- -- Author: Robert C. Shock, Dept of CS & CEG Wright State University -- In cooperation with: WRDC/ELED WPAFB Dayton, OH -- -- source: vhdl_name__.a with text_io; with vhdl_lexicon; with transliterate_gn; package body vhdl_name is function "=" ( the_left: in vhdl_lexicon.element_name; the_right: in vhdl_lexicon.element_name ) return boolean renames vhdl_lexicon."="; -- ESTABLISH DELIMITER generic package type single_delimiter_array is array ( single_delimiter ) of character; ar_single_delimiter: single_delimiter_array := ( vhdl_lexicon.ampersand =>'&', vhdl_lexicon.apostrophe => ''', vhdl_lexicon.left_parenthesis =>'(', vhdl_lexicon.right_parenthesis =>')', vhdl_lexicon.star =>'*', vhdl_lexicon.plus => '+', vhdl_lexicon.comma => ',', vhdl_lexicon.hyphen => '-', vhdl_lexicon.dot =>'.', vhdl_lexicon.slash =>'/', vhdl_lexicon.colon =>':', vhdl_lexicon.semicolon =>';', vhdl_lexicon.less_than => '<', vhdl_lexicon.equal => '=', vhdl_lexicon.greater_than => '>', vhdl_lexicon.vertical_bar =>'|'); package transliterate_single_delimiter is new transliterate_gn ( item => character, enum => single_delimiter, array_range_enum => single_delimiter_array, array_values => ar_single_delimiter, equal => "=" ); -- ESTABLISH COMPOUND DELIMITER generic package subtype string_2 is string ( 1 .. 2 ); type compound_delimiter_ar_type is array ( compound_delimiter ) of string_2; ar_compound_delimiter: compound_delimiter_ar_type := ( vhdl_lexicon.arrow => "=>", vhdl_lexicon.double_star => "**", vhdl_lexicon.assignment_variable => ":=", vhdl_lexicon.inequality => "/=", vhdl_lexicon.greater_than_equal => ">=", vhdl_lexicon.less_than_equal => "<=", vhdl_lexicon.box=> "<>" ); package transliterate_compound_delimiter is new transliterate_gn ( item => string_2, enum => compound_delimiter, array_range_enum => compound_delimiter_ar_type, array_values => ar_compound_delimiter, equal => "=" ); -- ESTABLISH SEPARATOR generic package type separator_ar_type is array ( separator ) of character; ar_separator: separator_ar_type := ( vhdl_lexicon.horizontal_tab => ascii.ht, vhdl_lexicon.vertical_tab => ascii.vt, vhdl_lexicon.carriage_return => ascii.cr, vhdl_lexicon.line_feed => ascii.lf, vhdl_lexicon.form_feed => ascii.ff, vhdl_lexicon.space_character => ' ', vhdl_lexicon.end_file => ascii.eot ); package transliterate_separator is new transliterate_gn ( item => character, enum => separator, array_range_enum => separator_ar_type, array_values => ar_separator, equal => "=" ); package element_name_io is new text_io.enumeration_io ( vhdl_lexicon.element_name ); -- OBJECTS g_reserve_word_name: reserve_word; g_reserve_word_name_valid: boolean := false; -- function is_reserve_word ( the_value: in string ) return boolean is length: natural; begin element_name_io.get ( from => the_value & "_id", item => g_reserve_word_name, last => length ); for value in reserve_word loop if value = g_reserve_word_name then g_reserve_word_name := value; g_reserve_word_name_valid := true; return true; end if; end loop; exception when text_io.data_error => g_reserve_word_name_valid := false; return false; end is_reserve_word; function reserve_word_name_is return reserve_word is begin if g_reserve_word_name_valid then return g_reserve_word_name; else raise lexical_name_is_not_known; end if; end reserve_word_name_is; -- function is_compound_delimiter ( the_value: in string ) return boolean is begin if the_value'length = 2 then return transliterate_compound_delimiter.is_a_member ( the_value ); end if; return false; end is_compound_delimiter; function compound_delimiter_name_is return compound_delimiter is begin return transliterate_compound_delimiter.value_is; exception when transliterate_compound_delimiter.no_value_exception => raise lexical_name_is_not_known; end compound_delimiter_name_is; -- function is_single_delimiter ( the_character: in character ) return boolean is begin return transliterate_single_delimiter.is_a_member ( the_character ); end is_single_delimiter; function single_delimiter_name_is return single_delimiter is begin return transliterate_single_delimiter.value_is; exception when transliterate_single_delimiter.no_value_exception => raise lexical_name_is_not_known; end single_delimiter_name_is; -- function is_separator ( the_character: in character ) return boolean is begin return transliterate_separator.is_a_member ( the_character ); end; function separator_name_is return separator is begin return transliterate_separator.value_is; exception when transliterate_separator.no_value_exception => raise lexical_name_is_not_known; end separator_name_is; end vhdl_name;