Boron Parser

A very important part of Nucleus is the parser; this will also be the case for Boron. However there is room for improvement and more flexibility.

After thinking about where to place the parser in the architecture I think we could actually use two parsers. There are two places where the parser is needed; and in both places it doesn't necesarrely have to be the same parser.

SkinParser

This parser is the easiest to place somewhere in the architecture. It parses a skin and proceeds it. So it could be a core-service. This way clients could ask the core to parse a skin and process everything. (not every client would have to use skins).

ContentParser

This is a bit more difficult to place. In Nucleus 3.x this is the same parser as the SkinParser. However there is demand for other parsers, like Textile, Wiki, phpBBCode etc. If the content-parser is well designed, it would become possible to provide content-specific parsing (of items, comments etc).

For maximum flexibility I think we should split the parser into two (or more?) parts:

  • A part that really parses the content and creates an intermediate data-struct from the content, for example, an array, .containing data and type for every row.

This would enable the use of content with a completely different parser, while the data, itself, is still processed by the core (or at least the same code that processes all content, what every parser is used).

  • “data blocks processor” (bad name). This would be a class to process the data structure, output by any parser.

By combining these two we would get a flexible system, where one can freely choose parsers (as long as the parser outputs our data structure) and processors (as long as they understand our data-structure).

Maybe the architecture of the DokuWiki could help us here?

Resources

(scroll down and read the thread #290 and below - people coming up with an answer to “How do you share data in the Composite structure?”)

  • WACT's parser is something to look at also.



:!: These are part of the Nucleus 5 plans. Read more about the project.

nucleus5/parser.txt · Last modified: 2006/07/05 13:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki