tools/pas2c/PascalPreprocessor.hs
changeset 10240 bfae7354d42f
parent 10120 b7f632c12784
child 15988 24545642473f
equal deleted inserted replaced
10239:ed8bab6e92ba 10240:bfae7354d42f
    90 
    90 
    91     ifdef = do
    91     ifdef = do
    92         s <- try (string "IFDEF") <|> try (string "IFNDEF")
    92         s <- try (string "IFDEF") <|> try (string "IFNDEF")
    93         let f = if s == "IFNDEF" then not else id
    93         let f = if s == "IFNDEF" then not else id
    94 
    94 
    95         spaces
    95         ds <- (spaces >> identifier) `sepBy` (spaces >> string "OR")
    96         d <- identifier
       
    97         spaces
    96         spaces
    98         char' '}'
    97         char' '}'
    99 
    98 
   100         updateState $ \(m, b) ->
    99         updateState $ \(m, b) ->
   101             (m, (f $ d `Map.member` m) : b)
   100             (m, (f $ any (flip Map.member m) ds) : b)
   102 
   101 
   103         return ""
   102         return ""
   104 
   103 
   105     if' = do
   104     if' = do
   106         try (string' "IF" >> notFollowedBy alphaNum)
   105         try (string' "IF" >> notFollowedBy alphaNum)