summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-09-28refactor: make TracingEmitter only work with usizesMartin Fischer
2023-09-28chore: add BasicEmitter stubMartin Fischer
2023-09-28break!: rename DefaultEmitter to TracingEmitterMartin Fischer
2023-09-28refactor: simplify attribute logic in DefaultEmitterMartin Fischer
2023-09-28refactor: clean up DefaultEmitter codeMartin Fischer
2023-09-28chore: reorder DefaultEmitter methods as wellMartin Fischer
See the previous commit.
2023-09-28docs: put Emitter methods in a more logical orderMartin Fischer
2023-09-28refactor: make NaiveParser new* signatures more readableMartin Fischer
2023-09-28break!: remove NaiveParser::new_with_spansMartin Fischer
The method never really made much sense since you could just as well use NaiveParser::new.
2023-09-28break!: make DefaultEmitter::emit_eof emit EndOfFileMartin Fischer
2023-09-28break!: add Token::EndOfFileMartin Fischer
While the end-of-file token can also be represented by None, this is less clear than having an explicit variant. Especially when it comes to tree construction, the spec explicitly has conditions named "An end-of-file token", and it's nice if the code for tree construction can match the spec text closely.
2023-09-28break!: emit chars instead of stringsMartin Fischer
The HTML spec specifies that the tokenizer emits character tokens. That html5gum always emitted strings instead was probably just done to make the token consumption more convenient. When it comes to tree construction character tokens are however actually more convenient than string tokens since the spec defines that specific character tokens should be ignored in specific states (and character tokens let us avoid string manipulation for these conditions). This should also make the DefaultEmitter more performant for cases where you don't actually need the strings at all (or only a few) since it avoids string allocations. Though I haven't benchmarked it.
2023-09-28refactor: proxy emit_string calls through utilsMartin Fischer
This is done separately so that the next commit has a cleaner diff.
2023-09-28refactor: move machine impl details to machine moduleMartin Fischer
This commit separates the public API (the "Tokenizer") from the internal implementation (the "Machine") to make the code more readable.
2023-09-28refactor: move utils module under tokenizer::machineMartin Fischer
2023-09-28refactor: only use InternalState re-export for feature-gated internal APIMartin Fischer
2023-09-28refactor: move machine module under tokenizerMartin Fischer
2023-09-28//: remove wrong commentMartin Fischer
Methods defined in another module don't have access to private fields, so the function could very well have been implemented as a method.
2023-09-28break!: remove Token::ErrorMartin Fischer
An error isn't a token (in general and also according to the spec). You shouldn't have to filter out errors when you're just interested in tokens but most importantly having errors in the Token enum is annoying when implementing tree construction (since the spec conditions exhaustively cover all Token variants except Token::Error).
2023-09-28refactor: remove DefaultEmitter::push_error helper fnMartin Fischer
2023-09-28break!: rename Emitter::emit_error to report_errorMartin Fischer
2023-09-28chore: move emit_error method upMartin Fischer
2023-09-28feat: add blanket impl of Reader for boxed readersMartin Fischer
2023-09-27break!: remove Emitter::pop_token, use Iterator insteadMartin Fischer
2023-09-27chore: move bounds to where clauseMartin Fischer
2023-09-12docs: move warning from DefaultEmitter to TokenizerMartin Fischer
2023-09-11chore: move DefaultEmitter to own moduleMartin Fischer
2023-09-09refactor: merge token types with attr to new token moduleMartin Fischer
2023-09-09chore: group public modules togetherMartin Fischer
2023-09-09docs: stop referencing Emitter from token typesMartin Fischer
2023-09-03docs: add spans exampleMartin Fischer
2023-09-03feat: add Doctype::name_spanMartin Fischer
2023-09-03break!: make Doctype name field optionalMartin Fischer
2023-09-03fix!: make comment data spans encoding-independentMartin Fischer
2023-09-03fix: make doctype id spans encoding-independentMartin Fischer
2023-09-03fix!: make set_self_closing encoding-independentMartin Fischer
2023-09-03fix!: make attribute spans encoding-independentMartin Fischer
2023-09-03fix!: make start/end tag name spans encoding-independentMartin Fischer
2023-09-03fix: don't assume UTF-8 in machine/tokenizerMartin Fischer
2023-09-03refactor: inline internal method only used onceMartin Fischer
2023-09-03fix!: make PosTrackingReader encoding-independentMartin Fischer
While much of the span logic currently assumes UTF-8, we also want to support other character encodings, such as e.g. UTF-16 where characters can take up more or less bytes than in UTF-8.
2023-09-03refactor: also use some_offset for start/end tagsMartin Fischer
2023-09-03fix!: calculate tag offsets in Tokenizer instead of Emitter implMartin Fischer
2023-09-03fix: too small char ref error spansMartin Fischer
2023-09-03chore: rename doctype_offset field to some_offsetMartin Fischer
We'll reuse the field for another offset in the next commit.
2023-09-03refactor: proxy init_doctype through TokenizerMartin Fischer
2023-09-03fix: off-by-one missing-semicolon-after-character-reference spanMartin Fischer
2023-09-03fix!: off-by-one end-tag-with-trailing-solidus spanMartin Fischer
2023-09-03fix: most error spans mistakenly being emptyMartin Fischer
With codespan_reporting an empty span shows up exactly like a one-byte span, which is why I didn't notice this mistake earlier.
2023-09-03fix: off-by-one eof error spansMartin Fischer