Changeset 15365 for src/Pugs/Parser
- Timestamp:
- 02/26/07 18:00:32 (21 months ago)
- Files:
-
- 1 modified
-
src/Pugs/Parser/Program.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Parser/Program.hs
r15297 r15365 33 33 34 34 decodeProgram :: String -> String 35 decodeProgram str = removeCRLF $!case detectSourceEncoding str of36 UTF8 xs -> decodeUTF8 xs37 UTF16 LittleEndian xs -> decodeUTF16LE xs38 UTF16 BigEndian xs -> decodeUTF16BE xs39 UTF32 LittleEndian xs -> decodeUTF32LE xs40 UTF32 BigEndian xs -> decodeUTF32BE xs35 decodeProgram str = case detectSourceEncoding str of 36 UTF8 xs -> decodeUTF8 (removeCRLF xs) 37 UTF16 LittleEndian xs -> decodeUTF16LE (removeCRLF xs) 38 UTF16 BigEndian xs -> decodeUTF16BE (removeCRLF xs) 39 UTF32 LittleEndian xs -> decodeUTF32LE (removeCRLF xs) 40 UTF32 BigEndian xs -> decodeUTF32BE (removeCRLF xs) 41 41 where 42 removeCRLF ('\r':'\n':xs) = let rest = removeCRLF xs in seq rest ('\n':rest)43 removeCRLF (x:xs) = let rest = removeCRLF xs in seq rest (x:rest)42 removeCRLF ('\r':'\n':xs) = '\n':removeCRLF xs 43 removeCRLF (x:xs) = x:removeCRLF xs 44 44 removeCRLF [] = [] 45 45 decodeUTF16BE (a:b:c:d:xs)
