GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
MINI_PARSER_BUFFER
+
Point of view
All features
ANY
All features
class MINI_PARSER_BUFFER
Summary
top
Useful and efficient mini parsing buffer. From the user point of view, an object of this class can be considered as the combination of a
STRING
to be parsed with an extra INTEGER index to memorize the current position in this
STRING
.
Direct parents
Insert list:
STRING_HANDLER
Class invariant
top
memory
/= Void
Overview
top
Creation features
{
ANY
}
default_create
Default creation method.
initialize_with
(string:
ABSTRACT_STRING
)
Initialize the
Current
buffer interning
string
.
Features
{
ANY
}
initialize_with
(string:
ABSTRACT_STRING
)
Initialize the
Current
buffer interning
string
.
next
Move the
current_index
forward by one.
skip_separators
Skip all separators by using
is_separator
of class
CHARACTER
.
last_error
:
PARSE_ERROR
Can be used to memorize an error message.
set_last_error
(error:
PARSE_ERROR
)
set_last_error_message
(error_message:
STRING
)
set_current_index
(new_index:
INTEGER_32
)
To be able to move (usually back) in the buffer
print_position_on
(stream:
OUTPUT_STREAM
)
Memo
{
ANY
}
set_memory
(a_memory:
MINI_PARSER_MEMORY
)
memo
:
INTEGER_32
restore
(a_memo:
INTEGER_32
)
memory
:
MINI_PARSER_MEMORY
Queries
{
ANY
}
lower
:
INTEGER_32
upper
:
INTEGER_32
Maximum valid index in storage.
count
:
INTEGER_32
The length of the
Current
buffer which is also the maximum valid index.
capacity
:
INTEGER_32
Of
storage
.
current_index
:
INTEGER_32
Index of the current character.
current_character
:
CHARACTER
The current character (the one at
current_index
).
end_reached
:
BOOLEAN
Is the end of the buffer reached?
marked
:
BOOLEAN
clear_mark
{}
storage
:
FIXED_STRING
The
storage
area to be parsed.
default_create
Default creation method.
default_memory
:
DEFAULT_MINI_PARSER_MEMORY
initialize_with
(string:
ABSTRACT_STRING
)
effective procedure
{
ANY
}
top
Initialize the
Current
buffer interning
string
.
require
string /= Void
ensure
count
= string.count
last_error
= Void
next
effective procedure
{
ANY
}
top
Move the
current_index
forward by one.
require
not
end_reached
ensure
current_index
= 1 + old
current_index
skip_separators
effective procedure
{
ANY
}
top
Skip all separators by using
is_separator
of class
CHARACTER
.
last_error
:
PARSE_ERROR
writable attribute
{
ANY
}
top
Can be used to memorize an error message.
set_last_error
(error:
PARSE_ERROR
)
effective procedure
{
ANY
}
top
ensure
last_error
= error
set_last_error_message
(error_message:
STRING
)
effective procedure
{
ANY
}
top
ensure
last_error
.message = error_message
set_current_index
(new_index:
INTEGER_32
)
effective procedure
{
ANY
}
top
To be able to move (usually back) in the buffer
require
new_index.in_range(
lower
,
upper
+ 1)
ensure
current_index
= new_index
print_position_on
(stream:
OUTPUT_STREAM
)
effective procedure
{
ANY
}
top
require
stream.is_connected
set_memory
(a_memory:
MINI_PARSER_MEMORY
)
effective procedure
{
ANY
}
top
require
a_memory /= Void
ensure
memory
= a_memory
memo
:
INTEGER_32
effective function
{
ANY
}
top
restore
(a_memo:
INTEGER_32
)
effective procedure
{
ANY
}
top
memory
:
MINI_PARSER_MEMORY
writable attribute
{
ANY
}
top
lower
:
INTEGER_32
effective function
{
ANY
}
top
upper
:
INTEGER_32
effective function
{
ANY
}
top
Maximum valid index in storage.
count
:
INTEGER_32
effective function
{
ANY
}
top
The length of the
Current
buffer which is also the maximum valid index.
capacity
:
INTEGER_32
effective function
{
ANY
}
top
Of
storage
.
current_index
:
INTEGER_32
writable attribute
{
ANY
}
top
Index of the current character.
current_character
:
CHARACTER
effective function
{
ANY
}
top
The current character (the one at
current_index
).
require
current_index
.in_range(
lower
,
upper
+ 1)
end_reached
:
BOOLEAN
effective function
{
ANY
}
top
Is the end of the buffer reached?
ensure
Result =
current_index
>
upper
Result implies
marked
marked
:
BOOLEAN
writable attribute
{
ANY
}
top
clear_mark
effective procedure
{
ANY
}
top
ensure
not
marked
storage
:
FIXED_STRING
writable attribute
{}
top
The
storage
area to be parsed.
default_create
effective procedure
{}
top
Default creation method.
It is used when no creation method is specified if allowed. Note it may be renamed.
default_memory
:
DEFAULT_MINI_PARSER_MEMORY
once function
{}
top