3078 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3079 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
3080 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
3081 |
!!!cp (1001); |
if ($self->{is_xml}) { |
3082 |
|
!!!cp (1001.1); |
3083 |
|
!!!parse-error (type => 'bare ero', |
3084 |
|
line => $self->{line_prev}, |
3085 |
|
column => $self->{column_prev} |
3086 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
3087 |
|
} else { |
3088 |
|
!!!cp (1001); |
3089 |
|
## No error |
3090 |
|
} |
3091 |
## Don't consume |
## Don't consume |
|
## No error |
|
3092 |
## Return nothing. |
## Return nothing. |
3093 |
# |
# |
3094 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
3097 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
3098 |
!!!next-input-character; |
!!!next-input-character; |
3099 |
redo A; |
redo A; |
3100 |
} elsif ((0x0041 <= $self->{nc} and |
} elsif ($self->{is_xml} or |
3101 |
|
(0x0041 <= $self->{nc} and |
3102 |
$self->{nc} <= 0x005A) or # A..Z |
$self->{nc} <= 0x005A) or # A..Z |
3103 |
(0x0061 <= $self->{nc} and |
(0x0061 <= $self->{nc} and |
3104 |
$self->{nc} <= 0x007A)) { # a..z |
$self->{nc} <= 0x007A)) { # a..z |
3142 |
redo A; |
redo A; |
3143 |
} |
} |
3144 |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
3145 |
if ($self->{nc} == 0x0078 or # x |
if ($self->{nc} == 0x0078) { # x |
|
$self->{nc} == 0x0058) { # X |
|
3146 |
!!!cp (995); |
!!!cp (995); |
3147 |
$self->{state} = HEXREF_X_STATE; |
$self->{state} = HEXREF_X_STATE; |
3148 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3149 |
!!!next-input-character; |
!!!next-input-character; |
3150 |
redo A; |
redo A; |
3151 |
|
} elsif ($self->{nc} == 0x0058) { # X |
3152 |
|
!!!cp (995.1); |
3153 |
|
if ($self->{is_xml}) { |
3154 |
|
!!!parse-error (type => 'uppercase hcro'); ## TODO: type |
3155 |
|
} |
3156 |
|
$self->{state} = HEXREF_X_STATE; |
3157 |
|
$self->{kwd} .= chr $self->{nc}; |
3158 |
|
!!!next-input-character; |
3159 |
|
redo A; |
3160 |
} elsif (0x0030 <= $self->{nc} and |
} elsif (0x0030 <= $self->{nc} and |
3161 |
$self->{nc} <= 0x0039) { # 0..9 |
$self->{nc} <= 0x0039) { # 0..9 |
3162 |
!!!cp (994); |
!!!cp (994); |
3364 |
redo A; |
redo A; |
3365 |
} |
} |
3366 |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
3367 |
if (length $self->{kwd} < 30 and |
if ((0x0041 <= $self->{nc} and # a |
3368 |
## NOTE: Some number greater than the maximum length of entity name |
$self->{nc} <= 0x005A) or # x |
3369 |
((0x0041 <= $self->{nc} and # a |
(0x0061 <= $self->{nc} and # a |
3370 |
$self->{nc} <= 0x005A) or # x |
$self->{nc} <= 0x007A) or # z |
3371 |
(0x0061 <= $self->{nc} and # a |
(0x0030 <= $self->{nc} and # 0 |
3372 |
$self->{nc} <= 0x007A) or # z |
$self->{nc} <= 0x0039) or # 9 |
3373 |
(0x0030 <= $self->{nc} and # 0 |
$self->{nc} == 0x003B or # ; |
3374 |
$self->{nc} <= 0x0039) or # 9 |
($self->{is_xml} and |
3375 |
$self->{nc} == 0x003B)) { # ; |
not ($is_space->{$self->{nc}} or |
3376 |
|
{ |
3377 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3378 |
|
$self->{entity_add} => 1, |
3379 |
|
}->{$self->{nc}}))) { |
3380 |
our $EntityChar; |
our $EntityChar; |
3381 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3382 |
if (defined $EntityChar->{$self->{kwd}}) { |
if (defined $EntityChar->{$self->{kwd}} or |
3383 |
|
$self->{ge}->{$self->{kwd}}) { |
3384 |
if ($self->{nc} == 0x003B) { # ; |
if ($self->{nc} == 0x003B) { # ; |
3385 |
!!!cp (1020); |
if (defined $self->{ge}->{$self->{kwd}}) { |
3386 |
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
if ($self->{ge}->{$self->{kwd}}->{only_text}) { |
3387 |
|
!!!cp (1020.1); |
3388 |
|
$self->{entity__value} = $self->{ge}->{$self->{kwd}}->{value}; |
3389 |
|
} else { |
3390 |
|
if (defined $self->{ge}->{$self->{kwd}}->{notation}) { |
3391 |
|
!!!cp (1020.2); |
3392 |
|
!!!parse-error (type => 'unparsed entity', ## TODO: type |
3393 |
|
value => $self->{kwd}); |
3394 |
|
} else { |
3395 |
|
!!!cp (1020.3); |
3396 |
|
} |
3397 |
|
$self->{entity__value} = '&' . $self->{kwd}; ## TODO: expand |
3398 |
|
} |
3399 |
|
} else { |
3400 |
|
if ($self->{is_xml}) { |
3401 |
|
!!!cp (1020.4); |
3402 |
|
!!!parse-error (type => 'entity not declared', ## TODO: type |
3403 |
|
value => $self->{kwd}, |
3404 |
|
level => { |
3405 |
|
'amp;' => $self->{level}->{warn}, |
3406 |
|
'quot;' => $self->{level}->{warn}, |
3407 |
|
'lt;' => $self->{level}->{warn}, |
3408 |
|
'gt;' => $self->{level}->{warn}, |
3409 |
|
'apos;' => $self->{level}->{warn}, |
3410 |
|
}->{$self->{kwd}} || |
3411 |
|
$self->{level}->{must}); |
3412 |
|
} else { |
3413 |
|
!!!cp (1020); |
3414 |
|
} |
3415 |
|
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
3416 |
|
} |
3417 |
$self->{entity__match} = 1; |
$self->{entity__match} = 1; |
3418 |
!!!next-input-character; |
!!!next-input-character; |
3419 |
# |
# |
3659 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
3660 |
|
|
3661 |
## TODO: |
## TODO: |
3662 |
|
|
3663 |
|
if (not $self->{stop_processing} and |
3664 |
|
not $self->{document}->xml_standalone) { |
3665 |
|
!!!parse-error (type => 'stop processing', ## TODO: type |
3666 |
|
level => $self->{level}->{info}); |
3667 |
|
$self->{stop_processing} = 1; |
3668 |
|
} |
3669 |
|
|
3670 |
!!!next-input-character; |
!!!next-input-character; |
3671 |
redo A; |
redo A; |
3672 |
} elsif ($self->{nc} == 0x005D) { # ] |
} elsif ($self->{nc} == 0x005D) { # ] |
3901 |
} |
} |
3902 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3903 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3904 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3905 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3906 |
!!!next-input-character; |
!!!next-input-character; |
3907 |
redo A; |
redo A; |
3949 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3950 |
attrdefs => [], |
attrdefs => [], |
3951 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3952 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3953 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3954 |
!!!next-input-character; |
!!!next-input-character; |
3955 |
redo A; |
redo A; |
3998 |
} |
} |
3999 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
4000 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
4001 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
4002 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4003 |
!!!next-input-character; |
!!!next-input-character; |
4004 |
redo A; |
redo A; |
4800 |
redo A; |
redo A; |
4801 |
} |
} |
4802 |
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
|
## TODO: XMLize |
|
|
|
|
4803 |
if ($is_space->{$self->{nc}} or |
if ($is_space->{$self->{nc}} or |
4804 |
{ |
{ |
4805 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
4806 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
4807 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
4808 |
|
!!!parse-error (type => 'bare ero', |
4809 |
|
line => $self->{line_prev}, |
4810 |
|
column => $self->{column_prev} |
4811 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
4812 |
## Don't consume |
## Don't consume |
|
## No error |
|
4813 |
## Return nothing. |
## Return nothing. |
4814 |
# |
# |
4815 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
4818 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
4819 |
!!!next-input-character; |
!!!next-input-character; |
4820 |
redo A; |
redo A; |
|
} elsif ((0x0041 <= $self->{nc} and |
|
|
$self->{nc} <= 0x005A) or # A..Z |
|
|
(0x0061 <= $self->{nc} and |
|
|
$self->{nc} <= 0x007A)) { # a..z |
|
|
# |
|
4821 |
} else { |
} else { |
|
!!!parse-error (type => 'bare ero'); |
|
|
## Return nothing. |
|
4822 |
# |
# |
4823 |
} |
} |
4824 |
|
|