Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parser stopped to read input after empty line #17

Merged
merged 2 commits into from
Dec 27, 2016
Merged

Conversation

pleonex
Copy link
Contributor

@pleonex pleonex commented Dec 27, 2016

If the parser found an empty line it stopped reading more
input. The issue was that empty lines and EOF were similar.
As an empty line contains the new line characters (\n, \r\n),
we are using them to distinguish these two situations. The fix
applies to the InputFileDevice and InputConsoleDevice.

Fixes #16

If the parser found an empty line it stopped reading more
input. The issue was that empty lines and EOF were similar.
As an empty line contains the new line characters (\n, \r\n),
we are using them to distinguish these two situations. The fix
applies to the InputFileDevice and InputConsoleDevice.

Fixes #16
@pleonex pleonex added the bug label Dec 27, 2016
@pleonex pleonex added this to the v1.2 milestone Dec 27, 2016
@pleonex pleonex self-assigned this Dec 27, 2016
@pleonex pleonex requested a review from iblancasa December 27, 2016 15:11
line = True # For the first condition.
while line:
line = ""
while line is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It should be:

while line:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because then line == "" will be false too and don't want to stop for empty lines.

line = device.read_line()

# Remove end of lines
if line:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You first check "if line". Then "if not line" and then you only continues with this iteration if line...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because we want to remove new line chars only when line is not None and we don't want to set line to an empty string to distinguish between empty line and EOF.

@iblancasa iblancasa merged commit baa3fae into master Dec 27, 2016
@pleonex pleonex deleted the fix_emptylines branch December 28, 2016 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parser stops reading input after an empty line
2 participants