Automatic generation produced by ISE Eiffel
note description: "Buffered files or strings for lexical analysis" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2017-04-14 01:58:10 -0800 (Fri, 14 Apr 2017) $" revision: "$Revision: 100191 $" deferred class interface TEXT_FILLER feature -- Access buffer: STRING_8 -- Buffer filled by fill_buffer. char_buffered_number: INTEGER_32 -- Number of characters read and written -- in buffer since the beginning. column_nb_array: LEX_ARRAY [INTEGER_32] -- Array recording the column numbers of each buffered -- character (the column number of the i-th character in the -- buffer is the i-th entry of `column_nb_array`). generating_type: TYPE [detachable TEXT_FILLER] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void 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 line_nb_array: LEX_ARRAY [INTEGER_32] -- Array recording the line numbers of each buffered -- character (the line number of the i-th character in the -- buffer is the i-th entry of `line_nb_array`). source_file_path: detachable PATH -- The source file path if `source_is_file`. feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: TEXT_FILLER): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: TEXT_FILLER): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: TEXT_FILLER): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Status setting close_file -- Close input file if any. ensure file_is_void: file = Void create_buffers (buf, lin: INTEGER_32) -- Create buffers and mask. ensure buffer_size = buf line_length = lin exclude (i, j: INTEGER_32) -- Discard columns i to j from the input. -- A zero value for j means all the way to the -- end of the line. require i_positive: i > 0 j_null_or_greater_than_i: j = 0 or j >= i fill_buffer (b: INTEGER_32) -- Copy the characters from the b+1-st to the last one in -- the beginning of the buffer and then fill the end of -- the buffer with the text. This routine skips the columns -- forbidden by exclude, but always puts '\n' at the end -- of a line; the line and column numbers are those of -- the characters in the real file. require buffer_created: buffer /= Void c_buffer_created: column_nb_array /= Void l_buffer_created: line_nb_array /= Void b_not_too_large: b <= buffer_size b_positive: b >= 0 fill_whole_buffer -- Fill with new characters. resize_and_fill_buffer (buf, b: INTEGER_32) -- When increasing `buffer_size`: resize the buffer and then -- fill the new buffer. -- When decreasing `buffer_size`: fill the buffer and then -- resize it. -- When filling the buffer: Copy the characters from the -- b+1-st to the last one (of the buffer before resizing) in -- the beginning of the buffer and then fill -- the end of the buffer (after resizing) with the text. -- This routine skips the columns -- forbidden by exclude, but always puts '\n' at the end -- of a line; the line and column numbers are those of -- the characters in the real file. require buffer_created: buffer /= Void c_buffer_created: column_nb_array /= Void l_buffer_created: line_nb_array /= Void b_not_too_large: b <= buffer_size b_positive: b >= 0 ensure buffer_size = buf set_file (f_name: READABLE_STRING_GENERAL) -- Use f_name as input file. require file_name_not_void: f_name /= Void ensure source_is_file: source_is_file has_file: attached file has_source_file_path: source_file_path /= Void set_string (s: STRING_8) -- Use s as the input string. require string_not_void: s /= Void ensure source_is_string: not source_is_file has_string: attached string feature -- Duplication copy (other: TEXT_FILLER) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: TEXT_FILLER) -- Effect equivalent to that of: -- `copy` (other . `deep_twin`) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: TEXT_FILLER -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: TEXT_FILLER) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: TEXT_FILLER -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: TEXT_FILLER -- New object equal to Current -- `twin` calls `copy`; to change copying/twinning semantics, redefine `copy`. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable TEXT_FILLER -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.`default` for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Implementation buffer_size: INTEGER_32 -- Buffer size. feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) note comment: "[ Buffered files or strings When the buffer is filled, the columns forbidden by exclude are not copied in the buffer, but the last one, which is always a carriage return. The routine filling the buffer fills also the two arrays "line_nb_array", and "column_nb_array", recording the position of each character of the buffer in the original text. The class is deferred, to let an heir resetting its datas each time it fills the buffer. Do not forget to create the buffers before using this class. ]" copyright: "Copyright (c) 1984-2017, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class TEXT_FILLER -- Generated by Eiffel Studio --
For more details: eiffel.org