Copyright | (c) Christian Maeder and Uni Bremen 2002-2006 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | Christian.Maeder@dfki.de |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Parsing of interspersed annotations
- a parser state to collect annotations
- parsing annoted keywords
- parsing an annoted item list
Synopsis
- type AParser st = GenParser Char (AnnoState st)
- class AParsable a where
- class TermParser a where
- termParser :: Bool -> AParser st a
- aToTermParser :: AParser st a -> Bool -> AParser st a
- data AnnoState st = AnnoState {
- toAnnos :: [Annotation]
- _userState :: st
- emptyAnnos :: st -> AnnoState st
- parseAnnos :: AnnoState a -> GenParser Char st (AnnoState a)
- parseLineAnnos :: AnnoState a -> GenParser Char st (AnnoState a)
- addAnnos :: AParser st ()
- addLineAnnos :: AParser st ()
- getAnnos :: AParser st [Annotation]
- mLineAnnos :: GenParser Char st [Annotation]
- annos :: AParser st [Annotation]
- lineAnnos :: AParser st [Annotation]
- tryItemEnd :: [String] -> AParser st ()
- startKeyword :: [String]
- annoParser :: AParser st a -> AParser st (Annoted a)
- allAnnoParser :: AParser st a -> AParser st (Annoted a)
- trailingAnnosParser :: AParser st a -> AParser st [Annoted a]
- annosParser :: AParser st a -> AParser st [Annoted a]
- itemList :: [String] -> String -> ([String] -> AParser st b) -> ([Annoted b] -> Range -> a) -> AParser st a
- auxItemList :: [String] -> [Token] -> AParser st b -> ([Annoted b] -> Range -> a) -> AParser st a
- itemAux :: [String] -> AParser st a -> AParser st ([a], [Token], [[Annotation]])
- wrapAnnos :: AParser st a -> AParser st a
- asKey :: String -> AParser st Token
- anComma :: AParser st Token
- anSemi :: AParser st Token
- semiOrComma :: CharParser st Token
- anSemiOrComma :: AParser st Token
- trySemi :: AParser st Token
- trySemiOrComma :: AParser st Token
- optSemi :: AParser st ([Token], [Annotation])
- equalT :: AParser st Token
- colonT :: AParser st Token
- equiT :: AParser st Token
- lessT :: AParser st Token
- dotT :: AParser st Token
- asT :: AParser st Token
- barT :: AParser st Token
- forallT :: AParser st Token
Documentation
type AParser st = GenParser Char (AnnoState st) Source #
parsers that can collect annotations via side effects
class AParsable a where Source #
Instances
class TermParser a where Source #
Nothing
:: Bool | |
-> AParser st a | True for terms, formulas otherwise |
Instances
TermParser () Source # | |
Defined in Common.AnnoState termParser :: Bool -> AParser st () Source # | |
TermParser C_FORMULA Source # | |
Defined in CoCASL.Parse_AS termParser :: Bool -> AParser st C_FORMULA Source # | |
TermParser DL_FORMULA Source # | |
Defined in CASL_DL.Parse_AS termParser :: Bool -> AParser st DL_FORMULA Source # | |
TermParser ConstraintFORMULA Source # | |
Defined in ConstraintCASL.Formula termParser :: Bool -> AParser st ConstraintFORMULA Source # | |
TermParser CspSen Source # | |
Defined in CspCASL.SignCSP termParser :: Bool -> AParser st CspSen Source # | |
TermParser EM_FORMULA Source # | |
Defined in ExtModal.Parse_AS termParser :: Bool -> AParser st EM_FORMULA Source # | |
TermParser TermExt Source # | |
TermParser H_FORMULA Source # | |
Defined in Hybrid.Parse_AS termParser :: Bool -> AParser st H_FORMULA Source # | |
TermParser M_FORMULA Source # | |
Defined in Modal.Parse_AS termParser :: Bool -> AParser st M_FORMULA Source # | |
TermParser Dlformula Source # | |
aToTermParser :: AParser st a -> Bool -> AParser st a Source #
just the list of currently collected annotations
AnnoState | |
|
Instances
OperatorState (AnnoState st) Source # | |
emptyAnnos :: st -> AnnoState st Source #
no annotations
parseAnnos :: AnnoState a -> GenParser Char st (AnnoState a) Source #
add further annotations to the input state
parseLineAnnos :: AnnoState a -> GenParser Char st (AnnoState a) Source #
add only annotations on consecutive lines to the input state
addLineAnnos :: AParser st () Source #
add only annotations on consecutive lines to the internal state
getAnnos :: AParser st [Annotation] Source #
extract all annotation from the internal state,
resets the internal state to emptyAnnos
mLineAnnos :: GenParser Char st [Annotation] Source #
annotations on consecutive lines
annos :: AParser st [Annotation] Source #
explicitly parse annotations, reset internal state
lineAnnos :: AParser st [Annotation] Source #
explicitly parse annotations on consecutive lines. reset internal state
tryItemEnd :: [String] -> AParser st () Source #
succeeds if the previous item is finished
startKeyword :: [String] Source #
keywords that indicate a new item for tryItemEnd
.
the quantifier exists does not start a new item.
annoParser :: AParser st a -> AParser st (Annoted a) Source #
parse preceding annotations and the following item
trailingAnnosParser :: AParser st a -> AParser st [Annoted a] Source #
parse preceding and consecutive trailing annotations of an item in
between. Unlike annosParser
do not treat all trailing annotations as
preceding annotations of the next item.
annosParser :: AParser st a -> AParser st [Annoted a] Source #
parse an item list preceded and followed by annotations
itemList :: [String] -> String -> ([String] -> AParser st b) -> ([Annoted b] -> Range -> a) -> AParser st a Source #
parse an item list preceded by a singular or plural keyword, interspersed with semicolons and an optional semicolon at the end
auxItemList :: [String] -> [Token] -> AParser st b -> ([Annoted b] -> Range -> a) -> AParser st a Source #
generalized version of itemList
for an other keyword list for tryItemEnd
and without pluralKeyword
itemAux :: [String] -> AParser st a -> AParser st ([a], [Token], [[Annotation]]) Source #
parse an item list without a starting keyword
annoted keywords
semiOrComma :: CharParser st Token Source #
anSemiOrComma :: AParser st Token Source #
trySemiOrComma :: AParser st Token Source #
check for a semicolon or comma beyond annotations and trailing line annos