summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-28chore: build html5lib_tests::Output laterMartin Fischer
This is done separately so that the next commit has a cleaner diff.
2023-09-28refactor: make labeler closures take NaiveParserMartin Fischer
The second next commit will move errors out of the Token enum but we still want to be able to test that the spans of errors are character encoding independent.
2023-09-28feat: add blanket impl of Reader for boxed readersMartin Fischer
2023-09-28refactor: make parser helper fn generic over readerMartin Fischer
2023-09-28chore: make assert_char_encoding_independence more readableMartin Fischer
2023-09-28chore: rename internal tokenizer helper fn to parserMartin Fischer
2023-09-28[0/10]: remove Token::ErrorMartin 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-05docs: fix heading style in changelogMartin Fischer
2023-09-05fix(docs): Comment data_offset field was changedMartin Fischer
I forgot to document this breaking change in e993f19c2b8ef00b32f17f9ed32306f3ceb21bc3.
2023-09-03chore: bump version to 0.5.1v0.5.1Martin Fischer
2023-09-03chore: bump edition to 2021Martin Fischer
2023-09-03chore: add categories to Cargo.tomlMartin 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-03refactor: make test_and_annotate test encoding-independenceMartin Fischer
2023-09-03docs: the span logic no longer assumes UTF-8Martin Fischer
2023-09-03fix!: make comment data spans encoding-independentMartin Fischer
2023-09-03test: test comment data spans more thoroughlyMartin 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-03test: verify that span logic incorrectly assumes UTF-8Martin Fischer
2023-09-03refactor: make span tests tokenizer-independentMartin Fischer
2023-09-03refactor: let comment and doctype tests check multiple casesMartin 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