Skip to content

Comma-list declarations issue 2856#2975

Merged
Dunbaratu merged 5 commits intoKSP-KOS:developfrom
DanTGL:list_declarations_issue_2856
Aug 1, 2021
Merged

Comma-list declarations issue 2856#2975
Dunbaratu merged 5 commits intoKSP-KOS:developfrom
DanTGL:list_declarations_issue_2856

Conversation

@DanTGL
Copy link
Contributor

@DanTGL DanTGL commented Jun 22, 2021

Added comma-list declarations.

Fixes #2856

It is not finished yet as I have only added them for SET right now.

@marianoapp
Copy link
Contributor

If you made changes to the grammar you need to commit the kRISC.tpg file too. I assume you did since the PR includes changes to the Parser class.

@thexa4
Copy link
Contributor

thexa4 commented Jun 22, 2021

Does this allow set foo to 1, bar to foo.?

@DanTGL
Copy link
Contributor Author

DanTGL commented Jun 22, 2021

@marianoapp I didn't realize that I was supposed to modify the kRISC.tpg file, but I've done it now and generated the code with TinyPG.

@thexa4 Yes, that works.

@DanTGL
Copy link
Contributor Author

DanTGL commented Jun 23, 2021

This basically works by splitting them up in separate operations, so the only actual changes are how the statement is parsed and compiled. So it basically still functions the same way as having separate statements.

This is basically the only thing I've changed in the code aside from kRISC.tpg:

private void VisitSetStatement(ParseNode node)
{
NodeStartHousekeeping(node);
for (int i = 1; i < node.Nodes.Count; i += 4)
{
ProcessSetOperation(node.Nodes[i], node.Nodes[i + 2]);
}
}

@DanTGL DanTGL changed the title [Not Ready] Comma-list declarations issue 2856 Comma-list declarations issue 2856 Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support comma-list declarations

4 participants