First version of a Parser calling Acceptor functions instead of constructing #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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, something like:
def firstpair = ((name ~ "=" ~ value) | name)
A Parser calling Acceptor functions can't take them back, so I needed a more complicated approach.