Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

xml.parser.eiffel

Class XM_EIFFEL_ENTITY_DEF


Direct ancestors

HASHABLE, XM_EIFFEL_SCANNER, UC_IMPORTED_UTF8_ROUTINES

Known direct descendants

XM_EIFFEL_PE_ENTITY_DEF

Creation

Features

Invariants

indexing

description

Entity definition and scanner

remark

This class represents an entity name/type and also a scanner for this %
%entity. The two concepts could be distinct, but this helps enforcing %
%the property that an entity cannot be recursively included, as the %
%scanner can be checked for being in use if the entity is recursively %
%included. This is not really a is-a relationship though.

library

Gobo Eiffel XML Library

copyright

Copyright (c) 2002, Eric Bezault and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2005/07/13 19:48:54 $

revision

$Revision: 1.15 $

class

XM_EIFFEL_ENTITY_DEF

inherit

HASHABLE
XM_EIFFEL_SCANNER

create

make_literal (a_name: STRING; a_value: STRING)

-- Create a new literal entity definition from a_value.

require
a_name_not_void: a_name /= Void
a_value_not_void: a_value /= Void
ensure
is_literal: is_literal
value_set: value = a_value
make_external (a_resolver: like resolver; an_id: like external_id)

-- Create a new external entity definition from a_value.

require
a_resolver_not_void: a_resolver /= Void
an_id_not_void: an_id /= Void
ensure
is_external: is_external
value_set: value = Void and literal_name = Void
external_id_set: external_id = an_id
resolver_set: resolver = a_resolver
make_def (other: XM_EIFFEL_ENTITY_DEF)

-- Create a new entity definition from other.

require
other_not_void: other /= Void
ensure
is_external: is_external = other.is_external
is_literal: is_literal = other.is_literal
value_set: value = other.value

feature -- Access

any_array_: KL_ARRAY_ROUTINES [ANY]

-- Routines that ought to be in class ARRAY

-- (From KL_IMPORTED_ARRAY_ROUTINES)

ensure
any_array_routines_not_void: Result /= Void
array_special_integer_: KL_ARRAY_ROUTINES [SPECIAL [INTEGER]]

-- Routines that ought to be in class ARRAY

-- (From KL_IMPORTED_ARRAY_ROUTINES)

ensure
special_integer_array_routines_not_void: Result /= Void
boolean_array_: KL_ARRAY_ROUTINES [BOOLEAN]

-- Routines that ought to be in class ARRAY

-- (From KL_IMPORTED_ARRAY_ROUTINES)

ensure
boolean_array_routines_not_void: Result /= Void
integer_array_: KL_ARRAY_ROUTINES [INTEGER]

-- Routines that ought to be in class ARRAY

-- (From KL_IMPORTED_ARRAY_ROUTINES)

ensure
integer_array_routines_not_void: Result /= Void
special_any_: KL_SPECIAL_ROUTINES [ANY]

-- Routines that ought to be in class SPECIAL

-- (From KL_IMPORTED_SPECIAL_ROUTINES)

ensure
special_any_routines_not_void: Result /= Void
special_boolean_: KL_SPECIAL_ROUTINES [BOOLEAN]

-- Routines that ought to be in class SPECIAL

-- (From KL_IMPORTED_SPECIAL_ROUTINES)

ensure
special_boolean_routines_not_void: Result /= Void
special_character_: KL_SPECIAL_ROUTINES [CHARACTER]

-- Routines that ought to be in class SPECIAL

-- (From KL_IMPORTED_SPECIAL_ROUTINES)

ensure
special_character_routines_not_void: Result /= Void
special_integer_: KL_SPECIAL_ROUTINES [INTEGER]

-- Routines that ought to be in class SPECIAL

-- (From KL_IMPORTED_SPECIAL_ROUTINES)

ensure
special_integer_routines_not_void: Result /= Void
special_string_: KL_SPECIAL_ROUTINES [STRING]

-- Routines that ought to be in class SPECIAL

-- (From KL_IMPORTED_SPECIAL_ROUTINES)

ensure
special_string_routines_not_void: Result /= Void
string_: KL_STRING_ROUTINES

-- Routines that ought to be in class STRING

-- (From KL_IMPORTED_STRING_ROUTINES)

ensure
string_routines_not_void: Result /= Void
string_array_: KL_ARRAY_ROUTINES [STRING]

-- Routines that ought to be in class ARRAY

