From 065df28bbc8ab51de8ca5ca76cbbdcfd1d1b8c3a Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Tue, 21 Aug 2007 17:27:16 +0000 Subject: [PATCH] Make unknown preprocessor directives a warning rather than an error. This is what the "old" preprocessor does; it's more useful at the moment. --- PreprocessOccam.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PreprocessOccam.hs b/PreprocessOccam.hs index 836a446..7342f33 100644 --- a/PreprocessOccam.hs +++ b/PreprocessOccam.hs @@ -88,7 +88,12 @@ type DirectiveFunc = Meta -> [String] -> PassM ([Token] -> [Token]) handleDirective :: Meta -> String -> PassM ([Token] -> [Token]) handleDirective m s = lookup s directives where - lookup s [] = dieP m "Unknown preprocessor directive" + -- FIXME: This should really be an error rather than a warning, but + -- currently we support so few preprocessor directives that this is more + -- useful. + lookup s [] + = do addWarning m "Unknown preprocessor directive ignored" + return id lookup s ((re, func):ds) = case matchRegex re s of Just fields -> func m fields