Skip to content

Commit ce48441

Browse files
authored
Merge pull request #157 from andreasabel/issue46
[ fixed #46 ] give proper error when no lexing rules
2 parents 0198f73 + 643b9b6 commit ce48441

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Main.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ parseScript file prg =
113113
Left (Nothing, err) ->
114114
die (file ++ ": " ++ err ++ "\n")
115115

116-
Right script -> return script
116+
Right script@(_, _, scanner, _) -> do
117+
-- issue 46: give proper error when lexer definition is empty
118+
when (null $ scannerTokens scanner) $
119+
dieAlex $ file ++ " contains no lexer rules\n"
120+
return script
117121

118122
alex :: [CLIFlags]
119123
-> FilePath

0 commit comments

Comments
 (0)