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

VARS declared before first knot not listed under global variables table entry #3

Closed
Wyzoom opened this issue Feb 4, 2021 · 1 comment · Fixed by #4
Closed

VARS declared before first knot not listed under global variables table entry #3

Wyzoom opened this issue Feb 4, 2021 · 1 comment · Fixed by #4
Labels
bug Something isn't working parser

Comments

@Wyzoom
Copy link

Wyzoom commented Feb 4, 2021

Input ink file:

VAR a = "foo"
VAR b = "bar"
CONST c = 42
CONST d = "Number 42"

-> first_knot

== first_knot ==

In the knot a = {a}
In the knot b = {b}

-> second_knot

== second_knot ==
Then we change them :
~ a = "baz"
~ b = "bazbar"

Now a = {a}
and b = {b}

->DONE

Convert to lua using narrator 1.2 produces :

return {variables={},lists={},inclusions={},constants={d="Number 42",c=42},version={tree=1,engine=1},tree={first_knot={={"In the knovt a = #a#","In the knot b = #b#",{divert="second_knot"},""}},second_knot={={"Then we change them :",{value=""baz"",var="a"},{value=""bazbar"",var="b"},"Now a = #a#","and b = #b#",{divert="DONE"}}},={={{value=""foo"",var="a"},{value=""bar"",var="b"},{divert="first_knot"}}}}}

We see at the beginnig of the output :
As expected : constants={d="Number 42",c=42}
Not expected : variables={}

We only see variables a and b being outputted as variable definitions within the second knot, en their value is set the second time. They are present at the end of the output, but not at a place we would expect them.

Greetings, and thanks for writing narrator!
Wyzoom

@astrochili astrochili added bug Something isn't working parser labels Feb 4, 2021
astrochili added a commit that referenced this issue Feb 4, 2021
@astrochili astrochili linked a pull request Feb 4, 2021 that will close this issue
@astrochili
Copy link
Owner

@Wyzoom Thanks for the feedback!

The problem was that variables were assigned at runtime. Improved it in 1.3, now variables are assigned after parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants