note description: "Decimal number parsers, whose BNF syntax follows: %N sign ::= '+' | '-' %N digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' %N indicator ::= 'e' | 'E' %N digits ::= digit [digit]... %N point ::= '.' | ',' %N decimal-part ::= digits point [digits] | [point] digits %N exponent-part ::= indicator [sign] digits %N infinity ::= 'Infinity' | 'Inf' %N nan ::= 'NaN' | 'sNaN' %N numeric-value ::= decimal-part [exponent-part] | infinity %N numeric-string ::= [sign] numeric-value | nan%N" library: "Gobo Eiffel Decimal Arithmetic Library" copyright: "Copyright (c) 2004, Paul G. Crismer and others" license: "MIT License" date: "$Date: 2016-05-06 19:15:38 +0000 (Fri, 06 May 2016) $" revision: "$Revision: 98678 $" class interface MA_DECIMAL_TEXT_PARSER create make -- Create a new decimal parser. -- (from MA_DECIMAL_PARSER) feature -- Access Character_: KL_CHARACTER_ROUTINES -- Routines that ought to be in class CHARACTER -- (from KL_IMPORTED_CHARACTER_ROUTINES) ensure -- from KL_IMPORTED_CHARACTER_ROUTINES instance_free: class character_routines_not_void: Result /= Void coefficient_begin: INTEGER_32 -- Index of last parsed coefficient begin coefficient_count: INTEGER_32 -- Number of characters in coefficient part coefficient_end: INTEGER_32 -- Index of last parsed coefficient end decimal_point_index: INTEGER_32 -- Index of decimal point if any error_code: INTEGER_32 -- Description of last error exponent_as_double: REAL_64 -- Exponent expressed as DOUBLE exponent_begin: INTEGER_32 -- Index of last parsed first exponent character exponent_count: INTEGER_32 -- Count of significant digits in exponent; -- Synonym of exponent_significant_digits exponent_end: INTEGER_32 -- Index of last parsed last exponent character exponent_sign: INTEGER_32 -- Sign of exponent of last parsed decimal exponent_significant_digits: INTEGER_32 -- Count of significant digits in exponent fractional_part_count: INTEGER_32 -- Number of characters in the fractional part generating_type: TYPE [detachable MA_DECIMAL_TEXT_PARSER] -- 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 last_decimal: detachable MA_DECIMAL -- Last decimal parsed -- (from MA_DECIMAL_PARSER) last_parsed: detachable STRING_8 -- Last parsed string sign: INTEGER_32 -- Sign of last parsed decimal state: INTEGER_32 -- Last state of parsing finite state automaton String_: KL_STRING_ROUTINES -- Routines that ought to be in class STRING -- (from KL_IMPORTED_STRING_ROUTINES) ensure -- from KL_IMPORTED_STRING_ROUTINES instance_free: class string_routines_not_void: Result /= Void 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 (other: MA_DECIMAL_TEXT_PARSER): 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: MA_DECIMAL_TEXT_PARSER): 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 (other: MA_DECIMAL_TEXT_PARSER): 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 decimal_point_is_comma: BOOLEAN -- Has last parsed number a comma as decimal point? error: BOOLEAN -- Has there been an error in last parse operation? has_exponent: BOOLEAN -- Has last parsed number an exponent? has_point: BOOLEAN -- Has last parsed number a fractional part? is_comma_allowed: BOOLEAN -- Is ',' allowed as fractional part separator? is_infinity: BOOLEAN -- Is last parsed number an 'Infinity'? is_nan: BOOLEAN -- Is last parsed number a 'Not a Number'? is_snan: BOOLEAN -- Is last parsed number a 'Signaling NaN'? 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 -- Duplication copy (other: MA_DECIMAL_TEXT_PARSER) -- 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: MA_DECIMAL_TEXT_PARSER) -- 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: MA_DECIMAL_TEXT_PARSER -- 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: MA_DECIMAL_TEXT_PARSER) -- 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: MA_DECIMAL_TEXT_PARSER -- 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: MA_DECIMAL_TEXT_PARSER -- 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 MA_DECIMAL_TEXT_PARSER -- 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 parse (s: STRING_8) -- Parse s. require -- from MA_DECIMAL_PARSER a_string_not_void: s /= Void a_string_not_empty: not s.is_empty ensure -- from MA_DECIMAL_PARSER last_decimal_not_void_when_no_error: not error implies last_decimal /= Void ensure then last_parsed_string_affected: last_parsed = s parse_ctx (s: STRING_8; ctx: MA_DECIMAL_CONTEXT; parse_comma_as_decimal_point: BOOLEAN) -- Parse s using ctx wrt parse_comma_as_decimal_point. require s_not_void: s /= Void s_not_empty: not s.is_empty ensure no_mode_change: is_comma_allowed = old is_comma_allowed last_parsed_string_affected: last_parsed = s last_decimal_not_void_when_no_error: not error implies last_decimal /= Void parse_with_decimal_point_comma (s: STRING_8) -- Parse s with comma as decimal point. require s_not_void: s /= Void s_not_empty: not s.is_empty ensure no_mode_change: is_comma_allowed = old is_comma_allowed last_parsed_string_affected: last_parsed = s last_decimal_not_void_when_no_error: not error implies last_decimal /= Void feature -- Constants State_comma: INTEGER_32 = 11 State_error: INTEGER_32 = 14 State_exponent: INTEGER_32 = 9 State_exponent_sign: INTEGER_32 = 13 State_fractional_part: INTEGER_32 = 8 State_infinity: INTEGER_32 = 5 State_integer_part: INTEGER_32 = 6 State_nan: INTEGER_32 = 2 State_point: INTEGER_32 = 7 State_sign: INTEGER_32 = 10 State_snan: INTEGER_32 = 3 State_start: INTEGER_32 = 1 State_start_exponent: INTEGER_32 = 12 State_starting_point: INTEGER_32 = 4 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 decimal_point_is_comma_implies_has_fractional_part: decimal_point_is_comma implies has_point -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) end -- class MA_DECIMAL_TEXT_PARSER
Generated by ISE EiffelStudio