Re: BBC Parsing
Reply #139 –
This might sound crazy, but BBC types should be classes. Their properties should be what they are allowed to do.
For instance:
final class \BBC\Types\ClosedType
{
const HAS_PARAM = false;
const HAS_EQUALS = false;
const HAS_BEFORE = true;
const HAS_AFTER = true;
const HAS_CONTENT = false;
const PARSE_CONTENT = false;
const PARSE_EQUALS = false;
}
The idea would be to define the rules for each type in the code. This would be fleshed out more and the rules themselves would be defined (in documentation, don't need another class for that). One could then expand the types to make the individual codes lighter. With a syntax tree, it would also make parsing cheaper.