From 0bd3235f852454a1c1c6dfe55e26786ad13bc4b5 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 6 Nov 2017 20:08:00 +0100 Subject: [PATCH] fix #176 - infinite loop on align syntax error inside AsmStatement (#177) fix #176 - infinite loop on align syntax error inside AsmStatement merged-on-behalf-of: Brian Schott --- src/dparse/parser.d | 11 +++++++++++ test/fail_files/issue0176.d | 1 + 2 files changed, 12 insertions(+) create mode 100644 test/fail_files/issue0176.d diff --git a/src/dparse/parser.d b/src/dparse/parser.d index 42d2f026..c75cdb3c 100644 --- a/src/dparse/parser.d +++ b/src/dparse/parser.d @@ -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")) { diff --git a/test/fail_files/issue0176.d b/test/fail_files/issue0176.d new file mode 100644 index 00000000..c41762a2 --- /dev/null +++ b/test/fail_files/issue0176.d @@ -0,0 +1 @@ +void foo(){ asm{ align 8); }} \ No newline at end of file