1-----------------------------------------------------------------------------
3-- Module : PureScript.Parser.Common
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15module PureScript.Parser.Common where
17import Control.Applicative
18import qualified Text.Parsec as P
19import qualified Text.Parsec.Token as PT
20import qualified Text.Parsec.Language as PL
22langDef = PL.haskellStyle
23 { PT.identStart = P.lower <|> P.char '_'
24 , PT.reservedNames = [ "case"
40tokenParser = PT.makeTokenParser langDef
41lexeme = PT.lexeme tokenParser
42identifier = PT.identifier tokenParser
43reserved = PT.reserved tokenParser
44operator = PT.operator tokenParser
45stringLiteral = PT.stringLiteral tokenParser
46natural = PT.natural tokenParser
47naturalOrFloat = PT.naturalOrFloat tokenParser
48whiteSpace = PT.whiteSpace tokenParser
49parens = PT.parens tokenParser
50braces = PT.braces tokenParser
51angles = PT.angles tokenParser
52brackets = PT.brackets tokenParser
53squares = PT.squares tokenParser
54semi = PT.semi tokenParser
55comma = PT.comma tokenParser
56colon = PT.colon tokenParser
57dot = PT.dot tokenParser
58semiSep = PT.semiSep tokenParser
59semiSep1 = PT.semiSep1 tokenParser
60commaSep = PT.commaSep tokenParser
61commaSep1 = PT.commaSep1 tokenParser
63properName :: P.Parsec String u String
64properName = lexeme $ P.try properName'
66 properName' = (:) <$> P.upper <*> many (PT.identLetter langDef) P.<?> "name"
68augment :: P.Stream s m t => P.ParsecT s u m a -> P.ParsecT s u m b -> (a -> b -> a) -> P.ParsecT s u m a
69augment p q f = (flip $ maybe id $ flip f) <$> p <*> P.optionMaybe q
71fold :: P.Stream s m t => P.ParsecT s u m a -> P.ParsecT s u m b -> (a -> b -> a) -> P.ParsecT s u m a
72fold first more combine = do
75 return $ foldl combine a bs
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list