From 844a07afa04a3b4657b3eabbce9aa5876e399de9 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Wed, 23 Jan 2013 17:12:05 -0800 Subject: [PATCH] Added warning for empty do clauses --- ShellCheck/Parser.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 6a15460..d0ff08b 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -1130,6 +1130,10 @@ readDoGroup loopPos = do acceptButWarn g_Semi ErrorC "No semicolons directly after 'do'." allspacing + optional (do + try . lookAhead $ g_Done + parseProblemAt loopPos ErrorC "Can't have empty do clauses (use 'true' as a no-op).") + commands <- readCompoundList g_Done `orFail` do parseProblemAt pos ErrorC "Couldn't find 'done' for this 'do'."