1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
------------------------------------------------------------------------------
--- A interface for parsers
---
--- @author Jasper Sikorra - jsi@informatik.uni-kiel.de
--- @version March 2014
------------------------------------------------------------------------------
module ParseTypes (
module ParseMonad,
module ParsePos,
module ParseError,
module ParseTypes,
module ParseWarning
) where
import ParseMonad
import ParsePos
import ParseError
import ParseWarning
--- Type of a Translator for a DSL
type LangParser = Pos -> String -> IO (PM String)
type Langtag = String
--- The StandardToken is used by the CIParser and Translator to store
--- informations on Integrated Code
data StandardToken = StTk Pos Pos (Maybe Langtag) Code
type Code = String
type Offset = Int
getIdentPos :: StandardToken -> Pos
getIdentPos (StTk p _ _ _) = p
getCodePos :: StandardToken -> Pos
getCodePos (StTk _ p _ _) = p
getOffset :: StandardToken -> Offset
getOffset = getCol . getCodePos
getLangtag :: StandardToken -> Maybe Langtag
getLangtag (StTk _ _ l _) = l
getCode :: StandardToken -> Code
getCode (StTk _ _ _ c) = c
--- Check wether a StandardToken contains a DSL or normal Curry
containsDSL :: StandardToken -> Bool
containsDSL (StTk _ _ (Just _) _) = True
containsDSL (StTk _ _ Nothing _) = False
|