Why can't the parser just use some simple regexes to make things easier for modders if not actual game programmers of the game.
I've written 6 simple regexes which would be fully compatible with the current syntax but eliminate a whole lot of unnecessary restrictions.
- Header line (any printable character which is not letter on digit, repeated at least 3 times):
Code: Select all
^\s*[^\sA-Za-z0-9]{3,}\s*$
- Version:
Code: Select all
^\s*[Vv]ersion[:\s]\s*([0-9.]+)\s*$
- Date:
Code: Select all
^\s*[Dd]ate[:\s]\s*([0-9]{4}\.[0-9]{2}\.[0-9]{2})\s*$
- Category:
Code: Select all
^\s*(\w+):\s*$
- Entry:
Code: Select all
^\s*(?!-{3,})-\s*(\S|\S.*\S)\s*$
- Ignored line (empty or containing only non-printable characters):
Code: Select all
^\s*$