projects
/
ghc-hetmet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Fix comment/code inconsistency spotted by Bulat Ziganshin
[ghc-hetmet.git]
/
utils
/
ext-core
/
ParseGlue.hs
1
module ParseGlue where
2
3
data ParseResult a = OkP a | FailP String
4
type P a = String -> Int -> ParseResult a
5
6
thenP :: P a -> (a -> P b) -> P b
7
m `thenP` k = \ s l ->
8
case m s l of
9
OkP a -> k a s l
10
FailP s -> FailP s
11
12
returnP :: a -> P a
13
returnP m _ _ = OkP m
14
15
failP :: String -> P a
16
failP s s' _ = FailP (s ++ ":" ++ s')
17
18
data Token =
19
TKmodule
20
| TKdata
21
| TKnewtype
22
| TKforall
23
| TKrec
24
| TKlet
25
| TKin
26
| TKcase
27
| TKof
28
| TKcoerce
29
| TKnote
30
| TKexternal
31
| TKwild
32
| TKoparen
33
| TKcparen
34
| TKobrace
35
| TKcbrace
36
| TKhash
37
| TKeq
38
| TKcoloncolon
39
| TKstar
40
| TKrarrow
41
| TKlambda
42
| TKbiglambda
43
| TKat
44
| TKdot
45
| TKquestion
46
| TKsemicolon
47
| TKname String
48
| TKcname String
49
| TKinteger Integer
50
| TKrational Rational
51
| TKstring String
52
| TKchar Char
53
| TKEOF
54
55
56
57
58
59
60
61
62
63
64
65