Commit graph

156 commits

Author SHA1 Message Date
1971892635 Basic skeleton of test suite 2019-12-10 18:00:08 -05:00
205c56679a TreeBuilder progress 2019-12-10 16:50:20 -06:00
08ebc11ce7 More TreeBuilder stuff 2018-10-16 16:57:07 -05:00
b4c3c08800 Another daily TreeBuilder 2018-09-19 16:31:00 -05:00
0624e0be93 Pushing forward on TreeBuilder
• Updated mensbeam/intl dependency.
• Moved scope methods from Element to OpenElementsStack. They don't need to be used outside of the parser and don't make sense there.
• Cleaned up parse errors. Displaying what is expected or found is not helpful.
2018-09-19 09:09:36 -05:00
6e7145c022 More daily TreeBuilder stuff 2018-09-14 16:05:20 -05:00
8e87149419 Daily TreeBuilder additions 2018-09-14 14:16:07 -05:00
f5e6179fad Daily updates to token emitting 2018-09-13 17:00:10 -05:00
63fe744864 Printing 👌🏻
Made each of the node types serialize themselves through __toString with serialize used in Document, DocumentFragment, and Element.
2018-09-13 13:05:22 -05:00
ab1a78c192 Modifying printing
• Added exceptions for disabled inherited DOMDocument methods that don't make sense in an HTML5 library.
• Moved the inherited methods from the Printing trait to Document as DocumentFragment and Element don't inherit anything to print.
2018-09-12 08:47:52 -05:00
dfda8d5f3a Organization
• Moved the ancestor and descendant methods into their own traits along with the compare method which they share.
• Made DocumentFragment use only the descendant methods and not the ancestor ones.
• Fixed error in README.
2018-09-11 09:54:46 -05:00
fd6003fb4e Added additional entry point
• Added an option to use Document::loadHTML or Document::load to parse a document.
• Made the DOM elements use dW\HTML5 namespace instead of dW\HTML5\DOM.
• Fixed where TreeBuilder wasn't being properly destructed when the parser is finished.
2018-09-10 16:56:38 -05:00
86c6577752 Forgotten fixes 2018-09-06 22:00:08 -05:00
5af174d346 Rewrote DOM Tools
• Discovered a way to extend the existing DOM tools, so Parser now works with custom classes for the DOM.
• \dW\HTML5\DOM is no longer needed, and its functionality has been split between DOM\Document and DOM\Element.
• Printer's functionality is now handled by DOM\Document\saveHTML through a trait to make maintenance easier.
• Normalized Exception constants.
• Fixed various typing bugs.
2018-09-06 21:51:08 -05:00
69fa554d43 Updated \mensbeam\intl dependency 2018-09-05 11:08:27 -05:00
f948e3ffad Fix Printer bugs
• Oops. Didn't have the \ in front of the DOM classes.
• Forgot function keyword on Printer::escapeString.
• Finished out the spec on Printer::serialize.
2018-09-05 10:26:45 -05:00
d6dada9c5e Printer progress 2018-09-04 17:01:55 -05:00
c5631050cc Started Printer 2018-09-04 08:28:25 -05:00
66ec4dab27 Fix character reference parsing 2018-08-31 13:25:05 -05:00
33363ab2d3 Fixed Data bug
• Fixed bug where Data::consumeWhile and Data::consumeUntil wouldn't move the pointer back one position if there were no matches.
• Changed DataStream to Data.
• Made each class have its own debug static property so each can print debug information separately.
2018-08-27 14:57:47 -05:00
fd886d9a3a DataStream fixes
• Removed dependency on ext-mbstring.
• Fixed bug where when using DataStream::consumeUntil and DataStream::consumeWhile where the column would be advanced whether the pointer was moved or not.
2018-08-24 08:35:55 -05:00
1b172f4d61 Rewrote DataStream
• Changed DataStream from using an internal array storage to using /mensbeam/intl, much more efficient and in line with the specification.
• DataStream now calculates the line and column as it goes instead of relying upon a weird array of positions.
• Removed dependency on ext-intl.
2018-08-23 23:17:27 -05:00
ed3cf3add1 Added template insertion mode stack 2018-08-22 17:01:55 -05:00
c414f3dbfa Changed Stack to abstract class
Moved the stack of open elements to its own class OpenElementsStack and made it and ActiveFormattingElementsList inherit from an abstract Stack class.
2018-08-22 09:11:07 -05:00
5fc38d8946 More TreeBuilder stuff 2018-08-21 16:58:04 -05:00
85894ed1ea Fixed an issue with tokenization of attributes 2018-08-20 14:00:27 -05:00
d95f3e37e4 Fixed document building
• The document was being rewritten when tree building and therefore not being output when the parser completed.
• Allowed DOM to be instanced, containing an implementation and document so the tree builder can create a document when a doctype is found.
2018-08-17 16:26:27 -05:00
d1307f39d9 Fixed tree construction dispatching
• PHP's DOM returns null when the namespace isn't specified, so it was causing the dispatcher to parse tokens in foreign content when it wasn't supposed to.
2018-08-15 16:50:11 -05:00
e199df20aa Completed After head insertion mode, started In body
• Added debugging output for TreeBuilder, showing the insertion mode and foreign if content is foreign.
• Fixed syntax errors that weren't caught in last commit
2018-08-13 16:30:06 -05:00
f818d716a3 More TreeBuilder stuff 2018-08-10 16:51:47 -05:00
48d125e18a Continuing work on TreeBuilder 2018-08-09 16:59:35 -05:00
106efd5a8a Moved treebuilder to its own class
• Changed use of static:: with constants to self:: in TreeBuilder
2018-08-06 11:41:31 -05:00
e61b8ff8b5 Decoupled ActiveFormattingElementsList from Parser
• Made the token insertion methods static in Parser so that ActiveFormattingElementsList::reconstruct can insert methods without having to access the Parser instance itself. Might do it differently later, but this works for now.
• Since the fragment context that is passed to Stack can be null it is necessary to check whether the argument is valid before continuing.
• Parser::instance is now protected as all classes are now decoupled.
2018-08-05 09:59:23 -05:00
37205029a3 Decoupled Stack from Parser 2018-08-04 18:01:15 -05:00
85cc8c1aa3 Added authors file and updated license 2018-08-03 23:21:15 -05:00
2f0426946f Remove unnecessary breaks in Tokenizer 2018-08-03 23:13:06 -05:00
298decab24 Decouple ParseError from Parser 2018-08-03 23:08:18 -05:00
222d60579c Have Parser destroy its instance when finished
• Getting ready to work on fragment parsing, simplifying Parser::parseFragment.
• Added short example in README
2018-08-03 16:57:51 -05:00
33403f721f Decouple the tokenizer from the parser
This does not quite yet allow the tokenizer to be tested in isolation,
as the parse error emitter still assumes an instance of Parser is
available
2018-08-02 12:18:30 -04:00
f6c0fa981b Re-order missed unconsumes in the last commit 2018-08-02 11:51:29 -04:00
0c13114dee Remove leftover uses of emitToken in tokenizer 2018-08-02 11:46:01 -04:00
9df201f663 Remove erroneously added sub-repository 2018-08-02 11:31:59 -04:00
0d7a0a3367 Change tokenizer constant references to self::
Changing static:: to self:: makes constant de-referencing a
compile-time operation rather than run-time, potentially improving
performance. As constants cannot be overridden by extending classes,
there is no advantage to using static:: for these constants
2018-08-02 11:30:12 -04:00
027e5b9f58 Moved tokenizer to its own class
• Changed the name of the parser instance variable from Parser::$self to Parser::$instance
• Added parse errors for entities into ParseError.
• Moved Parser::fixDOM to DOM::fixIdAttributes.
• Added an exception for when the tokenizer enters an invalid state (infinite looping).
• Made ParseError use Parser::$instance->data instead of a passed around DataStream object.
2018-08-01 16:40:03 -05:00
e8bb3a97f7 Random fixes
• Made names of storage property in Stack and ActiveFormattingElementsList consistent to elsewhere
• Parser has its own public static variable that is an intance of itself, so ActiveFormattingElementsList can use that instead of passing an instance around.
• Added separate exception for ActiveFormattingElementsList
2018-07-31 12:47:56 -05:00
0d21ed5d72 More active formatting elements stuff 2018-07-30 17:03:10 -05:00
08696fc4c5 Added List of Active Formatting Elements 2018-07-30 08:12:19 -05:00
07d402e2d7 Simplified element creation methods 2018-07-26 17:01:53 -05:00
49a04997c9 Strict typing :) 2018-07-26 16:36:35 -05:00
1fc65f85bd Started HTML content tree building
• Removed html5.php; shouldn't have been there to begin with.
• Fixed bug where when feeding ParseError::trigger the wrong number of parameters it wouldn't have the correct exception to throw.
2018-07-26 16:30:29 -05:00