Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a quiescent state to the tokenizer to allow interrupting the parser ... #107

Merged
merged 1 commit into from Apr 18, 2015

Conversation

@jdm
Copy link
Member

jdm commented Mar 11, 2015

...and resuming it later.


self.input_buffers.push_back(input, pos);
self.run();
}

This comment has been minimized.

@kmcallister

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.

@jdm

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.

@kmcallister

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.

@kmcallister

kmcallister Mar 11, 2015

Contributor

You should change the docs in tokenizer/interface.rs to match.

states::Quiescent => {
self.state = states::Data;
return false;
}

This comment has been minimized.

@kmcallister

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.

@kmcallister

kmcallister Mar 11, 2015

Contributor

Nit: should have a trailing comma.

/// 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.

@kmcallister

kmcallister Mar 11, 2015

Contributor

Should derive the same set of traits as QuirksMode above.

@kmcallister
Copy link
Contributor

kmcallister commented Mar 23, 2015

@jdm: Any update on this?

@jdm
Copy link
Member Author

jdm commented Mar 23, 2015

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.

@kmcallister

kmcallister Mar 24, 2015

Contributor

Isn't the default return value NextParserState::Continue?

This comment has been minimized.

@jdm

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.

@kmcallister

kmcallister Apr 16, 2015

Contributor

It's now called for all tags, not just start tags.

@jdm
Copy link
Member Author

jdm commented Apr 16, 2015

Change pushed.

@jdm
Copy link
Member Author

jdm commented Apr 17, 2015

Fixed.

@kmcallister
Copy link
Contributor

kmcallister commented Apr 17, 2015

r=me with squash

…er and resuming it later.
@jdm jdm force-pushed the jdm:quiescent branch from cd8cca6 to 1babdb8 Apr 17, 2015
@jdm
Copy link
Member Author

jdm commented Apr 17, 2015

Squashed.

kmcallister added a commit that referenced this pull request Apr 18, 2015
Add a quiescent state to the tokenizer to allow interrupting the parser ...
@kmcallister kmcallister merged commit 5fca661 into servo:master Apr 18, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
bors-servo pushed a commit to servo/servo that referenced this pull request May 21, 2015
...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 -->
jrmuizel pushed a commit to jrmuizel/gecko-cinnabar that referenced this pull request Jun 12, 2017
…, 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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Sep 30, 2019
…, 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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…, 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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.