perlSGML.1997Sep
view release on metacpan or search on metacpan
## 5. Return $ent
## 2 and 3 should not conflict since parameter entity names should
## not conflict with general entity names.
##
sub entity_to_sys {
local($ent, $id) = @_;
$PubId2SysId{$id} ||
$ExtParmEnt2SysId{$ent} || $ExtGenEnt2SysId{$ent} ||
$id || $ent;
}
##---------------------------------------------------------------------------
## do_parm_entity() parses a parameter entity definition.
##
sub do_parm_entity {
local(*line) = @_;
local($name, $value);
$line =~ s/^\s*$pero?\s+//o; # Remove pero, '%'
$line =~ s/^(\S+)\s+//; $name = $1; # Get entity name
&debugMsg("$ENTITY $pero_ $name\n");
if ($line =~ s/^$PUBLIC\s+//io) { # PUBLIC external parm entity
$PubParEntity{$name} = &get_next_group(*line)
unless defined($PubParEntity{$name});
} elsif ($line =~ s/^$SYSTEM\s+//io) { # SYSTEM external parm entity
$SysParEntity{$name} = &get_next_group(*line)
unless defined($SysParEntity{$name});
} else { # Regular parm entity
if (!defined($ParEntity{$name})) {
$value = &get_next_group(*line);
&del_comments(*value);
$ParEntity{$name} = $value;
push(@ParEntities, $name);
}
}
}
##---------------------------------------------------------------------------
## do_gen_entity() parses a general entity definition.
##
sub do_gen_entity {
local(*line) = @_;
local($name, $tmp);
$line =~ s/^\s*(\S+)\s+//; $name = $1; # Get entity name
&debugMsg("$ENTITY $name\n");
$tmp = &get_next_group(*line);
GENSW: {
&do_ge_starttag($name, *line), last GENSW
if $tmp =~ /^\s*$STARTTAG\s*$/io;
&do_ge_endtag($name, *line), last GENSW
if $tmp =~ /^\s*$ENDTAG\s*$/io;
&do_ge_ms($name, *line), last GENSW
if $tmp =~ /^\s*$MS\s*$/io;
&do_ge_md($name, *line), last GENSW
if $tmp =~ /^\s*$MD\s*$/io;
&do_ge_pi($name, *line), last GENSW
if $tmp =~ /^\s*$PI\s*$/io;
&do_ge_cdata($name, *line), last GENSW
if $tmp =~ /^\s*$CDATA\s*$/io;
&do_ge_sdata($name, *line), last GENSW
if $tmp =~ /^\s*$SDATA\s*$/io;
&do_ge_public($name, *line), last GENSW
if $tmp =~ /^\s*$PUBLIC\s*$/io;
&do_ge_system($name, *line), last GENSW
if $tmp =~ /^\s*$SYSTEM\s*$/io;
$_AGE{$name} = $GenEntity{$name} = $tmp;
}
push(@GenEntities, $name);
}
##---------------------------------------------------------------------------
sub do_ge_starttag {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$StartTagEntity{$name} = $tmp;
}
sub do_ge_endtag {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$EndTagEntity{$name} = $tmp;
}
sub do_ge_ms {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$MSEntity{$name} = $tmp;
$_AGE{$name} = $mdo_ . $dso_ . $tmp . $msc_ . $mdc_;
}
sub do_ge_md {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$MDEntity{$name} = $tmp;
$_AGE{$name} = $mdo_ . $tmp . $mdc_;
}
sub do_ge_pi {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$PIEntity{$name} = $tmp;
$_AGE{$name} = $pio_ . $tmp . $pic_;
}
sub do_ge_cdata {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$CDataEntity{$name} = $tmp;
}
sub do_ge_sdata {
local($name, *line) = @_;
local($tmp);
$tmp = &get_next_group(*line);
$SDataEntity{$name} = $tmp;
}
sub do_ge_public {
local($name, *line) = @_;
&errMsg("Warning: General $PUBLIC entity skipped\n");
}
sub do_ge_system {
local($name, *line) = @_;
&errMsg("Warning: General $SYSTEM entity skipped\n");
}
##---------------------------------------------------------------------------
## get_inc() gets the inclusion element group of an element
## definition.
##
sub get_inc {
local(*line) = @_;
local($ret);
$line =~ s/^$inc\s*//o;
$ret = &get_next_group(*line);
$ret;
}
##---------------------------------------------------------------------------
## get_exc() gets the exclusion element group of an element
## definition.
##
sub get_exc {
local(*line) = @_;
local($ret);
$line =~ s/^$exc\s*//o;
$ret = &get_next_group(*line);
$ret;
}
##---------------------------------------------------------------------------
## get_next_group gets the next group from a declaration.
##
sub get_next_group {
local(*line) = @_;
local($o, $c, $tmp, $ret);
$ret = '';
$line =~ s/^\s*//;
$c = 0;
if ($line =~ /^$grpo/o) {
( run in 0.674 second using v1.01-cache-2.11-cpan-39bf76dae61 )