-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplate.hs
24 lines (22 loc) · 1.27 KB
/
Template.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- Copyright 2014 Alvaro J. Genial (http://alva.ro) -- see LICENSE.md for more.
module Text.Neat.Template where
data Element = Output Value
| Comment Block
| Define Function Block
| Filter Value Block
| With Binding Block
| For Binding Block (Maybe Block)
| If Value Block (Maybe Block)
| Switch Value [Case] (Maybe Block) -- TODO: Generalize to (Maybe Value)
| Text String deriving (Eq, Ord, Read, Show)
data File = File String Block deriving (Eq, Ord, Read, Show)
data Block = Block [Chunk] deriving (Eq, Ord, Read, Show)
data Chunk = Chunk Location Element deriving (Eq, Ord, Read, Show)
data Case = Case Pattern Block deriving (Eq, Ord, Read, Show)
data Binding = Binding Pattern Value deriving (Eq, Ord, Read, Show)
data Location = Location String Int deriving (Eq, Ord, Read, Show)
data Value = Value Location Pipeline deriving (Eq, Ord, Read, Show)
data Pattern = Pattern Location String deriving (Eq, Ord, Read, Show)
data Function = Function Location Name Pattern deriving (Eq, Ord, Read, Show)
type Name = String
type Pipeline = [String]