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"
38tokenParser = PT.makeTokenParser langDef
39lexeme = PT.lexeme tokenParser
40identifier = PT.identifier tokenParser
41reserved = PT.reserved tokenParser
42operator = PT.operator tokenParser
43stringLiteral = PT.stringLiteral tokenParser
44natural = PT.natural tokenParser
45naturalOrFloat = PT.naturalOrFloat tokenParser
46whiteSpace = PT.whiteSpace tokenParser
47parens = PT.parens tokenParser
48braces = PT.braces tokenParser
49angles = PT.angles tokenParser
50brackets = PT.brackets tokenParser
51squares = PT.squares tokenParser
52semi = PT.semi tokenParser
53comma = PT.comma tokenParser
54colon = PT.colon tokenParser
55dot = PT.dot tokenParser
56semiSep = PT.semiSep tokenParser
57semiSep1 = PT.semiSep1 tokenParser
58commaSep = PT.commaSep tokenParser
59commaSep1 = PT.commaSep1 tokenParser
61properName :: P.Parsec String u String
62properName = lexeme $ P.try properName'
64 properName' = (:) <$> P.upper <*> many (PT.identLetter langDef) P.<?> "name"
66augment :: 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
67augment p q f = (flip $ maybe id $ flip f) <$> p <*> P.optionMaybe q
69fold :: 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
70fold first more combine = do
73 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