Ignoring an empty line when the parser is able to parse it but I don't want it to. #266
-
This looks very similar to the issue here... #260 But my issue is that my parser is parsing an array of digits. So when it sees an empty line at the end of the file it parses it fine and returns an empty array for that line. I've dealt with this in other files but in this particular file it isn't working because it is able to parse. It's just parsing incorrectly. The input file is like this...
(Note the empty last line). And I want to parse it into a 2D array of Int... So my parsers looks like this..
The output I get from this is...
As you can see it is parsing the last empty line as an array of Digits of count 0. I can't seem to find a way to make this be ignored. The other solutions of using a Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @oliverfoggin, for the row parser I think you want |
Beta Was this translation helpful? Give feedback.
Hi @oliverfoggin, for the row parser I think you want
Many(minimum: 1)
, that way it fails on the last line, leaving it unconsumed. Then you can finish it off with aterminator
parser that consumes all trailing whitespace. Want to give that a shot and let me know if it works?