FtanML-WG/Scala-Parser — pull request #9 by smessmer (2012-10-03 21:33:43+00:00)
Title: First version of a Parser calling Acceptor functions instead of constructing

PLEASE DON'T MERGE THIS PULL REQUEST YET!

I'm almost sure it's broken. I just couldn't test it, because currently many tests aren't working, so I don't know which errors are mine and which aren't. Please ensure that the test cases in master branch work again and I'll merge this here after correcting my mistakes.

So this pull request is just to show such a Parser is possible.

The parser although has a drawback - it's admittedly shorter, but also more complicated than the parser just constructing FtanValues directly. So it would be harder to maintain.
One of the reasons is that we can't allow backtracking. When for example checking the first key/value pair of an element, our standard parser just parses the name, THEN checks if there is an equals sign and a value (=> attribute) or there is anoter name (=>the first was the tag name). This is done by backtracking. A Parser calling Acceptor functions can't take them back, so I needed a more complicated approach.