summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wast-parser.cc2
-rw-r--r--test/regress/regress-12.txt11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/wast-parser.cc b/src/wast-parser.cc
index a45e4424..2e0bfc57 100644
--- a/src/wast-parser.cc
+++ b/src/wast-parser.cc
@@ -1659,7 +1659,7 @@ Result WastParser::ParseGlobalType(Global* global) {
Result WastParser::ParseCommandList(CommandPtrVector* commands) {
WABT_TRACE(ParseCommandList);
- while (PeekMatch(TokenType::Lpar)) {
+ while (IsCommand(PeekPair())) {
CommandPtr command;
if (Succeeded(ParseCommand(&command))) {
commands->push_back(std::move(command));
diff --git a/test/regress/regress-12.txt b/test/regress/regress-12.txt
new file mode 100644
index 00000000..2fe1190b
--- /dev/null
+++ b/test/regress/regress-12.txt
@@ -0,0 +1,11 @@
+;;; ERROR: 1
+(module
+ (func)
+)
+
+(func))
+(;; STDERR ;;;
+out/test/regress/regress-12.txt:6:1: error: unexpected token (, expected EOF.
+(func))
+^
+;;; STDERR ;;)