Gutenberg still parsing blocks with a Regular Expression, instead of using a common parser #10353
Labels
[Feature] Parsing
Related to efforts to improving the parsing of a string of data and converting it into a different f
[Type] Feedback
Issues that relate purely to feedback on a feature that isn't necessarily actionable
One of the most important parts of providing a single source of truth, is to have a single language to interpret and parse data. Gutenberg selected a custom PEG parser as its manner of interpreting HTML comments into blocks. As such, that PEG parser defines the manner in which blocks are to be written and parsed. It is the single source of truth on blocks.
However, on every page load, Gutenberg ignores this PEG parser, and instead uses a regular expression, that doesn't actually understand the format it parses. This is a fundamental design flaw that will lead to many future bugs and increasingly hacky patches. a regular expression is incapable of properly parsing a PEG language, as they operate at fundamentally different Chomsky levels. Small differences in interpretation between the two competing parsers will inevitably be a source of bugs.
If Gutenberg's language is to be the source of truth, then a common parser needs to be in use everywhere it is used. This hacky solution just sets up dynamic blocks to become "Shortcodes 2", with all the baggage and limitations that come along with that.
Launching Gutenberg without a consistant php parser would be a huge mistake.
The text was updated successfully, but these errors were encountered: