indexing
	description: "General mechanisms for building lexical analyzers"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
	revision: "$Revision: 56675 $"

class interface
	LEX_BUILDER


create 
	make
			-- Set up the analyzer.
		ensure
			last_character_set: last_character_code = last_ascii

	make_extended (char_code: INTEGER_32)
			-- Set up the analyzer with `char_code' as 'last_character_code'.
		require
			valid_char_code: char_code > 0
		ensure
			last_character_set: last_character_code = char_code

feature -- Initialization

	initialize
			-- Set up attributes of analyzer.
		ensure
			initialized

	make
			-- Set up the analyzer.
		ensure
			last_character_set: last_character_code = last_ascii

	array_make (min_index, max_index: INTEGER_32)
			-- Allocate array; set index interval to
			-- `min_index' .. `max_index'; set all values to default.
			-- (Make array empty if `min_index' = `max_index' + 1).
			-- (from ARRAY)
		require -- from ARRAY
			valid_bounds: min_index <= max_index + 1
		ensure -- from ARRAY
			lower_set: lower = min_index
			upper_set: upper = max_index
			items_set: all_default

	pdfa_make (n, i: INTEGER_32)
			-- Make a PDFA with `n' states, and `i' + 1 inputs.
			-- (from PDFA)

	make_extended (char_code: INTEGER_32)
			-- Set up the analyzer with `char_code' as 'last_character_code'.
		require
			valid_char_code: char_code > 0
		ensure
			last_character_set: last_character_code = char_code

	make_from_array (a: ARRAY [LINKED_LIST [INTEGER_32]])
			-- Initialize from the items of `a'.
			-- (Useful in proper descendants of class `ARRAY',
			-- to initialize an array-like object from a manifest array.)
			-- (from ARRAY)
		require -- from ARRAY
			array_exists: a /= Void

	make_from_cil (na: NATIVE_ARRAY [like pdfa_item])
			-- Initialize array from `na'.
			-- (from ARRAY)
		require -- from ARRAY
			is_dotnet: {PLATFORM}.is_dotnet
			na_not_void: na /= Void
	
feature -- Access

	ack: INTEGER_32 is 6
			-- (from ASCII)

	ampersand: INTEGER_32 is 38
			-- (from ASCII)

	analyzer: LEXICAL
			-- The lexical analyzer built so far

	area: SPECIAL [LINKED_LIST [INTEGER_32]]
			-- Special data zone
			-- (from TO_SPECIAL)

	back_space: INTEGER_32 is 8
			-- (from ASCII)

	backslash: INTEGER_32 is 92
			-- (from ASCII)

	bar: INTEGER_32 is 124
			-- (from ASCII)

	bel: INTEGER_32 is 7
			-- (from ASCII)

	blank: INTEGER_32 is 32
			-- (from ASCII)

	break: INTEGER_32 is -7
			-- (from ASCII)

	bs: INTEGER_32 is 8
			-- (from ASCII)

	buf_overflow: INTEGER_32 is -9
			-- (from ASCII)

	can: INTEGER_32 is 24
			-- (from ASCII)

	carriage_return: INTEGER_32 is 13
			-- (from ASCII)

	case_diff: INTEGER_32 is 32
			-- Lower_a - Upper_a
			-- (from ASCII)

	case_sensitive: BOOLEAN
			-- Will future tools be case-sensitive?

	categories_table: ARRAY [INTEGER_32]
			-- Table of category numbers for each input

	character_set_size: INTEGER_32 is 128
			-- (from ASCII)

	circumflex: INTEGER_32 is 94
			-- (from ASCII)

	closing_brace: INTEGER_32 is 125
			-- (from ASCII)

	colon: INTEGER_32 is 58
			-- (from ASCII)

	comma: INTEGER_32 is 44
			-- (from ASCII)

	commercial_at: INTEGER_32 is 64
			-- (from ASCII)

	cr: INTEGER_32 is 13
			-- (from ASCII)

	ctrl_a: INTEGER_32 is 1
			-- (from ASCII)

	ctrl_b: INTEGER_32 is 2
			-- (from ASCII)

	ctrl_backslash: INTEGER_32 is 28
			-- (from ASCII)

	ctrl_c: INTEGER_32 is 3
			-- (from ASCII)

	ctrl_circumflex: INTEGER_32 is 30
			-- (from ASCII)

	ctrl_d: INTEGER_32 is 4
			-- (from ASCII)

	ctrl_e: INTEGER_32 is 5
			-- (from ASCII)

	ctrl_f: INTEGER_32 is 6
			-- (from ASCII)

	ctrl_g: INTEGER_32 is 7
			-- (from ASCII)

	ctrl_h: INTEGER_32 is 8
			-- (from ASCII)

	ctrl_i: INTEGER_32 is 9
			-- (from ASCII)

	ctrl_j: INTEGER_32 is 10
			-- (from ASCII)

	ctrl_k: INTEGER_32 is 11
			-- (from ASCII)

	ctrl_l: INTEGER_32 is 12
			-- (from ASCII)

	ctrl_lbracket: INTEGER_32 is 27
			-- (from ASCII)

	ctrl_m: INTEGER_32 is 13
			-- (from ASCII)

	ctrl_n: INTEGER_32 is 14
			-- (from ASCII)

	ctrl_o: INTEGER_32 is 15
			-- (from ASCII)

	ctrl_p: INTEGER_32 is 16
			-- (from ASCII)

	ctrl_q: INTEGER_32 is 17
			-- (from ASCII)

	ctrl_questmark: INTEGER_32 is 127
			-- (from ASCII)

	ctrl_r: INTEGER_32 is 18
			-- (from ASCII)

	ctrl_rbracket: INTEGER_32 is 29
			-- (from ASCII)

	ctrl_s: INTEGER_32 is 19
			-- (from ASCII)

	ctrl_t: INTEGER_32 is 20
			-- (from ASCII)

	ctrl_u: INTEGER_32 is 21
			-- (from ASCII)

	ctrl_underlined: INTEGER_32 is 31
			-- (from ASCII)

	ctrl_v: INTEGER_32 is 22
			-- (from ASCII)

	ctrl_w: INTEGER_32 is 23
			-- (from ASCII)

	ctrl_x: INTEGER_32 is 24
			-- (from ASCII)

	ctrl_y: INTEGER_32 is 25
			-- (from ASCII)

	ctrl_z: INTEGER_32 is 26
			-- (from ASCII)

	dc1: INTEGER_32 is 17
			-- (from ASCII)

	dc2: INTEGER_32 is 18
			-- (from ASCII)

	dc3: INTEGER_32 is 19
			-- (from ASCII)

	dc4: INTEGER_32 is 20
			-- (from ASCII)

	del: INTEGER_32 is 127
			-- (from ASCII)

	dfa: FIXED_DFA
			-- DFA built by routine construct_dfa,
			-- which recognizes the same language.
			-- (from NDFA)

	dle: INTEGER_32 is 16
			-- (from ASCII)

	dollar: INTEGER_32 is 36
			-- (from ASCII)

	dot: INTEGER_32 is 46
			-- (from ASCII)

	doublequote: INTEGER_32 is 34
			-- (from ASCII)

	down_arrow: INTEGER_32 is -3
			-- (from ASCII)

	eight: INTEGER_32 is 56
			-- (from ASCII)

	em: INTEGER_32 is 25
			-- (from ASCII)

	enq: INTEGER_32 is 5
			-- (from ASCII)

	entry (i: INTEGER_32): LINKED_LIST [INTEGER_32]
			-- Entry at index `i', if in index interval
			-- (from ARRAY)
		require -- from ARRAY
			valid_key: valid_index (i)

	eot: INTEGER_32 is 4
			-- (from ASCII)

	equal_sign: INTEGER_32 is 61
			-- (from ASCII)

	error_list: ERROR_LIST
			-- List of error messages

	esc: INTEGER_32 is 27
			-- (from ASCII)

	etb: INTEGER_32 is 23
			-- (from ASCII)

	etx: INTEGER_32 is 3
			-- (from ASCII)

	exclamation: INTEGER_32 is 33
			-- (from ASCII)

	final_array: ARRAY [INTEGER_32]
			-- The `final' value for each state
			-- (regular expression, if any, for which it is final).
			-- (from PDFA)

	first_printable: INTEGER_32 is 32
			-- (from ASCII)

	five: INTEGER_32 is 53
			-- (from ASCII)

	four: INTEGER_32 is 52
			-- (from ASCII)

	fs: INTEGER_32 is 28
			-- (from ASCII)

	generating_type: STRING_8
			-- Name of current object's generating type
			-- (type of which it is a direct instance)
			-- (from ANY)
		ensure -- from ANY
			generating_type_not_void: Result /= Void
			generating_type_not_empty: not Result.is_empty

	generator: STRING_8
			-- Name of current object's generating class
			-- (base class of the type of which it is a direct instance)
			-- (from ANY)
		ensure -- from ANY
			generator_not_void: Result /= Void
			generator_not_empty: not Result.is_empty

	grave_accent: INTEGER_32 is 96
			-- (from ASCII)

	greaterthan: INTEGER_32 is 62
			-- (from ASCII)

	greatest_input: INTEGER_32
			-- Greatest input used for the transitions from state
			-- to state (the smallest one is zero)
			-- (from AUTOMATON)

	gs: INTEGER_32 is 29
			-- (from ASCII)

	has (v: LINKED_LIST [INTEGER_32]): BOOLEAN
			-- Does `v' appear in array?
			-- (Reference or object equality,
			-- based on object_comparison.)
			-- (from ARRAY)
		ensure -- from CONTAINER
			not_found_in_empty: Result implies not is_empty

	has_letters: BOOLEAN
			-- Are there any letters among the active transitions?
			-- (from PDFA)

	home_arrow: INTEGER_32 is -6
			-- (from ASCII)

	ht: INTEGER_32 is 9
			-- (from ASCII)

	input_array: ARRAY [FIXED_INTEGER_SET]
			-- For each input, set of the states which have
			-- a transition on this input to the following state
			-- (from PDFA)

	item alias "[]" (i: INTEGER_32): LINKED_LIST [INTEGER_32] assign put
			-- Entry at index `i', if in index interval
			-- Was declared in ARRAY as synonym of infix "@".
			-- (from ARRAY)
		require -- from TABLE
			valid_key: valid_index (i)
		require -- from TO_SPECIAL
			valid_index: valid_index (i)

	keyword_h_table: HASH_TABLE [INTEGER_32, STRING_8]
			-- Keyword table

	keywords_case_sensitive: BOOLEAN
			-- Will future tools be case-sensitive for keywords?

	keywords_list: LINKED_LIST [STRING_8]
			-- Keywords associated with current automaton.
			-- (from PDFA)

	last_ascii: INTEGER_32 is 127
			-- (from ASCII)

	last_character_code: INTEGER_32
			-- Last character code recognized by the language

	last_created_tool: INTEGER_32
			-- Identification number of the last
			-- regular expression put in tool_list

	last_printable: INTEGER_32 is 126
			-- (from ASCII)

	lbracket: INTEGER_32 is 91
			-- (from ASCII)

	lcurly: INTEGER_32 is 40
			-- (from ASCII)

	left_arrow: INTEGER_32 is -4
			-- (from ASCII)

	lessthan: INTEGER_32 is 60
			-- (from ASCII)

	letter_layout: INTEGER_32 is 70
			-- (from ASCII)

	lexical_frozen: BOOLEAN
			-- Has the lexical grammar been finalized?
			-- | (in other words: has the DFA been built?)

	line_feed: INTEGER_32 is 10
			-- (from ASCII)

	lower_a: INTEGER_32 is 97
			-- (from ASCII)

	lower_b: INTEGER_32 is 98
			-- (from ASCII)

	lower_c: INTEGER_32 is 99
			-- (from ASCII)

	lower_d: INTEGER_32 is 100
			-- (from ASCII)

	lower_e: INTEGER_32 is 101
			-- (from ASCII)

	lower_f: INTEGER_32 is 102
			-- (from ASCII)

	lower_g: INTEGER_32 is 103
			-- (from ASCII)

	lower_h: INTEGER_32 is 104
			-- (from ASCII)

	lower_i: INTEGER_32 is 105
			-- (from ASCII)

	lower_j: INTEGER_32 is 106
			-- (from ASCII)

	lower_k: INTEGER_32 is 107
			-- (from ASCII)

	lower_l: INTEGER_32 is 108
			-- (from ASCII)

	lower_m: INTEGER_32 is 109
			-- (from ASCII)

	lower_n: INTEGER_32 is 110
			-- (from ASCII)

	lower_o: INTEGER_32 is 111
			-- (from ASCII)

	lower_p: INTEGER_32 is 112
			-- (from ASCII)

	lower_q: INTEGER_32 is 113
			-- (from ASCII)

	lower_r: INTEGER_32 is 114
			-- (from ASCII)

	lower_s: INTEGER_32 is 115
			-- (from ASCII)

	lower_t: INTEGER_32 is 116
			-- (from ASCII)

	lower_u: INTEGER_32 is 117
			-- (from ASCII)

	lower_v: INTEGER_32 is 118
			-- (from ASCII)

	lower_w: INTEGER_32 is 119
			-- (from ASCII)

	lower_x: INTEGER_32 is 120
			-- (from ASCII)

	lower_y: INTEGER_32 is 121
			-- (from ASCII)

	lower_z: INTEGER_32 is 122
			-- (from ASCII)

	minus: INTEGER_32 is 45
			-- (from ASCII)

	nak: INTEGER_32 is 21
			-- (from ASCII)

	nine: INTEGER_32 is 57
			-- (from ASCII)

	nl: INTEGER_32 is 10
			-- (from ASCII)

	np: INTEGER_32 is 12
			-- (from ASCII)

	nul: INTEGER_32 is 0
			-- (from ASCII)

	number_sign: INTEGER_32 is 35
			-- (from ASCII)

	one: INTEGER_32 is 49
			-- (from ASCII)

	opening_brace: INTEGER_32 is 123
			-- (from ASCII)

	overflow: INTEGER_32 is -8
			-- (from ASCII)

	percent: INTEGER_32 is 37
			-- (from ASCII)

	plus: INTEGER_32 is 43
			-- (from ASCII)

	questmark: INTEGER_32 is 63
			-- (from ASCII)

	rbracket: INTEGER_32 is 93
			-- (from ASCII)

	rcurly: INTEGER_32 is 41
			-- (from ASCII)

	right_arrow: INTEGER_32 is -5
			-- (from ASCII)

	rs: INTEGER_32 is 30
			-- (from ASCII)

	selected_tools: LINKED_LIST [INTEGER_32]
			-- Regular expressions included in the main one

	semicolon: INTEGER_32 is 59
			-- (from ASCII)

	seven: INTEGER_32 is 55
			-- (from ASCII)

	si: INTEGER_32 is 15
			-- (from ASCII)

	singlequote: INTEGER_32 is 39
			-- (from ASCII)

	six: INTEGER_32 is 54
			-- (from ASCII)

	slash: INTEGER_32 is 47
			-- (from ASCII)

	so: INTEGER_32 is 14
			-- (from ASCII)

	soh: INTEGER_32 is 1
			-- (from ASCII)

	sp: INTEGER_32 is 32
			-- (from ASCII)

	star: INTEGER_32 is 42
			-- (from ASCII)

	start_number: INTEGER_32
			-- Unique start state used for the beginning of
			-- the automaton's operation
			-- (from AUTOMATON)

	stx: INTEGER_32 is 2
			-- (from ASCII)

	sub: INTEGER_32 is 26
			-- (from ASCII)

	syn: INTEGER_32 is 22
			-- (from ASCII)

	tabulation: INTEGER_32 is 9
			-- (from ASCII)

	three: INTEGER_32 is 51
			-- (from ASCII)

	tilde: INTEGER_32 is 126
			-- (from ASCII)

	token_type_list: LINKED_LIST [INTEGER_32]
			-- Token types of the selected tools.
			-- Indexed by tool numbers.

	tool_list: LINKED_LIST [PDFA]
			-- Regular expressions used as auxiliary tools

	tool_names: LINKED_LIST [STRING_8]
			-- Names of regular expressions in tool list

	two: INTEGER_32 is 50
			-- (from ASCII)

	underlined: INTEGER_32 is 95
			-- (from ASCII)

	up_arrow: INTEGER_32 is -2
			-- (from ASCII)

	upper_a: INTEGER_32 is 65
			-- (from ASCII)

	upper_b: INTEGER_32 is 66
			-- (from ASCII)

	upper_c: INTEGER_32 is 67
			-- (from ASCII)

	upper_d: INTEGER_32 is 68
			-- (from ASCII)

	upper_e: INTEGER_32 is 69
			-- (from ASCII)

	upper_f: INTEGER_32 is 70
			-- (from ASCII)

	upper_g: INTEGER_32 is 71
			-- (from ASCII)

	upper_h: INTEGER_32 is 72
			-- (from ASCII)

	upper_i: INTEGER_32 is 73
			-- (from ASCII)

	upper_j: INTEGER_32 is 74
			-- (from ASCII)

	upper_k: INTEGER_32 is 75
			-- (from ASCII)

	upper_l: INTEGER_32 is 76
			-- (from ASCII)

	upper_m: INTEGER_32 is 77
			-- (from ASCII)

	upper_n: INTEGER_32 is 78
			-- (from ASCII)

	upper_o: INTEGER_32 is 79
			-- (from ASCII)

	upper_p: INTEGER_32 is 80
			-- (from ASCII)

	upper_q: INTEGER_32 is 81
			-- (from ASCII)

	upper_r: INTEGER_32 is 82
			-- (from ASCII)

	upper_s: INTEGER_32 is 83
			-- (from ASCII)

	upper_t: INTEGER_32 is 84
			-- (from ASCII)

	upper_u: INTEGER_32 is 85
			-- (from ASCII)

	upper_v: INTEGER_32 is 86
			-- (from ASCII)

	upper_w: INTEGER_32 is 87
			-- (from ASCII)

	upper_x: INTEGER_32 is 88
			-- (from ASCII)

	upper_y: INTEGER_32 is 89
			-- (from ASCII)

	upper_z: INTEGER_32 is 90
			-- (from ASCII)

	us: INTEGER_32 is 31
			-- (from ASCII)

	vt: INTEGER_32 is 11
			-- (from ASCII)

	zero: INTEGER_32 is 48
			-- (from ASCII)

	infix "@" (i: INTEGER_32): LINKED_LIST [INTEGER_32] assign put
			-- Entry at index `i', if in index interval
			-- Was declared in ARRAY as synonym of `item'.
			-- (from ARRAY)
		require -- from TABLE
			valid_key: valid_index (i)
		require -- from TO_SPECIAL
			valid_index: valid_index (i)
	
feature -- Measurement

	additional_space: INTEGER_32
			-- Proposed number of additional items
			-- (from RESIZABLE)
		ensure -- from RESIZABLE
			at_least_one: Result >= 1

	capacity: INTEGER_32
			-- Number of available indices
			-- Was declared in ARRAY as synonym of count.
			-- (from ARRAY)
		require -- from  BOUNDED
			True
		ensure then -- from ARRAY
			consistent_with_bounds: Result = upper - lower + 1

	count: INTEGER_32
			-- Number of available indices
			-- Was declared in ARRAY as synonym of capacity.
			-- (from ARRAY)
		require -- from  FINITE
			True
		ensure then -- from ARRAY
			consistent_with_bounds: Result = upper - lower + 1

	growth_percentage: INTEGER_32 is 50
			-- Percentage by which structure will grow automatically
			-- (from RESIZABLE)

	index_set: INTEGER_INTERVAL
			-- Range of acceptable indexes
			-- (from ARRAY)
		require -- from  INDEXABLE
			True
		ensure -- from INDEXABLE
			not_void: Result /= Void
		ensure then -- from ARRAY
			same_count: Result.count = count
			same_bounds: ((Result.lower = lower) and (Result.upper = upper))

	lower: INTEGER_32
			-- Minimum index
			-- (from ARRAY)

	minimal_increase: INTEGER_32 is 5
			-- Minimal number of additional items
			-- (from RESIZABLE)

	nb_states: INTEGER_32
			-- Number of states in the automaton
			-- (from AUTOMATON)

	occurrences (v: LINKED_LIST [INTEGER_32]): INTEGER_32
			-- Number of times `v' appears in structure
			-- (from ARRAY)
		ensure -- from BAG
			non_negative_occurrences: Result >= 0

	upper: INTEGER_32
			-- Maximum index
			-- (from ARRAY)
	
feature -- Comparison

	frozen deep_equal (some: ?ANY; other: like arg #1): BOOLEAN
			-- Are `some' and `other' either both void
			-- or attached to isomorphic object structures?
			-- (from ANY)
		ensure -- from ANY
			shallow_implies_deep: standard_equal (some, other) implies Result
			both_or_none_void: (some = Void) implies (Result = (other = Void))
			same_type: (Result and (some /=