I'm implementing a parser for MinML in typescript.
It's mostly done, but it doesn't recognize references containing symbols like - and +.
I could fix that by using backtracking, but I think it would be nicer to keep the parser linear with the ability to lookahead 3 chars.
The following cases, as far as I know, require backtracking to decide how to parse them:
[-[comment]] maps to []
[---] maps to "\u2014"
[----] maps to [----]
[ldquo] maps to some html code.
If references explicitly required a prefix like ., the previous cases wouldn't require backtracking and they would become:
[-[comment]] maps to []
.[---] maps to \u2014
[----] maps to [----]
.[ldquo] maps to some html code.
I feel the brackets are too overloaded and that the syntax .[reference] would bring some clarity.
I'm implementing a parser for MinML in typescript.
It's mostly done, but it doesn't recognize references containing symbols like
-and+.I could fix that by using backtracking, but I think it would be nicer to keep the parser linear with the ability to lookahead 3 chars.
The following cases, as far as I know, require backtracking to decide how to parse them:
[-[comment]]maps to[][---]maps to "\u2014"[----]maps to[----][ldquo]maps to some html code.If references explicitly required a prefix like
., the previous cases wouldn't require backtracking and they would become:[-[comment]]maps to[].[---]maps to\u2014[----]maps to[----].[ldquo]maps to some html code.I feel the brackets are too overloaded and that the syntax
.[reference]would bring some clarity.