Skip to content

Commit

Permalink
fix #176 - infinite loop on align syntax error inside AsmStatement (#177
Browse files Browse the repository at this point in the history
)

fix #176 - infinite loop on align syntax error inside AsmStatement
merged-on-behalf-of: Brian Schott <[email protected]>
  • Loading branch information
bbasile authored and dlang-bot committed Nov 6, 2017
1 parent 3eca167 commit 0bd3235
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/dparse/parser.d
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,20 @@ class Parser
advance(); // align
node.hasAlign = true;
if (currentIsOneOf(tok!"intLiteral", tok!"identifier"))
{
node.identifierOrIntegerOrOpcode = advance();
if (!currentIs(tok!";"))
{
error("';' expected.");
advance();
return null;
}
}
else
{
error("Identifier or integer literal expected.");
return null;
}
}
else if (currentIsOneOf(tok!"identifier", tok!"in", tok!"out", tok!"int"))
{
Expand Down
1 change: 1 addition & 0 deletions test/fail_files/issue0176.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void foo(){ asm{ align 8); }}

0 comments on commit 0bd3235

Please sign in to comment.