Skip to content

Commit

Permalink
Implement <rb> and <rtc> parsing rules (closes servo#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Sep 22, 2015
1 parent 0b4b48a commit 6345b1f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
14 changes: 0 additions & 14 deletions data/test/ignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
tb: ruby.dat-0
tb: ruby.dat-1
tb: ruby.dat-10
tb: ruby.dat-12
tb: ruby.dat-13
tb: ruby.dat-15
tb: ruby.dat-17
tb: ruby.dat-2
tb: ruby.dat-20
tb: ruby.dat-3
tb: ruby.dat-5
tb: ruby.dat-7
tb: tests19.dat-18
tb: tests19.dat-21
tb: tests20.dat-34
tb: tests20.dat-35
tb: tests20.dat-36
Expand Down
22 changes: 19 additions & 3 deletions src/tree_builder/rules.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// except according to those terms.

// This file is generated from rules.rs
// source SipHash: 6604065678599019684
// source SipHash: 307317075343040988

# ! [
doc =
Expand Down Expand Up @@ -1277,10 +1277,10 @@ impl <Handle, Sink> TreeBuilderStep for super::TreeBuilder<Handle, Sink> where
}
::tree_builder::types::TagToken(tag@::tokenizer::Tag {
kind: ::tokenizer::StartTag,
name: atom!(rp), .. }) |
name: atom!(rb), .. }) |
::tree_builder::types::TagToken(tag@::tokenizer::Tag {
kind: ::tokenizer::StartTag,
name: atom!(rt), .. }) => {
name: atom!(rtc), .. }) => {
if self.in_scope_named(default_scope, atom!(ruby)) {
self.generate_implied_end(cursory_implied_end);
}
Expand All @@ -1290,6 +1290,22 @@ impl <Handle, Sink> TreeBuilderStep for super::TreeBuilder<Handle, Sink> where
self.insert_element_for(tag);
Done
}
::tree_builder::types::TagToken(tag@::tokenizer::Tag {
kind: ::tokenizer::StartTag,
name: atom!(rp), .. }) |
::tree_builder::types::TagToken(tag@::tokenizer::Tag {
kind: ::tokenizer::StartTag,
name: atom!(rt), .. }) => {
if self.in_scope_named(default_scope, atom!(ruby)) {
self.generate_implied_end_except(atom!(rtc));
}
if !self.current_node_named(atom!(rtc)) &&
!self.current_node_named(atom!(ruby)) {
self.unexpected(&tag);
}
self.insert_element_for(tag);
Done
}
::tree_builder::types::TagToken(tag@::tokenizer::Tag {
kind: ::tokenizer::StartTag,
name: atom!(math), .. }) =>
Expand Down
13 changes: 12 additions & 1 deletion src/tree_builder/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ impl<Handle, Sink> TreeBuilderStep
Done
}

tag @ <rp> <rt> => {
tag @ <rb> <rtc> => {
if self.in_scope_named(default_scope, atom!(ruby)) {
self.generate_implied_end(cursory_implied_end);
}
Expand All @@ -734,6 +734,17 @@ impl<Handle, Sink> TreeBuilderStep
Done
}

tag @ <rp> <rt> => {
if self.in_scope_named(default_scope, atom!(ruby)) {
self.generate_implied_end_except(atom!(rtc));
}
if !self.current_node_named(atom!(rtc)) && !self.current_node_named(atom!(ruby)) {
self.unexpected(&tag);
}
self.insert_element_for(tag);
Done
}

tag @ <math> => self.enter_foreign(tag, ns!(MathML)),

tag @ <svg> => self.enter_foreign(tag, ns!(SVG)),
Expand Down
2 changes: 1 addition & 1 deletion src/tree_builder/tag_sets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ declare_tag_set!(pub table_body_context = tbody tfoot thead template html);
declare_tag_set!(pub table_row_context = tr template html);
declare_tag_set!(pub td_th = td th);

declare_tag_set!(pub cursory_implied_end = dd dt li option optgroup p rp rt);
declare_tag_set!(pub cursory_implied_end = dd dt li option optgroup p rb rp rt rtc);

declare_tag_set!(pub thorough_implied_end = cursory_implied_end
+ caption colgroup tbody td tfoot th thead tr);
Expand Down

0 comments on commit 6345b1f

Please sign in to comment.