+
Point of view
All features
class REGULAR_EXPRESSION_STRING_SCANNER
Summary
Facility to scan strings TODO improve it by using STRING_HANDLER and string's storage
Direct parents
Insert list: ANY
Known children
Insert list: BACKTRACKING_REGULAR_EXPRESSION, BACKTRACKING_REGULAR_EXPRESSION_BUILDER
Class invariant
Overview
Features
make
{ANY}
  • make
    Initialise the attributes.
basic
{ANY}
error management
{ANY}
scanning
{ANY}
make
effective procedure
{ANY}
Initialise the attributes.
scanned_string: ABSTRACT_STRING
writable attribute
{ANY}
The expression being currently build.
set_scanned_string (string: ABSTRACT_STRING)
effective procedure
{ANY}
Set the 'scanned_string' with 'string'.
ensure
has_error: BOOLEAN
writable attribute
{ANY}
True when an error was encountered
clear_error
effective procedure
{ANY}
Remove the error flag
ensure
last_error: STRING
effective function
{ANY}
Returns a string recorded for the error.
require ensure
  • not_void: Result /= Void
set_error (message: STRING)
effective procedure
{ANY}
Set has_error and last_error.
The explaining error string 'last_error' is created as follow: "Error at position 'position': 'message'.".
require
  • message_not_void: message /= Void
  • has_no_error: not has_error
ensure
position: INTEGER_32
writable attribute
{ANY}
The scanned position.
It is the position of 'last_character'.
last_character: CHARACTER
writable attribute
{ANY}
The scanned character.
The last character read from 'scanned_string'.
valid_last_character: BOOLEAN
writable attribute
{ANY}
True when 'last_character' is valid.
Is like 'scanned_string.valid_index(position)'
valid_previous_character: BOOLEAN
effective function
{ANY}
True if the position-1 is a valid position.
require ensure
previous_character: CHARACTER
effective function
{ANY}
The character at position-1.
require ensure
valid_next_character: BOOLEAN
effective function
{ANY}
True if the position+1 is a valid position.
require ensure
next_character: CHARACTER
effective function
{ANY}
The character at position+1.
require ensure
end_of_input: BOOLEAN
effective function
{ANY}
True when all the characters of 'scanned_string' are scanned.
ensure
goto_position (pos: INTEGER_32)
effective procedure
{ANY}
Change the currently scanned position to 'pos'.
Updates 'last_character' and 'valid_last_character' to reflect the new position value.
require ensure
read_character
effective procedure
{ANY}
Reads the next character.
require ensure
read_integer
effective procedure
{ANY}
Reads an integer value beginning at the currently scanned position.
The read value is stored in 'last_integer'.
require ensure
saved_position: INTEGER_32
writable attribute
{ANY}
The saved position (only one is currently enough).
save_position
effective procedure
{ANY}
Saves the current scanning position.
require ensure
restore_saved_position
effective procedure
{ANY}
Restore the scanning position to the last saved one.
ensure
last_string: STRING
writable attribute
{ANY}
A string buffer.
last_integer: INTEGER_32
writable attribute
{ANY}
An integer buffer.