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

Reversed output stream #17

Closed
y-lohse opened this issue Jul 4, 2016 · 7 comments
Closed

Reversed output stream #17

y-lohse opened this issue Jul 4, 2016 · 7 comments
Labels

Comments

@y-lohse
Copy link
Owner

y-lohse commented Jul 4, 2016

-> start

=== function get_stalk_time ===
{
- time == 0:
    ~ return "12 AM."
- time < 12:
    ~ return "{time} AM"
- time == 12:
    ~ return "12 PM."
- else:
    ~ return "{time - 12} PM"
}

=== start
VAR time = 11
{ get_stalk_time() }
-> END

The following example should produce 11 AM, but produces AM11 instead. The problem starts around here.

Ping @pineapplemachine who found this one.

@y-lohse y-lohse added the bug label Jul 4, 2016
@y-lohse y-lohse mentioned this issue Jul 4, 2016
@y-lohse
Copy link
Owner Author

y-lohse commented Jul 4, 2016

@pineapplemachine Is it possible you made other changes to the source (apart from 854d29d) that would have fixed this?

@pineapplemachine
Copy link
Contributor

pineapplemachine commented Jul 4, 2016

It was a one-line change and I made an error duplicating the change in the repo.

Should be fixed now.

@y-lohse
Copy link
Owner Author

y-lohse commented Jul 4, 2016

Ah, I see. However, I believe 6c57691 just fixes the symptom. The reference code doesn't invert things, so there's probably a mistake somewhere else. I'll look into it.

@y-lohse
Copy link
Owner Author

y-lohse commented Jul 4, 2016

Here's a smaller test file for reference.

=== start
{ get_stalk_time() }
-> END

=== function get_stalk_time ===
~ temp time = 11
~ return "before {time} after"

y-lohse added a commit that referenced this issue Jul 4, 2016
@joethephish
Copy link
Contributor

joethephish commented Jul 4, 2016

Actually, I think it's specific to the string building code? This might be
the simplest repro (also untested!)

{"before {1} after"}

@y-lohse
Copy link
Owner Author

y-lohse commented Jul 4, 2016

Sort of, your code uses a Stack and mine a simple array, so I was missing last in, first out behavior :|

@y-lohse y-lohse closed this as completed in a425309 Jul 4, 2016
@joethephish
Copy link
Contributor

Cool, good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants