Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a quiescent state to the tokenizer to allow interrupting the parser ... #107
Conversation
|
|
||
| self.input_buffers.push_back(input, pos); | ||
| self.run(); | ||
| } |
This comment has been minimized.
This comment has been minimized.
kmcallister
Mar 11, 2015
Contributor
Are these changes basically to allow calling feed with an empty string to re-start parsing? I'd rather just make run public.
This comment has been minimized.
This comment has been minimized.
jdm
Mar 11, 2015
Author
Member
Why? It makes the code in Servo easier, since it doesn't have to special-case restarting parsing when no input is available vs. feeding a new block of input that has been received.
This comment has been minimized.
This comment has been minimized.
kmcallister
Mar 11, 2015
Contributor
You can call run and then, if there's input available, call feed. Seems logical enough.
| } | ||
| match self.sink.query_state_change() { | ||
| None => (), | ||
| Some(s) => self.state = s, |
This comment has been minimized.
This comment has been minimized.
| states::Quiescent => { | ||
| self.state = states::Data; | ||
| return false; | ||
| } |
This comment has been minimized.
This comment has been minimized.
kmcallister
Mar 11, 2015
Contributor
This could use a comment along the lines of
Reachable only through
query_state_change. The tree builder wants the tokenizer to suspend processing.
| #[derive(PartialEq)] | ||
| pub enum NextParserState { | ||
| Suspend, | ||
| Continue |
This comment has been minimized.
This comment has been minimized.
| /// Whether to interrupt further parsing of the current input until | ||
| /// the next explicit resumption of the tokenizer, or continue without | ||
| /// any interruption. | ||
| #[derive(PartialEq)] |
This comment has been minimized.
This comment has been minimized.
|
@jdm: Any update on this? |
|
Changes pushed. |
| @@ -110,7 +110,8 @@ pub trait TokenSink { | |||
|
|
|||
| /// The tokenizer will call this after emitting any start tag. | |||
| /// This allows the tree builder to change the tokenizer's state. | |||
| /// By default no state changes occur. | |||
| /// By default a <script> element will put the tokenizer into a | |||
| /// quiescent state, but no other changes occur. | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jdm
Mar 24, 2015
Author
Member
That's true. I guess I'm not sure what documentation changes you're looking for here.
This comment has been minimized.
This comment has been minimized.
|
Change pushed. |
|
Fixed. |
|
r=me with squash |
…er and resuming it later.
|
Squashed. |
Add a quiescent state to the tokenizer to allow interrupting the parser ...
...r parsing. Hook up document loading to async networking events. Relies on servo/html5ever#107, so we'll likely need to backport it rather than wait for the next rustc upgrade. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5727) <!-- Reviewable:end -->
…, yet still block furthe (from jdm:parserinterrupt2); r=mbrubeck ...r parsing. Hook up document loading to async networking events. Relies on servo/html5ever#107, so we'll likely need to backport it rather than wait for the next rustc upgrade. Source-Repo: https://github.com/servo/servo Source-Revision: dd319c1a998bbd3eeb84fdc4ca8a41ee7877ca37
…, yet still block furthe (from jdm:parserinterrupt2); r=mbrubeck ...r parsing. Hook up document loading to async networking events. Relies on servo/html5ever#107, so we'll likely need to backport it rather than wait for the next rustc upgrade. Source-Repo: https://github.com/servo/servo Source-Revision: dd319c1a998bbd3eeb84fdc4ca8a41ee7877ca37 UltraBlame original commit: 8aaee5f990e4f5a363443ff33eaf8e60825ff898
…, yet still block furthe (from jdm:parserinterrupt2); r=mbrubeck ...r parsing. Hook up document loading to async networking events. Relies on servo/html5ever#107, so we'll likely need to backport it rather than wait for the next rustc upgrade. Source-Repo: https://github.com/servo/servo Source-Revision: dd319c1a998bbd3eeb84fdc4ca8a41ee7877ca37 UltraBlame original commit: 8aaee5f990e4f5a363443ff33eaf8e60825ff898
…, yet still block furthe (from jdm:parserinterrupt2); r=mbrubeck ...r parsing. Hook up document loading to async networking events. Relies on servo/html5ever#107, so we'll likely need to backport it rather than wait for the next rustc upgrade. Source-Repo: https://github.com/servo/servo Source-Revision: dd319c1a998bbd3eeb84fdc4ca8a41ee7877ca37 UltraBlame original commit: 8aaee5f990e4f5a363443ff33eaf8e60825ff898
jdm commentedMar 11, 2015
...and resuming it later.