-- (From KL_IMPORTED_ARRAY_ROUTINES)

ensure
string_array_routines_not_void: Result /= Void
external_id: XM_DTD_EXTERNAL_ID

-- Resolve external value.

hash_code: INTEGER

-- Hash code value
-- (on the entity name aspect)

-- (From HASHABLE)

ensure
good_hash_value: Result >= 0
input_name: STRING

-- Name of object being scanned

-- (From XM_EIFFEL_SCANNER_SKELETON)

last_token: INTEGER

-- Code of last token read
-- (0 means that the end-of-input has been reached,
-- non-positive values mean that an error occurred
-- (see header-comment of scanning_error.))

-- (From YY_SCANNER)

last_value: STRING

-- Semantic value of last token read

-- (From XM_EIFFEL_SCANNER_SKELETON)

literal_name: STRING

-- Literal entity name

start_condition: INTEGER

-- Start condition

-- (From YY_SCANNER)

std: KL_STANDARD_FILES

-- Standard files

-- (From KL_SHARED_STANDARD_FILES)

ensure
std_not_void: Result /= Void
text: STRING

-- Text of last token read
-- (Create a new string at each call.)

-- (From YY_SCANNER)

ensure
text_not_void: Result /= Void
correct_count: Result.count = text_count
text_item (i: INTEGER): CHARACTER

-- i-th character of last token read

-- (From YY_SCANNER)

require
i_large_enough: i >= 1
i_small_enough: i <= text_count
ensure
definition: Result = text.item (i)
text_substring (s, e: INTEGER): STRING

-- Substring of last token read
-- (Create a new string at each call.)
-- (For efficiency reason, this function bypasses the
-- call to text and creates the substring directly
-- from the input buffer.)

-- (From YY_SCANNER)

require
meaningful_start: 1 <= s
meaningful_interval: s <= e + 1
meaningful_end: e <= text_count
ensure
text_substring_not_void: Result /= Void
text_substring_empty: (s > e) implies (Result.count = 0)
definition: s <= e implies Result.is_equal (text.substring (s, e))
value: STRING

-- Literal entity value

feature -- Measurement

column: INTEGER

-- Column number of last token read when
-- '%option line' has been specified

-- (From YY_SCANNER)

ensure
column_positive: Result >= 1
line: INTEGER

-- Line number of last token read when
-- '%option line' has been specified

-- (From YY_SCANNER)

ensure
line_positive: Result >= 1
position: INTEGER

-- Position of last token read (i.e. number of
-- characters from the start of the input source)
-- when '%option position' has been specified

-- (From YY_SCANNER)

ensure
position_positive: Result >= 1
text_count: INTEGER

-- Number of characters in last token read

-- (From YY_SCANNER)

ensure
positive_count: Result >= 0

feature -- Status report

end_of_file: BOOLEAN

-- Has the end of input buffer been reached?
-- This means that last_token has been set
-- to 0 indicating "all done".

-- (From YY_SCANNER)

is_external: BOOLEAN

-- Is current entity an external entity?

is_hashable: BOOLEAN

