@@ -22,6 +22,7 @@ import qualified Reporting.Error.Syntax as Syntax
2222import qualified Reporting.Region as R
2323
2424
25+
2526reserveds :: [String]
2627reserveds =
2728 [ "if", "then", "else"
@@ -35,13 +36,17 @@ reserveds =
3536 ]
3637
3738
39+
3840-- ERROR HELP
3941
42+
4043expecting = flip (<?>)
4144
4245
46+
4347-- SETUP
4448
49+
4550type OpTable = Map.Map String (Int, Decl.Assoc)
4651type SourceM = State SourcePos
4752type IParser a = ParsecT String OpTable SourceM a
@@ -105,8 +110,10 @@ reserved word =
105110 return word
106111
107112
113+
108114-- INFIX OPERATORS
109115
116+
110117anyOp :: IParser String
111118anyOp =
112119 betwixt '`' '`' qualifiedVar
@@ -123,8 +130,10 @@ symOp =
123130 _ -> return op
124131
125132
133+
126134-- COMMON SYMBOLS
127135
136+
128137equals :: IParser String
129138equals =
130139 string "=" <?> "an equals sign '='"
@@ -147,8 +156,10 @@ commitIf check p =
147156 try (lookAhead check) >> p
148157
149158
159+
150160-- SEPARATORS
151161
162+
152163spaceySepBy1 :: IParser b -> IParser a -> IParser [a]
153164spaceySepBy1 sep parser =
154165 do value <- parser
@@ -216,8 +227,10 @@ constrainedSpacePrefix parser constraint =
216227 indented
217228
218229
230+
219231-- SURROUNDED BY
220232
233+
221234followedBy a b =
222235 do x <- a
223236 b
@@ -255,8 +268,10 @@ brackets =
255268 surround '{' '}' "bracket"
256269
257270
271+
258272-- HELPERS FOR EXPRESSIONS
259273
274+
260275getMyPosition :: IParser R.Position
261276getMyPosition =
262277 R.fromSourcePos <$> getPosition
@@ -307,8 +322,10 @@ dot =
307322 notFollowedBy (char '.')
308323
309324
325+
310326-- WHITESPACE
311327
328+
312329padded :: IParser a -> IParser a
313330padded p =
314331 do whitespace
@@ -417,8 +434,10 @@ closeComment =
417434 ]
418435
419436
437+
420438-- ODD COMBINATORS
421439
440+
422441failure msg = do
423442 inp <- getInput
424443 setInput ('x':inp)
@@ -492,8 +511,10 @@ anyUntilPos pos =
492511 else (:) <$> anyChar <*> anyUntilPos pos
493512
494513
514+
495515-- BASIC LANGUAGE LITERALS
496516
517+
497518shader :: IParser (String, L.GLShaderTipe)
498519shader =
499520 do try (string "[glsl|")