
30 Oct
2009
30 Oct
'09
4:41 p.m.
Hi Ozgur, Ozgur Akgun wrote:
pKeyword_Int = ( \ _ _ _ -> "int" ) <$> pSym 'i' <*> pSym 'n' <*> pSym 't' pKeyword_Float = ( \ _ _ _ _ _ -> "float" ) <$> pSym 'f' <*> pSym 'l' <*> pSym 'o' <*> pSym 'a' <*> pSym 't'
As you can see there is an obvious pattern if you try to capture a "keyword". If there were a function called pKeyword taking a string as an argument and producing the necessary parser, things would be easier.
I think pToken in Text.ParserCombinators.UU.Derived does what you want. Groetjes, Martijn.