Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE NoMonomorphismRestriction #-}
- import Text.ParserCombinators.Parsec
- empty = many (oneOf "\t\n\r ")
- inBraces = between (char '(') (char ')')
- commaList p = sepBy (between empty empty p) (char ',')
- array p = between (char '[') (char ']') (commaList p)
- identifier = many1 alphaNum
- quoted quote = do
- begin <- (char quote)
- result <- (many (noneOf [quote]))
- end <- (char quote)
- return result
- jsString = choice [(quoted '\''), (quoted '"')]
- amdModuleHeader = do
- string "define(" >> empty
- modules <- array jsString
- char ',' >> empty >> string "function("
- names <- commaList identifier
- string "){"
- return (modules, names)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement