aboutsummaryrefslogtreecommitdiff
path: root/src/Haskell/Parser
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-03-10 18:53:43 +0100
committertomsmeding <tom.smeding@gmail.com>2019-03-10 18:53:43 +0100
commit8384a1f7c01009ed125efee8e617da2da1f4b774 (patch)
tree5392c0a63fc49af9bb49e1e4d8769a2771a18a68 /src/Haskell/Parser
parent878eb45b3eb77ab309104f7e7b8480a8d12e04ad (diff)
Remove old parser
Diffstat (limited to 'src/Haskell/Parser')
-rw-r--r--src/Haskell/Parser/Def.hs100
1 files changed, 0 insertions, 100 deletions
diff --git a/src/Haskell/Parser/Def.hs b/src/Haskell/Parser/Def.hs
deleted file mode 100644
index 812140c..0000000
--- a/src/Haskell/Parser/Def.hs
+++ /dev/null
@@ -1,100 +0,0 @@
-{-# OPTIONS_GHC -Wno-missing-signatures #-}
-module Haskell.Parser.Def where
-
-import Control.Monad.Identity
-import Data.Char
-import Text.Parsec
--- import qualified Text.Parsec.Language as L
-import qualified Text.Parsec.Token as T
-import qualified Text.Parsec.IndentParsec.Token as IT
-import qualified Text.Parsec.IndentParsec.Prim as IP
-
-
--- LanguageDef things shamelessly stolen from Text.Parsec.Language.
--- Reason for stealing is that these have more generic types.
-haskellStyle = T.LanguageDef
- { T.commentStart = "{-"
- , T.commentEnd = "-}"
- , T.commentLine = "--"
- , T.nestedComments = True
- , T.identStart = letter
- , T.identLetter = alphaNum <|> oneOf "_'"
- , T.opStart = T.opLetter haskellStyle
- , T.opLetter = oneOf ":!#$%&*+./<=>?@\\^|-~"
- , T.reservedOpNames= []
- , T.reservedNames = []
- , T.caseSensitive = True
- }
-
-haskell :: T.GenTokenParser String () (IP.IndentT IP.HaskellLike Identity)
-haskell = T.makeTokenParser haskellDef
-
-haskellDef = haskell98Def
- { T.identLetter = T.identLetter haskell98Def <|> char '#'
- , T.reservedNames = T.reservedNames haskell98Def ++
- ["foreign","import","export","primitive"
- ,"_ccall_","_casm_"
- ,"forall"
- ]
- }
-
-haskell98Def = haskellStyle
- { T.reservedOpNames= ["::","..","=","\\","|","<-","->","@","~","=>"]
- , T.reservedNames = ["let","in","case","of","if","then","else",
- "data","type",
- "class","default","deriving","do","import",
- "infix","infixl","infixr","instance","module",
- "newtype","where",
- "primitive"
- -- "as","qualified","hiding"
- ]
- }
-
--- Bring the right combinators in scope.
-mySemiSep = IT.semiSepOrFoldedLines haskell
-myBraces = IT.bracesBlock haskell
-identifier = IT.identifier haskell
-operator = IT.operator haskell
-reserved = IT.reserved haskell
-reservedOp = IT.reservedOp haskell
-charLiteral = IT.charLiteral haskell
-stringLiteral = IT.stringLiteral haskell
-natural = IT.natural haskell
-integer = IT.integer haskell
-float = IT.float haskell
-naturalOrFloat = IT.naturalOrFloat haskell
-decimal = IT.decimal haskell
-hexadecimal = IT.hexadecimal haskell
-octal = IT.octal haskell
-symbol = IT.symbol haskell
-lexeme = IT.lexeme haskell
-whiteSpace = IT.whiteSpace haskell
-semi = IT.semi haskell
-comma = IT.comma haskell
-colon = IT.colon haskell
-dot = IT.dot haskell
-parens = IT.parens haskell
-parensBlock = IT.parensBlock haskell
-braces = IT.braces haskell
-bracesBlock = IT.bracesBlock haskell
-angles = IT.angles haskell
-anglesBlock = IT.anglesBlock haskell
-brackets = IT.brackets haskell
-bracketsBlock = IT.bracketsBlock haskell
-semiSep = IT.semiSep haskell
-semiSepOrFoldedLines = IT.semiSepOrFoldedLines haskell
-semiSep1 = IT.semiSep1 haskell
-semiSepOrFoldedLines1 = IT.semiSepOrFoldedLines1 haskell
-commaSep = IT.commaSep haskell
-commaSepOrFoldedLines = IT.commaSepOrFoldedLines haskell
-commaSep1 = IT.commaSep1 haskell
-commaSepOrFoldedLines1 = IT.commaSepOrFoldedLines1 haskell
-
--- Some more specific combinators.
-identifierGuard pr = try $ do
- s <- identifier
- guard (not (null s) && pr s)
- return s
-
-typeident = identifierGuard (isUpper . head)
-varident = identifierGuard (isLower . head)