/[suikacvs]/webroot/gate/2007/html/WebHACC/Language/WebIDL.pm
Suika

Contents of /webroot/gate/2007/html/WebHACC/Language/WebIDL.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sat Aug 2 06:07:11 2008 UTC (15 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +16 -0 lines
++ html/WebHACC/Language/ChangeLog	2 Aug 2008 06:07:07 -0000
2008-08-02  Wakaba  <wakaba@suika.fam.cx>

	* WebIDL.pm (generate_structure_error_section): New method.

++ html/WebHACC/ChangeLog	2 Aug 2008 06:06:40 -0000
2008-08-02  Wakaba  <wakaba@suika.fam.cx>

	* Output.pm ($htescape_value): New code.  Some methods should
	invoke this code instead of original $htescape, since that
	code will convert invisible characters into HTML tags
	such that that code is not suitable for attribute values
	and CDATA/PCDATA element contents.
	($get_object_path): New.  Future revision of this code should
	support real "path" to the node object.  The current version
	only dumps the type and the name of the node itself.
	(node_link): Support for non-DOM nodes.

	* Result.pm (add_error): Support for non-DOM nodes.

1 package WebHACC::Language::WebIDL;
2 use strict;
3 require WebHACC::Language::Base;
4 push our @ISA, 'WebHACC::Language::Base';
5
6 sub new ($) {
7 my $self = bless {}, shift;
8 return $self;
9 } # new
10
11 sub generate_syntax_error_section ($) {
12 my $self = shift;
13
14 require Whatpm::WebIDL;
15
16 my $out = $self->output;
17 $out->start_section (role => 'parse-errors');
18 $out->start_error_list (role => 'parse-errors');
19
20 my $input = $self->input;
21 my $result = $self->result;
22
23 require Encode;
24 my $s = $input->{is_char_string} ? $input->{s} : Encode::decode ($input->{charset} || 'utf-8', $input->{s}); ## TODO: charset
25 my $parser = Whatpm::WebIDL::Parser->new;
26
27 $self->{structure} = $parser->parse_char_string ($input->{s}, sub {
28 $result->add_error (@_, layer => 'syntax');
29 });
30
31 $out->end_error_list (role => 'parse-errors');
32 $out->end_section;
33 } # generate_parse_error_section
34
35 sub generate_structure_dump_section ($) {
36 my $self = shift;
37
38 my $out = $self->output;
39
40 $out->start_section (role => 'reformatted');
41
42 $out->start_code_block;
43 $out->text ($self->{structure}->idl_text);
44 $out->end_code_block;
45
46 $out->end_section
47 } # generate_structure_dump_section
48
49 sub generate_structure_error_section ($) {
50 my $self = shift;
51
52 my $out = $self->output;
53
54 $out->start_section (role => 'structure-errors');
55 $out->start_error_list (role => 'structure-errors');
56
57 $self->{structure}->check (sub {
58 $self->result->add_error (@_, layer => 'structure');
59 });
60
61 $out->end_error_list (role => 'structure-errors');
62 $out->end_section;
63 } # generate_structure_error_section
64
65 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24