Skip to content

Commit

Permalink
Allow identifiers to have a LABEL reference again
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusAmshove committed May 1, 2023
1 parent 7b81394 commit 52f2231
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,15 @@ protected IVariableReferenceNode consumeVariableReferenceNode(BaseSyntaxNode nod
consumeMandatory(reference, SyntaxKind.RPAREN);
}

if (peekKind(SyntaxKind.LPAREN) && peekKind(1, SyntaxKind.LABEL_IDENTIFIER))
{
while (!isAtEnd() && !peekKind(SyntaxKind.RPAREN))
{
consume(reference);
}
consumeMandatory(reference, SyntaxKind.RPAREN);
}

unresolvedReferences.add(reference);
return reference;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1983,4 +1983,11 @@ void parseDownloadPcCommandAsync()
{
assertParsesSingleStatement("DOWNLOAD PC 5 COMMAND 'Hi' ASYNC", IWritePcNode.class);
}

@Test
void allowLabelIdentifierAsVariableOperand()
{
var assignment = assertParsesSingleStatement("#VAR(R1.) := 5", IAssignmentStatementNode.class);
assertIsVariableReference(assignment.target(), "#VAR");
}
}

0 comments on commit 52f2231

Please sign in to comment.