Name: Anonymous 2007-08-16 12:33 ID:v5wQUxJL
======= URGENT NOTICE ======/PROG/ HAS BEEN DEHABILITATED BY C++ USING FAGGOTS
HOLY SHIT WHAT DO WE DO????????????????????????????
====== URGENT NOTICE =======
======= URGENT NOTICE ============ URGENT NOTICE =======
using namespace std;
[spoiler]module BBCode where
data Tag = Tag String Tag
| Text String
instance Show Tag where
show (Tag t v) = "[" ++ t ++ "]" ++ show v ++ "[/" ++ t ++ "]"
show (Text v) = v
b = Tag "b"
code = Tag "code"
i = Tag "i"
o = Tag "o"
spoiler = Tag "spoiler"
u = Tag "u"
expert = b.i.o.u
nest _ 0 x = x
nest t n x = nest t (n-1) (Tag t x)
sub = nest "sub"
sup = nest "sup"
pos scale pos | pos < 0.0 = sub $ abs amt
| otherwise = sup amt
where amt = round $ pos * scale[/spoiler]
this is awesome
module Language.BBCode.Parser
(BBCode(..),
-- A fast monadic BBCode parser utilizing the industrial
-- strength combinator library Parsec.
parseBBCode)
where
import Text.ParserCombinators.Parsec
-- Belongs in another module.
data BBCode = Element String [BBCode]
| Text String
-- An optimizing BBCode rendering machine.
-- Belongs in another module.
render (Element e []) = ""
render (Element e bs) = "[" ++ e ++ "]" ++
(concatMap render bs) ++
"[/" ++ e ++ "]"
render (Text s) = s
bbcode = many (bbcodeElement <|> bbcodeText)
bbcodeElement = do element <- try bbcodeOpenElement
content <- bbcode
bbcodeCloseElement element
return (Element element content)
bbcodeOpenElement = do char '['
s <- many1 letter
char ']'
return s
bbcodeCloseElement s = string ("[/" ++ s ++ "]")
bbcodeText = many1 (noneOf "[") >>= return . Text
parseBBCode bb = case parse bbcode "" bb of
Left e -> error $ show e
Right bs -> bs
-- A simple test case.
testbb = "[b][u][o]EXPERT PROGRAMMER[/o][/u][/b] " ++
"[spoiler][i]Read SICP![/i][/spoiler]"
test = do putStrLn testbb
putStrLn $ concatMap render $ parseBBCode testbb
asd harbl [b]copcks[/b]
also dicksp
someURL
http://dis.4chan.org/prog/
goddamn it show me the structure fields
<interactive>1:0: Not in scope: `goddamn'
...