Hets - the Heterogeneous Tool Set

Copyright(c) Christian Maeder and Uni Bremen 2002-2006
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellNone

Common.AnnoState

Contents

Description

Parsing of interspersed annotations

  • a parser state to collect annotations
  • parsing annoted keywords
  • parsing an annoted item list

Synopsis

Documentation

type AParser st = GenParser Char (AnnoState st) Source #

parsers that can collect annotations via side effects

class AParsable a where Source #

Minimal complete definition

aparser

Methods

aparser :: AParser st a Source #

Instances

class TermParser a where Source #

Methods

termParser :: Bool -> AParser st a Source #

Instances

aToTermParser :: AParser st a -> Bool -> AParser st a Source #

data AnnoState st Source #

just the list of currently collected annotations

Constructors

AnnoState 

Fields

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

addAnnos :: AParser st () Source #

add annotations to the internal 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

wrapAnnos :: AParser st a -> AParser st a Source #

collect preceding and trailing annotations

asKey :: String -> AParser st Token Source #

parse an annoted keyword

annoted keywords

semiOrComma :: CharParser st Token Source #

trySemi :: AParser st Token Source #

check for a semicolon beyond annotations

trySemiOrComma :: AParser st Token Source #

check for a semicolon or comma beyond annotations and trailing line annos

optSemi :: AParser st ([Token], [Annotation]) Source #

optional semicolon followed by annotations on consecutive lines