-- May current object be hashed?
-- (True if it is not its type's default.)

-- (From HASHABLE)

ensure
ok_if_not_default: Result implies (Current /= default)
is_literal: BOOLEAN

-- Is current entity a literal entity?

ensure
definition: Result = not is_external
scanning_error: BOOLEAN

-- Has an error occurred during scanning?
-- This can occur when too many reject are called (and hence
-- nothing can be matched anymore) or when the option "nodefault"
-- (or option -s) has been specified but the default rule is
-- matched nevertheless.

-- (From YY_SCANNER)

valid_start_condition (sc: INTEGER): BOOLEAN

-- Is sc a valid start condition?

-- (From YY_SCANNER)

feature -- Element change

append_text_substring_to_string (s, e: INTEGER; a_string: STRING)

-- Append text_substring at end of a_string.
-- (For efficiency reason, this feature bypasses
-- the call to text_substring and directly copies
-- the characters from the input buffer.)

-- (From YY_SCANNER)

require
a_string_not_void: a_string /= Void
s_large_enough: 1 <= s
valid_interval: s <= e + 1
e_small_enough: e <= text_count
ensure
count_set: a_string.count = old (a_string.count) + (e - s + 1)
append_text_to_string (a_string: STRING)

-- Append text at end of a_string.
-- (For efficiency reason, this feature bypasses the
-- call to text and directly copies the characters
-- from the input buffer.)

-- (From YY_SCANNER)

require
a_string_not_void: a_string /= Void
ensure
count_set: a_string.count = old (a_string.count) + text_count
last_character: CHARACTER

-- Last character read by read_character

-- (From YY_SCANNER)

less (n: INTEGER)

-- Return all but the first n matched
-- characters back to input_buffer.

-- (From YY_SCANNER)

require
n_large_enough: n >= 0
n_small_enough: n <= text_count
ensure
text_count_set: text_count = n
more

-- Tell scanner to append the next matched token
-- to current value of text instead of
-- replacing it.

-- (From YY_SCANNER)

read_character

-- Read a character from input_buffer.
-- Make result available in last_character.

-- (From YY_SCANNER)

reject

-- Direct scanner to proceed on the second best rule
-- which matched the input (when '%option reject'
-- has been specified).

-- (From YY_COMPRESSED_SCANNER_SKELETON)

terminate

-- Terminate scanner and set last_token
-- to 0 indicating "all done".

-- (From YY_SCANNER)

unread_character (c: CHARACTER)

-- Put c back to input_buffer. This will alter both
-- text and the content of input_buffer.

-- (From YY_SCANNER)

wrap: BOOLEAN

-- Should current scanner terminate when end of file is reached?
-- This function can be redefined to switch to another input
-- buffer (but don't forget to update start_condition).
-- (default: True.)

-- (From YY_SCANNER)

feature -- Scanner: set input buffer

apply_input_buffer

-- Set input buffer.

feature -- Scanner: events

in_use: BOOLEAN

-- Has the first token been processed?

read_token

-- Ignore XML declaration that may be at the start of an external entity.
-- Also that places the content of an external DTD within
-- a (DOCTYPE_DECL_START, DOCTYPE_DECL_END) token pair.

-- (From YY_SCANNER)

feature -- Scanner: initialization

reset

-- Reset first seen status.

-- (From YY_SCANNER)

feature -- Encoding

is_valid_encoding (an_encoding: STRING): BOOLEAN

-- Is this encoding known?

-- (From XM_EIFFEL_SCANNER_SKELETON)

set_encoding (an_encoding: STRING)

-- Set encoding.

-- (From XM_EIFFEL_SCANNER_SKELETON)

require
valid_encoding: is_valid_encoding (an_encoding)

feature -- Input

empty_buffer: YY_BUFFER

-- Empty input buffer

-- (From YY_SCANNER)

ensure
empty_buffer_not_void: Result /= Void
close_input

-- Close input buffer if needed.

-- (From XM_EIFFEL_SCANNER_SKELETON)

flush_input_buffer

-- Flush input_buffer. input_buffer will be automatically
-- refilled unless end of file has been found.

-- (From YY_SCANNER)

ensure
flushed: input_buffer.count = 0
input_buffer: YY_BUFFER

-- Input buffer

-- (From YY_SCANNER)

new_file_buffer (a_file: KI_CHARACTER_INPUT_STREAM): YY_FILE_BUFFER

-- New input buffer for a_file

-- (From YY_SCANNER)

require
a_file_not_void: a_file /= Void
a_file_open_read: a_file.is_open_read
ensure
new_buffer_not_void: Result /= Void
new_string_buffer (a_string: STRING): YY_BUFFER

-- New input buffer for a_string

-- (From YY_SCANNER)

require
a_string_not_void: a_string /= Void
ensure
new_buffer_not_void: Result /= Void
set_input_buffer (a_buffer: like input_buffer)

-- Set input_buffer to a_buffer.

-- (From YY_SCANNER)

require
a_buffer_not_void: a_buffer /= Void
ensure
input_buffer_set: input_buffer = a_buffer
ensure then
name_set: input_name = a_buffer.name
set_input_from_resolver (a_resolver: XM_EXTERNAL_RESOLVER)

-- Set input buffer from a resolver's last resolved
-- stream and remember resolver to close it.

-- (From XM_EIFFEL_SCANNER_SKELETON)

require
a_resolver_not_void: a_resolver /= Void
a_resolver_resolved: not a_resolver.has_error
ensure
input_stream_set: input_stream = a_resolver.last_stream
input_resolver_reset: input_resolver = a_resolver
set_input_stream (a_stream: KI_CHARACTER_INPUT_STREAM)

-- Set input buffer from a stream.
-- This class is then in charge of closing it.

-- (From XM_EIFFEL_SCANNER_SKELETON)

require
not_void: a_stream /= Void
readable: a_stream.is_open_read
ensure
input_stream_set: input_stream = a_stream
input_resolver_reset: input_resolver = Void

feature -- Reset

push_start_condition_dtd_ignore

-- Push start condition 'dtd_ignore' to the stack.

-- (From XM_EIFFEL_SCANNER_SKELETON)

feature -- Debugging

print_last_token

-- Print to standard error debug information
-- about the last token read. Can be redefined
-- in descendant classes to print more information.
-- (Called at the end of read_token when compiled
-- with 'debug ("GELEX")' enabled).

-- (From YY_SCANNER)

feature -- Error reporting

error_position: XM_DEFAULT_POSITION

-- Position.

-- (From XM_EIFFEL_SCANNER_SKELETON)

ensure
result_not_void: Result /= Void
fatal_error (a_message: STRING)

-- A fatal error occurred.

-- (From YY_SCANNER)

require
a_message_not_void: a_message /= Void
has_error: BOOLEAN

-- Was there an error?

-- (From XM_EIFFEL_SCANNER_SKELETON)

last_error: STRING

-- Last error

-- (From XM_EIFFEL_SCANNER_SKELETON)

feature -- Action

default_action

-- Action executed when default rule is matched.
-- (Note: this routine can be redefined in descendant classes.
-- Default: print last character read to standard output.)

-- (From YY_SCANNER)

post_action

-- Action executed after every semantic action
-- when '%option post-action' has been specified.
-- (Note: this routine can be redefined in descendant
-- classes. Default: do nothing.)

-- (From YY_SCANNER)

post_eof_action

-- Action executed after every end-of-file semantic action
-- (i.e. <>) when '%option post-eof-action' has been specified.
-- (Note: this routine can be redefined in descendant classes.
-- Default: do nothing.)

-- (From YY_SCANNER)

pre_action

-- Action executed before every semantic action
-- when '%option pre-action' has been specified.
-- (Note: this routine can be redefined in descendant
-- classes. Default: do nothing.)

-- (From YY_SCANNER)

pre_eof_action

-- Action executed before every end-of-file semantic action
-- (i.e. <>) when '%option pre-eof-action' has been specified.
-- (Note: this routine can be redefined in descendant classes.
-- Default: do nothing.)

-- (From YY_SCANNER)

feature -- Output

echo

-- Output text using feature output.

-- (From YY_SCANNER)

output (a_text: like text)

-- Output a_text.
-- (Note: this routine can be redefined in descendant
-- classes. Default: print a_text to standard output.)

-- (From YY_SCANNER)

require
a_text_not_void: a_text /= Void

feature -- Scanning

scan

-- Scan input_buffer until end of file is found
-- or an error occurs.

-- (From YY_SCANNER)

ensure
end_of_file: not scanning_error implies end_of_file

feature -- Setting

set_last_token (a_token: INTEGER)

-- Set last_token to a_token.

-- (From YY_SCANNER)

ensure
last_token_set: last_token = a_token
set_start_condition (a_start_condition: INTEGER)

-- Set start_condition to a_start_condition.

-- (From YY_SCANNER)

require
valid_start_condition: valid_start_condition (a_start_condition)
ensure
start_condition_set: start_condition = a_start_condition

feature -- Resolver

invariant

value_not_void: value /= Void or external_id /= Void
value_name_void_consistent: (value = Void) = (literal_name = Void)
resolver_not_void: resolver /= Void
type: is_literal xor is_external

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

start_conditions_not_void: start_conditions /= Void
character_entity_not_void: character_entity /= Void
input_name_not_void: input_name /= Void

-- From YY_COMPRESSED_SCANNER_SKELETON
yy_nxt_not_void: yy_nxt /= Void
yy_chk_not_void: yy_chk /= Void
yy_base_not_void: yy_base /= Void
yy_def_not_void: yy_def /= Void
yy_accept_not_void: yy_accept /= Void
yy_state_stack_not_void: yyReject_or_variable_trail_context implies yy_state_stack /= Void

-- From YY_SCANNER_SKELETON
yy_content_not_void: yy_content /= Void
yy_line_positive: yy_line >= 1
yy_column_positive: yy_column >= 1
yy_position_positive: yy_position >= 1

-- From YY_SCANNER
input_buffer_not_void: input_buffer /= Void
valid_start_condition: valid_start_condition (start_condition)

end