Changeset 12266 for src/Pugs/Lexer.hs

Show
Ignore:
Timestamp:
08/15/06 19:05:38 (2 years ago)
Author:
audreyt
Message:

* "\0" is made legal again, though "\00" "\01" etc are all still failures.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r12265 r12266  
    263263-- | Backslashed non-alphanumerics (except for @\^@) translate into themselves. 
    264264escapeCode      :: RuleParser String 
    265 escapeCode      = ch charEsc <|> charNum <|> ch charAscii <|> ch charControl <|> ch anyChar 
     265escapeCode      = charNum <|> ch charEsc <|> ch charAscii <|> ch charControl <|> ch anyChar 
    266266                <?> "escape code" 
    267267    where 
     
    278278charNum = do 
    279279    codes <- choice 
    280         [ many1 digit >>= \ds -> do 
    281             error ("Error: \\" ++ ds ++ " is ambiguous: write as decimal \\d" ++ ds ++ " or octal \\o" ++ ds ++ " instead") -- $ return [read ds] 
     280        [ many1 digit >>= \ds -> case ds of 
     281            "0" -> return [0] 
     282            _   -> error ("Error: Invalid escape sequence \\" ++ ds ++ "; write as decimal \\d" ++ ds ++ " or octal \\o" ++ ds ++ " instead") -- $ return [read ds] 
    282283        , based 'o'  8 octDigit 
    283284        , based 'x' 16 hexDigit