Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove the ioke colourizer stubs; they can go into their own project.

  • Loading branch information...
commit 445b5af829ee2f673f2f7dd79af84d04c08b1b54 1 parent 4619394
@flaviusb authored
Showing with 0 additions and 93 deletions.
  1. +0 −46 IokeColourizer.hs
  2. +0 −47 IokeGrammar.hs
View
46 IokeColourizer.hs
@@ -1,46 +0,0 @@
-{-# Language TemplateHaskell, QuasiQuotes, FlexibleContexts, DeriveDataTypeable #-}
-
-import Data.Data
-import Data.Typeable
-import qualified Data.Map as Map
-import qualified Data.List as List
-import Text.Peggy
-import Data.Maybe
-
-import Control.Applicative
-import System.IO
-
-import IokeGrammar
-
-main :: IO ()
-main = do
- the_data <- readFile "iokefile.ik.in"
- withFile "iokefile.html.out" WriteMode (\handle -> do
- hPutStr handle $ printColourized (case (parseString ioke "foo" the_data) of
- Right foo -> foo
- Left _ -> []))
-
-printColourized :: [Ioke] -> String
-printColourized iks = concat (map printBlock (colourize iks))
-
-data ColourBlock = ColourBlock String Colour
-
-data Colour = Colour String | UnColoured
-
-comment = Colour "rem"
-bangline = Colour "hb"
-
-printBlock :: ColourBlock -> String
-printBlock block = case block of
- ColourBlock text UnColoured -> text
- ColourBlock text (Colour col) -> "<div class=\"" ++ col ++ "\">" ++ text ++ "</div>"
-
-
-colourize :: [Ioke] -> [ColourBlock]
-colourize = map (\ik -> (case ik of
- Comment cont -> ColourBlock cont comment
- Ret -> ColourBlock "\r\n" UnColoured
- Fullstop -> ColourBlock "." UnColoured
- BangLine bang -> ColourBlock bang bangline
- ISpace num -> ColourBlock (replicate num ' ') UnColoured
- _ -> ColourBlock "" UnColoured))
View
47 IokeGrammar.hs
@@ -1,47 +0,0 @@
-{-# Language TemplateHaskell, QuasiQuotes, FlexibleContexts, DeriveDataTypeable #-}
-
-module IokeGrammar
-(ioke, Ioke(..)) where
-import Data.Data
-import Data.Typeable
-import qualified Data.Map as Map
-import qualified Data.List as List
-import Text.Peggy
-import Data.Maybe
-
-data Ioke = Cell Name Message | Symbol Name | Dict [DictElem] | IList [IListElem] | Comment String | LiteralString LitS | QuotedMessage | QuasiQuotedMessage | UnQuotedMessage | Ret | Fullstop | ISpace Int | BangLine String | MethodComment String | Key String deriving (Show, Data, Eq, Typeable)
-
-data DictElem = KV String String | Hash String String | DictMessage Message deriving (Show, Data, Eq, Typeable)
-
-data IListElem = IListElem Message deriving (Show, Data, Eq, Typeable)
-
-data Message = Message Name [MessageLine] deriving (Show, Data, Eq, Typeable)
-
-data MessageLine = [Message] deriving (Show, Data, Eq, Typeable)
-
-data LitS = SquareString [Chunk] | QuotedString [Chunk] deriving (Show, Data, Eq, Typeable)
-
-data Chunk = Lit String | Escape String | Interpolate Message deriving (Show, Data, Eq, Typeable)
-
-data Name = String deriving (Show, Data, Eq, Typeable)
-
-[peggy|
-ioke :: [Ioke]
- = (ret / dot / comment / hashbang / ispace)*
-
-ret :: Ioke
- = [\r\n] { Ret }
-
-dot :: Ioke
- = '.' { Fullstop }
-
-comment :: Ioke
- = (';' [^\n\r]+) { Comment (";" ++ $1) }
-
-hashbang :: Ioke
- = ('#!/' [^\n\r]+) { BangLine ("#!/" ++ $1) }
-
-ispace :: Ioke
- = [ ]+ { ISpace (length $1) }
-
-|]
Please sign in to comment.
Something went wrong with that request. Please try again.